1. What is MQTT

MQTT is an open-source pub/sub communication protocol. It is efficient in its utilization of bandwidth and system resources. As a result, it is popular in use cases ranging from low-powered embedded systems to cloud-native micro services.

The pub/sub model is at the core of MQTT communication. Information is organized by topics. Client devices can publish data to a topic to send messages to any subscribers. Similarly, clients can subscribe to a topic to be notified when a message is published.

implement. These characteristics make it widely applicable.

2. MQTT Topics on the Camera

There are 5 Topics on the camera:

  •  Snapshot Topic
  •  Status Topic
  •  Alarm Topic
  •  Remote Configure Topic
    •  Configuration Request Topic
    •  Configuration Respond Topic
  •  Wake Topic (No shown on the page)

Note: Except the “Wake Topic”, all topic on the web page is customizable and has default value as shown below:

3. Application on the Camera

  • 1. Enable the “Enable Post” , then the MQTT application functions.
  • 2. Check the “Post Content” option , then the camera will send corresponding topic data. 

For instance, if you want receive snapshots from the camera, you MUST check the “Snapshot” option, and set the “Snapshot Topic”.

  • 3. “Configure Request Topic” and “Configure Respond Topic” are for remote configuration, after setting the topic, they function always.
  • 4. Client subscribe the topic to receive and send data.

Note: All data is in JSON format.


4.Topic Description

1. Snapshot Topic 

l Client subscribes the “Snapshot Topic” .

l Camera publish snapshot data to the “Snapshot Topic”.

l After receiving snapshot data, the client needs to decode the data and transform it to an image file.

Data sample:

{

  "ts": 1682336818966,

  "values": {

    "devName": "4G Solar-powered ANPR Camera",

    "devMac": "5CC5638AE729",

    "file": "debug_202304240745431198T",

    "time": 1682336743,

    "imageSize": 20941,

    "image": "data:image/jpeg;base64,/9j/4AA...."

  }

2. Status Topic

l Client subscribes the “Status Topic”.

l Each time when the camera wakes up, it sends status data to the “Status Topic”. 

l The Heartbeat mechanism keeps the camera sending status data per hour.

Data sample:

{

  "ts": 1689238041244,

  "values": {

    "devName": "4G Solar-powered ANPR Camera",

    "devMac": "1CC3164126A2",

    "battery": {

      "soc": 91,

      "capacity": 5682,

      "voltage": 4052,

      "healthy": 100,

      "chargeCurrent": 0,

      "chargeStat": 0,

      "chargeVoltage": 10560,

      "powerGoodStat": 0

    },

    "radar": {

      "enable": 1

    },

    "gps": {

      "latitude": "24.62493",

      "longtitude": "118.03077",

      "altitude": "59.8"

    },

    "cellular": {

      "connectStatus": "4G Connected",

      "simStatus": "Valid",

      "signalStrength": 0,

      "imei": "868444050582056",

      "imsi": "460115211076172",

      "iccid": "89860322245922526572",

      "ipAddr": "10.33.177.77",

      "subMask": "255.255.255.252",

      "gateway": "10.33.177.78",

      "dns": "114.114.114.114",

      "dataMonthly": 6107722

    }

  }

}

3. Alarm Topic

l Client needs to subscribe to the “Alarm Topic”.

l Camera sends active alarms to this topic.

l Client parses the content after receiving it.

Data sample:

{

  "ts": 1682336818966,

  "values": {

    "devName": "4G Solar-powered ANPR Camera",

    "devMac": "5CC5638AE729",

    "alarm": "Low power" 

  }

}


4.Remote Configure Topic

For more information about the API, please refer to the API document.


(1) Configure Request Topic

l Client send message to the “Configure Request Topic”

Get request sample:

{

"api": "get.sys.info",

"devMac": 1CC3164171FE"

}



Set request sample:


{

"api": "set.sys.info",

"devMac": 1CC3164171FE",

“data”: {

 “deviceName”: “MQTT Test”

}

}

(2) Configure Response Topic

l Client subscribes the “Configure Response Topic”

Get response sample:

{

"devName": "4G Solar-powered ANPR Camera”,

"devMac": "1CC3164171FE",

"api": "get.sys.info",

"data": {

"deviceName": “4G Solar-powered ANPR Camera",

"model": "SC211-AU",

"hardware": "V1.0”,

"software": "C21.1.0.4",

"mac": "1C:C3:16:41:71:FE",

"sn": "264922455YG0”

}

}


Set response sample:


{

“devName”: “MQTT Test”,

“devMac”: “1CC3164171FE”,

“api”: “set.sys.info”,

“data”: {

 “code”: 0,

 “result”: “OK”

}

}


5. Wake

l When the camera is in sleep mode, Client sends any content to the “Wake Topic”, “4GSolarCam/Wake/5CC5638AE24C”, of which "5CC5638AE24C" is MAC address, to wake up the corresponding camera.

  • l After the camera wakes up, it will automatically turn on 4G cellular, then you can log in the web page.