本文介绍了设备双胞胎:如何在C#中读取/写入属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在IoT中注册了设备,并且客户端应用程序(设备)可以读取/更新报告的孪生属性.

I have registered the devices in IoT and the client application (device) can read/update reported twin properties.

这些属性是在狼吞虎咽:

The properties are the wollowing :

"EbbyVersion": {
"Major": 2,
"Minor": 1,
"Revision": 0
},

"Telemetry": {
"CachingInterval": 60,
"SendingInterval": 480,
"UploadTimeout": 10
},

"Power": {
"MaximumAvailable": 3500,
"Thresholds": {
    "Low": 2500,
    "Medium": 3000,
    "High": 3500
}
},

"Lighting": {
"R": 32,
"G": 64,
"B": 128,
"W": 255
},

我编写以下代码以连接到IoT Device Twin:

I write the following code to connect to IoT Device Twin :

var registryManager = RegistryManager.CreateFromConnectionString(AppSettings.KeyIoT);
var twin = await registryManager.GetTwinAsync(dto.DeviceIdorId);

现在,我必须从后端应用程序(在C#中)读取/更新所需的twin属性.需要帮助.

Now, I have to read/update desired twin properties from back end application (in C#). Need help.

推荐答案

希望 TwinCollection 类会有所帮助.请参阅此讨论 C#如何更新Azure IoT中心设备的所需孪生属性

Hopefully TwinCollection class would help. Please refer to this discussion C# How to update desired twin property of an Azure IoT Hub device

这篇关于设备双胞胎:如何在C#中读取/写入属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 08:00