From 995e7ace07ce21e7e5918f74c3a2a56c75c3e8f6 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 22 Nov 2011 18:52:02 +0100 Subject: sim: handle EnablePin() calls --- src/mm-sim.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src') 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 @@ -198,6 +198,44 @@ handle_change_pin (MMSim *self, return TRUE; } +/*****************************************************************************/ +/* 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 @@ -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, -- cgit v1.2.3-70-g09d2