diff options
author | Denis Kenzior <denkenz@gmail.com> | 2009-12-07 18:35:56 -0600 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2009-12-07 18:36:27 -0600 |
commit | 94f71484dbee1369f69f44e8f0ded81e1df9eb31 (patch) | |
tree | c3ef3c478b7830b8a732c3626bbcba3ad82af400 | |
parent | 7c7f265ebcc3cb851cdf99376340b7f4dbecd34c (diff) | |
download | ofono-94f71484dbee1369f69f44e8f0ded81e1df9eb31.tar.bz2 |
Register to MBM ERINFO notification
This is purely for information gathering purposes
-rw-r--r-- | plugins/mbm.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/plugins/mbm.c b/plugins/mbm.c index 7f38fa8b..b3c0d719 100644 --- a/plugins/mbm.c +++ b/plugins/mbm.c @@ -58,6 +58,23 @@ struct mbm_data { GAtChat *chat; }; +static void erinfo_notifier(GAtResult *result, gpointer user_data) +{ + GAtResultIter iter; + int mode, gsm, umts; + + g_at_result_iter_init(&iter, result); + + if (g_at_result_iter_next(&iter, "*ERINFO:") == FALSE) + return; + + g_at_result_iter_next_number(&iter, &mode); + g_at_result_iter_next_number(&iter, &gsm); + g_at_result_iter_next_number(&iter, &umts); + + ofono_info("network capability: GSM %d UMTS %d", gsm, umts); +} + static int mbm_probe(struct ofono_modem *modem) { struct mbm_data *data; @@ -93,6 +110,7 @@ static void mbm_debug(const char *str, void *user_data) static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data) { struct ofono_modem *modem = user_data; + struct mbm_data *data = ofono_modem_get_data(modem); DBG(""); @@ -100,6 +118,11 @@ static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data) ofono_modem_set_powered(modem, FALSE); ofono_modem_set_powered(modem, TRUE); + + g_at_chat_send(data->chat, "AT*ERINFO=1", none_prefix, + NULL, NULL, NULL); + g_at_chat_register(data->chat, "*ERINFO:", erinfo_notifier, + FALSE, modem, NULL); } static void cfun_query(gboolean ok, GAtResult *result, gpointer user_data) |