Giter VIP home page Giter VIP logo

Comments (2)

jw-msft avatar jw-msft commented on July 30, 2024

Yes, it should be straightforward to implement.

In the block of std::thread worker, before calling

Download(workflowId, updateType, info) {

it would first make call to your approval service as per its client/server protocol. For example, it could have long-lived keep-alive connection and block to wait for response, or poll over an interval of time and give up after max time (30 days)
, etc.

If the approval is denied, then download worker thread will need to set ADUC_Result result to an failure ResultCode and a reasonable ExtendedResultCode. e.g.

#define E_APPROVAL_DENIED <some 32-bit number>
{
    -1,
    E_APPROVAL_DENIED
} 

It needs to continue calling WorkCompletionCallback so that the state machine can continue it transition to the next state. e.g.

workCompletionData->WorkCompletionCallback(workCompletionData->WorkCompletionToken, result);

What this means for PP Agent is it will send the failure to the cloud for Download UpdateAction and it will show as failed and twin will have extended result code.
For PPR Agent, it will similarly show the entire deployment as failed and twin data will also contain the extended result code.

Exiting early and not transitioning to a final success/fail state and then to Idle will make backend not about device status. For PPR, it will show as in-progress indefinitely and there is no timeout for deployment. It is clearer to allow it to transition to final state so it will show success/failure in portal UX and service operator can see the reason (Approval was denied in this case).

If approved, it would just continue on with the Download() call (and also call WorkCompletionCallback with result of download).

from iot-hub-device-update.

GauravChoube avatar GauravChoube commented on July 30, 2024

@jw-msft
I have successfully changed the agent with above requirement and its working fine.
Basically i found out the place where code bypass to my customized block of code that do some action and once action fullfilled , i resume agent code by calling same function that should be called in normal flow.
function name is adu_handleaction().

from iot-hub-device-update.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.