Input/Output Format of the Codec Plug-In
Service Type |
Attribute Name |
Attribute Description |
Attribute Type (Data Type) |
---|---|---|---|
Battery |
- |
- |
- |
- |
batteryLevel |
Specifies the battery level in the unit of percent. The value ranges from 0 to 100. |
int |
Meter |
- |
- |
- |
- |
signalStrength |
Specifies the signal strength. |
int |
- |
currentReading |
Specifies the current read value. |
int |
- |
dailyActivityTime |
Specifies the daily activated communication duration. |
string |
The following shows the decode interface output for data reported by a device to the IoT platform.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
{
"identifier": "12345678",
"msgType": "deviceReq",
"data": [
{
"serviceId": "Meter",
"serviceData": {
"currentReading": "46.3",
"signalStrength": 16,
"dailyActivityTime": 5706
},
"eventTime": "20160503T121540Z"
},
{
"serviceId": "Battery",
"serviceData": {
"batteryLevel": 10
},
"eventTime": "20160503T121540Z"
}
]
}
|
The following shows the encode interface input when the IoT platform receives data reported by the device and sends a response to the device.
1 2 3 4 5 6 7 8 9 10 |
{
"identifier": "123",
"msgType": "cloudRsp",
'request': [
1,
2
],
"errcode": 0,
"hasMore": 0
}
|
The value of request can be [1,2], which is simulated data. The actual value prevails.
Basic Function |
Type |
Name |
Command Parameter |
Data Type |
Enumerated Value |
---|---|---|---|---|---|
WaterMeter |
Water meter |
- |
- |
- |
- |
- |
CMD |
SET_TEMPERATURE_READ_PERIOD |
- |
- |
- |
- |
- |
- |
value |
int |
- |
- |
RSP |
SET_TEMPERATURE_READ_PERIOD_RSP |
- |
- |
- |
- |
- |
- |
result |
int |
|
The following shows the input parameters of the encode interface when the IoT platform sends an order to the device.
1 2 3 4 5 6 7 8 9 10 |
{
"identifier": "12345678",
"msgType": "cloudReq",
"serviceId": "WaterMeter",
"cmd": "SET_TEMPERATURE_READ_PERIOD",
"paras": {
"value": 4
},
"hasMore": 0
}
|
After the IoT platform receives a response from the device, the IoT platform invokes the decode interface for decoding. The decode interface output is as follows:
1 2 3 4 5 6 7 8 |
{
"identifier": "123",
"msgType": "deviceRsp",
"errcode": 0,
"body": {
"result": 0
}
}
|
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot