Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notify user that an OTA download is going to start. #445

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

ActoryOu
Copy link
Member

Notify user that an OTA download is going to start.

Description

Callback to user when a new OTA job is received.

Checklist:

  • I have tested my changes. No regression in existing tests.
  • My code is formatted using Uncrustify.
  • I have read and applied the rules stated in CONTRIBUTING.md.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

@ravibhagavandas ravibhagavandas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any specific reason for adding this new notification type ?
Can we pass any useful information along with the event type ?
Can we add unit tests for the change?

@ActoryOu
Copy link
Member Author

ActoryOu commented Jun 21, 2022

In #214 description, user needs to know what's the job handling in OTA library.
Currently OTA callback to user when self-test started (OtaJobEventStartTest), custom job (OtaJobEventParseCustomJob), or invalid job (OtaJobParseErrNoActiveJobs), but there is no notification for normal OTA job started.

For the startup after the connection, I signal an OtaAgentEventStart event. This requests a job document (makes sense for self-test), but in case a new update exists, it starts downloading the update immediately. To stop the update, the agent must then be suspended explicitly, and the point to do this is unclear. In case of a self-test, we would like to receive the document and keep working (multiple ProcessLoops are required to finish self-test) until no new messages are received and we are still in OtaAgentStateWaitingForJob state. Therefore I cannot suspend the agent immediately after starting it. I had to build a relatively complicated logic to handle this. I think adding additional states like "update available" and "performing self-test" would be better.

I think we can provide a job doc for user to know the job ID. I'll add it and try to add unit tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants