iface-modem: new helpers to query supported modes

This commit is contained in:
Aleksander Morgado
2012-04-10 17:25:34 +02:00
parent e89a8a42a9
commit 83afd3ddc9
2 changed files with 74 additions and 0 deletions

View File

@@ -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 MMModemCapability
mm_iface_modem_get_current_capabilities (MMIfaceModem *self) mm_iface_modem_get_current_capabilities (MMIfaceModem *self)
{ {

View File

@@ -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 (MMIfaceModem *self);
gboolean mm_iface_modem_is_cdma_only (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) */ /* Initialize Modem interface (async) */
void mm_iface_modem_initialize (MMIfaceModem *self, void mm_iface_modem_initialize (MMIfaceModem *self,
GCancellable *cancellable, GCancellable *cancellable,