aboutsummaryrefslogtreecommitdiff
path: root/libmm-glib
diff options
context:
space:
mode:
Diffstat (limited to 'libmm-glib')
-rw-r--r--libmm-glib/Makefile.am4
-rw-r--r--libmm-glib/mm-modem.c2
-rw-r--r--libmm-glib/mm-modem.h11
-rw-r--r--libmm-glib/mm-sim.c609
-rw-r--r--libmm-glib/mm-sim.h120
5 files changed, 745 insertions, 1 deletions
diff --git a/libmm-glib/Makefile.am b/libmm-glib/Makefile.am
index cde0a76e..fabfcbc8 100644
--- a/libmm-glib/Makefile.am
+++ b/libmm-glib/Makefile.am
@@ -14,7 +14,9 @@ libmm_glib_la_SOURCES = \
mm-manager.h \
mm-manager.c \
mm-modem.h \
- mm-modem.c
+ mm-modem.c \
+ mm-sim.h \
+ mm-sim.c
libmm_glib_la_LIBADD = \
$(top_builddir)/libmm-common/libmm-common.la \
diff --git a/libmm-glib/mm-modem.c b/libmm-glib/mm-modem.c
index 819a0bde..ebc42c6e 100644
--- a/libmm-glib/mm-modem.c
+++ b/libmm-glib/mm-modem.c
@@ -20,6 +20,8 @@
* Copyright (C) 2011 Aleksander Morgado <aleksander@gnu.org>
*/
+#include <gio/gio.h>
+
#include "mm-modem.h"
/**
diff --git a/libmm-glib/mm-modem.h b/libmm-glib/mm-modem.h
index 2a83eaa0..ce853b66 100644
--- a/libmm-glib/mm-modem.h
+++ b/libmm-glib/mm-modem.h
@@ -26,6 +26,8 @@
#include <ModemManager.h>
#include <mm-gdbus-modem.h>
+#include "mm-sim.h"
+
G_BEGIN_DECLS
typedef MmGdbusObject MMModem;
@@ -35,18 +37,27 @@ typedef MmGdbusObject MMModem;
const gchar *mm_modem_get_path (MMModem *self);
const gchar *mm_modem_get_sim_path (MMModem *self);
+gchar *mm_modem_dup_sim_path (MMModem *self);
MMModemCapability mm_modem_get_modem_capabilities (MMModem *self);
MMModemCapability mm_modem_get_current_capabilities (MMModem *self);
guint mm_modem_get_max_bearers (MMModem *self);
guint mm_modem_get_max_active_bearers (MMModem *self);
const gchar *mm_modem_get_manufacturer (MMModem *self);
+gchar *mm_modem_dup_manufacturer (MMModem *self);
const gchar *mm_modem_get_model (MMModem *self);
+gchar *mm_modem_dup_model (MMModem *self);
const gchar *mm_modem_get_revision (MMModem *self);
+gchar *mm_modem_dup_revision (MMModem *self);
const gchar *mm_modem_get_device_identifier (MMModem *self);
+gchar *mm_modem_dup_device_identifier (MMModem *self);
const gchar *mm_modem_get_device (MMModem *self);
+gchar *mm_modem_dup_device (MMModem *self);
const gchar *mm_modem_get_driver (MMModem *self);
+gchar *mm_modem_dup_driver (MMModem *self);
const gchar *mm_modem_get_plugin (MMModem *self);
+gchar *mm_modem_dup_plugin (MMModem *self);
const gchar *mm_modem_get_equipment_identifier (MMModem *self);
+gchar *mm_modem_dup_equipment_identifier (MMModem *self);
guint mm_modem_get_unlock_required (MMModem *self);
guint mm_modem_get_unlock_retries (MMModem *self);
MMModemState mm_modem_get_state (MMModem *self);
diff --git a/libmm-glib/mm-sim.c b/libmm-glib/mm-sim.c
new file mode 100644
index 00000000..46722fdd
--- /dev/null
+++ b/libmm-glib/mm-sim.c
@@ -0,0 +1,609 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * libmm -- Access modem status & information from glib applications
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2011 Aleksander Morgado <aleksander@gnu.org>
+ */
+
+#include "mm-sim.h"
+
+/**
+ * mm_sim_get_path:
+ * @self: A #MMSim.
+ *
+ * Gets the DBus path of the #MMSim object.
+ *
+ * Returns: (transfer none): The DBus path of the #MMSim object.
+ */
+const gchar *
+mm_sim_get_path (MMSim *self)
+{
+ g_return_val_if_fail (G_IS_DBUS_PROXY (self), NULL);
+
+ RETURN_NON_EMPTY_CONSTANT_STRING (
+ g_dbus_proxy_get_object_path (G_DBUS_PROXY (self)));
+}
+
+/**
+ * mm_sim_dup_path:
+ * @self: A #MMSim.
+ *
+ * Gets a copy of the DBus path of the #MMSim object.
+ *
+ * Returns: (transfer full): The DBus path of the #MMSim object. The returned value should be freed with g_free().
+ */
+gchar *
+mm_sim_dup_path (MMSim *self)
+{
+ gchar *value;
+
+ g_return_val_if_fail (G_IS_DBUS_PROXY (self), NULL);
+
+ g_object_get (G_OBJECT (self),
+ "g-object-path", &value,
+ NULL);
+
+ RETURN_NON_EMPTY_STRING (value);
+}
+
+/**
+ * mm_sim_get_identifier:
+ * @self: A #MMSim.
+ *
+ * Gets the unique SIM identifier of the #MMSim object.
+ *
+ * <warning>It is only safe to use this function on the thread where @self was constructed. Use mm_sim_dup_identifier() if on another thread.</warning>
+ *
+ * Returns: (transfer none): The unique identifier of the #MMSim object, or %NULL if it couldn't be retrieved.
+ */
+const gchar *
+mm_sim_get_identifier (MMSim *self)
+{
+ g_return_val_if_fail (MM_GDBUS_IS_SIM (self), NULL);
+
+ return mm_gdbus_sim_get_sim_identifier (self);
+}
+
+/**
+ * mm_sim_dup_identifier:
+ * @self: A #MMSim.
+ *
+ * Gets a copy of the unique SIM identifier of the #MMSim object.
+ *
+ * Returns: (transfer full): The unique identifier of the #MMSim object, or %NULL if it couldn't be retrieved. The returned value should be freed with g_free().
+ */
+gchar *
+mm_sim_dup_identifier (MMSim *self)
+{
+ g_return_val_if_fail (MM_GDBUS_IS_SIM (self), NULL);
+
+ return mm_gdbus_sim_dup_sim_identifier (self);
+}
+
+/**
+ * mm_sim_get_imsi:
+ * @self: A #MMSim.
+ *
+ * Gets the International Mobile Subscriber Identity (IMSI) of the #MMSim object.
+ *
+ * <warning>It is only safe to use this function on the thread where @self was constructed. Use mm_sim_dup_imsi() if on another thread.</warning>
+ *
+ * Returns: (transfer none): The IMSI of the #MMSim object, or %NULL if it couldn't be retrieved.
+ */
+const gchar *
+mm_sim_get_imsi (MMSim *self)
+{
+ g_return_val_if_fail (MM_GDBUS_IS_SIM (self), NULL);
+
+ return mm_gdbus_sim_get_imsi (self);
+}
+
+/**
+ * mm_sim_dup_imsi:
+ * @self: A #MMSim.
+ *
+ * Gets a copy of the International Mobile Subscriber Identity (IMSI) of the #MMSim object.
+ *
+ * Returns: (transfer full): The IMSI of the #MMSim object, or %NULL if it couldn't be retrieved. The returned value should be freed with g_free().
+ */
+gchar *
+mm_sim_dup_imsi (MMSim *self)
+{
+ g_return_val_if_fail (MM_GDBUS_IS_SIM (self), NULL);
+
+ return mm_gdbus_sim_dup_imsi (self);
+}
+
+/**
+ * mm_sim_get_operator_identifier:
+ * @self: A #MMSim.
+ *
+ * Gets the Operator Identifier of the #MMSim object.
+ *
+ * <warning>It is only safe to use this function on the thread where @self was constructed. Use mm_sim_dup_operator_identifier() if on another thread.</warning>
+ *
+ * Returns: (transfer none): The Operator Identifier of the #MMSim object, or %NULL if it couldn't be retrieved.
+ */
+const gchar *
+mm_sim_get_operator_identifier (MMSim *self)
+{
+ g_return_val_if_fail (MM_GDBUS_IS_SIM (self), NULL);
+
+ return mm_gdbus_sim_get_operator_identifier (self);
+}
+
+/**
+ * mm_sim_dup_operator_identifier:
+ * @self: A #MMSim.
+ *
+ * Gets a copy of the Operator Identifier of the #MMSim object.
+ *
+ * Returns: (transfer full): The Operator Identifier of the #MMSim object, or %NULL if it couldn't be retrieved. The returned value should be freed with g_free().
+ */
+gchar *
+mm_sim_dup_operator_identifier (MMSim *self)
+{
+ g_return_val_if_fail (MM_GDBUS_IS_SIM (self), NULL);
+
+ return mm_gdbus_sim_dup_operator_identifier (self);
+}
+
+/**
+ * mm_sim_get_operator_name:
+ * @self: A #MMSim.
+ *
+ * Gets the Operator Name of the #MMSim object.
+ *
+ * <warning>It is only safe to use this function on the thread where @self was constructed. Use mm_sim_dup_operator_name() if on another thread.</warning>
+ *
+ * Returns: (transfer none): The Operator Name of the #MMSim object, or %NULL if it couldn't be retrieved.
+ */
+const gchar *
+mm_sim_get_operator_name (MMSim *self)
+{
+ g_return_val_if_fail (MM_GDBUS_IS_SIM (self), NULL);
+
+ return mm_gdbus_sim_get_operator_name (self);
+}
+
+/**
+ * mm_sim_dup_operator_name:
+ * @self: A #MMSim.
+ *
+ * Gets a copy of the Operator Name of the #MMSim object.
+ *
+ * Returns: (transfer full): The Operator Name of the #MMSim object, or %NULL if it couldn't be retrieved. The returned value should be freed with g_free().
+ */
+gchar *
+mm_sim_dup_operator_name (MMSim *self)
+{
+ g_return_val_if_fail (MM_GDBUS_IS_SIM (self), NULL);
+
+ return mm_gdbus_sim_dup_operator_name (self);
+}
+
+/**
+ * mm_sim_send_pin:
+ * @self: A #MMSim.
+ * @pin: The PIN code.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
+ * @user_data: User data to pass to @callback.
+ *
+ * Asynchronously sends the PIN code to the SIM card.
+ *
+ * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
+ * You can then call mm_sim_send_pin_finish() to get the result of the operation.
+ *
+ * See mm_sim_send_pin_sync() for the synchronous, blocking version of this method.
+ */
+void
+mm_sim_send_pin (MMSim *self,
+ const gchar *pin,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ g_return_if_fail (MM_GDBUS_IS_SIM (self));
+
+ mm_gdbus_sim_call_send_pin (self,
+ pin,
+ cancellable,
+ callback,
+ user_data);
+}
+
+/**
+ * mm_sim_send_pin_finish:
+ * @self: A #MMSim.
+ * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_sim_send_pin().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes an operation started with mm_sim_send_pin().
+ *
+ * Returns: (skip): %TRUE if the operation succeded, %FALSE if @error is set.
+ */
+gboolean
+mm_sim_send_pin_finish (MMSim *self,
+ GAsyncResult *res,
+ GError **error)
+{
+ g_return_val_if_fail (MM_GDBUS_IS_SIM (self), FALSE);
+
+ return mm_gdbus_sim_call_send_pin_finish (self, res, error);
+}
+
+/**
+ * mm_sim_send_pin_sync:
+ * @self: A #MMSim.
+ * @pin: The PIN code.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Synchronously sends the PIN to the SIM card.
+ *
+ * The calling thread is blocked until a reply is received.
+ * See mm_sim_send_pin() for the asynchronous version of this method.
+ *
+ * Returns: (skip): %TRUE if the operation succeded, %FALSE if @error is set.
+ */
+gboolean
+mm_sim_send_pin_sync (MMSim *self,
+ const gchar *pin,
+ GCancellable *cancellable,
+ GError **error)
+{
+ g_return_val_if_fail (MM_GDBUS_IS_SIM (self), FALSE);
+
+ return (mm_gdbus_sim_call_send_pin_sync (self,
+ pin,
+ cancellable,
+ error));
+}
+
+/**
+ * mm_sim_send_puk:
+ * @self: A #MMSim.
+ * @puk: The PUK code.
+ * @pin: The PIN code.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
+ * @user_data: User data to pass to @callback.
+ *
+ * Asynchronously sends the PUK code to the SIM card.
+ *
+ * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
+ * You can then call mm_sim_send_puk_finish() to get the result of the operation.
+ *
+ * See mm_sim_send_puk_sync() for the synchronous, blocking version of this method.
+ */
+void
+mm_sim_send_puk (MMSim *self,
+ const gchar *puk,
+ const gchar *pin,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ g_return_if_fail (MM_GDBUS_IS_SIM (self));
+
+ mm_gdbus_sim_call_send_puk (self,
+ puk,
+ pin,
+ cancellable,
+ callback,
+ user_data);
+}
+
+/**
+ * mm_sim_send_puk_finish:
+ * @self: A #MMSim.
+ * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_sim_send_puk().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes an operation started with mm_sim_send_puk().
+ *
+ * Returns: (skip): %TRUE if the operation succeded, %FALSE if @error is set.
+ */
+gboolean
+mm_sim_send_puk_finish (MMSim *self,
+ GAsyncResult *res,
+ GError **error)
+{
+ g_return_val_if_fail (MM_GDBUS_IS_SIM (self), FALSE);
+
+ return mm_gdbus_sim_call_send_puk_finish (self, res, error);
+}
+
+/**
+ * mm_sim_send_puk_sync:
+ * @self: A #MMSim.
+ * @puk: The PUK code.
+ * @pin: The PIN code.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Synchronously sends the PUK to the SIM card.
+ *
+ * The calling thread is blocked until a reply is received.
+ * See mm_sim_send_puk() for the asynchronous version of this method.
+ *
+ * Returns: (skip): %TRUE if the operation succeded, %FALSE if @error is set.
+ */
+gboolean
+mm_sim_send_puk_sync (MMSim *self,
+ const gchar *puk,
+ const gchar *pin,
+ GCancellable *cancellable,
+ GError **error)
+{
+ g_return_val_if_fail (MM_GDBUS_IS_SIM (self), FALSE);
+
+ return (mm_gdbus_sim_call_send_puk_sync (self,
+ puk,
+ pin,
+ cancellable,
+ error));
+}
+
+/**
+ * mm_sim_enable_pin:
+ * @self: A #MMSim.
+ * @pin: The PIN code.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
+ * @user_data: User data to pass to @callback.
+ *
+ * Asynchronously enables requesting the PIN code in the SIM card.
+ *
+ * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
+ * You can then call mm_sim_enable_pin_finish() to get the result of the operation.
+ *
+ * See mm_sim_enable_pin_sync() for the synchronous, blocking version of this method.
+ */
+void
+mm_sim_enable_pin (MMSim *self,
+ const gchar *pin,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ g_return_if_fail (MM_GDBUS_IS_SIM (self));
+
+ mm_gdbus_sim_call_enable_pin (self,
+ pin,
+ TRUE,
+ cancellable,
+ callback,
+ user_data);
+}
+
+/**
+ * mm_sim_enable_pin_finish:
+ * @self: A #MMSim.
+ * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_sim_enable_pin().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes an operation started with mm_sim_enable_pin().
+ *
+ * Returns: (skip): %TRUE if the operation succeded, %FALSE if @error is set.
+ */
+gboolean
+mm_sim_enable_pin_finish (MMSim *self,
+ GAsyncResult *res,
+ GError **error)
+{
+ g_return_val_if_fail (MM_GDBUS_IS_SIM (self), FALSE);
+
+ return mm_gdbus_sim_call_enable_pin_finish (self, res, error);
+}
+
+/**
+ * mm_sim_enable_pin_sync:
+ * @self: A #MMSim.
+ * @pin: The PIN code.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Synchronously enables requesting the PIN code in the SIM card.
+ *
+ * The calling thread is blocked until a reply is received.
+ * See mm_sim_enable_pin() for the asynchronous version of this method.
+ *
+ * Returns: (skip): %TRUE if the operation succeded, %FALSE if @error is set.
+ */
+gboolean
+mm_sim_enable_pin_sync (MMSim *self,
+ const gchar *pin,
+ GCancellable *cancellable,
+ GError **error)
+{
+ g_return_val_if_fail (MM_GDBUS_IS_SIM (self), FALSE);
+
+ return (mm_gdbus_sim_call_enable_pin_sync (self,
+ pin,
+ TRUE,
+ cancellable,
+ error));
+}
+
+/**
+ * mm_sim_disable_pin:
+ * @self: A #MMSim.
+ * @pin: The PIN code.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
+ * @user_data: User data to pass to @callback.
+ *
+ * Asynchronously disables requesting the PIN code in the SIM card.
+ *
+ * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
+ * You can then call mm_sim_disable_pin_finish() to get the result of the operation.
+ *
+ * See mm_sim_disable_pin_sync() for the synchronous, blocking version of this method.
+ */
+void
+mm_sim_disable_pin (MMSim *self,
+ const gchar *pin,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ g_return_if_fail (MM_GDBUS_IS_SIM (self));
+
+ mm_gdbus_sim_call_enable_pin (self,
+ pin,
+ FALSE,
+ cancellable,
+ callback,
+ user_data);
+}
+
+/**
+ * mm_sim_disable_pin_finish:
+ * @self: A #MMSim.
+ * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_sim_disable_pin().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes an operation started with mm_sim_disable_pin().
+ *
+ * Returns: (skip): %TRUE if the operation succeded, %FALSE if @error is set.
+ */
+gboolean
+mm_sim_disable_pin_finish (MMSim *self,
+ GAsyncResult *res,
+ GError **error)
+{
+ g_return_val_if_fail (MM_GDBUS_IS_SIM (self), FALSE);
+
+ return mm_gdbus_sim_call_enable_pin_finish (self, res, error);
+}
+
+/**
+ * mm_sim_disable_pin_sync:
+ * @self: A #MMSim.
+ * @pin: The PIN code.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Synchronously disables requesting the PIN code in the SIM card.
+ *
+ * The calling thread is blocked until a reply is received.
+ * See mm_sim_disable_pin() for the asynchronous version of this method.
+ *
+ * Returns: (skip): %TRUE if the operation succeded, %FALSE if @error is set.
+ */
+gboolean
+mm_sim_disable_pin_sync (MMSim *self,
+ const gchar *pin,
+ GCancellable *cancellable,
+ GError **error)
+{
+ g_return_val_if_fail (MM_GDBUS_IS_SIM (self), FALSE);
+
+ return (mm_gdbus_sim_call_enable_pin_sync (self,
+ pin,
+ FALSE,
+ cancellable,
+ error));
+}
+
+/**
+ * mm_sim_change_pin:
+ * @self: A #MMSim.
+ * @old_pin: The current PIN code.
+ * @new_pin: The new PIN code to be set.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
+ * @user_data: User data to pass to @callback.
+ *
+ * Asynchronously changes the PIN code in the SIM card.
+ *
+ * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
+ * You can then call mm_sim_change_pin_finish() to get the result of the operation.
+ *
+ * See mm_sim_change_pin_sync() for the synchronous, blocking version of this method.
+ */
+void
+mm_sim_change_pin (MMSim *self,
+ const gchar *old_pin,
+ const gchar *new_pin,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ g_return_if_fail (MM_GDBUS_IS_SIM (self));
+
+ mm_gdbus_sim_call_change_pin (self,
+ old_pin,
+ new_pin,
+ cancellable,
+ callback,
+ user_data);
+}
+
+/**
+ * mm_sim_change_pin_finish:
+ * @self: A #MMSim.
+ * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_sim_change_pin().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes an operation started with mm_sim_change_pin().
+ *
+ * Returns: (skip): %TRUE if the operation succeded, %FALSE if @error is set.
+ */
+gboolean
+mm_sim_change_pin_finish (MMSim *self,
+ GAsyncResult *res,
+ GError **error)
+{
+ g_return_val_if_fail (MM_GDBUS_IS_SIM (self), FALSE);
+
+ return mm_gdbus_sim_call_change_pin_finish (self, res, error);
+}
+
+/**
+ * mm_sim_change_pin_sync:
+ * @self: A #MMSim.
+ * @old_pin: The current PIN code.
+ * @new_pin: The new PIN code to be set.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Synchronously changes the PIN code in the SIM card.
+ *
+ * The calling thread is blocked until a reply is received.
+ * See mm_sim_change_pin() for the asynchronous version of this method.
+ *
+ * Returns: (skip): %TRUE if the operation succeded, %FALSE if @error is set.
+ */
+gboolean
+mm_sim_change_pin_sync (MMSim *self,
+ const gchar *old_pin,
+ const gchar *new_pin,
+ GCancellable *cancellable,
+ GError **error)
+{
+ g_return_val_if_fail (MM_GDBUS_IS_SIM (self), FALSE);
+
+ return (mm_gdbus_sim_call_change_pin_sync (self,
+ old_pin,
+ new_pin,
+ cancellable,
+ error));
+}
diff --git a/libmm-glib/mm-sim.h b/libmm-glib/mm-sim.h
new file mode 100644
index 00000000..73014349
--- /dev/null
+++ b/libmm-glib/mm-sim.h
@@ -0,0 +1,120 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * libmm -- Access modem status & information from glib applications
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2011 Aleksander Morgado <aleksander@gnu.org>
+ */
+
+#ifndef _MM_SIM_H_
+#define _MM_SIM_H_
+
+#include <ModemManager.h>
+#include <mm-gdbus-sim.h>
+
+G_BEGIN_DECLS
+
+typedef MmGdbusSim MMSim;
+#define MM_TYPE_SIM(o) MM_GDBUS_TYPE_SIM (o)
+#define MM_SIM(o) MM_GDBUS_SIM(o)
+#define MM_IS_SIM(o) MM_GDBUS_IS_SIM(o)
+
+const gchar *mm_sim_get_path (MMSim *self);
+const gchar *mm_sim_get_identifier (MMSim *self);
+const gchar *mm_sim_get_imsi (MMSim *self);
+const gchar *mm_sim_get_operator_identifier (MMSim *self);
+const gchar *mm_sim_get_operator_name (MMSim *self);
+
+gchar *mm_sim_dup_path (MMSim *self);
+gchar *mm_sim_dup_identifier (MMSim *self);
+gchar *mm_sim_dup_imsi (MMSim *self);
+gchar *mm_sim_dup_operator_identifier (MMSim *self);
+gchar *mm_sim_dup_operator_name (MMSim *self);
+
+void mm_sim_send_pin (MMSim *self,
+ const gchar *pin,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean mm_sim_send_pin_finish (MMSim *self,
+ GAsyncResult *res,
+ GError **error);
+gboolean mm_sim_send_pin_sync (MMSim *self,
+ const gchar *pin,
+ GCancellable *cancellable,
+ GError **error);
+
+void mm_sim_send_puk (MMSim *self,
+ const gchar *puk,
+ const gchar *pin,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean mm_sim_send_puk_finish (MMSim *self,
+ GAsyncResult *res,
+ GError **error);
+gboolean mm_sim_send_puk_sync (MMSim *self,
+ const gchar *puk,
+ const gchar *pin,
+ GCancellable *cancellable,
+ GError **error);
+
+void mm_sim_enable_pin (MMSim *self,
+ const gchar *pin,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean mm_sim_enable_pin_finish (MMSim *self,
+ GAsyncResult *res,
+ GError **error);
+gboolean mm_sim_enable_pin_sync (MMSim *self,
+ const gchar *pin,
+ GCancellable *cancellable,
+ GError **error);
+
+
+void mm_sim_disable_pin (MMSim *self,
+ const gchar *pin,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean mm_sim_disable_pin_finish (MMSim *self,
+ GAsyncResult *res,
+ GError **error);
+gboolean mm_sim_disable_pin_sync (MMSim *self,
+ const gchar *pin,
+ GCancellable *cancellable,
+ GError **error);
+
+void mm_sim_change_pin (MMSim *self,
+ const gchar *old_pin,
+ const gchar *new_pin,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean mm_sim_change_pin_finish (MMSim *self,
+ GAsyncResult *res,
+ GError **error);
+gboolean mm_sim_change_pin_sync (MMSim *self,
+ const gchar *old_pin,
+ const gchar *new_pin,
+ GCancellable *cancellable,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* _MM_SIM_H_ */