in sim70x0/cellular_sim70x0_api.c [1476:1559]
static CellularPktStatus_t _Cellular_RecvFuncGetPsmSettings( CellularContext_t * pContext,
const CellularATCommandResponse_t * pAtResp,
void * pData,
uint16_t dataLen )
{
/*Handling: +CPSMS: <mode>,[<Requested_Periodic-RAU>],[<Requested_GPRS-READY-timer>],[<Requested_Periodic-TAU>],[<Requested_Active-Time>] */
char * pInputLine = NULL;
char * pToken = NULL;
uint8_t tokenIndex = 0;
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
CellularATError_t atCoreStatus = CELLULAR_AT_SUCCESS;
CellularPsmSettings_t * pPsmSettings = NULL;
if( pContext == NULL )
{
LogError( ( "GetPsmSettings: Invalid context" ) );
pktStatus = CELLULAR_PKT_STATUS_FAILURE;
}
else if( ( pAtResp == NULL ) || ( pAtResp->pItm == NULL ) ||
( pAtResp->pItm->pLine == NULL ) || ( pData == NULL ) || ( dataLen != sizeof( CellularPsmSettings_t ) ) )
{
LogError( ( "GetPsmSettings: Invalid param" ) );
pktStatus = CELLULAR_PKT_STATUS_BAD_PARAM;
}
else
{
pInputLine = pAtResp->pItm->pLine;
pPsmSettings = ( CellularPsmSettings_t * ) pData;
atCoreStatus = Cellular_ATRemovePrefix( &pInputLine );
if( atCoreStatus == CELLULAR_AT_SUCCESS )
{
atCoreStatus = Cellular_ATRemoveAllDoubleQuote( pInputLine );
}
if( atCoreStatus == CELLULAR_AT_SUCCESS )
{
atCoreStatus = Cellular_ATGetNextTok( &pInputLine, &pToken );
}
if( atCoreStatus == CELLULAR_AT_SUCCESS )
{
tokenIndex = 0;
while( pToken != NULL )
{
atCoreStatus = parseGetPsmToken( pToken, tokenIndex, pPsmSettings );
if( atCoreStatus != CELLULAR_AT_SUCCESS )
{
LogInfo( ( "parseGetPsmToken %s index %d failed", pToken, tokenIndex ) );
}
tokenIndex++;
if( *pInputLine == ',' )
{
*pInputLine = '\0';
pToken = pInputLine;
*pToken = '\0';
pInputLine = &pInputLine[ 1 ];
}
else if( Cellular_ATGetNextTok( &pInputLine, &pToken ) != CELLULAR_AT_SUCCESS )
{
break;
}
else
{
/* Empty Else MISRA 15.7 */
}
}
}
LogDebug( ( "PSM setting: mode: %d, RAU: %d, RDY_Timer: %d, TAU: %d, Active_time: %d",
pPsmSettings->mode,
pPsmSettings->periodicRauValue,
pPsmSettings->gprsReadyTimer,
pPsmSettings->periodicTauValue,
pPsmSettings->activeTimeValue ) );
pktStatus = _Cellular_TranslateAtCoreStatus( atCoreStatus );
}
return pktStatus;
}