diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-02-19 10:50:11 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-16 14:28:14 +0100 |
commit | d09dfbb7d1eed75c28576d0461a62cbec3b5127f (patch) | |
tree | 2858a53206a2aeaef71eebdde1216926d941960b /plugins | |
parent | 1359c0a9282d46f7cc84786bd2a5ac6033d371d8 (diff) |
gobi: access technology loading implementation
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mm-broadband-modem-gobi.c | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/plugins/mm-broadband-modem-gobi.c b/plugins/mm-broadband-modem-gobi.c index 6d4f505b..95a99961 100644 --- a/plugins/mm-broadband-modem-gobi.c +++ b/plugins/mm-broadband-modem-gobi.c @@ -12,7 +12,7 @@ * * Copyright (C) 2008 - 2009 Novell, Inc. * Copyright (C) 2009 - 2011 Red Hat, Inc. - * Copyright (C) 2011 Google Inc. + * Copyright (C) 2011 - 2012 Google Inc. */ #include <config.h> @@ -24,10 +24,12 @@ #include <ctype.h> #include "ModemManager.h" +#include "mm-modem-helpers.h" #include "mm-serial-parsers.h" #include "mm-log.h" #include "mm-errors-types.h" #include "mm-iface-modem.h" +#include "mm-iface-modem-3gpp.h" #include "mm-base-modem-at.h" #include "mm-broadband-modem-gobi.h" @@ -37,6 +39,54 @@ G_DEFINE_TYPE_EXTENDED (MMBroadbandModemGobi, mm_broadband_modem_gobi, MM_TYPE_B G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init)); /*****************************************************************************/ +/* Load access technologies (Modem interface) */ + +static gboolean +load_access_technologies_finish (MMIfaceModem *self, + GAsyncResult *res, + MMModemAccessTechnology *access_technologies, + guint *mask, + GError **error) +{ + const gchar *p; + const gchar *response; + + response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, error); + if (!response) + return FALSE; + + p = mm_strip_tag (response, "*CNTI:"); + p = strchr (p, ','); + if (p) { + /* We are reporting ALL 3GPP access technologies here */ + *access_technologies = mm_3gpp_string_to_access_tech (p + 1); + *mask = MM_IFACE_MODEM_3GPP_ALL_ACCESS_TECHNOLOGIES_MASK; + return TRUE; + } + + g_set_error (error, + MM_CORE_ERROR, + MM_CORE_ERROR_FAILED, + "Couldn't parse access technologies result: '%s'", + response); + return FALSE; +} + +static void +load_access_technologies (MMIfaceModem *self, + GAsyncReadyCallback callback, + gpointer user_data) +{ + mm_base_modem_at_command (MM_BASE_MODEM (self), + "*CNTI=0", + 3, + FALSE, + NULL, /* cancellable */ + callback, + user_data); +} + +/*****************************************************************************/ MMBroadbandModemGobi * mm_broadband_modem_gobi_new (const gchar *device, @@ -62,6 +112,9 @@ mm_broadband_modem_gobi_init (MMBroadbandModemGobi *self) static void iface_modem_init (MMIfaceModem *iface) { + iface->load_access_technologies = load_access_technologies; + iface->load_access_technologies_finish = load_access_technologies_finish; + iface->modem_power_down = NULL; iface->modem_power_down_finish = NULL; } |