
Page 54 of 57
King Pigeon Hi-Tech. Co., Ltd.
Ver 3.0
GSM/SMS/GPRS/3G/4G
Cellular IoT M2M RTU
CONNECT: The client sends a” CONNECT “connection message request to the server;
CONNACK: The server responds with a “CONNACK” confirmation connection message, indicating that the
connection is successful;
After the client establishes a connection, it is a long connection, and the client can publish or subscribe to the
message on the server;
Take the device and the client's mobile phone as the client:
After the device publishes the topic on the broker proxy server, the customer can view the data through
subscription. That is, the device is the publisher and the customer's mobile phone is the subscriber.
Users can also publish topics through the MQTT server to control the device. That is, the user is the publisher
and the device is the subscriber.
Payload data format of device publish message
Publish Topic: MQTT client ID (filled in configuration software)
{
"sensorDatas":
[
{
"
flag
":"DI1",
//Read and write flag
"
switcher
":1
//data type and value
},
{
"
flag
":"AI1",
"
value
":10.00
}
{
"
flag
":"REG20000",
// Register address and value
"
value
":1.00
}
],
"
time
":"1591841863",
//Time stamp (When power on,first time connection no time stamp,later connections
have time stamp)
"
state
":"alarm",
//Alarm and recovery (only for alarm or recovery data, but not for timely report)
"
retransmit
":"enable"
//Historical data (only for re-transmission of historical data, but not for real-time data)
}
Note:
//Read and write flag: the character is "flag", followed by "read and write identification of IO data points"
//Data type and value:
1. Switch-type data: the character is "switcher", followed by "0" or "1" (0 open, 1 closed)
2. Numerical data: the character is "value", followed by "specific value"
//Timestamp: the character is "time", followed by "specific timestamp "
//Alarm and recovery identification: the characters are "state", followed by "alarm" or "recovery" (alarm is alarm
data, recovery is recovery data)