Sample code for Radio Access Technology
//--------------------------------------------------------------------------------------------------/*** Test: Radio Access Technology.**///--------------------------------------------------------------------------------------------------static void Testle_mrc_GetRat(){le_result_t res;le_mrc_Rat_t rat;res = le_mrc_GetRadioAccessTechInUse(&rat);LE_ASSERT(res == LE_OK);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", bitMask,((bitMask & LE_MRC_BITMASK_RAT_CDMA) ? 'Y' : 'N'),((bitMask & LE_MRC_BITMASK_RAT_GSM) ? '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(){le_mrc_RatBitMask_t bitMask = 0;le_mrc_RatBitMask_t bitMaskOrigin = 0;// Get the current rat preference.LE_ASSERT_OK(le_mrc_GetRatPreferences(&bitMaskOrigin));PrintRat(bitMaskOrigin);sleep(1);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);LE_ASSERT(LE_MRC_BITMASK_RAT_LTE == bitMask);}}LE_ASSERT_OK(le_mrc_SetRatPreferences(LE_MRC_BITMASK_RAT_GSM));sleep(1);LE_ASSERT_OK(le_mrc_GetRatPreferences(&bitMask));PrintRat(bitMask);LE_ASSERT(bitMask == LE_MRC_BITMASK_RAT_GSM);sleep(1);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));sleep(1);LE_ASSERT_OK(le_mrc_GetRatPreferences(&bitMask));PrintRat(bitMask);LE_ASSERT(bitMask == LE_MRC_BITMASK_RAT_CDMA);}LE_ASSERT_OK(le_mrc_SetRatPreferences(bitMaskOrigin));sleep(1);LE_ASSERT_OK(le_mrc_GetRatPreferences(&bitMask));PrintRat(bitMask);LE_ASSERT(bitMask == bitMaskOrigin);}