EIS Service Protocol

From ESS-WIKI
Jump to: navigation, search

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":"0005000E40000001",     // User Define, NULL-> Auto UUID-like devID
         "hostname":"WISE-1520+(devID4)",     // The same with Handler Name
         "sn":"0005000E40000001",
         "mac":"0005000E40000001",
         "version":"3.1.23",          
         "type":"Service",                               // Fixed: Service
         "product":"<ServiceGroup>",
         "manufacture":"",
         "status":"1",
         "commCmd":1,
         "requestID":30002,
         "agentID":"0005000E40000001", // the same with devID
         "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",  // Service version for user define
        "cagentType":"Service",    // fixed
        "osVersion":"SnailOS",
        "biosVersion":"",
        "platformName":"",
        "processorName":"Snail",  // different to SnailGW 
        "osArch":"SnailX86",
        "totalPhysMemKB":123,
        "macs":"000E40ABCDEF", // uuid
        "IP":""                                  // "null"
     },
     "commCmd":116,
     "requestID":109,
     "agentID":"0005000E40000001",
     "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":"0005000E40000001",
     "hostname":"WISE-1520+(devID4)",
     "sn":"0005000E40000001",
     "mac":"0005000E40000001",
     "version":"3.1.23",
     "type":"Service",
     "product":"",
     "manufacture":"",
     "status":"0",
     "commCmd":1,
     "requestID":30002,
     "agentID":"0005000E40000001",
     "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": {
           "<ServiceGroup>": {
              "<ServeName>":{
                "ServeName0":{
                       "Info": { "e": [  {"n":"Temperature","u":"Cel","v":0.000000,"min":-100},
                                         {"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":"0005000E40000001"   // => uuid
            },
           "bn":"<ServeName>"
          }
   },
   "commCmd":2052,
   "requestID":2001,
   "agentID":"0005000E40000001",
   "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":{  
            "<ServiceGroup>":{ 
                "<ServeName>":{ 
                    "ServeName0": {
                          "Info":{ 
                                 "e":[ {"n":"SmartData", "sv":"<json>"}],
                          "bn":"Info"
                      },
                      "bn":"0005000E40000001"    
                 },
                "bn":"<ServeName>"
             },
            "bn":"<ServiceName>"
        }
     },
     "commCmd":2055,
     "requestID":2001,
     "agentID":"0005000E40000001",
     "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":"ServiceGroup/ServeName/devID/Info/SmartML"
           }
        ]
     },
     "commCmd":523,
     "requestID":0,
     "agentID":"",
     "handlerName":"Service",
     "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":"<ServiceGroup>",
     "sessionID":"2746E3B65BAB115338B9668CDC5C35C4",
     "sensorInfoList":{ 
        "e":[ 
           { 
              "n":"ServiceGroup/ServeName/devID/Info/SmartML",
              "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":"Service",   // Fixed name for wisesnail parse rule
   "sendTS":1466088605
     "sensorIDList":{ 
        "e":[ 
           { 
              "sv":"<xml>",
              "n":"ServiceGroup/ServeName/devID/Info/SmartML"
           }
        ]
     }
  }
}

  • Description: Agent will reply accept this command
  • Type: Reply
  • Direction: Agent -> Server
  • Topic: /cagent/admin/<devID>/agentactionreq
  • QoS: 0
  • Retained: 0
  • Payload:


  "susiCommData":{ 
     "commCmd":526,
     "handlerName":"Service",
     "sessionID":"4DDF0B6DE2773176095F55E8C930507A",
     "sensorInfoList":{ 
        "e":[ 
           { 
              "n":"<ServiceGroup>/ServeName/<devID>/Info/SmartML",
              "StatusCode":202
           }
        ]
     }
  }
}

  • 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":"Service",
     "sessionID":"4DDF0B6DE2773176095F55E8C930507A",
     "sensorInfoList":{ 
        "e":[ 
           { 
              "n":"<ServiceGroup>/ServeName/<devID>/Info/SmartML",
              "sv":"<xml>",
              "StatusCode":200
           }
        ]
     }
  }
}

EventNotify

  • Description: 
  • Type: Auto update
  • Direction: Agent -> Server
  • Topic: /cagent/admin/<devID>/eventnotify
  • QoS: 0
  • Retained: 0
  • Payload:


   "susiCommData":{ 
      "commCmd":2059,
      "requestID":2001,
      "agentID":"0005000E40000001",
      "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