OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Azure IoT C SDK: Understanding IOTHUB_CLIENT_DEVICE_TWIN_CALLBACK

  • Thread starter Thread starter DrP3pp3r
  • Start date Start date
D

DrP3pp3r

Guest
I'm trying to understand the IOTHUB_CLIENT_DEVICE_TWIN_CALLBACK of the Azure IoT C SDK.

Unfortunately, except for the azure.github.io documentation, I cannot find any other useful resources. And the documentation itself is neither very detailed nor clear or exhaustive.

Is there any documentation about how the content of the payload parameter looks? Or does anyone know about this from implementing an Azure IoT Hub connection before?

From experimenting, it looks like when update_state (DEVICE_TWIN_UPDATE_STATE) is DEVICE_TWIN_UPDATE_COMPLETE a JSON is contained which is an object with a desired and a reported member. When update_state is DEVICE_TWIN_UPDATE_PARTIAL it seems payload just contains a JSON with the desired properties.

What's confusing me now is that the description of DEVICE_TWIN_UPDATE_STATE in the documentation

Enumeration passed to application callback to receive IoT Hub device or module twin data indicating whether the full twin or just partial update was received.

and for IOTHUB_CLIENT_DEVICE_TWIN_CALLBACK, parameter update_state

Whether application has received a full twin or just a patch update.

makes me expect something different. It sounds to me like when DEVICE_TWIN_UPDATE_COMPLETE is set, that payload should contain a JSON with the complete desired properties of the twin, and when DEVICE_TWIN_UPDATE_PARTIAL is set payload should contain a JSON with the partial desired properties of the twin (i.e. only the properties that changed).

Can anybody shine a light on this matter?
<p>I'm trying to understand the <em>IOTHUB_CLIENT_DEVICE_TWIN_CALLBACK</em> of the Azure IoT C SDK.</p>
<p>Unfortunately, except for the azure.github.io documentation, I cannot find any other useful resources. And the documentation itself is neither very detailed nor clear or exhaustive.</p>
<p>Is there any documentation about how the content of the <em>payload</em> parameter looks? Or does anyone know about this from implementing an Azure IoT Hub connection before?</p>
<p>From experimenting, it looks like when <em>update_state</em> (<em>DEVICE_TWIN_UPDATE_STATE</em>) is <em>DEVICE_TWIN_UPDATE_COMPLETE</em> a JSON is contained which is an object with a <em>desired</em> and a <em>reported</em> member.
When <em>update_state</em> is <em>DEVICE_TWIN_UPDATE_PARTIAL</em> it seems <em>payload</em> just contains a JSON with the desired properties.</p>
<p>What's confusing me now is that the description of <em>DEVICE_TWIN_UPDATE_STATE</em> in the <a href="https://azure.github.io/azure-iot-sdk-c/iothub__client__core__common_8h.html" rel="nofollow noreferrer">documentation</a></p>
<blockquote>
<p>Enumeration passed to application callback to receive IoT Hub device or module twin data indicating whether the full twin or just partial update was received.</p>
</blockquote>
<p>and for <em>IOTHUB_CLIENT_DEVICE_TWIN_CALLBACK</em>, parameter <em>update_state</em></p>
<blockquote>
<p>Whether application has received a full twin or just a patch update.</p>
</blockquote>
<p>makes me expect something different. It sounds to me like when <em>DEVICE_TWIN_UPDATE_COMPLETE</em> is set, that <em>payload</em> should contain a JSON with the complete desired properties of the twin, and when <em>DEVICE_TWIN_UPDATE_PARTIAL</em> is set <em>payload</em> should contain a JSON with the partial desired properties of the twin (i.e. only the properties that changed).</p>
<p>Can anybody shine a light on this matter?</p>
Continue reading...
 

Latest posts

Online statistics

Members online
0
Guests online
3
Total visitors
3
Top