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/cinterion/mm-plugin-cinterion.c | |
parent | 81ee07832d3ab733f59f869ad17d1d5577aef3ff (diff) |
port-serial-at: use GIO Async API like methods
Diffstat (limited to 'plugins/cinterion/mm-plugin-cinterion.c')
-rw-r--r-- | plugins/cinterion/mm-plugin-cinterion.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/plugins/cinterion/mm-plugin-cinterion.c b/plugins/cinterion/mm-plugin-cinterion.c index 27672b5f..7a04fdaa 100644 --- a/plugins/cinterion/mm-plugin-cinterion.c +++ b/plugins/cinterion/mm-plugin-cinterion.c @@ -76,25 +76,23 @@ cinterion_custom_init_finish (MMPortProbe *probe, static void sqport_ready (MMPortSerialAt *port, - GString *response, - GError *error, + GAsyncResult *res, CinterionCustomInitContext *ctx) { + const gchar *response; + /* Ignore errors, just avoid tagging */ - if (error) { - g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); - cinterion_custom_init_context_complete_and_free (ctx); - return; + response = mm_port_serial_at_command_finish (port, res, NULL); + if (response) { + /* A valid reply to AT^SQPORT tells us this is an AT port already */ + mm_port_probe_set_result_at (ctx->probe, TRUE); + + if (strstr (response, "Application")) + g_object_set_data (G_OBJECT (ctx->probe), TAG_CINTERION_APP_PORT, GUINT_TO_POINTER (TRUE)); + else if (strstr (response, "Modem")) + g_object_set_data (G_OBJECT (ctx->probe), TAG_CINTERION_MODEM_PORT, GUINT_TO_POINTER (TRUE)); } - /* A valid reply to AT^SQPORT tells us this is an AT port already */ - mm_port_probe_set_result_at (ctx->probe, TRUE); - - if (strstr (response->str, "Application")) - g_object_set_data (G_OBJECT (ctx->probe), TAG_CINTERION_APP_PORT, GUINT_TO_POINTER (TRUE)); - else if (strstr (response->str, "Modem")) - g_object_set_data (G_OBJECT (ctx->probe), TAG_CINTERION_MODEM_PORT, GUINT_TO_POINTER (TRUE)); - g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); cinterion_custom_init_context_complete_and_free (ctx); } @@ -117,13 +115,14 @@ cinterion_custom_init (MMPortProbe *probe, ctx->port = g_object_ref (port); ctx->cancellable = cancellable ? g_object_ref (cancellable) : NULL; - mm_port_serial_at_queue_command ( + mm_port_serial_at_command ( ctx->port, "AT^SQPORT?", 3, FALSE, /* raw */ + FALSE, /* allow cached */ ctx->cancellable, - (MMPortSerialAtResponseFn)sqport_ready, + (GAsyncReadyCallback)sqport_ready, ctx); } |