Giter Club home page Giter Club logo

jobs-for-aws-iot-embedded-sdk's Introduction

AWS IoT Jobs library

API Documentation Pages for current and previous releases of this library can be found here

The AWS IoT Jobs library helps you notify connected IoT devices of a pending Job. A Job can be used to manage your fleet of devices, update firmware and security certificates on your devices, or perform administrative tasks such as restarting devices and performing diagnostics. It interacts with the AWS IoT Jobs service using MQTT, a lightweight publish-subscribe protocol. This library provides a convenience API to compose and recognize the MQTT topic strings used by the Jobs service. The library is written in C compliant with ISO C90 and MISRA C:2012, and is distributed under the MIT Open Source License.

This library has gone through code quality checks including verification that no function has a GNU Complexity score over 10, and checks against deviations from mandatory rules in the MISRA coding standard. Deviations from the MISRA C:2012 guidelines are documented under MISRA Deviations. This library has also undergone both static code analysis from Coverity, and validation of memory safety with the CBMC bounded model checker.

See memory requirements for this library here.

AWS IoT Jobs v1.5.1 source code is part of the FreeRTOS 202406.00 LTS release.

Building the Jobs library

A compiler that supports C99 or later such as gcc is required to build the library.

Additionally, coreJSON is required for parsing. To build the library, first run:

git clone https://github.com/FreeRTOS/coreJSON.git --depth 1 --branch v3.2.0

Given an application in a file named example.c, gcc can be used like so:

gcc -I source/include -I coreJSON/source/include example.c coreJSON/source/core_json.c source/jobs.c -o example

gcc can also produce an object file to be linked later:

gcc -I source/include -I coreJSON/source/include -c source/jobs.c

CBMC

To learn more about CBMC and proofs specifically, review the training material here.

The test/cbmc directory contains CBMC proofs.

In order to run these proofs you will need to install CBMC and other tools by following the instructions here.

Reference example

The AWS IoT Device SDK for Embedded C repository contains a demo using the jobs library on a POSIX platform. https://github.com/aws/aws-iot-device-sdk-embedded-C/tree/main/demos/jobs/jobs_demo_mosquitto

Documentation

Existing Documentation

For pre-generated documentation, please see the documentation linked in the locations below:

Location
AWS IoT Device SDK for Embedded C
FreeRTOS.org

Note that the latest included version of the AWS IoT Jobs library may differ across repositories.

Generating Documentation

The Doxygen references were created using Doxygen version 1.9.2. To generate the Doxygen pages, please run the following command from the root of this repository:

doxygen docs/doxygen/config.doxyfile

Building unit tests

Platform Prerequisites

  • For running unit tests
    • C99 compiler like gcc
    • CMake 3.13.0 or later
    • Ruby 2.0.0 or later is additionally required for the Unity test framework (that we use).
  • For running the coverage target, lcov is additionally required.

Steps to build Unit Tests

  1. Create build directory: mkdir build && cd build

  2. Run cmake while inside build directory: cmake -S ../test

  3. Run this command to build the library and unit tests: make all

  4. The generated test executables will be present in build/bin/tests folder.

  5. Run ctest to execute all tests and view the test run summary.

Contributing

See CONTRIBUTING.md for information on contributing.

jobs-for-aws-iot-embedded-sdk's People

Contributors

aggarw13 avatar amazon-auto avatar angelonakos avatar aniruddhakanhere avatar archigup avatar bogdanthegeek avatar bradleysmith23 avatar chinglee-iot avatar dan4thewin avatar gkwicker avatar karkhaz avatar kstribrnamzn avatar leegeth avatar markrtuttle avatar mtalreja-a avatar rawalexe avatar ronakfof avatar sarenameas avatar skptak avatar sukhmanm avatar tony-josi-aws avatar xlin7799 avatar xuelix avatar yourslab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jobs-for-aws-iot-embedded-sdk's Issues

Modify Jobs_UpdateMsg to support optional Expected version field

Please refer the description of expected version for iot jobs:
https://docs.aws.amazon.com/iot/latest/apireference/API_iot-jobs-data_UpdateJobExecution.html#API_iot-jobs-data_UpdateJobExecution_RequestSyntax

This is an optional field and the user should be allowed to not pass and still construct a payload without the field. The API forces to provide an optional field here:

if( ( expectedVersion != NULL ) && ( expectedVersionLength > 0U ) && ( bufferSize >=

Could you please modify the API so that it allows to append values only if they are passed by the user?

Allow constructing Update messages with key-value pairs in `StatusDetails`

statusDetails is an optional field that can be used to update the Job status with additional details that can be used during verification step.

Please refer the usage of statusDetails field in the documentation: https://docs.aws.amazon.com/iot/latest/apireference/API_iot-jobs-data_UpdateJobExecution.html#iot-iot-jobs-data_UpdateJobExecution-request-statusDetails

Can you add the support to append key-value pairs in status details and statusDetails field when a job update message is sent?
Few example of such message:
{"status":"FAILED","statusDetails":{"self_test":"ready","updatedBy":"0x1e240"}} -> to notify that download is complete and device will go in self-test mode
{"status":"FAILED","statusDetails":{"self_test":"accepted","reason":"v1.0.0"}} ->to notify that new image was committed.

The APIs should provide an interface to construct such messages because these were provided by older ota agent to notify the ota progress and were very helpful

Jobs SDK State Access Audit

Description

Jobs-SDK may rely upon state - state which may be accessible across FreeRTOS tasks. We want to verify the SDK is task/thread safe by ensuring that state access across FreeRTOS tasks is done so behind a synchronization mechanism.

Help is wanted to audit the repository for state which can be used outside of the jobs task/thread or functions.

This work is being tracked by the FreeRTOS team however it may not be prioritized for some time. Your help in identifying problem state variables/structures will help us in correcting these issues faster. As always, if you are able to fix the issue, we appreciate the help and will gladly look at your PR.

Related Issues

Allow constructing messages for Job status updates with received blocks

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.

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.