MQTT-OneNET

MC20-MQTT

学习视频: https://www.bilibili.com/video/av56600113?from=search&seid=13353829396422857385

https://www.bilibili.com/video/av57481532?p=2

OneNET MQTTServer: 183.230.40.39:6002

大号:
设备ID_9:535135295
产品ID_6:259820
鉴权ID_9:20190714D

小号:
设备ID:535135347
产品ID:259820
鉴权ID:20190714X

设备连接:基于-TCP-软性

http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/errata01/os/mqtt-v3.1.1-errata01-os-complete.html#_Toc442180842
大号:
头 LL 固定 MQTT 固定 时间(2min) L+DeviceID L+ProductID L+QuanID
2min = 120s = 0x78
10 LL 00 04 4D 51 54 54 04 C2 00 78 00 09 35 33 35 31 33 35 32 39 35 00 06 32 35 39 38 32 30 00 09 32 30 31 39 30 37 31 34 44
L = 2+4+2+2(10)_9+2_6+2_9+2 = 40 = 0x28
LL = 28
10 28 00 04 4D 51 54 54 04 C2 00 78 00 09 35 33 35 31 33 35 32 39 35 00 06 32 35 39 38 32 30 00 09 32 30 31 39 30 37 31 34 44
接收到 20 02 01 00 即为成功

小号:
头 LL 固定 MQTT 固定 时间(2min) L+DeviceID L+ProductID L+QuanID
同上
10 28 00 04 4D 51 54 54 04 C2 00 78 00 09 35 33 35 31 33 35 33 34 37 00 06 32 35 39 38 32 30 00 09 32 30 31 39 30 37 31 34 58

断开连接:(E0 00)固定2个字节

心跳
C0 00
心跳回复
D0 00

先订阅,然后发布的内容才可以接收到

1、订阅 SUBSCRIBE

http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/errata01/os/mqtt-v3.1.1-errata01-os-complete.html#_Toc442180877

头 LL 固定(000A) L+topic(mnzb_topic) level0
82 LL 00 0A 00 0A 6D 6E 7A 62 5F 74 6F 70 69 63 00
LL = 2_2+10_1 = 15 = 0x0F
82 0F 00 0A 00 0A 6D 6E 7A 62 5F 74 6F 70 69 63 00

2、发布 PUBLISH

http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/errata01/os/mqtt-v3.1.1-errata01-os-complete.html#_Toc385349261

等级0 数据 "12345abcde"
头 LL 固定 L(10)+topic(mnzb_topic) publishData(12345abcde)
30 LL 00 0A 6D 6E 7A 62 5F 74 6F 70 69 63 31 32 33 34 35 61 62 63 64 65
LL = 2+10_10 = 22 = 0x16
30 16 00 0A 6D 6E 7A 62 5F 74 6F 70 69 63 31 32 33 34 35 61 62 63 64 65
发布回复:
63 02 00 01

30是发布,82是订阅

订阅回复:

取消订阅 UNSUBSCRIBE

http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/errata01/os/mqtt-v3.1.1-errata01-os-complete.html#_Toc442180886
A2 0E 00 0D 00 0A 6D 6E 7A 62 5F 74 6F 70 69 63
LL = 2+10_10 = 22 = 0x16
30 16 00 0A 6D 6E 7A 62 5F 74 6F 70 69 63 31 32 33 34 35 61 62 63 64 65

取消关注回复:
B0 02 00 0C

你可能感兴趣的:(网络设备)