Azure IoT-如果服务器和客户端都在更改设备孪生属性,该怎么办? [英] Azure IoT - What if both server and client are changing device twin properties?

查看:181
本文介绍了Azure IoT-如果服务器和客户端都在更改设备孪生属性,该怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Remote Monitoring Accelerator的Azure IoT解决方案.服务器(远程监视Web)和客户端(设备)都在更改设备孪生属性.有时,这些属性进入正在同步"状态,而似乎并没有脱离它.

I have an Azure IoT solution that uses the Remote Monitoring Accelerator. Both the server (remote monitoring web) and client (device) are changing the device twin properties. Sometimes those properties get into the "syncing" state and don't seem to get out of it.

那么谁有权更改设备孪生属性以及何时更改规则呢?

So what are the rules for who has the authority to change device twin properties and when?

我使用IoTHubDeviceClient_LL_SendReportedState()函数从设备端更改属性,顺便说一句.

I use the IoTHubDeviceClient_LL_SendReportedState() function to change properties from the device side, btw.

推荐答案

Azure IoT Device Twin代表可断开的分布式(例如 device-面向端面向服务端. Device Twin支持以过渡方式在这些端点之间创建影子副本".基本上,每个 end 都拥有用于编写(或更新)其属性的所有权,并且为此更改通知了另一个 end .

The Azure IoT Device Twin represents a lightweight generic data (state) model for disconnectable distributed ends such as a device-facing end and service-facing end. The Device Twin has a support for creating a "shadow copy" between those ends in the transitions manner. Basically, each end has ownership for writing (or updating) its property, which the other end is notified for this changes.

基于此通知,版本控制和设备孪生元数据,可以以可靠的方式将状态从一个 end 转换为另一状态.请注意,轻量级状态机必须在通知更改触发的设备和后端等每一端实现.

Based on this notifications, versioning and device twin metadata, the state can be transited from one end to other one in the reliable manner. Note, that the lightweight state machine must be implemented at the each end such as a device and backend triggered by the notification changes.

上面的图片来自文档

The above picture is from document Device twins, where is described this model in the detail.

更新:

以下屏幕片段是使用Device Twin属性在设备和后端之间的过渡状态的序列图示例:

The following screen snippet is an example of the sequence diagram for transition states between the Device and Back-end using a Device Twin properties:

在上面的示例中,此分布式状态机处理设备与后端之间来自进行中,确认,完成,空的传输状态.可以创建类似的过渡,例如: inprocess,nack,null ,后端和设备之间的过渡,断开设备的过渡等.

In the above example, this distributed state machine handles a transmission state from inprocess, ack, done, null between the Device and Back-end. Similar can be created the transitions for instance: inprocess, nack, null, between the Back-end and Device, for disconnected device, etc.

此示例使用了诸如 status 之类的附加属性来指示属性 Config 处于过渡状态,但可以添加更多的属性,例如原始值,版本等有助于恢复状态等.

This example used an additional property such as a status to indicate that the property Config is in the transition state, but can be added more, for instance, original value, version, etc. which they help to recover state, etc.

这篇关于Azure IoT-如果服务器和客户端都在更改设备孪生属性,该怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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