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);if (res == LE_OK){}LE_INFO("le_mrc_GetRadioAccessTechInUse return rat 0x%02X",rat);}
//--------------------------------------------------------------------------------------------------/*** 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_result_t res;le_mrc_RatBitMask_t bitMask = 0;le_mrc_RatBitMask_t bitMaskOrigin = 0;#define PRINT_RAT(x) LE_INFO("Rat preferences %02X=> CDMA.%c GSM.%c LTE.%c UMTS.%c", x,\( (x & LE_MRC_BITMASK_RAT_CDMA) ? 'Y' : 'N'),\( (x & LE_MRC_BITMASK_RAT_GSM) ? 'Y' : 'N'),\( (x & LE_MRC_BITMASK_RAT_LTE) ? 'Y' : 'N'),\( (x & LE_MRC_BITMASK_RAT_UMTS) ? 'Y' : 'N') );// Get the current rat preference.res = le_mrc_GetRatPreferences(&bitMaskOrigin);LE_ASSERT(res == LE_OK);if (LE_MRC_BITMASK_RAT_ALL == bitMaskOrigin){LE_INFO("Rat preferences %02X=> LE_MRC_BITMASK_RAT_ALL", bitMaskOrigin);}else{PRINT_RAT(bitMaskOrigin);}LE_ASSERT(res == LE_OK);res = le_mrc_GetRatPreferences(&bitMask);if (LE_MRC_BITMASK_RAT_ALL == bitMaskOrigin){LE_INFO("Rat preferences %02X=> LE_MRC_BITMASK_RAT_ALL", bitMaskOrigin);}else{PRINT_RAT(bitMaskOrigin);}LE_ASSERT(res == LE_OK);LE_ASSERT(bitMask == LE_MRC_BITMASK_RAT_LTE);res = le_mrc_SetRatPreferences(LE_MRC_BITMASK_RAT_GSM);LE_ASSERT(res == LE_OK);res = le_mrc_GetRatPreferences(&bitMask);if (LE_MRC_BITMASK_RAT_ALL == bitMaskOrigin){LE_INFO("Rat preferences %02X=> LE_MRC_BITMASK_RAT_ALL", bitMaskOrigin);}else{PRINT_RAT(bitMaskOrigin);}LE_ASSERT(res == LE_OK);LE_ASSERT(bitMask == LE_MRC_BITMASK_RAT_GSM);if (bitMaskOrigin & LE_MRC_BITMASK_RAT_UMTS){res = le_mrc_SetRatPreferences(LE_MRC_BITMASK_RAT_UMTS);LE_ASSERT(res == LE_OK);res = le_mrc_GetRatPreferences(&bitMask);if (LE_MRC_BITMASK_RAT_ALL == bitMaskOrigin){LE_INFO("Rat preferences %02X=> LE_MRC_BITMASK_RAT_ALL", bitMaskOrigin);}else{PRINT_RAT(bitMaskOrigin);}LE_ASSERT(res == LE_OK);LE_ASSERT(bitMask == LE_MRC_BITMASK_RAT_UMTS);}LE_ASSERT(res == LE_OK);res = le_mrc_GetRatPreferences(&bitMask);if (LE_MRC_BITMASK_RAT_ALL == bitMaskOrigin){LE_INFO("Rat preferences %02X=> LE_MRC_BITMASK_RAT_ALL", bitMaskOrigin);}else{PRINT_RAT(bitMaskOrigin);}LE_ASSERT(res == LE_OK);if (bitMaskOrigin & LE_MRC_BITMASK_RAT_CDMA){res = le_mrc_SetRatPreferences(LE_MRC_BITMASK_RAT_CDMA);LE_ASSERT(res == LE_OK);res = le_mrc_GetRatPreferences(&bitMask);if (LE_MRC_BITMASK_RAT_ALL == bitMaskOrigin){LE_INFO("Rat preferences %02X=> LE_MRC_BITMASK_RAT_ALL", bitMaskOrigin);}else{PRINT_RAT(bitMaskOrigin);}LE_ASSERT(res == LE_OK);LE_ASSERT(bitMask == LE_MRC_BITMASK_RAT_CDMA);}res = le_mrc_SetRatPreferences(bitMaskOrigin);LE_ASSERT(res == LE_OK);res = le_mrc_GetRatPreferences(&bitMask);if (LE_MRC_BITMASK_RAT_ALL == bitMaskOrigin){LE_INFO("Rat preferences %02X=> LE_MRC_BITMASK_RAT_ALL", bitMaskOrigin);}else{PRINT_RAT(bitMaskOrigin);}LE_ASSERT(res == LE_OK);LE_ASSERT(bitMask == bitMaskOrigin);}