Difference between revisions of "Device-Node.js SDK"

From ESS-WIKI
Jump to: navigation, search
(Created page with "= Introduction =   This is a EdgeSense southbound device service SDK in node.js. User can use this SDK to easy to develop your application to integrate with EdgeSense Co...")
 
Line 5: Line 5:
 
= Device-Node.js SDK =
 
= Device-Node.js SDK =
  
 +
== Requirement ==
 +
 +
*MQTT broker  V1.0.3 ( Ubuntu 16.04 ) / V1.0.4 ( Windows )
 +
*[[AgentLite-Node.js|AgentLite-Node.js]]
 +
*Node.js >= 5.x
 +
 +
 +
 +
= How To =
 +
 +
== Run Demo Sample ==
 +
 +
Download source code
 +
 +
git clone git@advgitlab.eastasia.cloudapp.azure.com:EdgeSense-Open/device-template-node.js.git
 +
 +
Run sample 
 +
 +
node index.js
 +
 +
== Development ==
 +
 +
=== config ===
 +
 +
agent_config.json
 +
<pre>  - DeivceNam: <XXX> Name of application
 +
  - version: version of application
 +
  - plugin: path of main entry program => ./module/<xxx>.js
 +
</pre>
 +
 +
log.json
 +
 +
confinuration of advlog-node.js
  
 +
http://advgitlab.eastasia.cloudapp.azure.com/EdgeSense-Open/advlog-node.js
  
== Requirement ==
+
=== Plugin ===
  
[[AgentLite-Node.js|AgentLite-Node.js]]
+
#Rename the '''Simple-plugin_temp.js''' by your applicaton name
 +
#Chang the plugin path in '''config/agent_config.json'''
 +
#Modify the Plugin Name:&nbsp;'''g_strPluginName'''
 +
#Fill the basic information:&nbsp;'''g_strPluginName'''
 +
#'''InitPlugin''': InitPlugin&nbsp; => Refer &lt; InitTest &gt; in Simple-plugin_test.js
 +
#'''AutoReport''': start auto report interval callback function; Implement to call send data in this=> Refer &lt; AutoUpdateTest &gt; in&nbsp;&nbsp;Simple-plugin_test.js
 +
#'''setSenseData''': DeviceOn server or others apps to set sensor value to the service. This callback function will be called and you need to implement a set function with your application at this.
 +
#'''sendEventTest''': You can refer to "sendEventTest" to trigger a event alarm to local MQTT Broker and transfer to DeviceOn server.

Revision as of 06:54, 30 September 2019

Introduction

  This is a EdgeSense southbound device service SDK in node.js. User can use this SDK to easy to develop your application to integrate with EdgeSense Core System. 

Device-Node.js SDK

Requirement

  • MQTT broker  V1.0.3 ( Ubuntu 16.04 ) / V1.0.4 ( Windows )
  • AgentLite-Node.js
  • Node.js >= 5.x


How To

Run Demo Sample

Download source code

git clone git@advgitlab.eastasia.cloudapp.azure.com:EdgeSense-Open/device-template-node.js.git

Run sample 

node index.js

Development

config

agent_config.json

  - DeivceNam: <XXX> Name of application
  - version: version of application
  - plugin: path of main entry program => ./module/<xxx>.js

log.json

confinuration of advlog-node.js

http://advgitlab.eastasia.cloudapp.azure.com/EdgeSense-Open/advlog-node.js

Plugin

  1. Rename the Simple-plugin_temp.js by your applicaton name
  2. Chang the plugin path in config/agent_config.json
  3. Modify the Plugin Name: g_strPluginName
  4. Fill the basic information: g_strPluginName
  5. InitPlugin: InitPlugin  => Refer < InitTest > in Simple-plugin_test.js
  6. AutoReport: start auto report interval callback function; Implement to call send data in this=> Refer < AutoUpdateTest > in  Simple-plugin_test.js
  7. setSenseData: DeviceOn server or others apps to set sensor value to the service. This callback function will be called and you need to implement a set function with your application at this.
  8. sendEventTest: You can refer to "sendEventTest" to trigger a event alarm to local MQTT Broker and transfer to DeviceOn server.