diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-08-13 11:07:45 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-08-20 16:27:04 +0200 |
commit | 1931a69e50d295b0e7ea308e9770381fdf0700b7 (patch) | |
tree | 8ac99d6247f979dfae163f4e9f40f913e1be5670 | |
parent | e150c4cf922a4caf2b741a2a155e7ae53eb57740 (diff) |
novatel: implement current access technology loading
-rw-r--r-- | plugins/novatel/mm-broadband-modem-novatel.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/plugins/novatel/mm-broadband-modem-novatel.c b/plugins/novatel/mm-broadband-modem-novatel.c index 54c62b34..f771b894 100644 --- a/plugins/novatel/mm-broadband-modem-novatel.c +++ b/plugins/novatel/mm-broadband-modem-novatel.c @@ -226,6 +226,53 @@ set_allowed_modes (MMIfaceModem *self, } /*****************************************************************************/ +/* Load access technologies (Modem interface) */ + +static gboolean +modem_load_access_technologies_finish (MMIfaceModem *self, + GAsyncResult *res, + MMModemAccessTechnology *access_technologies, + guint *mask, + GError **error) +{ + const gchar *response; + const gchar *p; + + 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) { + *access_technologies = mm_string_to_access_tech (p); + *mask = MM_MODEM_ACCESS_TECHNOLOGY_ANY; + return TRUE; + } + + g_set_error (error, + MM_CORE_ERROR, + MM_CORE_ERROR_FAILED, + "Couldn't parse $CNTI result '%s'", + response); + return FALSE; +} + +static void +modem_load_access_technologies (MMIfaceModem *self, + GAsyncReadyCallback callback, + gpointer user_data) +{ + mm_base_modem_at_command ( + MM_BASE_MODEM (self), + "$CNTI=0", + 3, + FALSE, + callback, + user_data); +} + +/*****************************************************************************/ /* Setup ports (Broadband modem class) */ static const MMBaseModemAtCommand nwdmat_sequence[] = { @@ -275,6 +322,8 @@ iface_modem_init (MMIfaceModem *iface) iface->load_allowed_modes_finish = load_allowed_modes_finish; iface->set_allowed_modes = set_allowed_modes; iface->set_allowed_modes_finish = set_allowed_modes_finish; + iface->load_access_technologies_finish = modem_load_access_technologies_finish; + iface->load_access_technologies = modem_load_access_technologies; } static void |