diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-iface-modem.c | 65 | ||||
-rw-r--r-- | src/mm-iface-modem.h | 9 |
2 files changed, 74 insertions, 0 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c index c094b578..49a18a59 100644 --- a/src/mm-iface-modem.c +++ b/src/mm-iface-modem.c @@ -3689,6 +3689,71 @@ mm_iface_modem_shutdown (MMIfaceModem *self) /*****************************************************************************/ +MMModemMode +mm_iface_modem_get_supported_modes (MMIfaceModem *self) +{ + MMModemMode supported = MM_MODEM_MODE_NONE; + MmGdbusModem *skeleton; + + g_object_get (self, + MM_IFACE_MODEM_DBUS_SKELETON, &skeleton, + NULL); + + if (skeleton) { + supported = mm_gdbus_modem_get_supported_modes (skeleton); + g_object_unref (skeleton); + } + + return supported; +} + +gboolean +mm_iface_modem_is_2g (MMIfaceModem *self) +{ + return (mm_iface_modem_get_supported_modes (self) & MM_MODEM_MODE_2G); +} + +gboolean +mm_iface_modem_is_2g_only (MMIfaceModem *self) +{ + MMModemMode supported; + + supported = mm_iface_modem_get_supported_modes (self); + return !((MM_MODEM_MODE_2G ^ supported) & supported); +} + +gboolean +mm_iface_modem_is_3g (MMIfaceModem *self) +{ + return (mm_iface_modem_get_supported_modes (self) & MM_MODEM_MODE_3G); +} + +gboolean +mm_iface_modem_is_3g_only (MMIfaceModem *self) +{ + MMModemMode supported; + + supported = mm_iface_modem_get_supported_modes (self); + return !((MM_MODEM_MODE_3G ^ supported) & supported); +} + +gboolean +mm_iface_modem_is_4g (MMIfaceModem *self) +{ + return (mm_iface_modem_get_supported_modes (self) & MM_MODEM_MODE_4G); +} + +gboolean +mm_iface_modem_is_4g_only (MMIfaceModem *self) +{ + MMModemMode supported; + + supported = mm_iface_modem_get_supported_modes (self); + return !((MM_MODEM_MODE_4G ^ supported) & supported); +} + +/*****************************************************************************/ + MMModemCapability mm_iface_modem_get_current_capabilities (MMIfaceModem *self) { diff --git a/src/mm-iface-modem.h b/src/mm-iface-modem.h index 3040303f..cad763ee 100644 --- a/src/mm-iface-modem.h +++ b/src/mm-iface-modem.h @@ -306,6 +306,15 @@ gboolean mm_iface_modem_is_3gpp_lte_only (MMIfaceModem *self); gboolean mm_iface_modem_is_cdma (MMIfaceModem *self); gboolean mm_iface_modem_is_cdma_only (MMIfaceModem *self); +/* Helpers to query supported modes */ +MMModemMode mm_iface_modem_get_supported_modes (MMIfaceModem *self); +gboolean mm_iface_modem_is_2g (MMIfaceModem *self); +gboolean mm_iface_modem_is_2g_only (MMIfaceModem *self); +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); + /* Initialize Modem interface (async) */ void mm_iface_modem_initialize (MMIfaceModem *self, GCancellable *cancellable, |