Difference between revisions of "EIS Service Protocol"

From ESS-WIKI
Jump to: navigation, search
(Created page with "= Overview = :Introduction for "WISE-Snail communication protocol for EIS Service". WISEAgent communication protocol is base on standard MQTT protocol. We also define Advante...")
 
Line 16: Line 16:
 
<pre>{
 
<pre>{
 
   "susiCommData": {
 
   "susiCommData": {
     "devID":"0027000E40000001",    // <span style="color:#FF0000;">User Define</span>, NULL-> Auto <span style="color:#FF0000;">UUID-like</span>
+
     "devID":"<span style="color:#FF0000;">0027000E40000001</span>",    // User Define, NULL-> Auto <span style="color:#FF0000;">UUID-like</span>
     "hostname":"<span style="color:#FF0000;"><ServiceName></span>",    // <span style="color:#FF0000;">The same with Handler Name</span>
+
     "hostname":"<span style="color:#FF0000;"><ServiceName></span>",    // The same with Handler Name
 
     "sn":"0027000E40000001",
 
     "sn":"0027000E40000001",
 
     "mac":"0027000E40000001",
 
     "mac":"0027000E40000001",
     "version":"<span style="color:#000000;">3.1.23</span>",           
+
     "version":"3.1.23",           
     "type":"<span style="color:#FF0000;">Service</span>",              // <span style="color:#FF0000;">Fixed: Service</span>     
+
     "type":"<span style="color:#0000FF;">Service</span>",              // <span style="color:#FF0000;">Fixed: Service</span>     
 
     "product":"<span style="color:#FF0000;"><ServiceName></span>",
 
     "product":"<span style="color:#FF0000;"><ServiceName></span>",
 
     "manufacture":"",
 
     "manufacture":"",
Line 27: Line 27:
 
     "commCmd":1,
 
     "commCmd":1,
 
     "requestID":30002,
 
     "requestID":30002,
     "agentID":"0027000E40000001",
+
     "agentID":"<span style="color:#FF0000;">0027000E40000001</span>",
 
     "handlerName":"general",
 
     "handlerName":"general",
 
     "sendTS":160081026
 
     "sendTS":160081026
Line 48: Line 48:
 
     {
 
     {
 
         "cagentVersion":"3.1.23",
 
         "cagentVersion":"3.1.23",
         "cagentType":"<span style="color:#FF0000;"><ServiceName></span>",  // <span style="color:#FF0000;">The same with Handler Name</span>
+
         "cagentType":"<span style="color:#FF0000;"><ServiceName></span>",  // The same with Handler Name
 
         "osVersion":"SnailOS",
 
         "osVersion":"SnailOS",
 
         "biosVersion":"",
 
         "biosVersion":"",
Line 60: Line 60:
 
     "commCmd":116,
 
     "commCmd":116,
 
     "requestID":109,
 
     "requestID":109,
     "agentID":"0027000E40000001",
+
     "agentID":"<span style="color:#FF0000;">0027000E40000001</span>",
 
     "handlerName":"general",
 
     "handlerName":"general",
 
     "sendTS":1466730390
 
     "sendTS":1466730390
Line 80: Line 80:
 
   "susiCommData": {
 
   "susiCommData": {
 
     "devID":"0027000E40000001",
 
     "devID":"0027000E40000001",
     "hostname":"<span style="color:#FF0000;"><ServiceName></span>"",
+
     "hostname":"<span style="color:#FF0000;"><ServiceName></span>",
 
     "sn":"0027000E40000001",
 
     "sn":"0027000E40000001",
 
     "mac":"0027000E40000001",
 
     "mac":"0027000E40000001",
 
     "version":"3.1.23",
 
     "version":"3.1.23",
     "type":"<span style="color:#FF0000;">Service</span>",
+
     "type":"<span style="color:#0000FF;">Service</span>",
 
     "product":"<span style="color:#FF0000;"><ServiceName></span>",
 
     "product":"<span style="color:#FF0000;"><ServiceName></span>",
 
     "manufacture":"",
 
     "manufacture":"",
Line 97: Line 97:
 
</pre>
 
</pre>
  
== Info or Update Device's Capability ==
+
== Info or Update Service's Capability ==
  
 
*Description: Agent will send it's capability to Server for description all resource.
 
*Description: Agent will send it's capability to Server for description all resource.
Line 114: Line 114:
 
             "Info": {"e":[ {"n":"Temperature","u":"Cel","v":0.000000,"min":-100.000000,"max":200.000000,"asm":"r","type":"d","rt":"ucum.Cel","st":"ipso","exten":""},
 
             "Info": {"e":[ {"n":"Temperature","u":"Cel","v":0.000000,"min":-100.000000,"max":200.000000,"asm":"r","type":"d","rt":"ucum.Cel","st":"ipso","exten":""},
 
                           {"n":"Humidity","u":"%","v":0.000000,"min":0.000000,"max":100.000000,"asm":"r","type":"d","rt":"ucum.%","st":"ipso","exten":""},
 
                           {"n":"Humidity","u":"%","v":0.000000,"min":0.000000,"max":100.000000,"asm":"r","type":"d","rt":"ucum.%","st":"ipso","exten":""},
                           {"n":"GPIO1","u":"","bv":0,"min":0.000000,"max":1.000000,"asm":"r","type":"b","rt":"","st":"ipso","exten":""},
+
                           {"n":"SmartML", "sv":"<xml>", "asm":"rw", "format":"xml", "encoding":"base64"},
                           {"n":"GPIO2","u":"","bv":0,"min":0.000000,"max":1.000000,"asm":"r","type":"b","rt":"","st":"ipso","exten":""}
+
                           {"n":"SmartData", "sv":"<json>", "asm":"r", "format":"json", "encoding":"base64"}
 
                           ],
 
                           ],
 
             "bn":"Info"
 
             "bn":"Info"
 
             },
 
             },
&nbsp;      "bn":"ServiceName"
+
          "bn":"<span style="color:#FF0000;"><ServiceName></span>"
 
       }
 
       }
 
   },
 
   },
Line 147: Line 147:
 
   "susiCommData":{   
 
   "susiCommData":{   
 
     "data":{   
 
     "data":{   
         "SenHub":{   
+
         "<span style="color:#FF0000;"><ServiceName></span>":{   
           "SenData":{   
+
           "Info":{   
 
               "e":[   
 
               "e":[   
                {
+
                  {"n":"SmartData", "sv":"<json>"}
                    "n":"Temperature",
+
                  ]
                    "v":1
+
               "bn":"Info"
                },
 
                { 
 
                    "n":"Humidity",
 
                    "v":57
 
                },
 
                { 
 
                    "n":"GPIO1",
 
                    "bv":0
 
                },
 
                { 
 
                    "n":"GPIO2",
 
                    "bv":0
 
                }
 
              ],
 
               "bn":"SenData"
 
 
           },
 
           },
 
           "ver":1
 
           "ver":1
 +
&nbsp;          "bn":"<span style="color:#FF0000;"><ServiceName></span>"
 
         }
 
         }
 
     },
 
     },
 
     "commCmd":2055,
 
     "commCmd":2055,
 
     "requestID":2001,
 
     "requestID":2001,
     "agentID":"0017000E40000001",
+
     "agentID":"0027000E40000001",
 
     "handlerName":"general",
 
     "handlerName":"general",
 
     "sendTS":160081031
 
     "sendTS":160081031
Line 196: Line 182:
 
         "e":[   
 
         "e":[   
 
           {   
 
           {   
               "n":"SenHub/Info/sw"
+
               "n":"<span style="color:#FF0000;"><ServiceName>/Info/SmartML</span>"
 
           }
 
           }
 
         ]
 
         ]
Line 203: Line 189:
 
     "requestID":0,
 
     "requestID":0,
 
     "agentID":"",
 
     "agentID":"",
     "handlerName":"SenHub",
+
     "handlerName":"<span style="color:#FF0000;"><ServiceName></span>",
 
     "sendTS":1466057267
 
     "sendTS":1466057267
 
   }
 
   }
Line 219: Line 205:
 
   "susiCommData":{   
 
   "susiCommData":{   
 
     "commCmd":524,
 
     "commCmd":524,
     "handlerName":"SenHub",
+
     "handlerName":"<span style="color:#FF0000;"><ServiceName></span>",
 
     "sessionID":"2746E3B65BAB115338B9668CDC5C35C4",
 
     "sessionID":"2746E3B65BAB115338B9668CDC5C35C4",
 
     "sensorInfoList":{   
 
     "sensorInfoList":{   
 
         "e":[   
 
         "e":[   
 
           {   
 
           {   
               "n":"/Info/sw",
+
               "n":"<span style="color:#FF0000;"><ServiceName>/Info/SmartML</span>",
               "sv":"1.0.00",
+
               "sv":"<xml>",
 
               "StatusCode":200
 
               "StatusCode":200
 
           }
 
           }
Line 245: Line 231:
 
<pre>{   
 
<pre>{   
 
   "susiCommData":{   
 
   "susiCommData":{   
 +
    "sessionID":"4DDF0B6DE2773176095F55E8C930507A",
 +
&nbsp;  "commCmd":525,
 +
&nbsp;  "requestID":0,
 +
&nbsp;  "agentID":"",
 +
&nbsp;  "handlerName":"<span style="color:#FF0000;"><ServiceName></span>",
 +
&nbsp;  "sendTS":1466088605
 
     "sensorIDList":{   
 
     "sensorIDList":{   
 
         "e":[   
 
         "e":[   
 
           {   
 
           {   
               "sv":"SenHub1",
+
               "sv":"<xml>",
               "n":"SenHub/Info/Name"
+
               "n":"<span style="color:#FF0000;"><ServiceName>/Info/SmartML</span>"
 
           }
 
           }
 
         ]
 
         ]
     },
+
     }
    "sessionID":"4DDF0B6DE2773176095F55E8C930507A",
 
    "commCmd":525,
 
    "requestID":0,
 
    "agentID":"",
 
    "handlerName":"SenHub",
 
    "sendTS":1466088605
 
 
   }
 
   }
 
}
 
}
Line 273: Line 259:
 
   "susiCommData":{   
 
   "susiCommData":{   
 
     "commCmd":526,
 
     "commCmd":526,
     "handlerName":"SenHub",
+
     "handlerName":"<span style="color:#FF0000;"><ServiceName></span>",
 
     "sessionID":"4DDF0B6DE2773176095F55E8C930507A",
 
     "sessionID":"4DDF0B6DE2773176095F55E8C930507A",
 
     "sensorInfoList":{   
 
     "sensorInfoList":{   
 
         "e":[   
 
         "e":[   
 
           {   
 
           {   
               "n":"/Info/Name",
+
               "n":"<span style="color:#FF0000;"><ServiceName>/Info/SmartML</span>",
               "sv":"Success",
+
               "sv":"<xml>",
 
               "StatusCode":200
 
               "StatusCode":200
 
           }
 
           }
Line 303: Line 289:
 
       "commCmd":2059,
 
       "commCmd":2059,
 
       "requestID":2001,
 
       "requestID":2001,
       "agentID":"000014DAE996BE04",
+
       "agentID":"0027000E40000001",
 
       "handlerName":"general",
 
       "handlerName":"general",
 
       "sendTS":1453356274,
 
       "sendTS":1453356274,
Line 312: Line 298:
 
         "handler":"MsgGen",
 
         "handler":"MsgGen",
 
         "extMsg":{
 
         "extMsg":{
&nbsp;          "predictMsg":{
+
              "predictMsg":{
 
               "health":"Sick",
 
               "health":"Sick",
 
               "suggestion1":"Please back up your HDD data. The HDD has the probability to break down in 30 days.",
 
               "suggestion1":"Please back up your HDD data. The HDD has the probability to break down in 30 days.",
 
               "deviceName":"ST9250315AS"
 
               "deviceName":"ST9250315AS"
 
             },
 
             },
&nbsp;          "alertMsg":{
+
              "alertMsg":{
&nbsp;              "warning":"Yes",
+
                    "warning":"Yes",
&nbsp;              "suggestion1":"Please lower the environment temperature under 40C.",
+
                    "suggestion1":"Please lower the environment temperature under 40C.",
&nbsp;              "suggestion2":"Please make sure the cooling system is working properly.",
+
                    "suggestion2":"Please make sure the cooling system is working properly.",
&nbsp;              "deviceName":"ST9250315AS"
+
                    "deviceName":"ST9250315AS"
&nbsp;          }
+
                }
&nbsp;        }
+
            }
 
       }
 
       }
 
   }
 
   }
Line 339: Line 325:
  
 
subtype:  
 
subtype:  
&nbsp;    THRESHOLD_CHECK_INFO
+
        THRESHOLD_CHECK_INFO
&nbsp;    THRESHOLD_CHECK_ERROR</pre>
+
        THRESHOLD_CHECK_ERROR
 
+
</pre>
== Service Discover ==
 
 
 
== Interactive Communication ==
 
 
 
*Description: Request Communication protocol to others service (agent)
 
*Type: Request
 
*Direction: Service-1 -> Service-2
 
*Topic: /cagent/admin/&lt;devID&gt;/Input
 
*QoS: 0
 
*Retained: 0
 
*Payload:
 
<pre>{ 
 
  "susiCommData":{ 
 
    "Input":{ 
 
        "e":[{"n":"Name","sv":"disk2"},
 
            {"n":"SMART1","v":68},
 
            {"n":"SMART2","v":10}]
 
        ]
 
    },
 
    "sessionID":"4DDF0B6DE2773176095F55E8C930507A",
 
    "commCmd":525,
 
    "requestID":0,
 
    "agentID":"",
 
    "handlerName":"ML",
 
    "sendTS":1466088605
 
  }
 
}</pre>
 
 
 
*Description: Service will response
 
*Type: Request
 
*Direction: Service-2&nbsp;-> Service-1
 
*Topic: /cagent/admin/&lt;devID&gt;/Output
 
*QoS: 0
 
*Retained: 0
 
*Payload:
 
<pre>{ 
 
  "susiCommData":{ 
 
    "Output":{
 
              "e":[{"n":"Name","sv":"disk2"},
 
                    {"n":"Health","bv":0}],
 
      "bn":"Output"
 
    },
 
    "sessionID":"4DDF0B6DE2773176095F55E8C930507A",
 
    "commCmd":2055,
 
    "requestID":2001,
 
    "agentID":"0085458221447854589",
 
    "handlerName":"general",
 
    "sendTS":160081031
 
  }
 
}</pre>
 
 
 
== Action ==
 
 
 
*Description:&nbsp;
 
*Type:&nbsp;?
 
*Direction: Agent -> Server
 
*Topic:&nbsp;????
 
*QoS:&nbsp;?
 
*Retained:&nbsp;?
 
*Payload:?
 
<pre>???</pre>
 

Revision as of 05:36, 9 March 2017

Overview

Introduction for "WISE-Snail communication protocol for EIS Service". WISEAgent communication protocol is base on standard MQTT protocol. We also define Advantech IoT Topic and message in JSON format. Follow standard to design our [Sensor Format in JSON ]

Protocol

Connect

  • Description: Agent Client sends the "Connect Info" to RMM Server for on-line notification.
  • Type: Info
  • Direction: Agent -> Server
  • Topic: /cagent/admin/<devID>/agentinfoack
  • QoS: 2
  • Retained: 0
  • Payload:
{
  "susiCommData": {
    	"devID":"<span style="color:#FF0000;">0027000E40000001</span>",     // User Define, NULL-> Auto <span style="color:#FF0000;">UUID-like</span>
    	"hostname":"<span style="color:#FF0000;"><ServiceName></span>",     // The same with Handler Name
    	"sn":"0027000E40000001",
    	"mac":"0027000E40000001",
    	"version":"3.1.23",           
    	"type":"<span style="color:#0000FF;">Service</span>",               // <span style="color:#FF0000;">Fixed: Service</span>     
    	"product":"<span style="color:#FF0000;"><ServiceName></span>",
    	"manufacture":"",
    	"status":"1",
    	"commCmd":1,
    	"requestID":30002,
    	"agentID":"<span style="color:#FF0000;">0027000E40000001</span>",
    	"handlerName":"general",
    	"sendTS":160081026
   }
}

OS Info

  • Description: Agent Client sends the OS Info" to RMM Server for device OS information.
  • Type: Info
  • Direction: Agent -> Server
  • Topic: /cagent/admin/<devID>/agentactionreq
  • QoS: 0
  • Retained: 0
  • Payload:
{
  "susiCommData":{
     "osInfo":
     {
        "cagentVersion":"3.1.23",
        "cagentType":"<span style="color:#FF0000;"><ServiceName></span>",   // The same with Handler Name
        "osVersion":"SnailOS",
        "biosVersion":"",
        "platformName":"",
        "processorName":"SnailGW",
        "osArch":"SnailX86",
        "totalPhysMemKB":123,
        "macs":"000E40ABCDEF",
        "IP":"192.168.0.100"
     },
     "commCmd":116,
     "requestID":109,
     "agentID":"<span style="color:#FF0000;">0027000E40000001</span>",
     "handlerName":"general",
     "sendTS":1466730390
   }
}


Disconnect

  • Description: Agent Client sends the "Disconnect Info" to Server for off-line notification.
  • Type: Info
  • Direction: Agent -> Server
  • Topic: /cagent/admin/<devID>/agentinfoack
  • QoS: 2
  • Retained: 0
  • Payload:
{
  "susiCommData": {
    	"devID":"0027000E40000001",
    	"hostname":"<span style="color:#FF0000;"><ServiceName></span>",
    	"sn":"0027000E40000001",
    	"mac":"0027000E40000001",
    	"version":"3.1.23",
    	"type":"<span style="color:#0000FF;">Service</span>",
    	"product":"<span style="color:#FF0000;"><ServiceName></span>",
    	"manufacture":"",
    	"status":"0",
    	"commCmd":1,
    	"requestID":30002,
    	"agentID":"0027000E40000001",
    	"handlerName":"general",
    	"sendTS":160081026
   }
}

Info or Update Service's Capability

  • Description: Agent will send it's capability to Server for description all resource.
  • Type: Auto update
  • Direction: Agent-> Server
  • Topic: /cagent/admin/<devID>/agentactionreq
  • QoS: 0
  • Retained: 0
  • Payload: 

Example: Service's Capability

{
  "susiCommData":{
    "infoSpec": {
        "<span style="color:#FF0000;"><ServiceName></span>": {
            "Info": {"e":[ {"n":"Temperature","u":"Cel","v":0.000000,"min":-100.000000,"max":200.000000,"asm":"r","type":"d","rt":"ucum.Cel","st":"ipso","exten":""},
                           {"n":"Humidity","u":"%","v":0.000000,"min":0.000000,"max":100.000000,"asm":"r","type":"d","rt":"ucum.%","st":"ipso","exten":""},
                           {"n":"SmartML", "sv":"<xml>", "asm":"rw", "format":"xml", "encoding":"base64"},
                           {"n":"SmartData", "sv":"<json>", "asm":"r", "format":"json", "encoding":"base64"}
                          ],
            "bn":"Info"
            },
          "bn":"<span style="color:#FF0000;"><ServiceName></span>"
       }
   },
   "commCmd":2052,
   "requestID":2001,
   "agentID":"0027000E40000001",
   "handlerName":"general",
   "sendTS":160081024
  }
}




Auto Update Sensor Data Value

  • Description: Agent will update latest value to server.
  • Type: Auto update
  • Direction: Agent-> Server
  • Topic: /cagent/admin/<devID>/deviceinfo
  • QoS: 0
  • Retained: 0
  • Payload:
{  
  "susiCommData":{  
     "data":{  
        "<span style="color:#FF0000;"><ServiceName></span>":{  
           "Info":{  
              "e":[  
                   {"n":"SmartData", "sv":"<json>"}
                  ]
              "bn":"Info"
           },
           "ver":1
           "bn":"<span style="color:#FF0000;"><ServiceName></span>"
        }
     },
     "commCmd":2055,
     "requestID":2001,
     "agentID":"0027000E40000001",
     "handlerName":"general",
     "sendTS":160081031
  }
}

Get Sensor Data

  • Description: Server can send mqtt message to get sensor data value.
  • Type: Request
  • Direction: Server -> Agent
  • Topic: /cagent/admin/<devID>/agentcallbackreq
  • QoS: 0
  • Retained: 0
  • Payload:
{  
  "susiCommData":{  
     "sessionID":"2746E3B65BAB115338B9668CDC5C35C4",
     "sensorIDList":{  
        "e":[  
           {  
              "n":"<span style="color:#FF0000;"><ServiceName>/Info/SmartML</span>"
           }
        ]
     },
     "commCmd":523,
     "requestID":0,
     "agentID":"",
     "handlerName":"<span style="color:#FF0000;"><ServiceName></span>",
     "sendTS":1466057267
  }
}
  • Description: Agent will reply its data value.
  • Type: Reply
  • Direction: Agent -> Server
  • Topic: /cagent/admin/<devID>/agentactionreq
  • QoS: 0
  • Retained: 0
  • Payload:
{  
  "susiCommData":{  
     "commCmd":524,
     "handlerName":"<span style="color:#FF0000;"><ServiceName></span>",
     "sessionID":"2746E3B65BAB115338B9668CDC5C35C4",
     "sensorInfoList":{  
        "e":[  
           {  
              "n":"<span style="color:#FF0000;"><ServiceName>/Info/SmartML</span>",
              "sv":"<xml>",
              "StatusCode":200
           }
        ]
     }
  }
}

Set Sensor Data

  • Description: Server can send mqtt message to set sensor data value.
  • Type: Request
  • Direction: Server -> Agent
  • Topic: /cagent/admin/<devID>/agentcallbackreq
  • QoS: 0
  • Retained: 0
  • Payload:
{  
  "susiCommData":{  
    "sessionID":"4DDF0B6DE2773176095F55E8C930507A", 
    "commCmd":525, 
    "requestID":0, 
    "agentID":"", 
    "handlerName":"<span style="color:#FF0000;"><ServiceName></span>", 
    "sendTS":1466088605
     "sensorIDList":{  
        "e":[  
           {  
              "sv":"<xml>",
              "n":"<span style="color:#FF0000;"><ServiceName>/Info/SmartML</span>"
           }
        ]
     }
  }
}
  • Description: Agent will reply its result.
  • Type: Reply
  • Direction: Agent -> Server
  • Topic: /cagent/admin/<devID>/agentactionreq
  • QoS: 0
  • Retained: 0
  • Payload:
{  
  "susiCommData":{  
     "commCmd":526,
     "handlerName":"<span style="color:#FF0000;"><ServiceName></span>",
     "sessionID":"4DDF0B6DE2773176095F55E8C930507A",
     "sensorInfoList":{  
        "e":[  
           {  
              "n":"<span style="color:#FF0000;"><ServiceName>/Info/SmartML</span>",
              "sv":"<xml>",
              "StatusCode":200
           }
        ]
     }
  }
}


EventNotify

  • Description: 
  • Type: Auto update
  • Direction: Agent -> Server
  • Topic: /cagent/admin/<devID>/eventnotify
  • QoS: ?
  • Retained: ?
  • Payload:
{  
   "susiCommData":{  
      "commCmd":2059,
      "requestID":2001,
      "agentID":"0027000E40000001",
      "handlerName":"general",
      "sendTS":1453356274,
      "eventnotify":{  
         "subtype":"predictError", #predictError/predictInfo
         "msg":"HDD smart 5 over the threshold",
         "severity":2,
         "handler":"MsgGen",
         "extMsg":{
               "predictMsg":{
               "health":"Sick",
               "suggestion1":"Please back up your HDD data. The HDD has the probability to break down in 30 days.",
               "deviceName":"ST9250315AS"
            },
              "alertMsg":{
                    "warning":"Yes",
                    "suggestion1":"Please lower the environment temperature under 40C.",
                    "suggestion2":"Please make sure the cooling system is working properly.",
                    "deviceName":"ST9250315AS"
                 }
             }
      }
   }
}


severity:
     Severity_Emergency = 0,
     Severity_Alert     = 1,
     Severity_Critical  = 2,
     Severity_Error     = 3,
     Severity_Warning   = 4,
     Severity_Informational = 5,
     Severity_Debug     = 6,

subtype: 
        THRESHOLD_CHECK_INFO
        THRESHOLD_CHECK_ERROR