device/wwan: static assert that ModemManager and NM capabilities correspond

This commit is contained in:
Thomas Haller
2022-01-28 21:26:05 +01:00
parent 64630f57a2
commit c0f9925de8
2 changed files with 9 additions and 0 deletions

View File

@@ -204,6 +204,13 @@ get_capabilities(NMModem *_self,
MMModemCapability *supported;
guint n_supported;
G_STATIC_ASSERT(MM_MODEM_CAPABILITY_POTS == (guint64) NM_DEVICE_MODEM_CAPABILITY_POTS);
G_STATIC_ASSERT(MM_MODEM_CAPABILITY_CDMA_EVDO
== (guint64) NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO);
G_STATIC_ASSERT(MM_MODEM_CAPABILITY_GSM_UMTS == (guint64) NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS);
G_STATIC_ASSERT(MM_MODEM_CAPABILITY_LTE == (guint64) NM_DEVICE_MODEM_CAPABILITY_LTE);
G_STATIC_ASSERT(MM_MODEM_CAPABILITY_5GNR == (guint64) NM_DEVICE_MODEM_CAPABILITY_5GNR);
/* For now, we don't care about the capability combinations, just merge all
* combinations in a single mask */
if (mm_modem_get_supported_capabilities(self->_priv.modem_iface, &supported, &n_supported)) {

View File

@@ -443,6 +443,8 @@ typedef enum { /*< flags >*/
NM_DEVICE_MODEM_CAPABILITY_LTE = 0x00000008,
NM_DEVICE_MODEM_CAPABILITY_5GNR = 0x00000040,
} NMDeviceModemCapabilities;
/* Note: the numeric values of NMDeviceModemCapabilities must be identical to the values
* in MMModemCapability. See the G_STATIC_ASSERT() in nm-modem-broadband.c's get_capabilities(). */
/**
* NMWimaxNspNetworkType: