gpt4 book ai didi

c - Azure IoT - 重置和清除设备孪生

转载 作者:行者123 更新时间:2023-12-02 07:21:01 25 4
gpt4 key购买 nike

我正在使用适用于 C 的 Azure IoT SDK。我需要我的设备能够不时完全清除设备孪生上报告的属性。

在我的设备孪生中,报告的属性中有一个小型层次结构,其中包含项目列表。例如 items.item1.Temperatureitems.item2.humidity

我似乎能够删除项目的单个属性,例如“湿度”,甚至可以删除单个项目,例如“item1”,但不能立即删除项目的完整列表,这应该是可能的。

JSON_Value*  root_value  = json_value_init_object();
JSON_Object* root_object = json_value_get_object(root_value);

// delete all items from twin
char* items= "items";
(void)json_object_dotset_null(root_object, items);

char* result = json_serialize_to_string(root_value);
json_value_free(root_value);
(void)IoTHubDeviceClient_SendReportedState(_device_handle, (const unsigned char*)result, strlen(result), ReportedStateCallback, NULL);

执行此代码时,我收到以下错误:

错误:时间:2021 年 2 月 18 日星期四 13:09:48 文件:/azure-iot-sdk-c/iothub_client/src/iothub_client_core.c Func:IoTHubClientCore_SendReportedState 行:1860 无效参数(NULL)

预先感谢您对此的任何支持。

最佳答案

这不是最新 SDK 版本中的存储库。请升级到最新的 LTS 版本。

关于c - Azure IoT - 重置和清除设备孪生,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66261055/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com