diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2013-11-17 01:11:12 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2014-02-13 13:40:21 +0100 |
commit | d4dfd661b9bcfdad5a79e2a3f28374f0d0982c23 (patch) | |
tree | c6bf095648969ac35fc93a81922575deb228c392 /plugins/longcheer/mm-plugin-longcheer.c | |
parent | 81ee07832d3ab733f59f869ad17d1d5577aef3ff (diff) |
port-serial-at: use GIO Async API like methods
Diffstat (limited to 'plugins/longcheer/mm-plugin-longcheer.c')
-rw-r--r-- | plugins/longcheer/mm-plugin-longcheer.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/plugins/longcheer/mm-plugin-longcheer.c b/plugins/longcheer/mm-plugin-longcheer.c index 55e574a7..d9217b79 100644 --- a/plugins/longcheer/mm-plugin-longcheer.c +++ b/plugins/longcheer/mm-plugin-longcheer.c @@ -67,20 +67,22 @@ static void longcheer_custom_init_step (LongcheerCustomInitContext *ctx); static void gmr_ready (MMPortSerialAt *port, - GString *response, - GError *error, + GAsyncResult *res, LongcheerCustomInitContext *ctx) { const gchar *p; + const gchar *response; + GError *error = NULL; + response = mm_port_serial_at_command_finish (port, res, &error); if (error) { /* Just retry... */ longcheer_custom_init_step (ctx); - return; + goto out; } /* Note the lack of a ':' on the GMR; the X200 doesn't send one */ - p = mm_strip_tag (response->str, "AT+GMR"); + p = mm_strip_tag (response, "AT+GMR"); if (p && *p == 'L') { /* X200 modems have a GMR firmware revision that starts with 'L', and * as far as I can tell X060s devices have a revision starting with 'C'. @@ -98,6 +100,10 @@ gmr_ready (MMPortSerialAt *port, } longcheer_custom_init_context_complete_and_free (ctx); + +out: + if (error) + g_error_free (error); } static void @@ -124,13 +130,14 @@ longcheer_custom_init_step (LongcheerCustomInitContext *ctx) } ctx->retries--; - mm_port_serial_at_queue_command ( + mm_port_serial_at_command ( ctx->port, "AT+GMR", 3, FALSE, /* raw */ + FALSE, /* allow_cached */ ctx->cancellable, - (MMPortSerialAtResponseFn)gmr_ready, + (GAsyncReadyCallback)gmr_ready, ctx); } |