View a markdown version of this page

Implemente o agente OTA - Integrações gerenciadas para AWS IoT Device Management

As traduções são geradas por tradução automática. Em caso de conflito entre o conteúdo da tradução e da versão original em inglês, a versão em inglês prevalecerá.

Implemente o agente OTA

Ao receber o documento de trabalho de integrações gerenciadas, você deve ter uma implementação de seu próprio agente OTA que processe o documento de trabalho, baixe atualizações e execute qualquer operação de instalação. O agente OTA precisa executar as seguintes etapas:

  1. Analise documentos de trabalho para URLs de firmware do Amazon S3.

  2. Baixe as atualizações de firmware por meio de HTTP.

  3. Verifique as assinaturas digitais.

  4. Instale atualizações validadas.

  5. Ligue iotmi\_JobsHandler\_updateJobStatus com SUCCESS ou FAILED status.

Quando seu dispositivo conclui com êxito a operação OTA, ele deve chamar a iotmi\_JobsHandler\_updateJobStatus API com o status de JobSucceeded Para relatar um trabalho bem-sucedido.

/** * @brief Enumeration of possible job statuses. */ typedef enum{ JobQueued, /** The job is in the queue, waiting to be processed. */ JobInProgress, /** The job is currently being processed. */ JobFailed, /** The job processing failed. */ JobSucceeded, /** The job processing succeeded. */ JobRejected /** The job was rejected, possibly due to an error or invalid request. */ } iotmi_JobCurrentStatus_t; /** * @brief Update the status of a job with optional status details. * * @param[in] pJobId Pointer to the job ID string. * @param[in] jobIdLength Length of the job ID string. * @param[in] status The new status of the job. * @param[in] statusDetails Pointer to a string containing additional details about the job status. * This can be a JSON-formatted string or NULL if no details are needed. * @param[in] statusDetailsLength Length of the status details string. Set to 0 if `statusDetails` is NULL. * * @return 0 on success, non-zero on failure. */ int iotmi_JobsHandler_updateJobStatus( const char * pJobId, size_t jobIdLength, iotmi_JobCurrentStatus_t status, const char * statusDetails, size_t statusDetailsLength );