Sample code for Radio Access Technology
//--------------------------------------------------------------------------------------------------/*** Test: Radio Access Technology.**///--------------------------------------------------------------------------------------------------static void Testle_mrc_GetRat(void){le_result_t res;le_mrc_Rat_t rat;res = le_mrc_GetRadioAccessTechInUse(&rat);LE_INFO("le_mrc_GetRadioAccessTechInUse return rat 0x%02X",rat);}
//--------------------------------------------------------------------------------------------------/*** Display bitmask RAT*///--------------------------------------------------------------------------------------------------static void PrintRat(le_mrc_RatBitMask_t bitMask){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'),}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;le_result_t res;// Get the current rat preference.LE_ASSERT_OK(le_mrc_GetRatPreferences(&bitMaskOrigin));PrintRat(bitMaskOrigin);res = le_mrc_SetRatPreferences(LE_MRC_BITMASK_RAT_LTE);if (LE_OK == res){LE_ASSERT_OK(le_mrc_GetRatPreferences(&bitMask));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);}}}if (LE_OK == res){LE_ASSERT_OK(le_mrc_GetRatPreferences(&bitMask));PrintRat(bitMask);LE_ASSERT(LE_MRC_BITMASK_RAT_TDSCDMA == bitMask);}LE_ASSERT_OK(le_mrc_SetRatPreferences(LE_MRC_BITMASK_RAT_GSM));LE_ASSERT_OK(le_mrc_GetRatPreferences(&bitMask));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));LE_ASSERT_OK(le_mrc_GetRatPreferences(&bitMask));PrintRat(bitMask);LE_ASSERT((LE_MRC_BITMASK_RAT_GSM | LE_MRC_BITMASK_RAT_UMTS) == bitMask);LE_ASSERT_OK(le_mrc_GetRatPreferences(&bitMask));PrintRat(bitMask);LE_ASSERT(LE_MRC_BITMASK_RAT_ALL == bitMask);if (bitMaskOrigin & LE_MRC_BITMASK_RAT_CDMA){LE_ASSERT_OK(le_mrc_SetRatPreferences(LE_MRC_BITMASK_RAT_CDMA));LE_ASSERT_OK(le_mrc_GetRatPreferences(&bitMask));PrintRat(bitMask);LE_ASSERT(LE_MRC_BITMASK_RAT_CDMA == bitMask);}LE_ASSERT_OK(le_mrc_SetRatPreferences(LE_MRC_BITMASK_RAT_UMTS));LE_ASSERT_OK(le_mrc_GetRatPreferences(&bitMask));PrintRat(bitMask);LE_ASSERT(LE_MRC_BITMASK_RAT_UMTS == bitMask);LE_ASSERT_OK(le_mrc_SetRatPreferences(bitMaskOrigin));LE_ASSERT_OK(le_mrc_GetRatPreferences(&bitMask));PrintRat(bitMask);LE_ASSERT(bitMaskOrigin == bitMask);}