Difference between revisions of "Connectivity/AdvHeartBeat"
From ESS-WIKI
Line 1: | Line 1: | ||
=AdvHeartBeat Protocol= | =AdvHeartBeat Protocol= | ||
==AdvHeartBeat Topic & Payload== | ==AdvHeartBeat Topic & Payload== | ||
+ | Type: Response | ||
+ | Direction: Agent -> Server | ||
Topic: /cagent/admin/<devID>/notify | Topic: /cagent/admin/<devID>/notify | ||
QoS: 0 | QoS: 0 | ||
Line 17: | Line 19: | ||
#Server need to check update time from AdvHeartBeat Table only. | #Server need to check update time from AdvHeartBeat Table only. | ||
#If the latest update time is over timeout ( Note: This value is depend on Server. Recommend: 3 x send rate => 3 x 60 = 180 sec => tolerate drop 2 AdvHeartBeat MSG ). | #If the latest update time is over timeout ( Note: This value is depend on Server. Recommend: 3 x send rate => 3 x 60 = 180 sec => tolerate drop 2 AdvHeartBeat MSG ). | ||
− | ##If it is timeout & status is connected => then change status to disconnect & send a | + | ##If it is timeout & status is connected => then change status to disconnect & send a "Re-Connect" message to this device |
#If server check there is latest AdvHeartBeat message in table but there are not device information in device list table ( SQL ). | #If server check there is latest AdvHeartBeat message in table but there are not device information in device list table ( SQL ). | ||
##Server sends a re-connect message to this device. | ##Server sends a re-connect message to this device. | ||
+ | ##Server needs to send "Get Capability" message to client after receiving a connect info message. Agent will send all handlers' capability to server. | ||
+ | |||
+ | ==Re-Connect Message== | ||
+ | :If Server aware any problem of a device's status/information. Server will send a re-connect message to Agent. Agent sends a connect info to Server after receiving a re-connect message. You can refer below for detail. | ||
+ | |||
+ | Type: Request | ||
+ | Direction: Server -> Agent | ||
+ | Topic: /cagent/admin/<devID>/agentcallbackreq | ||
+ | QoS: 0 | ||
+ | Retained: 0 | ||
+ | Payload: | ||
+ | { | ||
+ | "susiCommData": { | ||
+ | "commCmd": 125, | ||
+ | "handlerName": "general", | ||
+ | "response": { | ||
+ | "statuscode": 4, | ||
+ | "msg": "Reconnect" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Type: Response | ||
+ | Direction: Agent -> Server | ||
+ | Topic: /cagent/admin/<devID>/agentinfoack | ||
+ | QoS: 0 | ||
+ | Retained: 0 | ||
+ | Payload: | ||
+ | { | ||
+ | "susiCommData": { | ||
+ | "devID":"0017000E40000001", | ||
+ | "hostname":"AAA", | ||
+ | "sn":"0017000E40000001", | ||
+ | "mac":"0017000E40000001", | ||
+ | "version":"3.1.23", | ||
+ | "type":"SenHub", | ||
+ | "product":"WISE-1020", | ||
+ | "manufacture":"", | ||
+ | "status":"1", | ||
+ | "commCmd":1, | ||
+ | "requestID":30002, | ||
+ | "agentID":"0017000E40000001", | ||
+ | "handlerName":"general", | ||
+ | "sendTS":160081026 | ||
+ | } | ||
+ | } | ||
+ | |||
+ | ==Get Capability== | ||
+ | Type: Request | ||
+ | Direction: Server -> Agent | ||
+ | Topic: /cagent/admin/<agentID>/agentcallbackreq | ||
+ | QoS: 0 | ||
+ | Retained: 0 | ||
+ | Payload: | ||
+ | { | ||
+ | "susiCommData": { | ||
+ | "requestID":1001, | ||
+ | "catalogID": 4, | ||
+ | "commCmd":2051, | ||
+ | "handlerName":"general" | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Type: Response | ||
+ | Direction: Agent -> Server | ||
+ | Topic: /cagent/admin/<agentID>/agentactionreq | ||
+ | QoS: 0 | ||
+ | Retained: 0 | ||
+ | Payload: ( ex: HWM ) | ||
+ | { | ||
+ | "susiCommData": { | ||
+ | "infoSpec": { | ||
+ | "HWM": { | ||
+ | "e": [ | ||
+ | {"n": "v01","type": "volt","u": "V","max": 20,"min": 10}, | ||
+ | {"n": "v02","type": "volt","u": "V","max": 20,"min": 10}, | ||
+ | {"n": "t01","type": "temp","u": "Cel","max": 100,"min": 10}, | ||
+ | {"n": "V143360","type": "current","u": "A","max": 100,"min": 10} | ||
+ | ], | ||
+ | "bn": "HWM" | ||
+ | }, | ||
+ | "requestID": 2001, | ||
+ | "commCmd": 2052, | ||
+ | "catalogID": 4, | ||
+ | "agentID": "000014DAE996BE04", | ||
+ | "sendTS": 1417000000004, | ||
+ | "handlerName": "general" | ||
+ | } | ||
+ | } | ||
+ | } | ||
=Parameters of "AdvHeartBeat Protocol"= | =Parameters of "AdvHeartBeat Protocol"= |
Revision as of 08:17, 1 July 2016
Contents
AdvHeartBeat Protocol
AdvHeartBeat Topic & Payload
Type: Response Direction: Agent -> Server Topic: /cagent/admin/<devID>/notify QoS: 0 Retained: 0 Payload: ~ 35 character {"hb":{"devID":"0017000E40000001"}}
Client Site
- Agent needs send "AdvHeartBeat" message ( refer to AdvHeartBeat Topic & Payload ) by period as below picture.
Server Site
- Server updates latest update time after receiving a AdvHeartBeat message with its AdvHeartBeat Table( NoSQL ).
- Server need to check update time from AdvHeartBeat Table only.
- If the latest update time is over timeout ( Note: This value is depend on Server. Recommend: 3 x send rate => 3 x 60 = 180 sec => tolerate drop 2 AdvHeartBeat MSG ).
- If it is timeout & status is connected => then change status to disconnect & send a "Re-Connect" message to this device
- If server check there is latest AdvHeartBeat message in table but there are not device information in device list table ( SQL ).
- Server sends a re-connect message to this device.
- Server needs to send "Get Capability" message to client after receiving a connect info message. Agent will send all handlers' capability to server.
Re-Connect Message
- If Server aware any problem of a device's status/information. Server will send a re-connect message to Agent. Agent sends a connect info to Server after receiving a re-connect message. You can refer below for detail.
Type: Request Direction: Server -> Agent Topic: /cagent/admin/<devID>/agentcallbackreq QoS: 0 Retained: 0 Payload: { "susiCommData": { "commCmd": 125, "handlerName": "general", "response": { "statuscode": 4, "msg": "Reconnect" } } }
Type: Response Direction: Agent -> Server Topic: /cagent/admin/<devID>/agentinfoack QoS: 0 Retained: 0 Payload: { "susiCommData": { "devID":"0017000E40000001", "hostname":"AAA", "sn":"0017000E40000001", "mac":"0017000E40000001", "version":"3.1.23", "type":"SenHub", "product":"WISE-1020", "manufacture":"", "status":"1", "commCmd":1, "requestID":30002, "agentID":"0017000E40000001", "handlerName":"general", "sendTS":160081026 } }
Get Capability
Type: Request Direction: Server -> Agent Topic: /cagent/admin/<agentID>/agentcallbackreq QoS: 0 Retained: 0 Payload: { "susiCommData": { "requestID":1001, "catalogID": 4, "commCmd":2051, "handlerName":"general" } }
Type: Response Direction: Agent -> Server Topic: /cagent/admin/<agentID>/agentactionreq QoS: 0 Retained: 0 Payload: ( ex: HWM ) { "susiCommData": { "infoSpec": { "HWM": { "e": [ {"n": "v01","type": "volt","u": "V","max": 20,"min": 10}, {"n": "v02","type": "volt","u": "V","max": 20,"min": 10}, {"n": "t01","type": "temp","u": "Cel","max": 100,"min": 10}, {"n": "V143360","type": "current","u": "A","max": 100,"min": 10} ], "bn": "HWM" }, "requestID": 2001, "commCmd": 2052, "catalogID": 4, "agentID": "000014DAE996BE04", "sendTS": 1417000000004, "handlerName": "general" } } }
Parameters of "AdvHeartBeat Protocol"
Sending Rate
Unit: second Default: 60 Range: 1 ~ 0xFFFFFFFF -1 => Agent doesn't send "AdvHeartBeat" message
Query parameters of "AdvHeartBeat"
Type: Request Direction: Server -> Agent Topic: /cagent/admin/<devID>/agentcallbackreq Payload: { "susiCommData": { "commCmd": 127, "handlerName": "general", "sessionID": "123465" } }
Type: Response Direction: Agent -> Server Topic: /cagent/admin/<devID>/agentactionreq Payload: { "susiCommData": { "commCmd": 128, "handlerName": "general", "heartbeatrate": 60, "sessionID": "123465" } }
Change parameters of "AdvHeartBeat"
Type: Request Direction: Server -> Agent Topic: /cagent/admin/<devID>/agentcallbackreq Payload: { "susiCommData": { "commCmd": 129, "handlerName": "general", "heartbeatrate": 20, "sessionID": "123465" } }
Type: Response Direction: Agent -> Server Topic: /cagent/admin/<devID>/agentactionreq Payload: { "susiCommData": { "commCmd": 130, "handlerName": "general", "result":"SUCCESS", //or "FALSE" "sessionID": "123465" } }
How to confirm the Agent supports "AdvHeartBeat" protocol?
1. Check the version in deviceinfo
Agent will support "AdvHeartBeat" in version "3.2". >= 3.2 : Agent supports AdvHeartBeat < 3.2 : Agent doesn't support AdvHeartBeat
2. Query the parameters of "AdvHeartBeat" by "Query parameters of "AdvHeartBeat"