1. What is MQTT
MQTT (Message Queuing Telemetry Transport) is a messaging protocol based on the publish/subscribe paradigm under the ISO standard (ISO/IEC PRF 20922). It works on the TCP/IP protocol family and is a publish/subscribe message protocol designed for remote devices with low hardware performance and poor network conditions.
MQTT is a client-server based message publish/subscribe transport protocol. The MQTT protocol is lightweight, simple, open and easy to implement. These characteristics make it widely applicable.
2. MQTT Application Description
The following description “SC” stands for 4G solar device(SC211-NA/EU/AU);
“Client” stands for client device.
The topic is divided into 5 parts
l Snapshot
l Alarm
l Wake
l Status
l Configuration
1) Snapshot
Client needs to pre-sbuseribe to the 4GSolarCam/Snapshoy
"SC->Client",SC actively pushes the picture to the topic
After the client receives it,it needs to parse the data and save the image data as "JPG"
eg: The content of the push map is as follows
2) Alarm
Client needs to pre-subscribe to the topic 4GSolarCam/Alarm
"SC -> Client", SC sends active alarms to this topic
Client parses the content after receiving it
eg: The content of the alarm is as follows
3) Wake
SC subscription topic 4GSolarCam/Wake/5CC5638AE24C where "5CC5638AE24C", is the SC's own MAC address
"Client -> SC", in sleep state, Client sends any content to the topic to wake up the corresponding SC, such as ",wake",
After the SC wakes up, it will automatically turn on "WiFi", and "4G", and you can log in to the web page
4) Status
Client needs to pre-subscribe topic 4GSolarCam/Status
"SC -> Client", after SC wakes up, it will actively send status information to the topic
eg: The status information is as follows
SC subscription topic 4GSolarCam/Status/5CC5638AE24C, where "5CC5638AE24C" is the MAC address of SC itself
"Client -> SC", in 4G working state, Client sends "status" to this topic to get the status information of corresponding SC
After SC receives the message, it will send the status information to the topic 4GSolarCam/Status
5) Config
SC subscription topic 4GSolarCam/Config/5CC5638AE24C, where "5CC5638AE24C" is the MAC address of SC itself
"Client -> SC", in 4G working state, Client sends different customized information to the topic to configure SC, as follows
"shutdown": close the application
"reboot": restart the application
"upgrade": Online upgrade
After SC receives the message, it performs corresponding operations according to the content