BinaryMessageCodecBuilder.create()
.decode()
// 0x04 属性上报
.match(eq(int1(1), fixed((byte) 0x04)))
.deviceId(append(string("device-"), int1(0)))
.isReportProperty()
.property("humidity", hexFloat(Endian.BIG, 3))
.property("temperature", hexFloat(Endian.BIG, 5))
.next()
// 0x01 事件上报
.match(eq(int1(1), fixed((byte) 0x01)))
.deviceId(append(string("device-"), int1(0)))
.isEvent()
.eventId(fixed("fire_alarm"))
.data(map()
.add(fixed("temp"), hexFloat(Endian.BIG, 3))
.build())
.end()
.build();