Closed Sneezry closed 6 years ago
Can you please provide more details?
Hi @tameraw, thank you for reply. Device twin sample sends reported twin to IoT Hub using IoTHubDeviceTwin_SendReportedStateCar method, and we can see the code block here: https://github.com/Azure/azure-iot-sdk-c/blob/master/serializer/samples/devicetwin_simplesample/devicetwin_simplesample.c#L132
However, there is nothing about IoTHubDeviceTwin_SendReportedStateCar. In another word, we still have no idea how to send reported twin to IoT Hub with C SDK.
Correct, you're not going to find an explicit definition for IoTHubDeviceTwin_SendReportedStateCar. It is defined as a helper by the DECLARE_DEVICETWIN_MODEL() macro.
When debugging through the serializer, a lot of times your best bet is to single-step into unclear functions and soon you should hit "paydirt" of the underlying implementation. In this case it will be IoTHubDeviceTwin_SendReportedState_Impl.
You can look at the SendReportedState documentation to understand more details, though in a nutshell this will just send up the state as filled in by the Car variable.
Or... let me know on this thread if I can help explain anything else.
@jspaith thank you for the information! I am writing some azure iot device twin samples for our board, and I didn't find anything to explain how to send reported twin with azure iot c sdk either in docs or github sample code. I guess I didn't find the right place. However, I have tried to call IoTHubClient_LL_SendReportedState, and now it works. While I was searching for the information, I found this issue, and I guess that user has the same confusion as me https://github.com/Azure-Samples/iot-hub-feather-huzzah-client-app/issues/17
@Sneezry Thanks for the link to the other GitHub issue.
What we have today obviously isn't clear enough, so I'm going to add a bunch of additional comments around the SendReportedStateCar function so it's easier to understand without hitting GitHub. It's in branch serializer-dt-comments, I'll get it reviewed and hopefully through our gates by end of day today.
Thanks again for bringing all this to our attention.
I've merged the change into mainline. I'm closing the issue but feel free to re-open this (or new one) if anything else is needed.
https://github.com/Azure/azure-iot-sdk-c/blob/master/serializer/samples/devicetwin_simplesample/devicetwin_simplesample.c#L132