api: new 5GNR capability

This commit is contained in:
Aleksander Morgado
2020-03-23 06:36:36 +01:00
parent bf771be7fa
commit 7354dc928f
5 changed files with 22 additions and 9 deletions

View File

@@ -37,6 +37,7 @@
* @MM_MODEM_CAPABILITY_GSM_UMTS: Modem supports at least one of GSM, GPRS, EDGE, UMTS, HSDPA, HSUPA, or HSPA+ packet switched data capability.
* @MM_MODEM_CAPABILITY_LTE: Modem has LTE data capability.
* @MM_MODEM_CAPABILITY_IRIDIUM: Modem has Iridium capabilities.
* @MM_MODEM_CAPABILITY_5GNR: Modem has 5GNR capabilities. Since 1.14.
* @MM_MODEM_CAPABILITY_ANY: Mask specifying all capabilities.
*
* Flags describing one or more of the general access technology families that a
@@ -50,8 +51,9 @@ typedef enum { /*< underscore_name=mm_modem_capability >*/
MM_MODEM_CAPABILITY_CDMA_EVDO = 1 << 1,
MM_MODEM_CAPABILITY_GSM_UMTS = 1 << 2,
MM_MODEM_CAPABILITY_LTE = 1 << 3,
/* MM_MODEM_CAPABILITY_LTE_ADVANCED = 1 << 4 */
/* MM_MODEM_CAPABILITY_LTE_ADVANCED deprecated */
MM_MODEM_CAPABILITY_IRIDIUM = 1 << 5,
MM_MODEM_CAPABILITY_5GNR = 1 << 6,
MM_MODEM_CAPABILITY_ANY = 0xFFFFFFFF
} MMModemCapability;

View File

@@ -38,7 +38,8 @@
* properties of the 3GPP interface.
*
* The 3GPP interface is exposed whenever a modem has any of the 3GPP
* capabilities (%MM_MODEM_CAPABILITY_GSM_UMTS or %MM_MODEM_CAPABILITY_LTE).
* capabilities (%MM_MODEM_CAPABILITY_GSM_UMTS, %MM_MODEM_CAPABILITY_LTE
* or %MM_MODEM_CAPABILITY_5GNR).
*/
G_DEFINE_TYPE (MMModem3gpp, mm_modem_3gpp, MM_GDBUS_TYPE_MODEM3GPP_PROXY)

View File

@@ -4220,8 +4220,7 @@ current_capabilities_internal_load_unlock_required_ready (MMIfaceModem *self,
mm_obj_dbg (self, "multimode device without SIM, no 3GPP capabilities");
caps = mm_gdbus_modem_get_current_capabilities (ctx->skeleton);
caps &= ~MM_MODEM_CAPABILITY_GSM_UMTS;
caps &= ~MM_MODEM_CAPABILITY_LTE;
caps &= ~MM_MODEM_CAPABILITY_3GPP;
/* CDMA-EVDO must still be around */
g_assert (caps & MM_MODEM_CAPABILITY_CDMA_EVDO);
@@ -4283,8 +4282,7 @@ load_current_capabilities_ready (MMIfaceModem *self,
/* If the device is a multimode device (3GPP+3GPP2) check whether we have a
* SIM or not. */
if (caps & MM_MODEM_CAPABILITY_CDMA_EVDO &&
(caps & MM_MODEM_CAPABILITY_GSM_UMTS || caps & MM_MODEM_CAPABILITY_LTE)) {
if ((caps & MM_MODEM_CAPABILITY_CDMA_EVDO) && (caps & MM_MODEM_CAPABILITY_3GPP)) {
mm_obj_dbg (self, "checking if multimode device has a SIM...");
internal_load_unlock_required (
self,
@@ -5570,7 +5568,7 @@ mm_iface_modem_is_3gpp_lte_only (MMIfaceModem *self)
MMModemCapability capabilities;
capabilities = mm_iface_modem_get_current_capabilities (self);
return (capabilities & MM_MODEM_CAPABILITY_LTE) && !((MM_MODEM_CAPABILITY_LTE ^ capabilities) & capabilities);
return ((capabilities & MM_MODEM_CAPABILITY_LTE) && !((MM_MODEM_CAPABILITY_LTE ^ capabilities) & capabilities));
}
gboolean

View File

@@ -1029,6 +1029,9 @@ mm_modem_capability_from_qmi_rat_mode_preference (QmiNasRatModePreference qmi)
if (qmi & QMI_NAS_RAT_MODE_PREFERENCE_LTE)
caps |= MM_MODEM_CAPABILITY_LTE;
if (qmi & QMI_NAS_RAT_MODE_PREFERENCE_5GNR)
caps |= MM_MODEM_CAPABILITY_5GNR;
return caps;
}
@@ -1050,6 +1053,9 @@ mm_modem_capability_to_qmi_rat_mode_preference (MMModemCapability caps)
if (caps & MM_MODEM_CAPABILITY_LTE)
qmi |= QMI_NAS_RAT_MODE_PREFERENCE_LTE;
if (caps & MM_MODEM_CAPABILITY_5GNR)
qmi |= QMI_NAS_RAT_MODE_PREFERENCE_5GNR;
return qmi;
}
@@ -1063,6 +1069,11 @@ mm_modem_capability_to_qmi_acquisition_order_preference (MMModemCapability caps)
array = g_array_new (FALSE, FALSE, sizeof (QmiNasRadioInterface));
if (caps & MM_MODEM_CAPABILITY_5GNR) {
value = QMI_NAS_RADIO_INTERFACE_5GNR;
g_array_append_val (array, value);
}
if (caps & MM_MODEM_CAPABILITY_LTE) {
value = QMI_NAS_RADIO_INTERFACE_LTE;
g_array_append_val (array, value);
@@ -1166,7 +1177,7 @@ mm_modem_capability_from_qmi_radio_technology_preference (QmiNasRadioTechnologyP
if (qmi & QMI_NAS_RADIO_TECHNOLOGY_PREFERENCE_LTE)
caps |= MM_MODEM_CAPABILITY_LTE;
/* FIXME: LTE Advanced? */
/* NOTE: no 5GNR defined in Technology Preference */
return caps;
}

View File

@@ -41,7 +41,8 @@
#define MM_MODEM_CAPABILITY_3GPP \
(MM_MODEM_CAPABILITY_GSM_UMTS | \
MM_MODEM_CAPABILITY_LTE)
MM_MODEM_CAPABILITY_LTE | \
MM_MODEM_CAPABILITY_5GNR)
gchar *mm_strip_quotes (gchar *str);
const gchar *mm_strip_tag (const gchar *str,