2

I am using the Azure IoT SDK for C. I need my device to be able to completely clear the reported properties on the device twin from time to time.

In my device twin I have a small hierarchy in the reported properties which contains a list of items. For example items.item1.temperature , items.item2.humidity

I seem to be able to delete individual properties of an item such as "humidity", and even delete an individual item such as "item1" but not the complete list of items at once which should be possible .

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);
 

When this code executes, I receive the following error :

Error: Time:Thu Feb 18 13:09:48 2021 File:/azure-iot-sdk-c/iothub_client/src/iothub_client_core.c Func:IoTHubClientCore_SendReportedState Line:1860 invalid arg (NULL)

Thanks in advance for any support on this.

Engineer999
  • 3,683
  • 6
  • 33
  • 71

1 Answers1

0

This is not repo in the latest SDK version. Please upgrade to the latest LTS release.

  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/32438996) – EsmaeelE Aug 14 '22 at 08:02