If you use GB/T 32960 cloud gateway devices, you can forward the messages of the devices to a user-managed server by using the data forwarding feature. The messages include device logon and verification messages, device unregistration messages, and device data submission messages. You can push messages that are submitted by devices to the server by using the Advanced Message Queuing Protocol (AMQP) subscription feature. This topic describes how to use the data forwarding feature to forward messages. This topic also provides instructions on the required topics and data types.
Usage notes
When you forward messages, take note of the following items:
You can use only the new version of the data forwarding feature to configure data forwarding rules for cloud gateway devices. For more information, see Configure a data forwarding parser.
You cannot subscribe to topics for GB/T 32960 cloud gateway devices. Therefore, you cannot forward the data of GB/T 32960 cloud gateway devices from a topic to another topic.
If you want to forward the messages of GB/T 32960 cloud gateway devices, you can add the following types of topics as a data source: Custom, Device Status Change Notification, and Device Changes Throughout Lifecycle. If you want to add a custom topic as a data source, you must specify the Vehicle Identification Number (VIN) of the vehicle in the topic name. For more information, see Add a data source.
You can use server-side subscriptions to push only the following types of data: Device Upstream Notification, Device Status Change Notification, and Device Changes Throughout Lifecycle. For more information, see Configure an AMQP server-side subscription.
The parameters of a device message 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.
Format of data that is submitted by a device when the 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" }Format of data that is submitted by a device when the 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 | If you use a GB/T 32960 cloud gateway, set the value to |
status | String | The status of the device.
|
iotId | String | The unique identifier of the device in IoT Platform. |
offlineReasonCode | Integer | The error code that is returned when the device goes offline. For more information, see 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 | This parameter is a historical field and is no longer used. |
utcLastTime | String | |
time | String | The time when the device went online or offline. The received messages are not sorted by the time when the device went online or offline. You must sort the messages based on the value of the time parameter. For example, you receive the following three messages in sequence:
These three messages show that the device first went offline, then went online, and finally went 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. |