api: new 5G mode
This commit is contained in:
@@ -243,6 +243,7 @@ typedef enum { /*< underscore_name=mm_modem_access_technology >*/
|
||||
* @MM_MODEM_MODE_2G: GPRS, EDGE.
|
||||
* @MM_MODEM_MODE_3G: UMTS, HSxPA.
|
||||
* @MM_MODEM_MODE_4G: LTE.
|
||||
* @MM_MODEM_MODE_5G: 5GNR. Since 1.14.
|
||||
* @MM_MODEM_MODE_ANY: Any mode can be used (only this value allowed for POTS modems).
|
||||
*
|
||||
* Bitfield to indicate which access modes are supported, allowed or
|
||||
@@ -256,6 +257,7 @@ typedef enum { /*< underscore_name=mm_modem_mode >*/
|
||||
MM_MODEM_MODE_2G = 1 << 1,
|
||||
MM_MODEM_MODE_3G = 1 << 2,
|
||||
MM_MODEM_MODE_4G = 1 << 3,
|
||||
MM_MODEM_MODE_5G = 1 << 4,
|
||||
MM_MODEM_MODE_ANY = 0xFFFFFFFF
|
||||
} MMModemMode;
|
||||
|
||||
|
@@ -5515,6 +5515,22 @@ mm_iface_modem_is_4g_only (MMIfaceModem *self)
|
||||
FALSE);
|
||||
}
|
||||
|
||||
gboolean
|
||||
mm_iface_modem_is_5g (MMIfaceModem *self)
|
||||
{
|
||||
return find_supported_mode (self, MM_MODEM_MODE_5G, NULL);
|
||||
}
|
||||
|
||||
gboolean
|
||||
mm_iface_modem_is_5g_only (MMIfaceModem *self)
|
||||
{
|
||||
gboolean only;
|
||||
|
||||
return (find_supported_mode (self, MM_MODEM_MODE_5G, &only) ?
|
||||
only :
|
||||
FALSE);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
MMModemCapability
|
||||
|
@@ -402,6 +402,8 @@ gboolean mm_iface_modem_is_3g (MMIfaceModem *self);
|
||||
gboolean mm_iface_modem_is_3g_only (MMIfaceModem *self);
|
||||
gboolean mm_iface_modem_is_4g (MMIfaceModem *self);
|
||||
gboolean mm_iface_modem_is_4g_only (MMIfaceModem *self);
|
||||
gboolean mm_iface_modem_is_5g (MMIfaceModem *self);
|
||||
gboolean mm_iface_modem_is_5g_only (MMIfaceModem *self);
|
||||
|
||||
/* Helpers to query properties */
|
||||
const gchar *mm_iface_modem_get_model (MMIfaceModem *self);
|
||||
|
@@ -975,6 +975,9 @@ mm_modem_mode_from_qmi_rat_mode_preference (QmiNasRatModePreference qmi)
|
||||
if (qmi & QMI_NAS_RAT_MODE_PREFERENCE_LTE)
|
||||
mode |= MM_MODEM_MODE_4G;
|
||||
|
||||
if (qmi & QMI_NAS_RAT_MODE_PREFERENCE_5GNR)
|
||||
mode |= MM_MODEM_MODE_5G;
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
@@ -1002,6 +1005,9 @@ mm_modem_mode_to_qmi_rat_mode_preference (MMModemMode mode,
|
||||
|
||||
if (mode & MM_MODEM_MODE_4G)
|
||||
pref |= QMI_NAS_RAT_MODE_PREFERENCE_LTE;
|
||||
|
||||
if (mode & MM_MODEM_MODE_5G)
|
||||
pref |= QMI_NAS_RAT_MODE_PREFERENCE_5GNR;
|
||||
}
|
||||
|
||||
return pref;
|
||||
@@ -1107,6 +1113,14 @@ mm_modem_mode_to_qmi_acquisition_order_preference (MMModemMode allowed,
|
||||
|
||||
array = g_array_new (FALSE, FALSE, sizeof (QmiNasRadioInterface));
|
||||
|
||||
if (allowed & MM_MODEM_MODE_5G) {
|
||||
value = QMI_NAS_RADIO_INTERFACE_5GNR;
|
||||
if (preferred == MM_MODEM_MODE_5G)
|
||||
g_array_prepend_val (array, value);
|
||||
else
|
||||
g_array_append_val (array, value);
|
||||
}
|
||||
|
||||
if (allowed & MM_MODEM_MODE_4G) {
|
||||
value = QMI_NAS_RADIO_INTERFACE_LTE;
|
||||
if (preferred == MM_MODEM_MODE_4G)
|
||||
@@ -1300,6 +1314,7 @@ mm_modem_mode_to_qmi_gsm_wcdma_acquisition_order_preference (MMModemMode mode,
|
||||
return QMI_NAS_GSM_WCDMA_ACQUISITION_ORDER_PREFERENCE_AUTOMATIC;
|
||||
case MM_MODEM_MODE_CS:
|
||||
case MM_MODEM_MODE_4G:
|
||||
case MM_MODEM_MODE_5G:
|
||||
case MM_MODEM_MODE_ANY:
|
||||
default:
|
||||
break;
|
||||
|
@@ -1047,22 +1047,38 @@ typedef struct {
|
||||
MMModemMode mode;
|
||||
} Ws46Mode;
|
||||
|
||||
/* 3GPP TS 27.007 r14, section 5.9: select wireless network +WS46 */
|
||||
/* 3GPP TS 27.007 v16.3.0, section 5.9: select wireless network +WS46 */
|
||||
static const Ws46Mode ws46_modes[] = {
|
||||
/* GSM Digital Cellular Systems (GERAN only) */
|
||||
{ 12, MM_MODEM_MODE_2G },
|
||||
/* UTRAN only */
|
||||
{ 22, MM_MODEM_MODE_3G },
|
||||
/* 3GPP Systems (GERAN, UTRAN and E-UTRAN) */
|
||||
{ 25, MM_MODEM_MODE_ANY },
|
||||
{ 25, MM_MODEM_MODE_2G | MM_MODEM_MODE_3G | MM_MODEM_MODE_4G },
|
||||
/* E-UTRAN only */
|
||||
{ 28, MM_MODEM_MODE_4G },
|
||||
/* GERAN and UTRAN */
|
||||
{ 29, MM_MODEM_MODE_2G | MM_MODEM_MODE_3G },
|
||||
/* GERAN and E-UTRAN */
|
||||
{ 30, MM_MODEM_MODE_2G | MM_MODEM_MODE_4G },
|
||||
/* UERAN and E-UTRAN */
|
||||
/* UTRAN and E-UTRAN */
|
||||
{ 31, MM_MODEM_MODE_3G | MM_MODEM_MODE_4G },
|
||||
/* GERAN, UTRAN, E-UTRAN and NG-RAN */
|
||||
{ 35, MM_MODEM_MODE_2G | MM_MODEM_MODE_3G | MM_MODEM_MODE_4G | MM_MODEM_MODE_5G },
|
||||
/* NG-RAN only */
|
||||
{ 36, MM_MODEM_MODE_5G },
|
||||
/* E-UTRAN and NG-RAN */
|
||||
{ 37, MM_MODEM_MODE_4G | MM_MODEM_MODE_5G },
|
||||
/* UTRAN, E-UTRAN and NG-RAN */
|
||||
{ 38, MM_MODEM_MODE_3G | MM_MODEM_MODE_4G | MM_MODEM_MODE_5G },
|
||||
/* GERAN, E-UTRAN and NG-RAN */
|
||||
{ 39, MM_MODEM_MODE_2G | MM_MODEM_MODE_4G | MM_MODEM_MODE_5G },
|
||||
/* UTRAN and NG-RAN */
|
||||
{ 40, MM_MODEM_MODE_3G | MM_MODEM_MODE_5G },
|
||||
/* GERAN, UTRAN and NG-RAN */
|
||||
{ 41, MM_MODEM_MODE_2G | MM_MODEM_MODE_3G | MM_MODEM_MODE_5G },
|
||||
/* GERAN and NG-RAN */
|
||||
{ 42, MM_MODEM_MODE_2G | MM_MODEM_MODE_5G },
|
||||
};
|
||||
|
||||
GArray *
|
||||
@@ -1078,6 +1094,7 @@ mm_3gpp_parse_ws46_test_response (const gchar *response,
|
||||
guint val;
|
||||
guint i;
|
||||
guint j;
|
||||
gboolean supported_5g = FALSE;
|
||||
gboolean supported_4g = FALSE;
|
||||
gboolean supported_3g = FALSE;
|
||||
gboolean supported_2g = FALSE;
|
||||
@@ -1109,14 +1126,14 @@ mm_3gpp_parse_ws46_test_response (const gchar *response,
|
||||
|
||||
for (j = 0; j < G_N_ELEMENTS (ws46_modes); j++) {
|
||||
if (ws46_modes[j].ws46 == val) {
|
||||
if (val != 25) {
|
||||
if (ws46_modes[j].mode & MM_MODEM_MODE_5G)
|
||||
supported_5g = TRUE;
|
||||
if (ws46_modes[j].mode & MM_MODEM_MODE_4G)
|
||||
supported_4g = TRUE;
|
||||
if (ws46_modes[j].mode & MM_MODEM_MODE_3G)
|
||||
supported_3g = TRUE;
|
||||
if (ws46_modes[j].mode & MM_MODEM_MODE_2G)
|
||||
supported_2g = TRUE;
|
||||
}
|
||||
g_array_append_val (modes, ws46_modes[j].mode);
|
||||
break;
|
||||
}
|
||||
@@ -1145,6 +1162,8 @@ mm_3gpp_parse_ws46_test_response (const gchar *response,
|
||||
*mode |= MM_MODEM_MODE_3G;
|
||||
if (supported_4g)
|
||||
*mode |= MM_MODEM_MODE_4G;
|
||||
if (supported_5g)
|
||||
*mode |= MM_MODEM_MODE_5G;
|
||||
|
||||
if (*mode == 0) {
|
||||
inner_error = g_error_new (MM_CORE_ERROR, MM_CORE_ERROR_FAILED, "No way to fixup the ANY value");
|
||||
|
Reference in New Issue
Block a user