@@ -302,15 +302,20 @@ static CellularPktStatus_t _Cellular_ProcessLine( const CellularContext_t * pCon
302302 CellularPktStatus_t pkStatus = CELLULAR_PKT_STATUS_FAILURE ;
303303 bool result = false;
304304 const char * const * pTokenSuccessTable = NULL ;
305+ const char * const * pTokenErrorTable = NULL ;
305306 const char * const * pTokenExtraTable = NULL ;
306307 uint32_t tokenSuccessTableSize = 0 ;
308+ uint32_t tokenErrorTableSize = 0 ;
307309 uint32_t tokenExtraTableSize = 0 ;
310+ int32_t flagkExtraTokenTableCheck = 0 ;
308311
309312 if ( ( pContext -> tokenTable .pCellularSrcTokenErrorTable != NULL ) &&
310313 ( pContext -> tokenTable .pCellularSrcTokenSuccessTable != NULL ) )
311314 {
312315 pTokenSuccessTable = pContext -> tokenTable .pCellularSrcTokenSuccessTable ;
313316 tokenSuccessTableSize = pContext -> tokenTable .cellularSrcTokenSuccessTableSize ;
317+ pTokenErrorTable = pContext -> tokenTable .pCellularSrcTokenErrorTable ;
318+ tokenErrorTableSize = pContext -> tokenTable .cellularSrcTokenErrorTableSize ;
314319 pTokenExtraTable = pContext -> tokenTable .pCellularSrcExtraTokenSuccessTable ;
315320 tokenExtraTableSize = pContext -> tokenTable .cellularSrcExtraTokenSuccessTableSize ;
316321
@@ -322,38 +327,40 @@ static CellularPktStatus_t _Cellular_ProcessLine( const CellularContext_t * pCon
322327
323328 if ( result == true )
324329 {
325- pResp -> status = true;
326- pkStatus = CELLULAR_PKT_STATUS_OK ;
327- CellularLogDebug ( "Final AT response is SUCCESS [%s] in extra table" , pLine );
330+ flagkExtraTokenTableCheck = 1 ;
328331 }
329-
330- if ( result != true )
332+ else
331333 {
332334 ( void ) Cellular_ATcheckErrorCode ( pLine , pTokenSuccessTable ,
333335 tokenSuccessTableSize , & result );
334-
335- if ( result == true )
336- {
337- pResp -> status = true;
338- pkStatus = CELLULAR_PKT_STATUS_OK ;
339- CellularLogDebug ( "Final AT response is SUCCESS [%s]" , pLine );
340- }
341336 }
342337
343- if ( result ! = true )
338+ if ( result = = true )
344339 {
345- pResp -> status = false ;
340+ pResp -> status = true ;
346341 pkStatus = CELLULAR_PKT_STATUS_OK ;
347- CellularLogError ( "Modem return ERROR: line %s, cmd : %s, respPrefix %s, status: %d" ,
348- ( pContext -> pCurrentCmd != NULL ? pContext -> pCurrentCmd : "NULL" ),
349- pLine ,
350- ( pRespPrefix != NULL ? pRespPrefix : "NULL" ),
351- pkStatus );
342+ CellularLogDebug ( "Final AT response is SUCCESS [%s] in %s table" , pLine , flagkExtraTokenTableCheck == 1 ? "extra" : "success" );
352343 }
353344
354345 if ( result != true )
355346 {
356- pkStatus = _processIntermediateResponse ( pLine , pResp , atType , pRespPrefix );
347+ ( void ) Cellular_ATcheckErrorCode ( pLine , pTokenErrorTable ,
348+ tokenErrorTableSize , & result );
349+
350+ if ( result == true )
351+ {
352+ pResp -> status = false;
353+ pkStatus = CELLULAR_PKT_STATUS_OK ;
354+ CellularLogError ( "Modem return ERROR: line %s, cmd : %s, respPrefix %s, status: %d" ,
355+ ( pContext -> pCurrentCmd != NULL ? pContext -> pCurrentCmd : "NULL" ),
356+ pLine ,
357+ ( pRespPrefix != NULL ? pRespPrefix : "NULL" ),
358+ pkStatus );
359+ }
360+ else
361+ {
362+ pkStatus = _processIntermediateResponse ( pLine , pResp , atType , pRespPrefix );
363+ }
357364 }
358365 }
359366
0 commit comments