| | |
| | | @Field(type = FieldType.Text) |
| | | private String infoContent; |
| | | /** |
| | | * 速度 |
| | | */ |
| | | @Field(type = FieldType.Integer) |
| | | private Integer speed; |
| | | /** |
| | | * 经度 |
| | | */ |
| | | @Field(type = FieldType.Integer) |
| | | private Integer longitude; |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | @Field(type = FieldType.Integer) |
| | | private Integer latitude; |
| | | /** |
| | | * 报警处理结果 |
| | | * 0x00:处理中 |
| | | * 0x01:已处理完毕 |
| | |
| | | * 解析报文 |
| | | */ |
| | | public UPWarnMsgAdptInfo decode(WarnMsg warnMsg) { |
| | | byte[] data = warnMsg.getData(); |
| | | ByteBuf byteBuf = Unpooled.wrappedBuffer(data); |
| | | this.vehicleNo = warnMsg.getVehicleNo(); |
| | | this.vehicleColor = warnMsg.getVehicleColor(); |
| | | this.dataType = warnMsg.getDataType(); |
| | | this.dataLength = warnMsg.getDataLength(); |
| | | |
| | | //报警信息来源 |
| | | this.warnSrc = byteBuf.readByte(); |
| | | //报警类型 |
| | | this.warnType = byteBuf.readShort(); |
| | | byte[] readableBytes = new byte[8]; |
| | | byteBuf.readBytes(readableBytes); |
| | | String time = ByteArrayUtil.bytes2HexStr(readableBytes); |
| | | //报警时间 |
| | | this.warnTime = Long.parseLong(time, 16); |
| | | //信息ID |
| | | this.infoId = byteBuf.readInt(); |
| | | //报警数据长度 |
| | | this.infoLength = byteBuf.readInt(); |
| | | //上报报警信息内容 |
| | | this.infoContent = Jtt809Util.readGBKString(byteBuf, this.infoLength); |
| | | try { |
| | | byte[] data = warnMsg.getData(); |
| | | ByteBuf byteBuf = Unpooled.wrappedBuffer(data); |
| | | this.vehicleNo = warnMsg.getVehicleNo(); |
| | | this.vehicleColor = warnMsg.getVehicleColor(); |
| | | this.dataType = warnMsg.getDataType(); |
| | | this.dataLength = warnMsg.getDataLength(); |
| | | |
| | | //报警信息来源 |
| | | this.warnSrc = byteBuf.readByte(); |
| | | //报警类型 |
| | | this.warnType = byteBuf.readShort(); |
| | | byte[] readableBytes = new byte[8]; |
| | | byteBuf.readBytes(readableBytes); |
| | | String time = ByteArrayUtil.bytes2HexStr(readableBytes); |
| | | //报警时间 |
| | | this.warnTime = Long.parseLong(time, 16); |
| | | //信息ID |
| | | this.infoId = byteBuf.readInt(); |
| | | //报警数据长度 |
| | | this.infoLength = byteBuf.readInt(); |
| | | //上报报警信息内容 |
| | | this.infoContent = Jtt809Util.readGBKString(byteBuf, this.infoLength); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return this; |
| | | } |
| | | } |