Azure IOT Hub的设备连接(在线/离线)状态 [英] Device connectivity( online/offline) status with the Azure IOT Hub

查看:412
本文介绍了Azure IOT Hub的设备连接(在线/离线)状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将移动设备连接到物联网中心。我想 显示安装在另一台设备上的IOT集线器服务应用程序上设备的连接(在线/离线)状态。怎么做到这一点?当
连接状态发生变化时,是否会触发自动触发/事件?还有服务SDK中的任何API来检查设备的连接状态。

解决方案

嗨雷,


你有一些选择。让我指出相关文档:




最近围绕这个主题进行了一次有趣的讨论,请参阅
here


了解以下内容非常重要:



"



IoT Hub身份注册表包含一个名为  connectionState 。在开发和调试期间,只使用  connectionState  字段。
IoT解决方案不应在运行时查询字段例如,在发送云之前,请不要查询&strong;
connectionState  字段以检查设备是否已连接 - 设备消息或短信。我们建议
订阅 
设备已断开连接 事件   on
事件网格以获取警报并监控设备连接使用此 
教程  到
了解如何在物联网解决方案中集成IoT Hub中的设备连接和设备断开事件。



"





拥有IoTHub上每台设备的准确状态(connected\disconnected)并非易事,具体取决于您的具体情况。


< p style ="margin-bottom:0px; font-family:SegoeUI,Lato,'Helvetica Neue',Helvetica,Arial,sans-serif;颜色:#333333; font-size:16px">



希望它有所帮助。



谢谢! 





I connected my mobile device to the IOT hub. I would like to  display the connectivity (online/offline) status of the device on IOT hub service app installed on another device. How to achieve this? Is there any automatic trigger/event that fires when there is change in connectivity status? Also is there any API in service SDK to check the connectivity status of the device.

解决方案

Hi Ray,

You have some options for that. Let me point you to the relevant documentation:

Recently there was an interesting discussion around this topic as well, see here.

It is very important that you understand the following:

"

The IoT Hub identity registry contains a field called connectionState. Only use the connectionState field during development and debugging. IoT solutions should not query the field at run time. For example, do not query the connectionState field to check if a device is connected before you send a cloud-to-device message or an SMS. We recommend subscribing to the device disconnected event on Event Grid to get alerts and monitor the device connection state. Use this tutorial to learn how to integrate Device Connected and Device Disconnected events from IoT Hub in your IoT solution.

"

Having an exact state (connected\disconnected) of every devices on your IoTHub is not an easy task and it will depend on your specific scenario.

Hope it helps.

Thanks! 



这篇关于Azure IOT Hub的设备连接(在线/离线)状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆