工具包引入
<dependency>
<groupId>cn.allbs</groupId>
<artifactId>allbs-model</artifactId>
<version>0.8.1</version>
</dependency>
源码下载
根据自己项目写的工具包,有需要可以下载后修改:https://github.com/chenqi92/allbs-model
解析字段说明
字段值 | 字段说明 |
---|---|
machineNo |
机器号 |
time |
时间 |
version |
版本号 |
order |
命令-中文说明 |
preOrder |
命令-原始值 |
code |
代码 |
controller |
控制器 |
message |
信息类型-中文说明 |
preMessage |
信息类型-原始值 |
circuit |
回路 |
part |
部位 |
disk |
盘号 |
district |
区号 |
boardNumber |
板号 |
line |
专线号 |
address |
地址 |
type |
部件类型-中文说明 |
preType |
部件类型-原始值 |
status |
状态 |
preStatus |
状态 |
sensorChannel |
传感器通道 |
alarmValue |
报警值 |
accumulateSum |
累加和 |
unit |
单位 |
心跳报文解析
报文解析示例

示例代码
byte[] bytes = new byte[26];
bytes[0] = (byte) 0x82;
bytes[1] = (byte) 0x30;
bytes[2] = (byte) 0x30;
bytes[3] = (byte) 0x32;
bytes[4] = (byte) 0x34;
bytes[5] = (byte) 0x30;
bytes[6] = (byte) 0x30;
bytes[7] = (byte) 0x30;
bytes[8] = (byte) 0x30;
bytes[9] = (byte) 0x30;
bytes[10] = (byte) 0x30;
bytes[11] = (byte) 0x31;
bytes[12] = (byte) 0x31;
bytes[13] = (byte) 0x30;
bytes[14] = (byte) 0x35;
bytes[15] = (byte) 0x31;
bytes[16] = (byte) 0x38;
bytes[17] = (byte) 0x30;
bytes[18] = (byte) 0x3E;
bytes[19] = (byte) 0x30;
bytes[20] = (byte) 0x3F;
bytes[21] = (byte) 0x31;
bytes[22] = (byte) 0x31;
bytes[23] = (byte) 0x38;
bytes[24] = (byte) 0x30;
bytes[25] = (byte) 0x83;
JBF293KMapper jbf293KMapper = new JBF293KMapper();
System.out.println(jbf293KMapper.readValue(bytes, Map.class));
结果图

正常应答数据
报文解析示例

示例代码
byte[] bytes = new byte[26];
// 报文头
bytes[0] = (byte) 0x82;
// D1
bytes[1] = (byte) 0x30;
bytes[2] = (byte) 0x39;
// D2
bytes[3] = (byte) 0x30;
bytes[4] = (byte) 0x31;
// D3
bytes[5] = (byte) 0x30;
bytes[6] = (byte) 0x30;
// D4
bytes[7] = (byte) 0x30;
bytes[8] = (byte) 0x30;
// D5
bytes[9] = (byte) 0x30;
bytes[10] = (byte) 0x30;
// D6
bytes[11] = (byte) 0x30;
bytes[12] = (byte) 0x30;
// D7
bytes[13] = (byte) 0x30;
bytes[14] = (byte) 0x30;
// D8
bytes[15] = (byte) 0x30;
bytes[16] = (byte) 0x30;
// D9
bytes[17] = (byte) 0x30;
bytes[18] = (byte) 0x30;
// D10
bytes[19] = (byte) 0x30;
bytes[20] = (byte) 0x30;
// D11
bytes[21] = (byte) 0x30;
bytes[22] = (byte) 0x30;
// D12
bytes[23] = (byte) 0x30;
bytes[24] = (byte) 0x3A;
// 报文尾
bytes[25] = (byte) 0x83;
JBF293KMapper jbf293KMapper = new JBF293KMapper();
System.out.println(jbf293KMapper.readValue(bytes, Map.class));
结果图

火警数据报文解析
报文解析示例

代码示例
byte[] bytes = new byte[26];
// 报文头
bytes[0] = (byte) 0x82;
// D1
bytes[1] = (byte) 0x38;
bytes[2] = (byte) 0x30;
// D2
bytes[3] = (byte) 0x32;
bytes[4] = (byte) 0x34;
// D3
bytes[5] = (byte) 0x30;
bytes[6] = (byte) 0x38;
// D4
bytes[7] = (byte) 0x39;
bytes[8] = (byte) 0x3B;
// D5
bytes[9] = (byte) 0x30;
bytes[10] = (byte) 0x31;
// D6
bytes[11] = (byte) 0x31;
bytes[12] = (byte) 0x31;
// D7
bytes[13] = (byte) 0x30;
bytes[14] = (byte) 0x33;
// D8
bytes[15] = (byte) 0x30;
bytes[16] = (byte) 0x38;
// D9
bytes[17] = (byte) 0x31;
bytes[18] = (byte) 0x30;
// D10
bytes[19] = (byte) 0x30;
bytes[20] = (byte) 0x34;
// D11
bytes[21] = (byte) 0x30;
bytes[22] = (byte) 0x38;
// D12
bytes[23] = (byte) 0x38;
bytes[24] = (byte) 0x30;
// 报文尾
bytes[25] = (byte) 0x83;
JBF293KMapper jbf293KMapper = new JBF293KMapper();
System.out.println(jbf293KMapper.readValue(bytes, Map.class));
结果示例

喷洒启动
报文解析示例

代码示例
byte[] bytes = new byte[26];
// 报文头
bytes[0] = (byte) 0x82;
// D1
bytes[1] = (byte) 0x3F;
bytes[2] = (byte) 0x3A;
// D2
bytes[3] = (byte) 0x30;
bytes[4] = (byte) 0x32;
// D3
bytes[5] = (byte) 0x30;
bytes[6] = (byte) 0x3B;
// D4
bytes[7] = (byte) 0x30;
bytes[8] = (byte) 0x32;
// D5
bytes[9] = (byte) 0x30;
bytes[10] = (byte) 0x32;
// D6
bytes[11] = (byte) 0x31;
bytes[12] = (byte) 0x31;
// D7
bytes[13] = (byte) 0x30;
bytes[14] = (byte) 0x33;
// D8
bytes[15] = (byte) 0x30;
bytes[16] = (byte) 0x39;
// D9
bytes[17] = (byte) 0x30;
bytes[18] = (byte) 0x3E;
// D10
bytes[19] = (byte) 0x30;
bytes[20] = (byte) 0x3D;
// D11
bytes[21] = (byte) 0x31;
bytes[22] = (byte) 0x3B;
// D12
bytes[23] = (byte) 0x35;
bytes[24] = (byte) 0x3E;
// 报文尾
bytes[25] = (byte) 0x83;
JBF293KMapper jbf293KMapper = new JBF293KMapper();
System.out.println(jbf293KMapper.readValue(bytes, Map.class));
结果示例

单常开防火门故障
报文解析示例(文档累加和错误)

代码示例
byte[] bytes = new byte[26];
// 报文头
bytes[0] = (byte) 0x82;
// D1
bytes[1] = (byte) 0x3F;
bytes[2] = (byte) 0x3B;
// D2
bytes[3] = (byte) 0x32;
bytes[4] = (byte) 0x34;
// D3
bytes[5] = (byte) 0x30;
bytes[6] = (byte) 0x31;
// D4
bytes[7] = (byte) 0x3F;
bytes[8] = (byte) 0x3E;
// D5
bytes[9] = (byte) 0x31;
bytes[10] = (byte) 0x31;
// D6
bytes[11] = (byte) 0x31;
bytes[12] = (byte) 0x31;
// D7
bytes[13] = (byte) 0x30;
bytes[14] = (byte) 0x33;
// D8
bytes[15] = (byte) 0x31;
bytes[16] = (byte) 0x37;
// D9
bytes[17] = (byte) 0x30;
bytes[18] = (byte) 0x37;
// D10
bytes[19] = (byte) 0x30;
bytes[20] = (byte) 0x37;
// D11
bytes[21] = (byte) 0x31;
bytes[22] = (byte) 0x3F;
// D12
bytes[23] = (byte) 0x3A;
bytes[24] = (byte) 0x37;
// 报文尾
bytes[25] = (byte) 0x83;
JBF293KMapper jbf293KMapper = new JBF293KMapper();
System.out.println(jbf293KMapper.readValue(bytes, Map.class));
结果示例

剩余电流探测器故障
报文示例

代码示例
byte[] bytes = new byte[26];
// 报文头
bytes[0] = (byte) 0x82;
// D1
bytes[1] = (byte) 0x3F;
bytes[2] = (byte) 0x3C;
// D2
bytes[3] = (byte) 0x32;
bytes[4] = (byte) 0x34;
// D3
bytes[5] = (byte) 0x32;
bytes[6] = (byte) 0x30;
// D4
bytes[7] = (byte) 0x3C;
bytes[8] = (byte) 0x37;
// D5
bytes[9] = (byte) 0x32;
bytes[10] = (byte) 0x32;
// D6
bytes[11] = (byte) 0x31;
bytes[12] = (byte) 0x31;
// D7
bytes[13] = (byte) 0x30;
bytes[14] = (byte) 0x34;
// D8
bytes[15] = (byte) 0x31;
bytes[16] = (byte) 0x37;
// D9
bytes[17] = (byte) 0x30;
bytes[18] = (byte) 0x37;
// D10
bytes[19] = (byte) 0x30;
bytes[20] = (byte) 0x37;
// D11
bytes[21] = (byte) 0x31;
bytes[22] = (byte) 0x3F;
// D12
bytes[23] = (byte) 0x38;
bytes[24] = (byte) 0x32;
// 报文尾
bytes[25] = (byte) 0x83;
JBF293KMapper jbf293KMapper = new JBF293KMapper();
System.out.println(jbf293KMapper.readValue(bytes, Map.class));
结果示例

温度探测器
报文示例(文档中报文crc校验值错误)

代码示例
byte[] bytes = new byte[36];
// 报文头
bytes[0] = (byte) 0x82;
// D1
bytes[1] = (byte) 0x3F;
bytes[2] = (byte) 0x3C;
// D2
bytes[3] = (byte) 0x30;
bytes[4] = (byte) 0x32;
// D3
bytes[5] = (byte) 0x30;
bytes[6] = (byte) 0x31;
// D4
bytes[7] = (byte) 0x34;
bytes[8] = (byte) 0x32;
// D5
bytes[9] = (byte) 0x3F;
bytes[10] = (byte) 0x3F;
// D6
bytes[11] = (byte) 0x31;
bytes[12] = (byte) 0x31;
// D7
bytes[13] = (byte) 0x30;
bytes[14] = (byte) 0x35;
// D8
bytes[15] = (byte) 0x31;
bytes[16] = (byte) 0x38;
// D9
bytes[17] = (byte) 0x30;
bytes[18] = (byte) 0x3F;
// D10
bytes[19] = (byte) 0x32;
bytes[20] = (byte) 0x3D;
// D11
bytes[21] = (byte) 0x30;
bytes[22] = (byte) 0x31;
// D12
bytes[23] = (byte) 0x3A;
bytes[24] = (byte) 0x3B;
// D13
bytes[25] = (byte) 0x31;
bytes[26] = (byte) 0x33;
// D14
bytes[27] = (byte) 0x30;
bytes[28] = (byte) 0x30;
// D15
bytes[29] = (byte) 0x35;
bytes[30] = (byte) 0x38;
// D16
bytes[31] = (byte) 0x30;
bytes[32] = (byte) 0x32;
// CRC
bytes[33] = (byte) 0x3E;
bytes[34] = (byte) 0x33;
// 报文尾
bytes[35] = (byte) 0x83;
JBF293KMapper jbf293KMapper = new JBF293KMapper();
System.out.println(jbf293KMapper.readValue(bytes, Map.class));
结果示例

调试过程
设备接线

配置设备网络地址和串口


使用串口工具模拟发送报文
{% link 串口调试工具,nas,http://gofile.me/5lHRJ/Ji3BeVc1e %}

启动java服务接收数据

原文始发于微信公众号(询于刍荛):java中JBF293K协议报文解析,获取消防应急门状态、报警数据等信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/280953.html