Skip to content

Architecture

Alt text

Topic Overview

Topic Category Topic Content Publisher Subscriber
Device Status Report iot/{gw}/{device}/status { "status":"CONNECTED", "time":1524448722} Gateway Platform
Device Data Report iot/{gw}/{device}/data { "type":"MeasureData", "values":{ "blood_oxygen":96, "heart_rate":64 }, "time":1524448722} Gateway Platform
Device Command iot/{gw}/{device}/command { "type":"StartMeasure", "args":{ } } Platform Gateway
Device Command Response iot/{gw}/{device}/command_reply { "type":"StartMeasure", "result":{  "status":"ok",  "detail":""}} Gateway Platform
Server Ping to Gateway iot/{gw}/connect/ping {} Platform Gateway
Gateway Ping Response to Server iot/{gw}/connect/pingresp {} Gateway Platform
Gateway Will Topic iot/{gw}/connect/will {} Broker Platform
Gateway Devices Topic When Connected iot/{gw}/sub_devices/dev_list There may be two types of messages:
1. Gateway Side Err msg:
{ "err_msg": "xxx"}
2. Devices List Of Gateways:
[{ "name": "Pulse Oximeter Watch 1", "deveui": "2CAB33CC8FFA", "product_name": "Prince-100G", "product_category": "watch"}, { "name": "Blood Pressure Monitor\t1", "deveui": "D1F001013720", "product_name": "U80M", "product_category": "blood_pressure"}]
Gateway Platform

Flow Chart

Device Status Report

Alt text

Device Data Report

Alt text

Device Command

Alt text

Gateway Devices Topic When Connected

Alt text

Topic Details

Device Status Report

Field Field Description Type Optional Example
status Device status, CONNECTED or DISCONNECTED string Required CONNECTED
time Timestamp (seconds since the Unix epoch) number Required 1524448722

Device Data Report

Field Field Description Type Optional Example
device.mac Device Mac string Required 2cab33cc8ffa
device.make Manufacturer string Required ATH
device.model Product name string Required Prince-100G
measure.type Type of measure data string Required pulseox
measure.time UTC represented in ISO8601 format using the timezone representation +00:00 string Required 2023-11-23T11:59:05+00:00
measure.data Measure data of device JSON Required {"heartRate":{"value":69,"unit":"bpm"},"spo2":{"value":98,"unit":"%"}}

Complete example:

{
     "device": {
          "mac": "2cab33cc8ffa",
          "make": "ATH",
          "model": "Prince-100G"
     },
     "measure": {
          "type": "pulseox",
          "time": "2023-11-23T11:59:05+00:00",
          "data": {
               "heartRate": {
                    "value": 69,
                    "unit": "bpm"
               },
               "spo2": {
                    "value": 98,
                    "unit": "%"
               }
          }
     }
}

Measure Data supported by the device refers to Supported Devices

Device Command

Field Field Description Type Optional Example
type Type of command string Required StartMeasure
args Command args JSON Required {}

Commands supported by the device refers to Supported Devices

Device Command Response

Field Field Description Type Optional Example
type Type of command string Required StartMeasure
result Result of command JSON Required
result.status command result statusOk or Fail string ok
result.detail command result detail string Optional

Gateway Devices Topic When Connected

Gateway Side Err msg

Field Field Description Type Optional Example
err_msg Gateway side error msg, when gateway get value from nvs string Required {\"err_msg\":\"xxx\"}

Devices List Of Gateways

Field Field Description Type Optional Example
name Device name string Required Pulse Oximeter Watch 1
deveui Device mac String Required 2CAB33CC8FFA
product_name Product name String Required Prince-100G
product_category Product category String Required watch