Sample code for Radio Access Technology

//--------------------------------------------------------------------------------------------------
/**
* Test: Radio Access Technology.
*
*/
//--------------------------------------------------------------------------------------------------
static void Testle_mrc_GetRat
(
void
)
{
 
LE_ASSERT(res == LE_OK);
 
 
LE_INFO("le_mrc_GetRadioAccessTechInUse return rat 0x%02X",rat);
}
//--------------------------------------------------------------------------------------------------
/**
* Display bitmask RAT
*/
//--------------------------------------------------------------------------------------------------
static void PrintRat
(
)
{
if(LE_MRC_BITMASK_RAT_ALL != bitMask)
{
LE_INFO("Rat preferences %02X=> CDMA.%c GSM.%c LTE.%c UMTS.%c TD-SCDMA.%c", bitMask,
((bitMask & LE_MRC_BITMASK_RAT_CDMA) ? 'Y' : 'N'),
((bitMask & LE_MRC_BITMASK_RAT_GSM) ? 'Y' : 'N'),
((bitMask & LE_MRC_BITMASK_RAT_LTE) ? 'Y' : 'N'),
((bitMask & LE_MRC_BITMASK_RAT_UMTS) ? 'Y' : 'N'),
((bitMask & LE_MRC_BITMASK_RAT_TDSCDMA) ? 'Y' : 'N'));
}
else
{
LE_INFO("Rat preferences => LE_MRC_BITMASK_RAT_ALL");
}
}
//--------------------------------------------------------------------------------------------------
/**
* Test: rat preferences mode. Module must supported GSM and LTEs
*
* le_mrc_GetRatPreferences() API test
* le_mrc_SetRatPreferences() API test
*/
//--------------------------------------------------------------------------------------------------
static void Testle_mrc_RatPreferences
(
void
)
{
le_mrc_RatBitMask_t bitMask = 0;
le_mrc_RatBitMask_t bitMaskOrigin = 0;
 
// Get the current rat preference.
PrintRat(bitMaskOrigin);
 
res = le_mrc_SetRatPreferences(LE_MRC_BITMASK_RAT_LTE);
LE_ASSERT((LE_OK == res) || (LE_UNSUPPORTED == res));
 
if (LE_OK == res)
{
PrintRat(bitMask);
 
if ((LE_MRC_BITMASK_RAT_LTE != bitMask))
{
if ((LE_MRC_BITMASK_RAT_LTE | LE_MRC_BITMASK_RAT_GSM) == bitMask)
{
LE_WARN("LTE only not supported");
}
else
{
le_mrc_SetRatPreferences(bitMaskOrigin);
}
}
}
 
LE_ASSERT((LE_OK == res) || (LE_UNSUPPORTED == res));
 
if (LE_OK == res)
{
PrintRat(bitMask);
 
}
 
LE_ASSERT_OK(le_mrc_SetRatPreferences(LE_MRC_BITMASK_RAT_GSM));
 
PrintRat(bitMask);
LE_ASSERT(LE_MRC_BITMASK_RAT_GSM == bitMask);
 
LE_ASSERT_OK(le_mrc_SetRatPreferences(LE_MRC_BITMASK_RAT_GSM | LE_MRC_BITMASK_RAT_UMTS));
 
PrintRat(bitMask);
LE_ASSERT((LE_MRC_BITMASK_RAT_GSM | LE_MRC_BITMASK_RAT_UMTS) == bitMask);
 
 
PrintRat(bitMask);
 
if (bitMaskOrigin & LE_MRC_BITMASK_RAT_CDMA)
{
LE_ASSERT_OK(le_mrc_SetRatPreferences(LE_MRC_BITMASK_RAT_CDMA));
 
PrintRat(bitMask);
LE_ASSERT(LE_MRC_BITMASK_RAT_CDMA == bitMask);
}
 
LE_ASSERT_OK(le_mrc_SetRatPreferences(LE_MRC_BITMASK_RAT_UMTS));
 
PrintRat(bitMask);
LE_ASSERT(LE_MRC_BITMASK_RAT_UMTS == bitMask);
 
 
PrintRat(bitMask);
LE_ASSERT(bitMaskOrigin == bitMask);
}