Sample code for Radio Configuration Preferences

//--------------------------------------------------------------------------------------------------
/**
* Test: 2G/3G band Preferences mode.
*
* le_mrc_GetBandPreferences() API test
* le_mrc_SetBandPreferences() API test
*
*/
//--------------------------------------------------------------------------------------------------
static void Testle_mrc_BandPreferences
(
void
)
{
le_mrc_BandBitMask_t bandMask = 0;
le_mrc_BandBitMask_t bandMaskOrigin = 0;
 
#define PRINT_BAND(x) LE_INFO("Band preferences 0x%016"PRIX64, x);
 
// Get the current rat preference.
res = le_mrc_GetBandPreferences(&bandMaskOrigin);
LE_ASSERT(res == LE_OK);
PRINT_BAND(bandMaskOrigin);
 
LE_WARN_IF(( bandMaskOrigin == 0), "le_mrc_GetBandPreferences bandMaskOrigin = 0");
 
if (bandMaskOrigin != 0)
{
res = le_mrc_SetBandPreferences(bandMaskOrigin);
LE_ASSERT(res == LE_OK);
 
// Get the current rat preference.
res = le_mrc_GetBandPreferences(&bandMask);
PRINT_BAND(bandMask);
LE_ASSERT(res == LE_OK);
LE_ASSERT(bandMask == bandMaskOrigin);
}
}
 
 
//--------------------------------------------------------------------------------------------------
/**
* Test: Lte band Preferences mode.
*
* le_mrc_GetLteBandPreferences() API test
* le_mrc_SetLteBandPreferences() API test
*
*/
//--------------------------------------------------------------------------------------------------
static void Testle_mrc_LteBandPreferences
(
void
)
{
le_mrc_LteBandBitMask_t bandMaskOrigin = 0;
 
#define PRINT_BANDLTE(x) LE_INFO("LTE Band MRC preferences 0x%016X", x);
 
// Get the current rat preference.
res = le_mrc_GetLteBandPreferences(&bandMaskOrigin);
LE_ASSERT(res == LE_OK);
PRINT_BANDLTE(bandMaskOrigin);
 
LE_WARN_IF(( bandMaskOrigin == 0), "Testle_mrc_LteBandPreferences bandMaskOrigin = 0");
 
if (bandMaskOrigin != 0)
{
res = le_mrc_SetLteBandPreferences(bandMaskOrigin);
LE_ASSERT(res == LE_OK);
 
// Get the current rat preference.
res = le_mrc_GetLteBandPreferences(&bandMask);
PRINT_BANDLTE(bandMask);
LE_ASSERT(res == LE_OK);
LE_ASSERT(bandMask == bandMaskOrigin);
}
}
 
 
//--------------------------------------------------------------------------------------------------
/**
* Test: TD-SCDMA band Preferences mode.
*
* le_mrc_GetTdScdmaBandPreferences() API test
* le_mrc_SetTdScdmaBandPreferences() API test
*
*/
//--------------------------------------------------------------------------------------------------
static void Testle_mrc_TdScdmaBandPreferences
(
void
)
{
le_mrc_TdScdmaBandBitMask_t bandMaskOrigin = 0;
 
#define PRINT_BANDCDMA(x) LE_INFO("TD-SCDMA Band preferences 0x%016X", x);
 
// Get the current rat preference.
res = le_mrc_GetTdScdmaBandPreferences(&bandMaskOrigin);
LE_ASSERT((LE_OK == res) || (LE_UNSUPPORTED == res));
 
if (LE_OK == res)
{
// The TD-SCDMA is supported
LE_ASSERT(0 != bandMaskOrigin);
PRINT_BANDCDMA(bandMaskOrigin);
 
// Get the current rat preference.
PRINT_BANDCDMA(bandMask);
LE_ASSERT(bandMask == bandMaskOrigin);
}
else
{
// Try to set a Band when TD-SCDMA is not supported
LE_MRC_BITMASK_TDSCDMA_BAND_A |
LE_MRC_BITMASK_TDSCDMA_BAND_F));
 
// Try to get the TD-SCDMA Band Preferences when TD-SCDMA is not supported
}
}