Sample code for Neighboring Cells Information

//--------------------------------------------------------------------------------------------------
/**
* Test: Neighbor Cells Information.
*
*/
//--------------------------------------------------------------------------------------------------
static void Testle_mrc_GetNeighboringCellsInfo
(
void
)
{
le_mrc_NeighborCellsRef_t ngbrRef;
le_mrc_CellInfoRef_t cellRef;
uint32_t i = 0;
uint32_t cid = 0;
uint32_t lac = 0;
int32_t rxLevel = 0;
le_mrc_Rat_t rat = 0;
int32_t ecio = 0;
int32_t intraRsrp = 0;
int32_t intraRsrq = 0;
int32_t interRsrp = 0;
int32_t interRsrq = 0;
 
LE_INFO("Start Testle_mrc_GetNeighborCellsInfo");
 
if (ngbrRef)
{
i = 0;
 
cellRef = le_mrc_GetFirstNeighborCellInfo(ngbrRef);
LE_ASSERT(cellRef);
cid = le_mrc_GetNeighborCellId(cellRef);
rxLevel = le_mrc_GetNeighborCellRxLevel(cellRef);
rat = le_mrc_GetNeighborCellRat(cellRef);
LE_INFO("Cell #%d, cid.%d, lac.%d, rxLevel.%ddBm, RAT.%d", i, cid, lac, rxLevel, rat);
// Specific values for UMTS and LTE
switch(rat)
{
case LE_MRC_RAT_UMTS:
LE_INFO("Cell #%d, UMTS EcIo.%010.1fdB", i, ((double)ecio/10));
break;
 
case LE_MRC_RAT_LTE:
res = le_mrc_GetNeighborCellLteIntraFreq(cellRef, &intraRsrq, &intraRsrp);
LE_ASSERT(res == LE_OK);
res = le_mrc_GetNeighborCellLteInterFreq(cellRef, &interRsrq, &interRsrp);
LE_ASSERT(res == LE_OK);
 
LE_INFO("Cell #%d, LTE Intra-RSRQ.%010.1fdB, Intra-RSRP.%010.1fdBm, "
"Inter-RSRQ.%010.1fdB, Inter-RSRP.%010.1fdBm",
i, ((double)intraRsrq/10), ((double)intraRsrp/10),
((double)interRsrq/10), ((double)interRsrp/10));
break;
 
default:
LE_INFO("Nothing more to display");
break;
}
 
while ((cellRef = le_mrc_GetNextNeighborCellInfo(ngbrRef)) != NULL)
{
i++;
cid = le_mrc_GetNeighborCellId(cellRef);
rxLevel = le_mrc_GetNeighborCellRxLevel(cellRef);
rat = le_mrc_GetNeighborCellRat(cellRef);
LE_INFO("Cell #%d, cid.%d, lac.%d, rxLevel.%ddBm, RAT.%d", i, cid, lac, rxLevel, rat);
// Specific values for UMTS and LTE
switch(rat)
{
case LE_MRC_RAT_UMTS:
LE_INFO("Cell #%d, UMTS EcIo.%010.1fdB", i, ((double)ecio/10));
break;
 
case LE_MRC_RAT_LTE:
res = le_mrc_GetNeighborCellLteIntraFreq(cellRef, &intraRsrq, &intraRsrp);
LE_ASSERT(res == LE_OK);
res = le_mrc_GetNeighborCellLteInterFreq(cellRef, &interRsrq, &interRsrp);
LE_ASSERT(res == LE_OK);
 
LE_INFO("Cell #%d, LTE Intra-RSRQ.%010.1fdB, Intra-RSRP.%010.1fdBm, "
"Inter-RSRQ.%010.1fdB, Inter-RSRP.%010.1fdBm",
i, ((double)intraRsrq/10), ((double)intraRsrp/10),
((double)interRsrq/10), ((double)interRsrp/10));
break;
 
default:
LE_INFO("Nothing more to display");
break;
}
}
 
}
}