Azure IoT 中心是否可以部分更新所需的属性?
Azure IoT hub Partial update of desired properties possible?
是否可以从设备端部分更新报告的属性?到目前为止,我只看到有关部分更新所需属性的文章,例如:https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-device-twins.
如果可行,是否可以使用 azure-iot-hub-c-sdk?
谢谢
是的,可以使用 azure-iot-hub-c-sdk 更新所需的属性。可以参考范例iothub_client_sample_device_twin。如果您在修改 connectionString 后 运行 示例,您将从 Azure 门户获得部分更改,如下所示:
是的,这记录在 Understand and use device twins in IoT Hub(2018 年 7 月 19 日检索)。
The device app operates on the device twin using the following atomic operations:
- Retrieve device twin. This operation returns the device twin document (including tags and desired and reported system properties) for the currently connected device.
- Partially update reported properties. This operation enables the partial update of the reported properties of the currently connected device. This operation uses the same JSON update format that the solution back end uses for a partial update of desired properties.
- Observe desired properties. The currently connected device can choose to be notified of updates to the desired properties when they happen. The device receives the same form of update (partial or full replacement) executed by the solution back end.
是否可以从设备端部分更新报告的属性?到目前为止,我只看到有关部分更新所需属性的文章,例如:https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-device-twins.
如果可行,是否可以使用 azure-iot-hub-c-sdk?
谢谢
是的,可以使用 azure-iot-hub-c-sdk 更新所需的属性。可以参考范例iothub_client_sample_device_twin。如果您在修改 connectionString 后 运行 示例,您将从 Azure 门户获得部分更改,如下所示:
是的,这记录在 Understand and use device twins in IoT Hub(2018 年 7 月 19 日检索)。
The device app operates on the device twin using the following atomic operations:
- Retrieve device twin. This operation returns the device twin document (including tags and desired and reported system properties) for the currently connected device.
- Partially update reported properties. This operation enables the partial update of the reported properties of the currently connected device. This operation uses the same JSON update format that the solution back end uses for a partial update of desired properties.
- Observe desired properties. The currently connected device can choose to be notified of updates to the desired properties when they happen. The device receives the same form of update (partial or full replacement) executed by the solution back end.