# 网关+子设备属性事件上传格式
[TOC]
## 1、数据结构体
| 标签名 | 作用 | 类型|
| --- | --- | --- |
| schema| 路由 | varchar |
| profile | 设备入网参数 | array |
| properties | 属性 | array |
| events| 事件 | array |
| time | 时间戳 | int|
### profile 参数
| 标签名 | 作用 | 类型|
| --- | --- | --- |
| nodeType| 节点类型:dev设备,net网关 | net|
| idAcl| id认证标准:true使用,false,不使用 | |
| iotKey | 设备入网Key|varchar |
| iotSecret | 设备入网Secret |varchar |
### properties 属性参数
| 标签名 | 作用 | 类型|
| --- | --- | --- |
| netInfo| 网关属性| array|
| devices|子设备属性 |array |
|netInfo | 作用 | 类型|
| --- | --- | --- |
| sw_version| 软件版本 | varchar |
| hw_version| 硬件版本 | varchar |
| connect_type| 联网方式:wifi、gprs、ethernet| varchar |
| location| 定位信息 |varchar |
| altitude| 海拔信息 | varchar |
| key/value| 其他参数 |varchar |
|devices | 作用 | 类型|
| --- | --- | --- |
| sn| 子设备sn码 | varchar |
| devType| 子设备类型 | varchar |
| info| 属性 | array|
### events 事件参数
| 标签名 | 作用 | 类型|
| --- | --- | --- |
| key/value| 事件格式 |varchar |
## 2、网关+子设备属性上传
路由:`dev/properties`
```
{
"schema": "dev/properties",
"profile": {
"iotKey": "",
"iotSecret": "",
"nodeType": "",
"idAcl": ""
},
"properties": {
"netInfo": {
"swVersion": "",
"hwVersion": "",
"connectType": "",
"location": "",
"altitude": ""
},
"devices": [{
"sn": "",
"devType": "",
"info": {
"key": "value",
"key1": "value1"
}
}, {
"sn": "",
"devType": "",
"info": {
"key": "value",
"key1": "value1"
}
}]
},
"time": ""
}
```
Example:
```
{
"schema": "dev/properties",
"profile": {
"iotKey": "",
"iotSecret": "",
"nodeType": "",
"idAcl": ""
},
"properties": {
"netInfo": {
"sw_version": "V1.0",
"hw_version": "V1.0",
"connect_type": "gprs",
"location": "108.906796,34.180912",
"altitude": "500"
},
"devices": [{
"sn": "1134423424",
"devType":"dev",
"info": {
"sw_version": "V1.0",
"hw_version": "V1.0"
}
}, {
"sn": "234212111",
"devType":"pt",
"info": {
"sw_version": "V1.0",
"hw_version": "V1.0"
}
}]
},
"time": "1558574467"
}
```
## 3、网关+子设备事件上传格式
路由:`dev/events`
```
{
"schema": "dev/events",
"profile": {
"iotKey": "",
"iotSecret": "",
"nodeTypev": "net",
"idAcl": ""
},
"events": {
"netInfo": {
"key": "value",
"key1": "value1"
},
"devices": [{
"sn": "",
"devType": "",
"info": {
"key": "value",
"key1": "value1"
}
}, {
"sn": "",
"devType": "",
"info": {
"key": "value",
"key1": "value1"
}
}]
},
"time": ""
}
```