Commit 0dc62b84 by 胡高建

Update README.md

parent 0d410d10
### MQTT交互接口
### 自定义MQTT交互接口
#### Change Log
- 2021-04-21:
- xxx
上行payload中的公共参数
#### 上行payload中的公共参数
```javascript
{
"version": {version},
"device_id": {device_id},
"device_name": {device_name},
"lan_ip": {lan_ip},
"timestamp": {timestamp}
}
```
version、device_id、lan_ip都是字符型,timestamp是整型,13位数的时间戳
version、device_name、lan_ip都是字符型,timestamp是整型,为10位数的时间戳
......@@ -21,11 +24,12 @@ version、device_id、lan_ip都是字符型,timestamp是整型,13位数的
| Function | Topic | Payload | Remark |
| ---------------- | -------------------------------------------------------- | ------------------------------------------------------------ | ------------------------------- |
| 关机上报 | /{productID}/{deviceName}/up/device_state_changed | {"version": {version}, "device_id": {device_id}, "lan_ip": {lan_ip}, "timestamp": {timestamp}, "params": {"state": "off", "auto": true}} | 自动关机auto传true,手动传false |
| 开机上报 | /{productID}/{deviceName}/up/device_state_changed | {"version": {version}, "device_id": {device_id}, "lan_ip": {lan_ip}, "timestamp": {timestamp}, "params": {"state": "on"}} | |
| 指令执行完成上报 | /{productID}/{deviceName}/up/commands_execution_finished | {"version": {version}, "device_id": {device_id}, "lan_ip": {lan_ip}, "timestamp": {timestamp}, "params": {"success": true}} | 成功传true,失败传false |
| 资源更新完成 | /{productID}/{deviceName}/up/resource_updated | {"version": {version}, "device_id": {device_id}, "lan_ip": {lan_ip}, "timestamp": {timestamp}, "params": {"resource_id": {resource_id}} | |
| 缓存数据超时 | /{productID}/{deviceName}/up/cache_timed_out | {"version": {version}, "device_id": {device_id}, "lan_ip": {lan_ip}, "timestamp": {timestamp}, "params": {"cache_id": {cache_id}} | |
| 关机上报 | /{productID}/{deviceName}/up/device_state_changed | {"version": "1.0.0", "device_name": "device1", "lan_ip": "192.168.1.2", "timestamp": 1618903842, "params": {"state": "off", "auto": true}} | 自动关机时auto传true,手动传false |
| 开机上报 | /{productID}/{deviceName}/up/device_state_changed | {"version": "1.0.0", "device_name": "device1", "lan_ip": "192.168.1.2", "timestamp": 1618903842, "params": {"state": "on"}} | |
| 指令执行完成上报 | /{productID}/{deviceName}/up/commands_execution_finished | {"version": "1.0.0", "device_name": "device1", "lan_ip": "192.168.1.2", "timestamp": 1618903842, "params": {"success": true}} | 成功传true,失败传false |
| 资源更新完成 | /{productID}/{deviceName}/up/resource_updated | {"version": "1.0.0", "device_name": "device1", "lan_ip": "192.168.1.2", "timestamp": 1618903842, "params": {"resource_id": "1"} | |
| 资源更新进度上报 | /{productID}/{deviceName}/up/resource_updating_progress | {"version": "1.0.0", "device_name": "device1", "lan_ip": "192.168.1.2", "timestamp": 1618903842, "params": {"resource_id": "1", "progress": 0.8} | progress为当前进度,取值0<=progress<=1 |
| 缓存数据超时 | /{productID}/{deviceName}/up/cache_timed_out | {"version": "1.0.0", "device_name": "device1", "lan_ip": "192.168.1.2", "timestamp": 1618903842, "params": {"cache_id": "1"} | |
......@@ -33,9 +37,8 @@ version、device_id、lan_ip都是字符型,timestamp是整型,13位数的
| Function | Topic | Payload | Remark |
| ------------------- | ---------------------------------------------------- | -------------------------------- | ------------------- |
| 资源下载地址 | /{productID}/{deviceName}/down/resource_download_url | {"resource_url": {resource_url} | |
| 资源上传id | /{productID}/{deviceName}/down/resource_upload_id | {"resource_id": {resource_id}} | resource_id为字符型 |
| 资源上传地址 | /{productID}/{deviceName}/down/resource_upload_url | {"resource_url": {resource_url}} | |
| 心跳间隔最大周期(s) | /{productID}/{deviceName}/down/heartbeat_max_seconds | {"seconds": {seconds}} | seconds为整型 |
| 资源下载地址 | /{productID}/{deviceName}/down/resource_download_url | {"resource_url": "https://xxx.yyy.zzz"} | |
| 资源上传id | /{productID}/{deviceName}/down/resource_upload_id | {"resource_id": "xxx"} | resource_id为字符型 |
| 资源上传地址 | /{productID}/{deviceName}/down/resource_upload_url | {"resource_url": "https://xxx.yyy.zzz"} | |
| 心跳间隔最大周期(s) | /{productID}/{deviceName}/down/heartbeat_max_seconds | {"seconds": 300} | seconds为整型 |
b
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment