IoT managed integrations End Device SDK
Loading...
Searching...
No Matches
iotmi_jobs_handler.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 Amazon.com, Inc. or its affiliates. All rights reserved.
3 *
4 * AMAZON PROPRIETARY/CONFIDENTIAL
5 *
6 * You may not use this file except in compliance with the terms and
7 * conditions set forth in the accompanying LICENSE.txt file.
8 *
9 * THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
10 * DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
11 * IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
12 * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
13 */
14
25#ifndef IOTMI_JOBS_HANDLER_H_
26#define IOTMI_JOBS_HANDLER_H_
27
28#include <stdbool.h>
29#include <stddef.h>
30#include <stdint.h>
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
39#define JOBS_HANDLER_JOBID_MAX_LENGTH 64U /* per AWS IoT API Reference */
40
73
113
153
157typedef struct iotmi_JobDocument {
161 char pJobId[JOBS_HANDLER_JOBID_MAX_LENGTH + 1]; /* +1 for null terminator */
162
167
174 const char* pJobDocument;
175
181
193
211 const iotmiJobsHandler_config_t* pConfig);
212
235 iotmi_JobData_t* pJobDocument, uint32_t timeoutMs);
236
252 iotmi_JobData_t* pJobDocument);
253
268
292 const char* pJobId, size_t jobIdLength, iotmi_JobCurrentStatus_t status,
293 const char* statusDetails, size_t statusDetailsLength);
294
305
306#ifdef __cplusplus
307}
308#endif
309
310#endif /* IOTMI_JOBS_HANDLER_H_ */
iotmi_JobCurrentStatus_t
Enumeration of possible job statuses.
Definition iotmi_jobs_handler.h:117
@ kJobCurrentStatusMax
The maximum value for job status.
Definition iotmi_jobs_handler.h:151
@ kJobInProgress
The job is currently being processed.
Definition iotmi_jobs_handler.h:131
@ kJobRejected
The job was rejected, possibly due to an error or invalid request.
Definition iotmi_jobs_handler.h:146
@ kJobFailed
The job processing failed.
Definition iotmi_jobs_handler.h:136
@ kJobCurrentStatusMin
The minimum value for job status.
Definition iotmi_jobs_handler.h:121
@ kJobSucceeded
The job processing succeeded.
Definition iotmi_jobs_handler.h:141
@ kJobQueued
The job is in the queue, waiting to be processed.
Definition iotmi_jobs_handler.h:126
JobsHandlerStatus_t iotmiJobsHandler_destroyJobDocument(iotmi_JobData_t *pJobDocument)
Destroy a job document.
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.
JobsHandlerStatus_t iotmiJobsHandler_getJobDocument(iotmi_JobData_t *pJobDocument, uint32_t timeoutMs)
Retrieve a job document from the internal queue.
JobsHandlerStatus_t
Return codes from jobs functions.
Definition iotmi_jobs_handler.h:77
@ kJobsHandlerTimeout
The function timed out.
Definition iotmi_jobs_handler.h:101
@ kJobsHandlerError
An unspecified error occurred in the function.
Definition iotmi_jobs_handler.h:86
@ kJobsHandlerBadParameter
A function parameter was NULL or has an illegal value.
Definition iotmi_jobs_handler.h:91
@ kJobsHandlerSyncQueueError
An error occurred while using the PAL Sync Queue.
Definition iotmi_jobs_handler.h:111
@ kJobsHandlerOutOfMemory
The function ran out of memory.
Definition iotmi_jobs_handler.h:96
@ kJobsHandlerMqttAdapterError
An error occurred while using the MQTT adapter.
Definition iotmi_jobs_handler.h:106
@ kJobsHandlerSuccess
The function completed successfully.
Definition iotmi_jobs_handler.h:81
struct iotmi_JobDocument iotmi_JobData_t
Structure representing a job document.
struct iotmiJobsHandler_config iotmiJobsHandler_config_t
Configuration structure for initializing the Jobs Handler.
bool iotmiJobsHandler_isInitialized()
Check if the Jobs Handler is initialized.
JobsHandlerStatus_t iotmiJobsHandler_start(const iotmiJobsHandler_config_t *pConfig)
Initialize the Jobs Handler.
void iotmiJobsHandler_stop(void)
Stop the Jobs Handler and release all resources.
#define JOBS_HANDLER_JOBID_MAX_LENGTH
Maximum length of a job ID for the AWS IoT Jobs Service.
Definition iotmi_jobs_handler.h:39
JobsHandlerStatus_t iotmiJobsHandler_pollJobDocument()
Poll for a job document from the IoT Jobs service.
Structure representing a job document.
Definition iotmi_jobs_handler.h:157
size_t jobDocumentLength
Length of the job document content.
Definition iotmi_jobs_handler.h:179
size_t jobIdLength
Length of the job ID string.
Definition iotmi_jobs_handler.h:166
char pJobId[JOBS_HANDLER_JOBID_MAX_LENGTH+1]
job ID string.
Definition iotmi_jobs_handler.h:161
const char * pJobDocument
Pointer to the job document content in JSON format.
Definition iotmi_jobs_handler.h:174
Configuration structure for initializing the Jobs Handler.
Definition iotmi_jobs_handler.h:44
uint32_t mqttSubscribeTimeoutMs
The timeout for MQTT subscribe operations in milliseconds.
Definition iotmi_jobs_handler.h:71
const char * pThingName
The Thing Name for the jobs operations.
Definition iotmi_jobs_handler.h:50
size_t jobsQueueSize
The queue size for holding pending job documents.
Definition iotmi_jobs_handler.h:57
uint32_t mqttPublishTimeoutMs
The timeout for MQTT publish operations in milliseconds.
Definition iotmi_jobs_handler.h:64