@@ -268,6 +268,16 @@ STATIC bool activateImage( void );
268268 */
269269STATIC bool sendSuccessMessage ( void );
270270
271+ /**
272+ * @brief Print the OTA job document metadata.
273+ *
274+ * @param[in] jobId String containing the job ID.
275+ * @param[in] jobFields Pointer to the parameters extracted from the OTA job
276+ * document.
277+ */
278+ STATIC void printJobParams ( const char * jobId ,
279+ AfrOtaJobDocumentFields_t jobFields );
280+
271281/**
272282 * @brief Send the necessary message to request a job document.
273283 */
@@ -485,6 +495,40 @@ STATIC bool sendSuccessMessage( void )
485495 globalJobId [ 0 ] = 0U ;
486496}
487497
498+ STATIC void printJobParams ( const char * jobId ,
499+ AfrOtaJobDocumentFields_t jobFields )
500+ {
501+ char streamName [ jobFields .imageRefLen ];
502+ char filePath [ jobFields .filepathLen ];
503+ char certFile [ jobFields .certfileLen ];
504+ char sig [ jobFields .signatureLen ];
505+
506+ LogInfo ( ( "Extracted parameter: [jobid: %s]\n" , jobId ) );
507+
508+ /*
509+ * Strings in the jobFields structure are not null terminated so copy them
510+ * to a buffer and null terminate them for printing.
511+ */
512+ ( void ) memcpy ( streamName , jobFields .imageRef , jobFields .imageRefLen );
513+ streamName [ jobFields .imageRefLen ] = '\0' ;
514+ LogInfo ( ( "Extracted parameter: [streamname: %s]\n" , streamName ) );
515+
516+ ( void ) memcpy ( filePath , jobFields .filepath , jobFields .filepathLen );
517+ filePath [ jobFields .filepathLen ] = '\0' ;
518+ LogInfo ( ( "Extracted parameter: [filepath: %s]\n" , filePath ) );
519+
520+ LogInfo ( ( "Extracted parameter: [filesize: %u]\n" , jobFields .fileSize ) );
521+ LogInfo ( ( "Extracted parameter: [fileid: %u]\n" , jobFields .fileId ) );
522+
523+ ( void ) memcpy ( certFile , jobFields .certfile , jobFields .certfileLen );
524+ certFile [ jobFields .certfileLen ] = '\0' ;
525+ LogInfo ( ( "Extracted parameter: [certfile: %s]\n" , certFile ) );
526+
527+ ( void ) memcpy ( sig , jobFields .signature , jobFields .signatureLen );
528+ sig [ jobFields .signatureLen ] = '\0' ;
529+ LogInfo ( ( "Extracted parameter: [sig-sha256-rsa: %s]\n" , sig ) );
530+ }
531+
488532/* -------------------------------------------------------------------------- */
489533
490534/*
@@ -686,6 +730,8 @@ STATIC OtaPalJobDocProcessingResult_t receivedJobDocumentHandler( OtaJobEventDat
686730
687731 if ( handled )
688732 {
733+ printJobParams ( globalJobId , jobFields );
734+
689735 initMqttDownloader ( & jobFields );
690736
691737 /* AWS IoT core returns the signature in a PEM format. We need to
0 commit comments