首先用模拟器试下看看它发的啥?
.........................Send one mqtt packet.........................
FixHeader{
PacketTag = 48
PacketType = 3
RemainLength = 28
}
VariableHeaderPublish{
topic_name_len_= 3
topic_name= $dp
}
PayloadPublish{
payload_= [0x03]类型 [0x00 0x14]数据长度 0x7B 0x22 0x74 0x65 0x6D 0x70 0x65 0x72 0x61 0x74 0x75 0x72 0x65
0x22 0x3A 0x32 0x38 0x2E 0x36 0x7D
}Send One Packet Succ:
.........................Send one mqtt packet.........................
FixHeader{
PacketTag = 192
PacketType = 12
RemainLength = 0
}Send One Packet Succ:
仔细观察PayloadPublish发现除了温度的json数据外,还多3个字节: 类型+json格式数据长度
除了这个之外,发送主题要改成 "$dp"
上传成功后就可以到相应设备的数据流里去看数据了: