Difference between revisions of "Sample Plugin for DevMgt"
Eric.liang (talk | contribs) |
Eric.liang (talk | contribs) |
||
| (11 intermediate revisions by the same user not shown) | |||
| Line 7: | Line 7: | ||
= Demo = | = Demo = | ||
| − | + | == Overview == | |
| + | [[File:DevMgtSample Overall.jpg|600x400px|DevMgtSample Overall.jpg]] | ||
| + | == Device == | ||
| − | + | [[File:DevMgtSample1.jpg|800x200px]] | |
| − | 1. Handler reports its Capability and data value | + | == Parent Device == |
| + | |||
| + | [[File:DevMgtSample4.jpg|1000x250px]] | ||
| + | |||
| + | [[File:DevMgtSample3.jpg|800x200px]] | ||
| + | |||
| + | == Child Device == | ||
| + | |||
| + | [[File:DevMgtSample1-1.jpg|1000x500px]] | ||
| + | |||
| + | [[File:DevMgtSample6.jpg|400x200px]] | ||
| + | |||
| + | [[File:DevMgtSample7.jpg|1000x250px]] | ||
| + | |||
| + | [[File:DevMgtSample8.jpg|350x250px]] | ||
| + | |||
| + | = Protocol = | ||
| + | |||
| + | 1. Handler reports its Capability and data value -> User can add its resource in e:[ ] array follow IPSO format as below | ||
| + | <pre>{ | ||
| + | "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 | ||
| + | } | ||
| + | }</pre> | ||
2. Register a new child device | 2. Register a new child device | ||
| + | <pre>{ | ||
| + | "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 | ||
| + | }</pre> | ||
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 = | ||
| + | |||
| + | == <span style="font-size:larger;">Simulator Data</span> == | ||
| + | |||
| + | [[File:DevMgtSample-Code-JSON.jpg|1200x300px|DevMgtSample-Code-JSON.jpg]] | ||
| + | |||
| + | == <span style="font-size:larger;">Update Capabliity / Register child Devices, Capability / Auto Report</span> == | ||
| + | |||
| + | [[File:DevMgtSample-Code-Register-AutoReport.jpg|800x1200px|DevMgtSample-Code-Register-AutoReport.jpg]] | ||
| + | |||
| + | == Get Child device sensor value == | ||
| + | |||
| + | [[File:DevMgtSample-Code-SensorGet.jpg|800x1000px|DevMgtSample-Code-SensorGet.jpg]] | ||
| + | |||
| + | |||
| + | |||
| + | [[File:DevMgtSample-Code-SensorGet-1.jpg|400x200px|DevMgtSample-Code-SensorGet-1.jpg]] | ||
| + | |||
| + | = How To = | ||
| + | |||
| + | == Development Environment == | ||
| + | |||
| + | *Windows 7 / 10 x86, x64 | ||
| + | *VC2008 | ||
| + | |||
| + | == SOP == | ||
| + | |||
| + | 1. Download Agent framework Source code from Advantech ECG's gitliab | ||
| + | |||
| + | http://advgitlab.eastasia.cloudapp.azure.com/SRP-Connect/SRP-Plugin<br/> http://advgitlab.eastasia.cloudapp.azure.com/SRP-Connect/SRP-Connect | ||
| + | |||
| + | 2. Download the latest sample code at Release section. | ||
| + | 3. Copy sample code to EI-Agent project's "Agent framwork\<span style="color:#FF0000;">'''Modules'''</span>" folder and unzip. ( includes source code and a module_config.xml ) | ||
| + | 4. Open "CAgent.sln" with VC 2008 | ||
| − | + | 5. To add this sample plugin project in "Module" sub solution | |
| − | + | 6. Build -> Release: RMM-EI-Agent\Release\module, Debug: Agent framwork\Debug\module | |
| − | + | 7. Download a EI-Agent installation from WISE-PaaS portal and install it. ( Default path: C:\Program Files (x86)\Advantech\RMM EI Agent\ ) | |
| − | + | 8. Replace the module_config.xml to C:\Program Files (x86)\Advantech\RMM EI Agent\module\ ( EI-Agent will load the DevMgtSampleHandler.dll only ) | |
| − | + | 9. Restart the EI-Agent by "ServerSetting" UI application on Desktop. | |
= Release = | = Release = | ||
Latest revision as of 10:51, 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
Overview
Device
Parent Device
Child Device
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 Capabliity / Register child Devices, Capability / Auto Report
Get Child device sensor value
How To
Development Environment
- Windows 7 / 10 x86, x64
- VC2008
SOP
1. Download Agent framework Source code from Advantech ECG's gitliab
http://advgitlab.eastasia.cloudapp.azure.com/SRP-Connect/SRP-Plugin
http://advgitlab.eastasia.cloudapp.azure.com/SRP-Connect/SRP-Connect
2. Download the latest sample code at Release section.
3. Copy sample code to EI-Agent project's "Agent framwork\Modules" folder and unzip. ( includes source code and a module_config.xml )
4. Open "CAgent.sln" with VC 2008
5. To add this sample plugin project in "Module" sub solution
6. Build -> Release: RMM-EI-Agent\Release\module, Debug: Agent framwork\Debug\module
7. Download a EI-Agent installation from WISE-PaaS portal and install it. ( Default path: C:\Program Files (x86)\Advantech\RMM EI Agent\ )
8. Replace the module_config.xml to C:\Program Files (x86)\Advantech\RMM EI Agent\module\ ( EI-Agent will load the DevMgtSampleHandler.dll only )
9. Restart the EI-Agent by "ServerSetting" UI application on Desktop.
Release
| Item | Name | Version | Download |
| 1 | DevMgtSample-v1.0.1-20180509.zip |
v1.0.1 | Download Link |
| |
|
|
|
| |
|
|
|