Difference between revisions of "AgentLite-Node.js"

From ESS-WIKI
Jump to: navigation, search
(Created page with "= Introduction =  AgentLite-Node.js is a light weight south-bound agent in Node.js. There are 3 main components of "1. Net-Protocol ( ./lib/WISECore3.3.js)", 2. main pro...")
 
Line 22: Line 22:
 
=== Export Interfaces ===
 
=== Export Interfaces ===
  
int Handler_Initialize( param )
+
'''var Handler_Initialize( param )'''
 +
 
 +
*Description: ​Main program calls "'''Handler_Initialize"''' to initialize this module.           
 +
 
 +
 
 
<div style="margin-left:0.847cm;margin-right:0cm;">
 
<div style="margin-left:0.847cm;margin-right:0cm;">
 
{| class="wikitable" width="50%"
 
{| class="wikitable" width="50%"
Line 45: Line 49:
 
|}
 
|}
 
</div>
 
</div>
Handler_Uninitialize
+
'''var Handler_Uninitialize( )'''
 +
 
 +
*Description: ​Main program calls&nbsp;"'''Handler_Uninitialize"''' to uninitialize this module.&nbsp; &nbsp; &nbsp;
 +
 
 +
'''void&nbsp;Handler_AutoReportStart( interval )'''
 +
 
 +
*Description: ​Main program calls the "'''Handler_AutoReportStart"''' to start auto report.&nbsp; &nbsp;&nbsp;
 +
<div style="margin-left:0.847cm;margin-right:0cm;">
 +
{| class="wikitable" width="50%"
 +
|-
 +
! Parameter
 +
! Description
 +
|-
 +
| width="40%" | interval
 +
| report interval in second
 +
|}
 +
</div>
 +
'''var Handler_AutoReportStop()'''
 +
 
 +
*Description: ​Main program calls "'''Handler_AutoReportStop''''''"''' to stop auto report.&nbsp; &nbsp;&nbsp;
 +
 
 +
'''var&nbsp;Handler_Get_Capability()'''
  
1. g_strHandlerName&nbsp;: Plugin Name
+
*Description: ​Main program calls "'''Handler_AutoReportStop''''''"''' to get plugin's capability.
  
2.&nbsp;
+
'''var&nbsp;Handler_Recv( strTopic, strMsg )'''
 +
 
 +
*Description: ​Main program calls "'''Handler_Recv''''''"''' if receive a control message from others.
 +
<div style="margin-left:0.847cm;margin-right:0cm;">
 +
{| class="wikitable" width="50%"
 +
|-
 +
! Parameter
 +
! Description
 +
|-
 +
| width="40%" | strTopic
 +
| received mqtt topic&nbsp;
 +
|-
 +
| width="40%" | strMsg
 +
| received message
 +
|}
 +
</div>
  
 
== Source Code ==
 
== Source Code ==

Revision as of 17:34, 18 December 2018

Introduction

 AgentLite-Node.js is a light weight south-bound agent in Node.js. There are 3 main components of "1. Net-Protocol ( ./lib/WISECore3.3.js)", 2. main program ( AgentLite3.3.js) and 3. plugin module ( ./module/plugin_temp.js). Develop need to develop a plugin.js.

AgentLite-Node.js

Configure

./config/agent_config.json    : in JSON Format

<code>{         
  "ServerIP":"127.0.0.1",    
  "ServerPort": 1883,    
  "DeviceName": "SNMP_Handler",    
  "DevType": "Service",    
  "version": "v1.0.1"
}</code>

Plugin

Callback functions

Export Interfaces

var Handler_Initialize( param )

  • Description: ​Main program calls "Handler_Initialize" to initialize this module.           


Parameter Description
param.sendcbf reply action function point
param.sendreportcbf auto report function point
param.sendcapabilitycbf send capability function point
param.sendeventcbf send event message function point
param.sendreplytopiccbf send update data by reply action topic ( Monitor page ) function point

var Handler_Uninitialize( )

  • Description: ​Main program calls "Handler_Uninitialize" to uninitialize this module.     

void Handler_AutoReportStart( interval )

  • Description: ​Main program calls the "Handler_AutoReportStart" to start auto report.    
Parameter Description
interval report interval in second

var Handler_AutoReportStop()

  • Description: ​Main program calls "'Handler_AutoReportStop'" to stop auto report.    

var Handler_Get_Capability()

  • Description: ​Main program calls "'Handler_AutoReportStop'" to get plugin's capability.

var Handler_Recv( strTopic, strMsg )

  • Description: ​Main program calls "'Handler_Recv'" if receive a control message from others.
Parameter Description
strTopic received mqtt topic 
strMsg received message

Source Code

gitlab http://advgitlab.eastasia.cloudapp.azure.com/EdgeSense/AgentLite-Node.js

How To

Release