电信IoT平台——profile生成
2019-04-29 本文已影响186人
林定益想去NASA捡垃圾
profile是个由两个文件夹组成的zip
1 profile文件夹
新建一个文件夹命名为profile
并在该文件夹内新建文件devicetype-capability.json
,内容如下:
{
"devices": [
{
"manufacturerId": "TestPlug",
"manufacturerName": "TestPlug",
"model": "T001",
"protocolType": "CoAP",
"deviceType": "TEST",
"omCapability":
{
"upgradeCapability":{
"supportUpgrade":false
},
"fwUpgradeCapability":{
"supportUpgrade":true,
"upgradeProtocolType":"LWM2M",
"downloadProtocolType":"CoAP"
}
},
"serviceTypeCapabilities": [
{
"serviceId": "Connectivity",
"serviceType": "Connectivity",
"option": "Mandatory"
},
{
"serviceId": "SystemCmdRawData",
"serviceType": "SystemCmdRawData",
"option": "Master"
}
]
}
]
}
其中manufacturerId
,manufacturerName
,model
,deviceType
属性可以自定义,只要与插件对应即可,对应关系,见下篇《离线插件开发》。
2 service文件夹
新建一个文件夹命名为service
,在该文件夹下再新建两个文件夹(每个文件夹对应插件内编写好的服务字段,这里以透传插件为例),一个叫Connectivity
,另一个叫SystemCmdRawData
。
2.1 Connectivity
在该文件夹内新建文件夹profile
并在profile
内新建文件servicetype-capability.json
内容如下:
{
"services": [
{
"serviceType": "Connectivity",
"description": "Connectivity",
"commands": null,
"properties": [
{
"propertyName": "signalStrength",
"dataType": "int",
"required": true,
"min": -110,
"max": -48,
"step": 1,
"maxLength": 0,
"method": "RE",
"unit": "dbm",
"enumList": null
},
{
"propertyName": "linkQuality",
"dataType": "int",
"required": false,
"min": -110,
"max": -48,
"step": 1,
"maxLength": 0,
"method": "RE",
"unit": "dbm",
"enumList": null
},
{
"propertyName": "cellId",
"dataType": "int",
"required": false,
"min": 0,
"max": 268435455,
"step": 1,
"maxLength": 0,
"method": "RE",
"unit": null,
"enumList": null
}
]
}
]
}
2.2 SystemCmdRawData
在该文件夹内同样新建文件夹profile
并在profile
内新建文件servicetype-capability.json
内容如下:
{
"services": [
{
"serviceType": "SystemCmdRawData",
"description": "SystemCmdRawData",
"commands":[
{
"commandName": "COMMAND",
"paras": [
{
"paraName": "value",
"dataType": "string",
"required": true,
"min": 0,
"max": 200,
"step": 1,
"maxLength": 1000,
"unit": null,
"enumList": null
}
],
"responses": [
{
"responseName": "COMMAND_RSP",
"paras": [
{
"paraName": "result",
"dataType": "int",
"required": true,
"min": -1000000,
"max": 1000000,
"step": 1,
"maxLength": 10,
"unit": null,
"enumList": null
}
]
}
]
}
],
"properties": [
{
"propertyName": "SystemCmdRawData",
"dataType": "string",
"required": true,
"min": 0,
"max": 200,
"step": 1,
"maxLength": 1000,
"method": "RE",
"unit": null,
"enumList": null
}
]
}
]
}
3 压缩
最后,将service
和profile
文件夹添加到压缩包,以deviceType_manufacturerId_model.zip
命名如TEST_TestPlug_T001
即可。