mirror of
https://github.com/sailfishos/ofono
synced 2025-12-02 23:51:10 +08:00
nokia: Add GPRS handling
This commit is contained in:
@@ -39,6 +39,8 @@
|
|||||||
#include <ofono/sim.h>
|
#include <ofono/sim.h>
|
||||||
#include <ofono/sms.h>
|
#include <ofono/sms.h>
|
||||||
#include <ofono/ussd.h>
|
#include <ofono/ussd.h>
|
||||||
|
#include <ofono/gprs.h>
|
||||||
|
#include <ofono/gprs-context.h>
|
||||||
#include <ofono/phonebook.h>
|
#include <ofono/phonebook.h>
|
||||||
#include <ofono/log.h>
|
#include <ofono/log.h>
|
||||||
|
|
||||||
@@ -49,6 +51,8 @@ static const char *none_prefix[] = { NULL };
|
|||||||
struct nokia_data {
|
struct nokia_data {
|
||||||
GAtChat *modem;
|
GAtChat *modem;
|
||||||
GAtChat *control;
|
GAtChat *control;
|
||||||
|
struct ofono_gprs *gprs;
|
||||||
|
struct ofono_gprs_context *gc;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int nokia_probe(struct ofono_modem *modem)
|
static int nokia_probe(struct ofono_modem *modem)
|
||||||
@@ -120,7 +124,29 @@ static GAtChat *open_device(struct ofono_modem *modem,
|
|||||||
|
|
||||||
static void nokia_disconnect(gpointer user_data)
|
static void nokia_disconnect(gpointer user_data)
|
||||||
{
|
{
|
||||||
|
struct ofono_modem *modem = user_data;
|
||||||
|
struct nokia_data *data = ofono_modem_get_data(modem);
|
||||||
|
|
||||||
DBG("");
|
DBG("");
|
||||||
|
|
||||||
|
ofono_gprs_context_remove(data->gc);
|
||||||
|
|
||||||
|
g_at_chat_unref(data->modem);
|
||||||
|
data->modem = NULL;
|
||||||
|
|
||||||
|
data->modem = open_device(modem, "Modem", "Modem:");
|
||||||
|
if (!data->modem)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_at_chat_set_disconnect_function(data->modem,
|
||||||
|
nokia_disconnect, modem);
|
||||||
|
|
||||||
|
ofono_info("Reopened GPRS context channel");
|
||||||
|
|
||||||
|
data->gc = ofono_gprs_context_create(modem, 0, "atmodem", data->modem);
|
||||||
|
|
||||||
|
if (data->gprs && data->gc)
|
||||||
|
ofono_gprs_add_context(data->gprs, data->gc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
|
static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
@@ -227,6 +253,14 @@ static void nokia_post_sim(struct ofono_modem *modem)
|
|||||||
ofono_ussd_create(modem, OFONO_VENDOR_QUALCOMM_MSM,
|
ofono_ussd_create(modem, OFONO_VENDOR_QUALCOMM_MSM,
|
||||||
"atmodem", data->control);
|
"atmodem", data->control);
|
||||||
ofono_phonebook_create(modem, 0, "atmodem", data->control);
|
ofono_phonebook_create(modem, 0, "atmodem", data->control);
|
||||||
|
|
||||||
|
data->gprs = ofono_gprs_create(modem, OFONO_VENDOR_NOKIA,
|
||||||
|
"atmodem", data->control);
|
||||||
|
|
||||||
|
data->gc = ofono_gprs_context_create(modem, 0, "atmodem", data->modem);
|
||||||
|
|
||||||
|
if (data->gprs && data->gc)
|
||||||
|
ofono_gprs_add_context(data->gprs, data->gc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ofono_modem_driver nokia_driver = {
|
static struct ofono_modem_driver nokia_driver = {
|
||||||
|
|||||||
Reference in New Issue
Block a user