For GB/T 32960 cloud gateway devices, you can forward device logon and verification, unregistration, and data submission messages to your server by using the data forwarding feature. You can also push device-submitted messages to your server through AMQP subscriptions. This topic describes the topics and data formats used in message forwarding.
Usage notes
When you configure message forwarding, note the following:
-
Only the new version of the data forwarding feature supports cloud gateway devices. For more information, see Configure a data forwarding parser.
-
Topic subscription is not supported for GB/T 32960 cloud gateway devices. You cannot forward data from one topic to another for these devices.
-
To forward messages from GB/T 32960 cloud gateway devices, add one of the following topic types as a data source: Custom, Device Status Change Notification, and Device Changes Throughout Lifecycle. For a custom topic, you must specify the Vehicle Identification Number (VIN) of the vehicle in the topic name. For more information, see Add a data source.
-
Server-side subscriptions support only the following data types: Device Upstream Notification, Device Status Change Notification, and Device Changes Throughout Lifecycle. For more information, see Configure AMQP server-side subscription.
Device message parameters must conform to the GB/T 32960 protocol. For more information, see GB/T 32960-2016.
Device logon
Topic: /sys/${productKey}/${deviceName}/device/message/uplink.
{
"header": {
"command": 1,
"responseFlag": 254,
"vin": "onepart1234567891"
},
"body": {
"iccid": "12345678901234567890",
"month": 3,
"hour": 16,
"year": 23,
"subSystemNumber": 2,
"systemEncode": [
"12345678",
"87654321"
],
"systemEncodeLength": 8,
"day": 21,
"serialNo": 1,
"minute": 20,
"second": 12
}
}
|
Parameter |
Type |
Description |
|
header |
Object |
The data of the message header. |
|
command |
Integer |
The ID of the command. |
|
responseFlag |
Integer |
The ID of the response. |
|
vin |
String |
The VIN of the vehicle. |
|
body |
Object |
The data of the message body. |
|
iccid |
String |
The ICCID of the vehicle. |
|
year |
Integer |
The year in which the vehicle logged on to the system. |
|
month |
Integer |
The month in which the vehicle logged on to the system. |
|
day |
Integer |
The day on which the vehicle logged on to the system. |
|
hour |
Integer |
The hour at which the vehicle logged on to the system. |
|
minute |
Integer |
The minute at which the vehicle logged on to the system. |
|
second |
Integer |
The second at which the vehicle logged on to the system. |
|
subSystemNumber |
Integer |
The number of sub-systems that can be charged and store electricity. |
|
systemEncode |
List |
The codes of the sub-systems. |
|
systemEncodeLength |
Integer |
The length of the code. |
|
serialNo |
Integer |
The record number of the vehicle logon. |
Submit device status
Topic: /sys/${productKey}/${deviceName}/device/status/notify.
-
Data format when a device goes online:
{ "protocol": "gb32960", "status":"online", "iotId":"4z819VQHk6VSLmmBJfrf00107e****", "productKey":"al12345****", "deviceName":"deviceName1234", "time":"2018-08-31 15:32:28.205", "utcTime":"2018-08-31T07:32:28.205Z", "lastTime":"2018-08-31 15:32:28.195", "utcLastTime":"2018-08-31T07:32:28.195Z", "clientIp":"192.0.2.1" } -
Data format when a device goes offline:
{ "protocol": "gb32960", "status":"offline", "iotId":"4z819VQHk6VSLmmBJfrf00107e****", "offlineReasonCode":427, "productKey":"al12345****", "deviceName":"deviceName1234", "time":"2018-08-31 15:32:28.205", "utcTime":"2018-08-31T07:32:28.205Z", "lastTime":"2018-08-31 15:32:28.195", "utcLastTime":"2018-08-31T07:32:28.195Z", "clientIp":"192.0.2.1" }
Parameter description
|
Field |
Category |
Description |
|
protocol |
String |
For a GB/T 32960 cloud gateway, set this parameter to |
|
status |
String |
The status of the device.
|
|
iotId |
String |
The unique identifier of the device in IoT Platform. |
|
offlineReasonCode |
Integer |
The error code when the device goes offline. Device behavior error codes. |
|
productKey |
String |
The unique identifier of the product to which the device belongs. |
|
deviceName |
String |
The name of the device. |
|
lastTime |
String |
Deprecated. No longer used. |
|
utcLastTime |
String |
|
|
time |
String |
The time when the device went online or offline. Messages are not sorted by online/offline time. Sort them by the time value. For example, you receive the following three messages in sequence:
These three messages show that the device went offline, then online, then offline again. |
|
utcTime |
String |
The UTC time when the device went online or offline. |
|
clientIp |
String |
The public IP address of the device. |
Device data submission
Topic: /sys/${productKey}/${deviceName}/device/message/uplink.
{
"header": {
"command": 123,
"responseFlag":1,
"vin":""
},
"body": {
"data":""
}
}
|
Parameter name |
Data type |
Description |
|
header |
Object |
The data of the message header. |
|
command |
Integer |
The ID of the command. |
|
responseFlag |
Integer |
The ID of the response. |
|
vin |
String |
The VIN of the vehicle. |
|
body |
Object |
The data of the message body. The data is encoded in Base64. |
Device unregistration
Topic: /sys/${productKey}/${deviceName}/device/message/uplink.
{
"header": {
"command": 4,
"responseFlag": 254,
"vin": "onepart1234567891"
},
"body": {
"month": 3,
"hour": 16,
"year": 23,
"day": 21,
"minute": 20,
"second": 12,
"serialNo": 1
}
}
|
Parameter name |
Data type |
Description |
|
header |
Object |
The data of the message header. |
|
command |
Integer |
The ID of the command. |
|
responseFlag |
Integer |
The ID of the response. |
|
vin |
String |
The VIN of the vehicle. |
|
body |
Object |
The data of the message body. |
|
year |
Integer |
The year in which the vehicle was unregistered. |
|
month |
Integer |
The year in which the vehicle was unregistered. |
|
day |
Integer |
The month in which the vehicle was unregistered. |
|
hour |
Integer |
The hour at which the vehicle was unregistered. |
|
minute |
Integer |
The minute at which the vehicle was unregistered. |
|
second |
Integer |
The second at which the vehicle was unregistered. |
|
serialNo |
Integer |
The record number of the vehicle unregistration. |