|
IoT managed integrations End Device SDK
|
This file defines the Jobs Handler interface. The Jobs Handler provides APIs for managing IoT managed integrations OTA jobs. More...
#include <stdbool.h>#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Classes | |
| struct | iotmiJobsHandler_config |
| Configuration structure for initializing the Jobs Handler. More... | |
| struct | iotmi_JobDocument |
| Structure representing a job document. More... | |
Macros | |
| #define | JOBS_HANDLER_JOBID_MAX_LENGTH 64U /* per AWS IoT API Reference */ |
| Maximum length of a job ID for the AWS IoT Jobs Service. | |
Typedefs | |
| typedef struct iotmiJobsHandler_config | iotmiJobsHandler_config_t |
| Configuration structure for initializing the Jobs Handler. | |
| typedef struct iotmi_JobDocument | iotmi_JobData_t |
| Structure representing a job document. | |
Enumerations | |
| enum | JobsHandlerStatus_t { kJobsHandlerSuccess = 0 , kJobsHandlerError , kJobsHandlerBadParameter , kJobsHandlerOutOfMemory , kJobsHandlerTimeout , kJobsHandlerMqttAdapterError , kJobsHandlerSyncQueueError } |
| Return codes from jobs functions. More... | |
| enum | iotmi_JobCurrentStatus_t { kJobCurrentStatusMin = 0 , kJobQueued = kJobCurrentStatusMin , kJobInProgress , kJobFailed , kJobSucceeded , kJobRejected , kJobCurrentStatusMax } |
| Enumeration of possible job statuses. More... | |
Functions | |
| bool | iotmiJobsHandler_isInitialized () |
| Check if the Jobs Handler is initialized. | |
| JobsHandlerStatus_t | iotmiJobsHandler_start (const iotmiJobsHandler_config_t *pConfig) |
| Initialize the Jobs Handler. | |
| JobsHandlerStatus_t | iotmiJobsHandler_getJobDocument (iotmi_JobData_t *pJobDocument, uint32_t timeoutMs) |
| Retrieve a job document from the internal queue. | |
| JobsHandlerStatus_t | iotmiJobsHandler_destroyJobDocument (iotmi_JobData_t *pJobDocument) |
| Destroy a job document. | |
| JobsHandlerStatus_t | iotmiJobsHandler_pollJobDocument () |
| Poll for a job document from the IoT Jobs service. | |
| JobsHandlerStatus_t | iotmiJobsHandler_updateJobStatus (const char *pJobId, size_t jobIdLength, iotmi_JobCurrentStatus_t status, const char *statusDetails, size_t statusDetailsLength) |
| Update the status of a specific job with optional details. | |
| void | iotmiJobsHandler_stop (void) |
| Stop the Jobs Handler and release all resources. | |
This file defines the Jobs Handler interface. The Jobs Handler provides APIs for managing IoT managed integrations OTA jobs.
Enumeration of possible job statuses.
| enum JobsHandlerStatus_t |
Return codes from jobs functions.
| JobsHandlerStatus_t iotmiJobsHandler_destroyJobDocument | ( | iotmi_JobData_t * | pJobDocument | ) |
Destroy a job document.
This function frees the memory associated with a job document.
| [in] | pJobDocument | Pointer to the job document to destroy. |
kJobsHandlerSuccess on success.| JobsHandlerStatus_t iotmiJobsHandler_getJobDocument | ( | iotmi_JobData_t * | pJobDocument, |
| uint32_t | timeoutMs | ||
| ) |
Retrieve a job document from the internal queue.
This function waits for a job document to be available in the queue and retrieves it. If no job document is available, the function waits for up to timeoutMs milliseconds.
| [out] | pJobDocument | Pointer to a structure where the job document will be stored. The caller is responsible for freeing the memory of the job document by calling iotmiJobsHandler_destroyJobDocument. |
| [in] | timeoutMs | The maximum wait time in milliseconds for a job document to become available. |
kJobsHandlerSuccess if a job document is successfully retrieved.kJobsHandlerTimeout if no job document is available within the timeout.| bool iotmiJobsHandler_isInitialized | ( | ) |
Check if the Jobs Handler is initialized.
This function checks if the Jobs Handler has been successfully initialized and is ready for use.
true if the Jobs Handler is initialized, otherwise false. | JobsHandlerStatus_t iotmiJobsHandler_pollJobDocument | ( | ) |
Poll for a job document from the IoT Jobs service.
This function initiates a poll for a job document from the IoT Jobs service and adds it to the internal queue if available.
kJobsHandlerSuccess on success.| JobsHandlerStatus_t iotmiJobsHandler_start | ( | const iotmiJobsHandler_config_t * | pConfig | ) |
Initialize the Jobs Handler.
This function starts the Jobs Handler using the specified configuration parameters. It sets up the necessary resources for processing IoT Jobs.
| [in] | pConfig | Pointer to a configuration structure containing initialization parameters, such as Thing Name and queue size. |
kJobsHandlerSuccess on success.| void iotmiJobsHandler_stop | ( | void | ) |
Stop the Jobs Handler and release all resources.
This function stops the Jobs Handler, unsubscribes from any active topics, and frees any resources allocated for handling IoT Jobs.
| JobsHandlerStatus_t iotmiJobsHandler_updateJobStatus | ( | const char * | pJobId, |
| size_t | jobIdLength, | ||
| iotmi_JobCurrentStatus_t | status, | ||
| const char * | statusDetails, | ||
| size_t | statusDetailsLength | ||
| ) |
Update the status of a specific job with optional details.
This function updates the status of a specified job, with an option to include additional details in JSON format. The update is sent to the IoT Jobs service.
| [in] | pJobId | Pointer to the job ID string. |
| [in] | jobIdLength | Length of the job ID string. |
| [in] | status | The new status of the job. |
| [in] | statusDetails | Pointer to a JSON-formatted string containing additional status details, or NULL if not needed. |
| [in] | statusDetailsLength | Length of the status details string, or 0 if statusDetails is NULL. |
kJobsHandlerSuccess on success.