All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Mednyy <swexru@gmail.com>
To: ofono@ofono.org
Subject: [PATCH 1/1] add set_online interface to he910 modem
Date: Mon, 01 Dec 2014 14:35:09 +0300	[thread overview]
Message-ID: <547C526D.3030901@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1865 bytes --]

Had to add set_online interface to he910 modem connman now, working
properly if disable he910 cellular (was not implemented error before).
---
 plugins/he910.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/plugins/he910.c b/plugins/he910.c
index 69362b8..add2243 100644
--- a/plugins/he910.c
+++ b/plugins/he910.c
@@ -322,6 +322,30 @@ static void he910_pre_sim(struct ofono_modem *modem)
        ofono_location_reporting_create(modem, 0, "telitmodem", 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 he910_set_online(struct ofono_modem *modem, ofono_bool_t
online,
+                                ofono_modem_online_cb_t cb, void
*user_data)
+{
+        struct he910_data *data = ofono_modem_get_data(modem);
+        struct cb_data *cbd = cb_data_new(cb, user_data);
+        char const *command = online ? "AT+CFUN=1,0" : "AT+CFUN=4,0";
+
+        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 he910_post_online(struct ofono_modem *modem)
 {
        struct he910_data *data = ofono_modem_get_data(modem);
@@ -388,6 +412,7 @@ static struct ofono_modem_driver he910_driver = {
        .enable         = he910_enable,
        .disable        = he910_disable,
        .pre_sim        = he910_pre_sim,
+        .set_online     = he910_set_online,
        .post_online    = he910_post_online,
 };
 
-- 
1.9.1



             reply	other threads:[~2014-12-01 11:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-01 11:35 Alexey Mednyy [this message]
2014-12-02 17:36 ` [PATCH 1/1] add set_online interface to he910 modem Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=547C526D.3030901@gmail.com \
    --to=swexru@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.