Difference between revisions of "Sample Plugin for DevMgt"
From ESS-WIKI
Eric.liang (talk | contribs) |
Eric.liang (talk | contribs) |
||
| Line 46: | Line 46: | ||
3. Send child device's capability | 3. Send child device's capability | ||
| + | <pre>{ | ||
| + | "PLC": { | ||
| + | "SenData": { | ||
| + | "e": [{"n": "temperature","v": 46.2,"asm": "r"}, | ||
| + | {"n": "version","sv": "2.1.2","asm": "r"}, | ||
| + | {"n": "reset","u": "","bv": false,"min": false,"max": true,"asm": "rw"} | ||
| + | ], | ||
| + | "bn": "SenData" | ||
| + | }, | ||
| + | "ver": 1 | ||
| + | } | ||
| + | }</pre> | ||
4. Auto report child device's data | 4. Auto report child device's data | ||
| + | <pre>{ | ||
| + | "PLC": { | ||
| + | "SenData": { | ||
| + | "e": [{"n": "temperature","v": 51}], | ||
| + | "bn": "SenData" | ||
| + | }, | ||
| + | "ver": 1 | ||
| + | } | ||
| + | }</pre> | ||
= Code = | = Code = | ||
Revision as of 06:00, 9 May 2018
Contents
Introduction
This DevMgt hanlder sample code is descripting "How to retransmit child devices that connected through a EI-Agent's plugin".
Demo
Protocol
1. Handler reports its Capability and data value -> User can add its resource in e:[ ] array follow IPSO format as below
{
"DevMgt": {
"Info": {
"e": [{"n": "Name","sv": "PLC_Mgt","asm": "r"},
{"n": "sw","sv": "1.0.1","asm": "r"},
{"n": "reset","u": "","bv": false,"min": false,"max": true,"asm": "rw"}
],
"bn": "Info"
},
"ver": 1
}
}
2. Register a new child device
{
"devID": "0066000E4C000011", (*)
"hostname": "PLC-0", (*)
"sn": "0066000E4C000011",
"mac": "0066000E4C000011",
"version": "",
"type": "SenHub",
"product": "PLC", (*)
"manufacture": "",
"status": "1", (*)
"commCmd": 1,
"requestID": 30002,
"agentID": "0066000E4C000011",
"handlerName": "general",
"sendTS": 160081026
}
3. Send child device's capability
{
"PLC": {
"SenData": {
"e": [{"n": "temperature","v": 46.2,"asm": "r"},
{"n": "version","sv": "2.1.2","asm": "r"},
{"n": "reset","u": "","bv": false,"min": false,"max": true,"asm": "rw"}
],
"bn": "SenData"
},
"ver": 1
}
}
4. Auto report child device's data
{
"PLC": {
"SenData": {
"e": [{"n": "temperature","v": 51}],
"bn": "SenData"
},
"ver": 1
}
}
Code
Simulator Data
Update Handler Capabliity / Register child Devices & Capability / Auto Update child device data
Release
| Item | Name | Version | Download |
| 1 | DevMgtSample-v1.0.1-20180509.zip |
v1.0.1 | Download Link |
| |
|
|
|
| |
|
|
|