Skip to contentSkip to conversation

add set_online interface to he910 modem

PATCH In review Alexey Mednyy 2 participants 2 messages Dec 1, 2014 – Dec 2, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add set_online interface to he910 modem

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(+)
plugins/he910.c +2 -0
index 69362b8..add2243 100644
@@ -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,
};

Signature · 1 line
1.9.1
#1 lore raw

Hi Alexey,

Quoted 6 lines · Alexey Mednyy

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(+)

Please be aware that HE910s are shipped with no support for online mode.
It was a feature added by later firmware. On earlier firmware, the
HE910 would turn off the SIM when CFUN=4 is sent. This is obviously not what oFono expects.

By now this patch is probably okay to accept as the new firmware is more widely available. However, you might want to double check that your firmware is recent enough and is working as expected.

plugins/he910.c static void he910_pre_sim(struct ofono_modem *modem) · line 327

Quoted 11 lines
plugins/he910.c +2 -0
index 69362b8..add2243 100644
@@ -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)

Please re-read our coding style guidelines in doc/coding-style.txt. In particular, pay attention to indentation rules and how to break up long lines (over 80 characters).

Regards,
-Denis