Difference between revisions of "EdgeSense Southbound Service Development"
(.) |
(.) |
||
(29 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= Introduction = | = Introduction = | ||
− | + | This guide will help you build an EdgeSense Southbound service. | |
− | SRP-Plugin | + | You can develop WISE-Agent plugin (a.k.a Northbound plugin) by SRP-Plugin. |
− | + | And your plugin (built with SRP-Plugin) also can be running as a Southbound service. | |
− | = | + | At first, please refer to below documenation to develop a plugin. |
+ | |||
+ | *[http://advgitlab.eastasia.cloudapp.azure.com/WISE-PaaS-Documentation/Documentation/blob/master/documents/RMM/Agent/123-plugin.md How to Develop Customized Plugin Step by Step] | ||
+ | |||
+ | After the completion of your plugin development, you will need EdgeSense Device SDK to pack your plugin as a Southbound service. | ||
+ | |||
+ | To accellerate the development of EdgeSense southbound service, you will need to install EdgeSense Device SDK. | ||
+ | |||
+ | This is very helpful to shorten the time for integratoin, to build a flexible and powerful EdgeSense device service in fastest and most stable way. | ||
+ | |||
+ | = Run EdgeSense Southbound service = | ||
== Requirement == | == Requirement == | ||
+ | |||
+ | To build and run Southbound Service, please setup below softwares: | ||
+ | |||
+ | *Compiler Tools | ||
+ | *MQTT Broker | ||
+ | *WISE-Agent | ||
+ | |||
+ | |||
+ | |||
+ | 1. Compiler Tools | ||
For Windows development, | For Windows development, | ||
Line 19: | Line 39: | ||
</pre> | </pre> | ||
− | + | ||
+ | |||
+ | 2. MQTT Broker | ||
MQTT Broker For Windows | MQTT Broker For Windows | ||
Line 32: | Line 54: | ||
</pre> | </pre> | ||
− | |||
− | Download | + | |
− | + | 3. WISE-Agent | |
− | + | ||
+ | WISE-Agent for Windows | ||
+ | |||
+ | *Download from WISE-PaaS/EdgeSense Portal, Settings Page. | ||
+ | |||
+ | WISE-Agent for Ubuntu 16.04 | ||
+ | |||
+ | *Ask support AE to get latest WISEAgent. | ||
+ | |||
+ | == Download EdgeSense Device SDK == | ||
Download Agentlite for Windows development | Download Agentlite for Windows development | ||
Line 46: | Line 76: | ||
</pre> | </pre> | ||
− | == | + | == Run EdgeSense device service on Windows == |
− | 1 | + | 1. Copy HandlerSample.dll to agentlite\prebuilt\module folder. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
When we download agentlite, it looks like this picture: | When we download agentlite, it looks like this picture: | ||
Line 72: | Line 88: | ||
[[File:EdgeSense Southbound Service module folder.png|RTENOTITLE]] | [[File:EdgeSense Southbound Service module folder.png|RTENOTITLE]] | ||
− | + | 2. Modify agentlite\prebuilt\module\module_config.xml | |
<pre><ModuleNum>1</ModuleNum> | <pre><ModuleNum>1</ModuleNum> | ||
<ModuleName1>HandlerSample</ModuleName1> | <ModuleName1>HandlerSample</ModuleName1> | ||
Line 79: | Line 95: | ||
</pre> | </pre> | ||
− | + | 3. Modify agentlite\prebuilt\agent_config.xml | |
<pre><DeviceName>HandlerSample</DeviceName> | <pre><DeviceName>HandlerSample</DeviceName> | ||
<DevID>HandlerSample</DevID> | <DevID>HandlerSample</DevID> | ||
Line 88: | Line 104: | ||
</pre> | </pre> | ||
− | + | 4. Run Southbound service. | |
<pre>cd agentlite\prebuilt | <pre>cd agentlite\prebuilt | ||
CAgent.exe -n | CAgent.exe -n | ||
Line 95: | Line 111: | ||
[[File:EdgeSense Southbound Service run.png|RTENOTITLE]] | [[File:EdgeSense Southbound Service run.png|RTENOTITLE]] | ||
− | == | + | == Run EdgeSense device service on Ubuntu 16.04 == |
− | 1. Build SRP-Plugin and HandlerSample | + | 1. Build SRP-Plugin and HandlerSample service |
<pre>$ cd SRP-Plugin | <pre>$ cd SRP-Plugin | ||
$ sudo ./pre-install_ubuntu.sh | $ sudo ./pre-install_ubuntu.sh | ||
Line 103: | Line 119: | ||
</pre> | </pre> | ||
− | After build is complete, HandlerSample | + | 2. After build is complete, HandlerSample service is generated in SRP-Plugin/Release/module folder. |
− | <pre>$ ls -1 Release/module/ | + | <pre>$ ls -1 SRP-Plugin/Release/module/ |
HandlerSample.so | HandlerSample.so | ||
HandlerSample.so.0 | HandlerSample.so.0 | ||
Line 114: | Line 130: | ||
</pre> | </pre> | ||
− | + | 3. Copy HandlerSample to agentlite/prebuilt/module folder. | |
+ | <pre>cp -af HandlerSample.so* agentlite/prebuilt/module | ||
+ | </pre> | ||
+ | |||
+ | 4. Modify agentlite/prebuilt/module/module_config.xml | ||
<pre><ModuleNum>1</ModuleNum> | <pre><ModuleNum>1</ModuleNum> | ||
<ModuleName1>HandlerSample</ModuleName1> | <ModuleName1>HandlerSample</ModuleName1> | ||
Line 121: | Line 141: | ||
</pre> | </pre> | ||
− | + | 5. Modify agentlite/prebuilt/agent_config.xml | |
<pre><DeviceName>HandlerSample</DeviceName> | <pre><DeviceName>HandlerSample</DeviceName> | ||
<DevID>HandlerSample</DevID> | <DevID>HandlerSample</DevID> | ||
Line 130: | Line 150: | ||
</pre> | </pre> | ||
− | + | 6. Run Southbound service. | |
<pre>$ cd agentlite/prebuilt | <pre>$ cd agentlite/prebuilt | ||
$ ./cagent -n | $ ./cagent -n | ||
Line 137: | Line 157: | ||
Then you will see HandlerSample is loaded. | Then you will see HandlerSample is loaded. | ||
<pre>$ ./cagent -n | <pre>$ ./cagent -n | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
HandlerLoader loaded | HandlerLoader loaded | ||
− | |||
DllInitializer | DllInitializer | ||
DllFinalizer | DllFinalizer | ||
Line 152: | Line 163: | ||
GeneralHandler loaded | GeneralHandler loaded | ||
general> Initialize | general> Initialize | ||
− | |||
− | |||
DllInitializer | DllInitializer | ||
Load HandlerSample Successful | Load HandlerSample Successful | ||
HandlerSample> InitializeSADataSync_Initialize() | HandlerSample> InitializeSADataSync_Initialize() | ||
− | |||
− | |||
> HandlerSample StartAgent Initialized | > HandlerSample StartAgent Initialized | ||
Agent_HandlerSample no-service is start successfully! | Agent_HandlerSample no-service is start successfully! | ||
</pre> | </pre> | ||
+ | |||
+ | = Demo on WISE-PaaS/EdgeSense = | ||
+ | |||
+ | In WISE-PaaS/EdgeSense , HandlerSample service is listed in Device Monitoring page. | ||
+ | |||
+ | [[File:EdgeSense Southbound Service monitor1.png|RTENOTITLE]] | ||
+ | |||
+ | [[File:EdgeSense Southbound Service monitor2.png|RTENOTITLE]] | ||
+ | |||
+ | In WISE-PaaS/EdgeSense, you can read sensor data in Get/Set Sensor Data page. | ||
+ | |||
+ | [[File:EdgeSense Southbound Service get sensor1.png|RTENOTITLE]] | ||
+ | |||
+ | [[File:EdgeSense Southbound Service get sensor2.png|RTENOTITLE]] |
Latest revision as of 10:50, 1 August 2019
Contents
Introduction
This guide will help you build an EdgeSense Southbound service.
You can develop WISE-Agent plugin (a.k.a Northbound plugin) by SRP-Plugin.
And your plugin (built with SRP-Plugin) also can be running as a Southbound service.
At first, please refer to below documenation to develop a plugin.
After the completion of your plugin development, you will need EdgeSense Device SDK to pack your plugin as a Southbound service.
To accellerate the development of EdgeSense southbound service, you will need to install EdgeSense Device SDK.
This is very helpful to shorten the time for integratoin, to build a flexible and powerful EdgeSense device service in fastest and most stable way.
Run EdgeSense Southbound service
Requirement
To build and run Southbound Service, please setup below softwares:
- Compiler Tools
- MQTT Broker
- WISE-Agent
1. Compiler Tools
For Windows development,
- Please install Visual Studio 2008 or above. Visual Studio is available at official website.
For Ubuntu 16.04 development, please install below software,
$ sudo apt install autoconf autotools-dev libtool libmosquitto1 sqlite3 libxml2-dev libcurl4-openssl-dev libx11-dev libxtst-dev libxext-dev libmosquitto-dev libssl-dev
2. MQTT Broker
MQTT Broker For Windows
MQTT Broker for Ubuntu 16.04
$ sudo chmod +x MQTTBrokerSetup-1.0.5-Ubuntu_16.04-x86_64.run $ sudo ./MQTTBrokerSetup-1.0.5-Ubuntu_16.04-x86_64.run
3. WISE-Agent
WISE-Agent for Windows
- Download from WISE-PaaS/EdgeSense Portal, Settings Page.
WISE-Agent for Ubuntu 16.04
- Ask support AE to get latest WISEAgent.
Download EdgeSense Device SDK
Download Agentlite for Windows development
git clone https://github.com/ADVANTECH-Corp/agentlite.git
Download Agentlite for Ubuntu 16.04 development
git clone -b Ubuntu-16.04 https://github.com/ADVANTECH-Corp/agentlite.git
Run EdgeSense device service on Windows
1. Copy HandlerSample.dll to agentlite\prebuilt\module folder.
When we download agentlite, it looks like this picture:
Copy HandlerSample.dll to agentlite\prebuilt\module folder.
2. Modify agentlite\prebuilt\module\module_config.xml
<ModuleNum>1</ModuleNum> <ModuleName1>HandlerSample</ModuleName1> <ModulePath1>\module\HandlerSample.dll</ModulePath1> <ModuleEnable1>TRUE</ModuleEnable1>
3. Modify agentlite\prebuilt\agent_config.xml
<DeviceName>HandlerSample</DeviceName> <DevID>HandlerSample</DevID> <SN>HandlerSample</SN> <DevType>Service</DevType> <WorkDir></WorkDir> <ServiceName>Agent_HandlerSample</ServiceName>
4. Run Southbound service.
cd agentlite\prebuilt CAgent.exe -n
Run EdgeSense device service on Ubuntu 16.04
1. Build SRP-Plugin and HandlerSample service
$ cd SRP-Plugin $ sudo ./pre-install_ubuntu.sh $ ./build-srpplugin.sh
2. After build is complete, HandlerSample service is generated in SRP-Plugin/Release/module folder.
$ ls -1 SRP-Plugin/Release/module/ HandlerSample.so HandlerSample.so.0 HandlerSample.so.0.0.0 ModbusSample.so ModbusSample.so.0 ModbusSample.so.0.0.0 module_config.xml
3. Copy HandlerSample to agentlite/prebuilt/module folder.
cp -af HandlerSample.so* agentlite/prebuilt/module
4. Modify agentlite/prebuilt/module/module_config.xml
<ModuleNum>1</ModuleNum> <ModuleName1>HandlerSample</ModuleName1> <ModulePath1>/module/HandlerSample.so</ModulePath1> <ModuleEnable1>TRUE</ModuleEnable1>
5. Modify agentlite/prebuilt/agent_config.xml
<DeviceName>HandlerSample</DeviceName> <DevID>HandlerSample</DevID> <SN>HandlerSample</SN> <DevType>Service</DevType> <WorkDir></WorkDir> <ServiceName>Agent_HandlerSample</ServiceName>
6. Run Southbound service.
$ cd agentlite/prebuilt $ ./cagent -n
Then you will see HandlerSample is loaded.
$ ./cagent -n HandlerLoader loaded DllInitializer DllFinalizer DllInitializer GeneralHandler loaded general> Initialize DllInitializer Load HandlerSample Successful HandlerSample> InitializeSADataSync_Initialize() > HandlerSample StartAgent Initialized Agent_HandlerSample no-service is start successfully!
Demo on WISE-PaaS/EdgeSense
In WISE-PaaS/EdgeSense , HandlerSample service is listed in Device Monitoring page.
In WISE-PaaS/EdgeSense, you can read sensor data in Get/Set Sensor Data page.