From: "Gustavo F. Padovan" <[email protected]>

---
 plugins/bluetooth.h |    2 ++
 plugins/telit.c     |   47 ++++++++++++++++++++++++-----------------------
 2 files changed, 26 insertions(+), 23 deletions(-)

diff --git a/plugins/bluetooth.h b/plugins/bluetooth.h
index a9d3683..89733a1 100644
--- a/plugins/bluetooth.h
+++ b/plugins/bluetooth.h
@@ -49,6 +49,8 @@ struct bluetooth_sap_driver {
                                                                int bt_fd);
        void (*pre_sim) (struct ofono_modem *modem);
        void (*post_sim) (struct ofono_modem *modem);
+       void (*set_online) (struct ofono_modem *modem, ofono_bool_t online,
+                               ofono_modem_online_cb_t cb, void *user_data);
        int (*disable) (struct ofono_modem *modem);
 };
 
diff --git a/plugins/telit.c b/plugins/telit.c
index 8fe421f..dc6850f 100644
--- a/plugins/telit.c
+++ b/plugins/telit.c
@@ -566,11 +566,35 @@ static void telit_post_sim(struct ofono_modem *modem)
        ofono_sms_create(modem, 0, "atmodem", data->chat);
 }
 
+static void set_online_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+       struct cb_data *cbd = user_data;
+       ofono_modem_online_cb_t cb = cbd->cb;
+       struct ofono_error error;
+
+       decode_at_error(&error, g_at_result_final_response(result));
+       cb(&error, cbd->data);
+}
+
+static void telit_set_online(struct ofono_modem *modem, ofono_bool_t online,
+                               ofono_modem_online_cb_t cb, void *user_data)
+{
+       struct telit_data *data = ofono_modem_get_data(modem);
+       struct cb_data *cbd = cb_data_new(cb, user_data);
+       char const *command = online ? "AT+CFUN=1" : "AT+CFUN=4";
+
+       DBG("modem %p %s", modem, online ? "online" : "offline");
+
+       g_at_chat_send(data->chat, command, none_prefix, set_online_cb,
+                                               cbd, g_free);
+}
+
 static struct bluetooth_sap_driver sap_driver = {
        .name = "telit",
        .enable = telit_sap_enable,
        .pre_sim = telit_pre_sim,
        .post_sim = telit_post_sim,
+       .set_online = telit_set_online,
        .disable = telit_sap_disable,
 };
 
@@ -607,29 +631,6 @@ static void telit_remove(struct ofono_modem *modem)
        g_free(data);
 }
 
-static void set_online_cb(gboolean ok, GAtResult *result, gpointer user_data)
-{
-       struct cb_data *cbd = user_data;
-       ofono_modem_online_cb_t cb = cbd->cb;
-       struct ofono_error error;
-
-       decode_at_error(&error, g_at_result_final_response(result));
-       cb(&error, cbd->data);
-}
-
-static void telit_set_online(struct ofono_modem *modem, ofono_bool_t online,
-                               ofono_modem_online_cb_t cb, void *user_data)
-{
-       struct telit_data *data = ofono_modem_get_data(modem);
-       struct cb_data *cbd = cb_data_new(cb, user_data);
-       char const *command = online ? "AT+CFUN=1" : "AT+CFUN=4";
-
-       DBG("modem %p %s", modem, online ? "online" : "offline");
-
-       g_at_chat_send(data->chat, command, none_prefix, set_online_cb,
-                                               cbd, g_free);
-}
-
 static void telit_post_online(struct ofono_modem *modem)
 {
        struct telit_data *data = ofono_modem_get_data(modem);
-- 
1.7.6.2

_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to