diff options
author | Rémi Denis-Courmont <remi.denis-courmont@nokia.com> | 2011-01-20 10:37:52 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2011-01-20 12:10:32 +0100 |
commit | e3f51d7507b35bfe26440628b7e480c6d67e7a23 (patch) | |
tree | aeb71387d0680f646ddbb836743000142b164a25 | |
parent | 7b0e7b6640ce9b747bcae63c213b42e64bcb38f9 (diff) | |
download | ofono-e3f51d7507b35bfe26440628b7e480c6d67e7a23.tar.bz2 |
atmodem: packet switch bearer support
-rw-r--r-- | drivers/atmodem/gprs.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c index defb1548..daa3933d 100644 --- a/drivers/atmodem/gprs.c +++ b/drivers/atmodem/gprs.c @@ -200,6 +200,37 @@ static void xdatastat_notify(GAtResult *result, gpointer user_data) } } +static void cpsb_notify(GAtResult *result, gpointer user_data) +{ + struct ofono_gprs *gprs = user_data; + GAtResultIter iter; + gint bearer; + + g_at_result_iter_init(&iter, result); + + if (!g_at_result_iter_next(&iter, "+CPSB:")) + return; + + if (!g_at_result_iter_next_number(&iter, NULL)) + return; + + if (!g_at_result_iter_next_number(&iter, &bearer)) + return; + + ofono_gprs_bearer_notify(gprs, bearer); +} + +static void cpsb_set_cb(gboolean ok, GAtResult *result, gpointer user_data) +{ + struct ofono_gprs *gprs = user_data; + struct gprs_data *gd = ofono_gprs_get_data(gprs); + + if (!ok) + return; + + g_at_chat_register(gd->chat, "+CPSB:", cpsb_notify, FALSE, gprs, NULL); +} + static void gprs_initialized(gboolean ok, GAtResult *result, gpointer user_data) { struct ofono_gprs *gprs = user_data; @@ -208,6 +239,8 @@ static void gprs_initialized(gboolean ok, GAtResult *result, gpointer user_data) g_at_chat_register(gd->chat, "+CGEV:", cgev_notify, FALSE, gprs, NULL); g_at_chat_register(gd->chat, "+CGREG:", cgreg_notify, FALSE, gprs, NULL); + g_at_chat_send(gd->chat, "AT+CPSB=1", none_prefix, + cpsb_set_cb, gprs, NULL); switch (gd->vendor) { case OFONO_VENDOR_IFX: |