in source/cellular_3gpp_api.c [357:439]
static CellularPktStatus_t _parseTimeInCCLKResponse( char ** ppToken,
bool timeZoneSignNegative,
char ** ppTimeZoneResp,
CellularTime_t * pTimeInfo )
{
int32_t tempValue = 0;
CellularATError_t atCoreStatus = CELLULAR_AT_SUCCESS;
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
atCoreStatus = Cellular_ATStrtoi( *ppToken, 10, &tempValue );
if( atCoreStatus == CELLULAR_AT_SUCCESS )
{
if( ( tempValue >= 0 ) && ( tempValue <= ( int32_t ) UINT8_MAX ) )
{
pTimeInfo->hour = ( uint8_t ) tempValue;
}
else
{
LogError( ( "Error in Processing Hour. token %s", *ppToken ) );
atCoreStatus = CELLULAR_AT_ERROR;
}
}
if( atCoreStatus == CELLULAR_AT_SUCCESS )
{
/* Getting the next Token to process Minute in the CCLK AT Response. */
atCoreStatus = Cellular_ATGetSpecificNextTok( ppTimeZoneResp, ":", ppToken );
}
if( atCoreStatus == CELLULAR_AT_SUCCESS )
{
atCoreStatus = Cellular_ATStrtoi( *ppToken, 10, &tempValue );
if( atCoreStatus == CELLULAR_AT_SUCCESS )
{
if( ( tempValue >= 0 ) && ( tempValue <= ( int32_t ) UINT8_MAX ) )
{
pTimeInfo->minute = ( uint8_t ) tempValue;
}
else
{
LogError( ( "Error in Processing minute. Token %s", *ppToken ) );
atCoreStatus = CELLULAR_AT_ERROR;
}
}
}
if( atCoreStatus == CELLULAR_AT_SUCCESS )
{
/* Getting the next token to process Second in the CCLK AT Response.
* Get the next token based on the signedness of the Timezone. */
if( !timeZoneSignNegative )
{
atCoreStatus = Cellular_ATGetSpecificNextTok( ppTimeZoneResp, "+", ppToken );
}
else
{
atCoreStatus = Cellular_ATGetSpecificNextTok( ppTimeZoneResp, "-", ppToken );
}
}
if( atCoreStatus == CELLULAR_AT_SUCCESS )
{
atCoreStatus = Cellular_ATStrtoi( *ppToken, 10, &tempValue );
if( atCoreStatus == CELLULAR_AT_SUCCESS )
{
if( ( tempValue >= 0 ) && ( tempValue <= ( int32_t ) UINT8_MAX ) )
{
pTimeInfo->second = ( uint8_t ) tempValue;
}
else
{
LogError( ( "Error in Processing Second. Token %s", *ppToken ) );
atCoreStatus = CELLULAR_AT_ERROR;
}
}
}
pktStatus = _Cellular_TranslateAtCoreStatus( atCoreStatus );
return pktStatus;
}