aws / Jobs-for-AWS-IoT-embedded-sdk

Client library for using AWS IoT Jobs service on embedded devices
MIT License
13 stars 38 forks source link

Allow constructing messages for Job status updates with received blocks #101

Closed priyamourya25 closed 2 months ago

priyamourya25 commented 3 months ago

Allow constructing messages for Job status updates with additional details like number of downloaded blocks or additional string.

Considering a download of 100 blocks in a OTA file, it would be beneficial as a user to know the progress of the job. In older OTA agent, there was a mechanism to construct a message with number of downloaded blocks and total blocks expected in the file.

An example of such a message is: {"status":"IN_PROGRESS","statusDetails":{"receive":"12/100"}} which shows that 12 blocks are received among the 100 blocks.

This allows to track the OTA progress on the job execution when a OTA is in progress. Without regular updates, the job creater has no idea what is happening with the blocks and how far the download has been done.

rawalexe commented 3 months ago

Thank you for your suggestion, I'll forward this to the team

kstribrnAmzn commented 3 months ago

This request seems like the superset of your other request. This would be a perfect time for function overloading but unfortunately C doesn't support that. The next closest option is a variadic functions but this isn't a great solution either as the function signature would get ugly as more and more key-value pairs are added.

For both simplicity and ease of development, I'll put together a PR which takes in a JSON string for the StatusDetails field. Then as the user you can add whatever you want, as long as its valid JSON.

kstribrnAmzn commented 2 months ago

Closing as https://github.com/aws/Jobs-for-AWS-IoT-embedded-sdk/pull/105 is merged. This change allows you to provide a JSON key-value structure with any arbitrary number of key-value pairs.