@@ -256,6 +256,16 @@ STATIC bool activateImage( void );
256256 */
257257STATIC bool sendSuccessMessage ( void );
258258
259+ /**
260+ * @brief Print the OTA job document metadata.
261+ *
262+ * @param[in] jobId String containing the job ID.
263+ * @param[in] jobFields Pointer to the parameters extracted from the OTA job
264+ * document.
265+ */
266+ STATIC void printJobParams ( const char * jobId ,
267+ AfrOtaJobDocumentFields_t jobFields );
268+
259269/**
260270 * @brief Send the necessary message to request a job document.
261271 */
@@ -473,6 +483,40 @@ STATIC bool sendSuccessMessage( void )
473483 globalJobId [ 0 ] = 0U ;
474484}
475485
486+ STATIC void printJobParams ( const char * jobId ,
487+ AfrOtaJobDocumentFields_t jobFields )
488+ {
489+ char streamName [ jobFields .imageRefLen ];
490+ char filePath [ jobFields .filepathLen ];
491+ char certFile [ jobFields .certfileLen ];
492+ char sig [ jobFields .signatureLen ];
493+
494+ LogInfo ( ( "Extracted parameter: [jobid: %s]\n" , jobId ) );
495+
496+ /*
497+ * Strings in the jobFields structure are not null terminated so copy them
498+ * to a buffer and null terminate them for printing.
499+ */
500+ ( void ) memcpy ( streamName , jobFields .imageRef , jobFields .imageRefLen );
501+ streamName [ jobFields .imageRefLen ] = '\0' ;
502+ LogInfo ( ( "Extracted parameter: [streamname: %s]\n" , streamName ) );
503+
504+ ( void ) memcpy ( filePath , jobFields .filepath , jobFields .filepathLen );
505+ filePath [ jobFields .filepathLen ] = '\0' ;
506+ LogInfo ( ( "Extracted parameter: [filepath: %s]\n" , filePath ) );
507+
508+ LogInfo ( ( "Extracted parameter: [filesize: %u]\n" , jobFields .fileSize ) );
509+ LogInfo ( ( "Extracted parameter: [fileid: %u]\n" , jobFields .fileId ) );
510+
511+ ( void ) memcpy ( certFile , jobFields .certfile , jobFields .certfileLen );
512+ certFile [ jobFields .certfileLen ] = '\0' ;
513+ LogInfo ( ( "Extracted parameter: [certfile: %s]\n" , certFile ) );
514+
515+ ( void ) memcpy ( sig , jobFields .signature , jobFields .signatureLen );
516+ sig [ jobFields .signatureLen ] = '\0' ;
517+ LogInfo ( ( "Extracted parameter: [sig-sha256-rsa: %s]\n" , sig ) );
518+ }
519+
476520/* -------------------------------------------------------------------------- */
477521
478522/*
@@ -674,6 +718,8 @@ STATIC OtaPalJobDocProcessingResult_t receivedJobDocumentHandler( OtaJobEventDat
674718
675719 if ( handled )
676720 {
721+ printJobParams ( globalJobId , jobFields );
722+
677723 initMqttDownloader ( & jobFields );
678724
679725 /* AWS IoT core returns the signature in a PEM format. We need to
0 commit comments