Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Azure IoT Central中发送可写属性数据_Azure_Azure Iot Hub_Azure Iot Central - Fatal编程技术网

如何在Azure IoT Central中发送可写属性数据

如何在Azure IoT Central中发送可写属性数据,azure,azure-iot-hub,azure-iot-central,Azure,Azure Iot Hub,Azure Iot Central,我正在使用物联网中心开发小型物联网应用程序。下面是我的设备DCM 我正在使用.Net模拟器发送遥测和财产数据,但在Azure IoT Central中看不到TelemetryInterval财产数据。(遥测数据正确可见) 模拟器代码 var telemetryDataPoint = new { MessageTime = messageTime, Moisture = randMoisture

我正在使用物联网中心开发小型物联网应用程序。下面是我的设备DCM

我正在使用.Net模拟器发送遥测和财产数据,但在Azure IoT Central中看不到
TelemetryInterval
财产数据。(遥测数据正确可见)

模拟器代码

var telemetryDataPoint = new
            {
                MessageTime = messageTime,
                Moisture = randMoisture
            };
            var telemetryDataString = JsonConvert.SerializeObject(telemetryDataPoint);

            //set the body of the message to the serialized value of the telemetry data
            var message = new Message(Encoding.ASCII.GetBytes(telemetryDataString));

            message.Properties.Add("TelemetryInterval", "10");
            message.ContentEncoding = "utf-8";
            message.ContentType = "application/json";
            message.MessageId = Guid.NewGuid().ToString();
            await deviceClient.SendEventAsync(message);
我能解决这个问题

这是设备twin的报告属性,我们可以使用
TwinCollection
更新此属性

private static async void SendTwinData()
    {
        var twinProperties = new Microsoft.Azure.Devices.Shared.TwinCollection();
        twinProperties["TelemetryInterval"] = "2";
        await s_deviceClient.UpdateReportedPropertiesAsync(twinProperties);
    }