Skip to content

Commit 59bfdf4

Browse files
authored
[Cellular Library] Fix missing error token table setting. (#30)
* [Cellular Library] Fix missing error token table setting. * [Cellular Library] Update memory size and fix error handling
1 parent f0260f5 commit 59bfdf4

2 files changed

Lines changed: 29 additions & 22 deletions

File tree

common/src/cellular_pktio.c

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -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

docs/doxygen/include/size_table.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@
4040
<tr>
4141
<td>cellular_pktio.c</td>
4242
<td><center>1.8K</center></td>
43-
<td><center>1.5K</center></td>
43+
<td><center>1.6K</center></td>
4444
</tr>
4545
<tr>
4646
<td><b>Total estimates</b></td>
4747
<td><b><center>13.9K</center></b></td>
48-
<td><b><center>12.3K</center></b></td>
48+
<td><b><center>12.4K</center></b></td>
4949
</tr>
5050
</table>

0 commit comments

Comments
 (0)