Difference between revisions of "Connectivity/AdvHeartBeat"

From ESS-WIKI
Jump to: navigation, search
(Server Site)
Line 1: Line 1:
=How to confirm the Agent supports "AdvHeartBeat" protocol?=
+
=AdvHeartBeat Protocol=
1. Check the version in deviceinfo
+
==AdvHeartBeat Topic & Payload==
  Agent will support "AdvHeartBeat" in version "3.2".
+
Topic: /cagent/admin/<devID>/notify
          >= 3.2  : Agent supports AdvHeartBeat
+
QoS: 0
          < 3.: Agent doesn't support AdvHeartBeat
+
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.
 +
 
 +
[[File:AdvHeartBeat-FC-1.jpg|500x500px|AdvHeartBeat Protocol]]
 +
 
  
2. Query the parameters of "AdvHeartBeat" by "Query parameters of "AdvHeartBeat"
+
==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.
  
 
=Parameters of "AdvHeartBeat Protocol"=
 
=Parameters of "AdvHeartBeat Protocol"=
Line 68: Line 82:
 
  }
 
  }
  
=AdvHeartBeat Protocol=
+
=How to confirm the Agent supports "AdvHeartBeat" protocol?=
==AdvHeartBeat Topic & Payload==
+
1. Check the version in deviceinfo
Topic: /cagent/admin/<devID>/notify
+
  Agent will support "AdvHeartBeat" in version "3.2".
QoS: 0
+
          >= 3.2  : Agent supports AdvHeartBeat
  Retained: 0
+
          < 3.2  : Agent doesn't support AdvHeartBeat
Payload: ~ 35 character
 
{"hb":{"devID":"0017000E40000001"}}
 
  
==Client Site==
+
2. Query the parameters of "AdvHeartBeat" by "Query parameters of "AdvHeartBeat"
:Agent needs send "AdvHeartBeat" message ( refer to AdvHeartBeat  Topic & Payload ) by period as below picture.
 
 
 
[[File:AdvHeartBeat-FC-1.jpg|500x500px|AdvHeartBeat Protocol]]
 
 
 
 
 
==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.
 

Revision as of 07:58, 1 July 2016

AdvHeartBeat Protocol

AdvHeartBeat Topic & Payload

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.

AdvHeartBeat Protocol


Server Site

  1. Server updates latest update time after receiving a AdvHeartBeat message with its AdvHeartBeat Table( NoSQL ).
  2. Server need to check update time from AdvHeartBeat Table only.
  3. 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 ).
    1. If it is timeout & status is connected => then change status to disconnect & send a re-connect message to this device
  4. If server check there is latest AdvHeartBeat message in table but there are not device information in device list table ( SQL ).
    1. Server sends a re-connect message to this device.

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"