summaryrefslogtreecommitdiffstats
path: root/drivers/atmodem
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2012-11-23 16:20:15 +0100
committerMarcel Holtmann <marcel@holtmann.org>2012-11-23 16:20:15 +0100
commit48a5fec5cc4f96d8bf921bd6de1cb68d58d75d0f (patch)
tree999a4d8f0f913cd5b254af448a9c30d6a693f901 /drivers/atmodem
parente3cb6a5c685adcb92ff1e28173fd156557d40c64 (diff)
downloadofono-48a5fec5cc4f96d8bf921bd6de1cb68d58d75d0f.tar.bz2
atmodem: Monitor IFX technology and band changes
Diffstat (limited to 'drivers/atmodem')
-rw-r--r--drivers/atmodem/network-registration.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/drivers/atmodem/network-registration.c b/drivers/atmodem/network-registration.c
index ff73dab3..19b19b2a 100644
--- a/drivers/atmodem/network-registration.c
+++ b/drivers/atmodem/network-registration.c
@@ -679,6 +679,54 @@ static void ifx_xhomezr_notify(GAtResult *result, gpointer user_data)
ofono_info("Home zone: %s", label);
}
+static void ifx_xreg_notify(GAtResult *result, gpointer user_data)
+{
+ struct ofono_netreg *netreg = user_data;
+ struct netreg_data *nd = ofono_netreg_get_data(netreg);
+ int state;
+ const char *band;
+ GAtResultIter iter;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+XREG:"))
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &state))
+ return;
+
+ if (!g_at_result_iter_next_unquoted_string(&iter, &band))
+
+ DBG("state %d band %s", state, band);
+
+ switch (state) {
+ case 0: /* not registered */
+ nd->tech = -1;
+ break;
+ case 1: /* registered, GPRS attached */
+ nd->tech = ACCESS_TECHNOLOGY_GSM;
+ break;
+ case 2: /* registered, EDGE attached */
+ nd->tech = ACCESS_TECHNOLOGY_GSM_EGPRS;
+ break;
+ case 3: /* registered, WCDMA attached */
+ nd->tech = ACCESS_TECHNOLOGY_UTRAN;
+ break;
+ case 4: /* registered, HSDPA attached */
+ nd->tech = ACCESS_TECHNOLOGY_UTRAN_HSDPA;
+ break;
+ case 5: /* registered, HSUPA attached */
+ nd->tech = ACCESS_TECHNOLOGY_UTRAN_HSUPA;
+ break;
+ case 6: /* registered, HSUPA and HSDPA attached */
+ nd->tech = ACCESS_TECHNOLOGY_UTRAN_HSDPA_HSUPA;
+ break;
+ case 7: /* registered, GSM */
+ nd->tech = ACCESS_TECHNOLOGY_GSM;
+ break;
+ }
+}
+
static void ifx_xciev_notify(GAtResult *result, gpointer user_data)
{
//struct ofono_netreg *netreg = user_data;
@@ -1787,6 +1835,16 @@ static void at_creg_set_cb(gboolean ok, GAtResult *result, gpointer user_data)
g_at_chat_send(nd->chat, "AT+XMER=1", none_prefix,
NULL, NULL, NULL);
+ /* Register for network technology updates */
+ g_at_chat_register(nd->chat, "+XREG:", ifx_xreg_notify,
+ FALSE, netreg, NULL);
+ g_at_chat_send(nd->chat, "AT+XREG=1", none_prefix,
+ NULL, NULL, NULL);
+ g_at_chat_send(nd->chat, "AT+XBANDSEL?", none_prefix,
+ NULL, NULL, NULL);
+ g_at_chat_send(nd->chat, "AT+XUBANDSEL?", none_prefix,
+ NULL, NULL, NULL);
+
/* Register for home zone reports */
g_at_chat_register(nd->chat, "+XHOMEZR:", ifx_xhomezr_notify,
FALSE, netreg, NULL);