有没有办法使用Azure IOT Edge SDK从ModuleClient获取设备孪生

时间:2019-01-10 13:14:06

标签: c# azure azure-iot-edge

我正在使用'ModuleClient'类开发自定义边缘模块。 我必须在设备twin中配置属性,并在我的边缘模块中读取相应的值。

我知道可以使用Device Client类来实现。为此,我需要设备连接字符串,但是我没有方便的设备连接字符串(因为我们有成千上万的设备,因此这种方法会增加部署开销,因此我们不鼓励使用此方法)。

AmqpTransportSettings amqpSetting = new AmqpTransportSettings(TransportType.Amqp_Tcp_Only);

var mqttSetting = new MqttTransportSettings(TransportType.Mqtt_Tcp_Only);

TransportSettings[] settings = { amqpSetting };

// Open a connection to the Edge run-time - create from env with transport type (https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.devices.client.moduleclient.createfromenvironmentasync?view=azure-dotnet)
ioTHubModuleClient = await ModuleClient.CreateFromEnvironmentAsync(settings);

1 个答案:

答案 0 :(得分:0)

没有内置功能的选项可以从IoT边缘sdk获取设备双胞胎

但是可以解决以下链接,但不是推荐的方法 https://github.com/Azure/iotedge/issues/631