IoT Hub Device Update: How to recive a update file

Matthias Schneider 111 Reputation points
2021-04-13T12:37:52.273+00:00

I'm currently developing an update strategy for IoT devices running embedded Linux. With Azure Device Update for IoT Hub.
I have read a lot of MS documentation regarding this topic. But I am missing the part of how to connect all services together, so they do what I want.

What I know:

-

What I want:

-

  • Send Telemetry data for the device
  • Invoke Methods on the device
  • Deploy an Update Image to my IoT Devices.

What I have:

-

  • The Client Side of the update is implemented with rauc. I just need a way to deliver the update file to the device.
  • I can send Telemetry, edit device Twins and invoke Methods using the iot-sdk-c.
  • I created an IotHub with Device Update and connected my devices with the Device Update Agent
  • I created an Update-Artifact and imported it, and created a new deployment for my target group.
  • I was the able to simulate a successful download with the AducIotAgent.

My Problem:

-
I don't know how to connect all these parts together so that, when I deploy a new artifact, all compatible devices start the download by themselves, or if I am even on the right path.
My next step would be to simply invoke a method which downloads the update file and passes it to my rauc updater, but that would defeat the purpose of Device Update and Update Agent, at least with my current understanding of them.
I have an additional problem with the Device Agent which I explained on github, but I don't think that this is related.

Furthermore, I read that the Device Update uses PnP interfaces and in this guide they are using iot-dps to register new devices, but before I read further into these topics I would like to know if is suited for my case.

Same question on StackOverflow

Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,269 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Matthias Schneider 111 Reputation points
    2021-04-30T07:21:33.503+00:00

    Copping the Answer from Yuval Gross from Stack Overflow:

    At this point we do not have a general guideline on how to integrate your existing app/client/module with the update agent, which is something we're working to add very soon. For now I can refer you to some of the relevant pointer in our documentation, which will help you to get started:

    Update agent PnP interface: https://learn.microsoft.com/en-us/azure/iot-hub-device-update/device-update-plug-and-play

    Update agent workflow: https://learn.microsoft.com/en-us/azure/iot-hub-device-update/understand-device-update#device-update-agent

    Workflow code reference: https://github.com/Azure/iot-hub-device-update/blob/main/src/agent/adu_core_interface/src/agent_workflow.c

    Note that for installation specific implementations we have the concept of a "handler" which is maps to a specific "updateType". Here is the relevant pointer:
    https://learn.microsoft.com/en-us/azure/iot-hub-device-update/device-update-agent-overview#update-handlers

    An example of such handler is APT or SWUpdate, which resides here:
    https://github.com/Azure/iot-hub-device-update/tree/main/src/content_handlers/swupdate_handler

    That does not really answer my Question but shows me that I am not missing something obvious.
    How I see this is that, I can either extend the Agent functionality by modifying the source code, so that the sdk functions are executed as well. Or and that's the part I'm not sure about, I could have the SDK running at one module and the Agent as another. That way all date is sent and received, but I have two programs running.
    I think I could start the Agent from the SDK when an Update is viable. In that case 99% of the time there would be only one running program.

    If @António Sérgio Azevedo could verify this, then this Question can be closed.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.