# mesh 网络
数据上行: fogcloud/{pk}/{dn}/thing/up/mesh 数据下行: fogcloud/{pk}/{dn}/thing/down/mesh
具体请求类别根据 json 数据的 method 字段进行区分:
method | 说明 |
elect | 网关选举 |
login | mesh 节点上线 |
logout | mesh 节点下线 |
delete | 云端通知 mesh 节点被删除 |
node.raw | mesh 节点数据透传 |
gateway.raw | mesh 网关数据透传 |
node.productconfig | mesh 节点获取产品配置(请求&响应) |
# 1 节点数据透传
- 设备上行和下行数据格式:
{ "id": 123, "version": "1.0", "method": "node.raw", "params": [ { "address": 300, "raw_data": "xxxx" }, { "address": 302, "raw_data": "xxxx" } ] }
# 2 网关竞选
- 设备上行数据格式:
{ "id": 123, "version": "1.0", "method": "elect", "params": { "is_leader": true // true: 选举成功,false: 选举失败 } }
# 3 节点动作
节点上线时,物联网平台会根据拓扑关系进行身份校验。
# 3.1 节点上线
- 设备上行数据格式:
{ "id": 123, "version": "1.0", "method": "login", "params": { "addresses": [300, 301, 302] } }
# 3.2 节点下线
- 设备上行数据格式:
{ "id": 123, "version": "1.0", "method": "logout", "params": { "addresses": [300, 301, 302] } }
# 3.3 节点被删除
- 云端下行数据格式:
{ "id": 123, "version": "1.0", "method": "delete", "params": { "addresses": [300, 301, 302] } }
# 4 网关数据透传
下行数据:
{ "id": 123, "version": "1.0", "method": "gateway.raw", "params": { "raw_data": "xxxxxx" //hex字符串 } }
# 5 mesh 节点获取产品配置(请求&响应)
请求格式 { "id": 123, "version": "1.0", "method": "node.productconfig", "params": { "address": 300 } } 响应格式 { "id": 123, "version": "1.0", "method": "node.productconfig", "params": { "address": 300, "config":"xxxxx" } }