设备管理 IoTDM(联通用户专用)-设备数据变化通知和批量设备数据变化通知的区别是什么?

时间:2023-11-01 16:20:25

设备数据变化通知和批量设备数据变化通知的区别是什么?

设备数据变化通知和批量设备数据变化通知接口都是订阅设备的数据变化,只是封装的数据格式不一样。

例如:一款水表设备有Battery和Connectivity两种服务类型,每次上报数据都会上报这两个服务的数据。
  • 如果订阅deviceDatachanged(设备数据变化通知),则 物联网平台 分两次将数据推送到应用服务器,第一次推送Battery服务数据,第二次推送Connectivity服务数据。例如:
    {    "notifyType":"deviceDataChanged",    "deviceId":"70a8d7cd-5ecd-4bda-a87c-afc16bd31bda",    "gatewayId":"70a8d7cd-5ecd-4bda-a87c-afc16bd31bda",    "requestId":null,    "service":{        "serviceId":"battery",        "serviceType":"battery",        "data":{            "batteryLevel":66        },        "eventTime":"20170211T034003Z"    }}
    {    "notifyType":"deviceDataChanged",    "deviceId":"70a8d7cd-5ecd-4bda-a87c-afc16bd31bda",    "gatewayId":"70a8d7cd-5ecd-4bda-a87c-afc16bd31bda",    "requestId":null,    "service":{        "serviceId":"Connectivity",        "serviceType":"Connectivity",        "data":{            "signalStrength":72,            "cellId":4022250974,            "tac":61374,            "mnc":91,            "mcc":235        },        "eventTime":"20170211T092317Z"    }}
  • 如果订阅deviceDataschanged(批量设备数据变化通知),则物联网平台将两次服务的数据封装在一起发送到应用服务器。
    {    "notifyType":"deviceDatasChanged",    "requestId":null,    "deviceId":"70a8d7cd-5ecd-4bda-a87c-afc16bd31bda",    "gatewayId":"70a8d7cd-5ecd-4bda-a87c-afc16bd31bda",    "services":[        {            "serviceId":"battery",            "serviceType":"battery",            "data":{                "batteryLevel":66            },            "eventTime":"20170211T034003Z"        },        {            "serviceId":"Connectivity",            "serviceType":"Connectivity",            "data":{                "signalStrength":72,                "cellId":4022250974,                "tac":61374,                "mnc":91,                "mcc":235            },            "eventTime":"20170211T034003Z"        }    ]}
support.huaweicloud.com/iot_faq/iot_faq_00067.html