diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2011-11-22 18:52:02 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:14:23 +0100 |
commit | 995e7ace07ce21e7e5918f74c3a2a56c75c3e8f6 (patch) | |
tree | fa743cd3ca52ac124a42c1e1f20cdf4764516d75 /src/mm-sim.c | |
parent | b29a8ba44f7f9886a86a064e9e260800c5147509 (diff) |
sim: handle EnablePin() calls
Diffstat (limited to 'src/mm-sim.c')
-rw-r--r-- | src/mm-sim.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/mm-sim.c b/src/mm-sim.c index 6c5618c4..8cce64c1 100644 --- a/src/mm-sim.c +++ b/src/mm-sim.c @@ -199,6 +199,44 @@ handle_change_pin (MMSim *self, } /*****************************************************************************/ +/* ENABLE PIN */ + +NO_REPLY_READY_FN (enable_pin) + +static gboolean +handle_enable_pin (MMSim *self, + GDBusMethodInvocation *invocation, + const gchar *arg_pin, + gboolean arg_enabled) +{ + gchar *command; + DbusCallContext *ctx; + GError *error = NULL; + + ctx = dbus_call_context_new (self, invocation, &error); + if (!ctx) { + g_dbus_method_invocation_take_error (ctx->invocation, error); + return TRUE; + } + + command = g_strdup_printf ("+CLCK=\"SC\",%d,\"%s\"", + arg_enabled ? 1 : 0, + arg_pin); + mm_at_command (G_OBJECT (self), + ctx->port, + command, + 3, + (MMAtResponseProcessor)common_parse_no_reply, + NULL, /* response_processor_context */ + NULL, /* result_signature */ + NULL, /* TODO: cancellable */ + (GAsyncReadyCallback)handle_enable_pin_ready, + ctx); + g_free (command); + return TRUE; +} + +/*****************************************************************************/ static void mm_sim_export (MMSim *self) @@ -210,6 +248,10 @@ mm_sim_export (MMSim *self) "handle-change-pin", G_CALLBACK (handle_change_pin), NULL); + g_signal_connect (self, + "handle-enable-pin", + G_CALLBACK (handle_enable_pin), + NULL); if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (self), self->priv->connection, |