Sample code for Signal Quality

//--------------------------------------------------------------------------------------------------
/**
* Test: Network Registration State + Signal Quality.
*
*/
//--------------------------------------------------------------------------------------------------
static void Testle_mrc_GetStateAndQual
(
void
)
{
uint32_t quality;
 
res = le_mrc_GetNetRegState(&state);
LE_ASSERT(res == LE_OK);
 
res = le_mrc_GetSignalQual(&quality);
LE_ASSERT(res == LE_OK);
LE_ASSERT(quality<=5);
}
 
 
//--------------------------------------------------------------------------------------------------
/**
* Test: Get Signal Metrics.
*
*/
//--------------------------------------------------------------------------------------------------
static void Testle_mrc_GetSignalMetrics
(
void
)
{
int32_t rxLevel = 0;
uint32_t er = 0;
int32_t ecio = 0;
int32_t rscp = 0;
int32_t sinr = 0;
int32_t rsrq = 0;
int32_t rsrp = 0;
int32_t snr = 0;
int32_t io = 0;
 
LE_ASSERT(metricsRef != NULL);
 
rat = le_mrc_GetRatOfSignalMetrics(metricsRef);
LE_INFO("RAT of signal metrics is %d",rat);
switch(rat)
{
res = le_mrc_GetGsmSignalMetrics(metricsRef, &rxLevel, &er);
LE_ASSERT(res == LE_OK);
LE_INFO("GSM metrics rxLevel.%ddBm, er.%d", rxLevel, er);
break;
 
res = le_mrc_GetUmtsSignalMetrics(metricsRef, &rxLevel, &er, &ecio, &rscp, &sinr);
LE_ASSERT(res == LE_OK);
LE_INFO("UMTS/TD-SCDMA metrics rxLevel.%ddBm, er.%d, ecio.%010.1fdB,"
"rscp.%ddBm, sinr.%ddB", rxLevel, er, ((double)ecio/10), rscp, sinr);
break;
 
res = le_mrc_GetLteSignalMetrics(metricsRef, &rxLevel, &er, &rsrq, &rsrp, &snr);
LE_ASSERT(res == LE_OK);
LE_INFO("LTE metrics rxLevel.%ddBm, er.%d, rsrq.%010.1fdB, "
"rsrp.%010.1fdBm, snr.%010.1fdB",
rxLevel, er, ((double)rsrq/10), ((double)rsrp/10), ((double)snr/10));
break;
 
res = le_mrc_GetCdmaSignalMetrics(metricsRef, &rxLevel, &er, &ecio, &sinr, &io);
LE_ASSERT(res == LE_OK);
LE_INFO("CDMA metrics rxLevel.%ddBm, er.%d, ecio.%010.1fdB, "
"sinr.%ddB, io.%ddBm",
rxLevel, er, ((double)ecio/10), sinr, io);
break;
 
default:
LE_FATAL("Unknown RAT!");
break;
}
 
}