Difference between revisions of "WISE-PaaS/2.0 Protocol"

From ESS-WIKI
Jump to: navigation, search
Line 256: Line 256:
 
*Type: Auto update
 
*Type: Auto update
 
*Direction: Agent-> Server
 
*Direction: Agent-> Server
*Topic: /wisepaas/RMM/00000001-0000-0000-0000-999BAB6F4000/deviceinfo
+
*Topic: /wisepaas/RMM/00000001-0000-0000-0000-999BAB6F4000/agentactionack
 
*QoS: 0
 
*QoS: 0
 
*Retained: 0
 
*Retained: 0

Revision as of 03:01, 15 November 2017

Overview

Introduction for "EI-Agent to WISE-PaaS-2.0 communication protocol". 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 WISE-PaaS-2.0 Server for on-line notification.
  • Type: Info
  • Direction: Agent -> Server
  • Topic: /wisepaas/device/00000001-0000-0000-0000-999BAB6F4000/agentinfoack
  • QoS: 0
  • Retained: 0
  • Payload:
{
    "content": {
        "parentID": "",
        "hostname": "chihyu-PC",
        "sn": "000BAB578433",
        "mac": "000BAB6F3752",
        "version": "1.0.6.0",
        "type": "IPC",
        "product": "",
        "manufacture": "",
        "account": "",
        "passwd": "",
        "status": 1,
        "tag": "RMM"
    },
    "commCmd": 1,
    "agentID": "00000001-0000-0000-0000-999BAB6F4000",
    "handlerName": "general",
    "sendTS": {
        "$date": 1510044371567
    }
}

OS Info

  • Description: Agent Client sends the OS Info" to RMM Server for device OS information.
  • Type: Info
  • Direction: Agent -> Server
  • Topic: /wisepaas/RMM/00000001-0000-0000-0000-999BAB6F4000/agentactionack
  • QoS: 0
  • Retained: 0
  • Payload:
{
    "content": {
        "cagentVersion": "1.0.6.0",
        "cagentType": "IPC",
        "osVersion": "Windows Embedded Standard",
        "biosVersion": "V1.10",
        "platformName": "ARK-DS762",
        "processorName": "Intel(R) Core(TM) i7-3610QE CPU @ 2.30GHz",
        "osArch": "X64",
        "totalPhysMemKB": 1973544,
        "macs": "00:0B:AB:6F:37:52",
        "IP": "172.22.12.84"
    },
    "commCmd": 116,
    "agentID": "00000001-0000-0000-0000-999BAB6F4000",
    "handlerName": "general",
    "sendTS": {
        "$date": 1510044371812
    }
}


Disconnect

  • Description: Agent Client sends the "Disconnect Info" to Server for off-line notification.
  • Type: Info
  • Direction: Agent -> Server
  • Topic: /wisepaas/device/00000001-0000-0000-0000-999BAB6F4000/agentinfoack
  • QoS: 0
  • Retained: 0
  • Payload:
{
    "content": {
        "parentID": "",
        "hostname": "chihyu-PC",
        "sn": "000BAB578433",
        "mac": "000BAB6F3752",
        "version": "1.0.6.0",
        "type": "IPC",
        "product": "",
        "manufacture": "",
        "account": "",
        "passwd": "",
        "status": 1,
        "tag": "RMM"
    },
    "commCmd": 1,
    "agentID": "00000001-0000-0000-0000-999BAB6F4000",
    "handlerName": "general",
    "sendTS": {
        "$date": 1510044371567
    }
}

Will Message

  • Description: While Client lost connection or keep-alive timeout, the will message will send to the client that subscribe the topic
  • Type: Info
  • Direction: Agent -> Broker
  • Topic: /wisepaas/device/00000001-0000-0000-0000-999BAB6F4000/willmessage
  • QoS: 0
  • Retained: 0
  • Payload:
{
    "content": {
        "parentID": "",
        "hostname": "chihyu-PC",
        "sn": "000BAB578433",
        "mac": "000BAB6F3752",
        "version": "1.0.6.0",
        "type": "IPC",
        "product": "",
        "manufacture": "",
        "account": "",
        "passwd": "",
        "status": 0,
        "tag": "RMM"
    },
    "commCmd": 1,
    "agentID": "00000001-0000-0000-0000-999BAB6F4000",
    "handlerName": "general",
    "sendTS": {
        "$date": 1510044370561
    }
}

Info or Update Device's Capability

  • Description: Agent will send it's capability to Server for description all resource.
  • Type: Auto update
  • Direction: Agent-> Server
  • Topic: /wisepaas/RMM/00000001-0000-0000-0000-999BAB6F4000/agentactionack
  • QoS: 0
  • Retained: 0
  • Payload: 

Example: HDD PMQ Capability

{
    "content": {
        "HDD_PMQ": {
            "info": {
                "bn": "info",
                "e": [
                    {
                        "n": "type",
                        "sv": "PMQ",
                        "asm": "r"
                    },
                    {
                        "n": "name",
                        "sv": "HDD_PMQ",
                        "asm": "r"
                    },
                    {
                        "n": "description",
                        "sv": "This service is HDD PMQ Service",
                        "asm": "r"
                    },
                    {
                        "n": "version",
                        "sv": "1.0.2",
                        "asm": "r"
                    },
                    {
                        "n": "confidence level",
                        "v": 83.12,
                        "asm": "r",
                        "u": "%"
                    },
                    {
                        "n": "update",
                        "sv": null,
                        "asm": "rw"
                    },
                    {
                        "n": "eventNotify",
                        "bv": true,
                        "asm": "r"
                    }
                ]
            },
            "action": {
                "bn": "action",
                "e": [
                    {
                        "n": "a1",
                        "bv": false,
                        "asm": "r",
                        "msg": "Lower system temperature ( < 40 Celsius )."
                    },
                    {
                        "n": "a2",
                        "bv": false,
                        "asm": "r",
                        "msg": "Backup data to new disk."
                    },
                    {
                        "n": "a3",
                        "bv": false,
                        "asm": "r",
                        "msg": "Check power source."
                    },
                    {
                        "n": "ActionLog",
                        "sv": null,
                        "asm": "r"
                    }
                ]
            },
            "param": {
                "bn": "param",
                "e": [
                    {
                        "n": "report interval",
                        "v": 60,
                        "max": 3600,
                        "min": 10,
                        "asm": "rw",
                        "u": "sec"
                    },
                    {
                        "n": "enable report",
                        "bv": true,
                        "asm": "rw"
                    }
                ]
            },
            "opTS": {
                "$date": 1510044371815
            }
        }
    },
    "commCmd": 2052,
    "agentID": "00000001-0000-0000-0000-999BAB6F4000",
    "handlerName": "general",
    "sendTS": {
        "$date": 1510044371815
    }
}

Auto Update Data Value

  • Description: Agent will update latest value to server.
  • Type: Auto update
  • Direction: Agent-> Server
  • Topic: /wisepaas/RMM/00000001-0000-0000-0000-999BAB6F4000/agentactionack
  • QoS: 0
  • Retained: 0
  • Payload:
{
    "content": {
        "HDD_PMQ": {
            "info": {
                "bn": "info",
                "e": [
                    {
                        "n": "version",
                        "sv": "1.0.2"
                    },
                    {
                        "n": "confidence level",
                        "v": 89.6,
                        "asm": "r",
                        "u": "%"
                    }
                ]
            },
            "param": {
                "bn": "param",
                "e": [
                    {
                        "n": "report interval",
                        "v": 30
                    },
                    {
                        "n": "enable report",
                        "bv": true
                    }
                ]
            },
            "opTS": {
                "$date": 1510044371815
            }
        }
    },
    "commCmd": 2055,
    "agentID": "00000001-0000-0000-0000-999BAB6F4000",
    "handlerName": "general",
    "sendTS": {
        "$date": 1510044371815
    }
}

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":"SenHub/Info/sw"
           }
        ]
     },
     "commCmd":523,
     "requestID":0,
     "agentID":"",
     "handlerName":"SenHub",
     "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":"SenHub",
     "sessionID":"2746E3B65BAB115338B9668CDC5C35C4",
     "sensorInfoList":{  
        "e":[  
           {  
              "n":"/Info/sw",
              "sv":"1.0.00",
              "StatusCode":200
           }
        ]
     }
  }
}

Set 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":{  
     "sensorIDList":{  
        "e":[  
           {  
              "sv":"SenHub1",
              "n":"SenHub/Info/Name"
           }
        ]
     },
     "sessionID":"4DDF0B6DE2773176095F55E8C930507A",
     "commCmd":525,
     "requestID":0,
     "agentID":"",
     "handlerName":"SenHub",
     "sendTS":1466088605
  }
}
  • 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":"SenHub",
     "sessionID":"4DDF0B6DE2773176095F55E8C930507A",
     "sensorInfoList":{  
        "e":[  
           {  
              "n":"/Info/Name",
              "sv":"SenHub1",
              "StatusCode":200
           }
        ]
     }
  }
}