Blame libmm-glib/mm-sim.c

Packit d14447
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
Packit d14447
/*
Packit d14447
 * libmm -- Access modem status & information from glib applications
Packit d14447
 *
Packit d14447
 * This library is free software; you can redistribute it and/or
Packit d14447
 * modify it under the terms of the GNU Lesser General Public
Packit d14447
 * License as published by the Free Software Foundation; either
Packit d14447
 * version 2 of the License, or (at your option) any later version.
Packit d14447
 *
Packit d14447
 * This library is distributed in the hope that it will be useful,
Packit d14447
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit d14447
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit d14447
 * Lesser General Public License for more details.
Packit d14447
 *
Packit d14447
 * You should have received a copy of the GNU Lesser General Public
Packit d14447
 * License along with this library; if not, write to the
Packit d14447
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Packit d14447
 * Boston, MA 02110-1301 USA.
Packit d14447
 *
Packit d14447
 * Copyright (C) 2011 - 2012 Aleksander Morgado <aleksander@gnu.org>
Packit d14447
 * Copyright (C) 2012 Google, Inc.
Packit d14447
 */
Packit d14447
Packit d14447
#include "mm-helpers.h"
Packit d14447
#include "mm-sim.h"
Packit d14447
Packit d14447
/**
Packit d14447
 * SECTION: mm-sim
Packit d14447
 * @title: MMSim
Packit d14447
 * @short_description: The SIM interface
Packit d14447
 *
Packit d14447
 * The #MMSim is an object providing access to the methods, signals and
Packit d14447
 * properties of the SIM interface.
Packit d14447
 *
Packit d14447
 * When the SIM is exposed and available in the bus, it is ensured that at
Packit d14447
 * least this interface is also available.
Packit d14447
 */
Packit d14447
Packit d14447
G_DEFINE_TYPE (MMSim, mm_sim, MM_GDBUS_TYPE_SIM_PROXY)
Packit d14447
Packit d14447
/*****************************************************************************/
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_get_path:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 *
Packit d14447
 * Gets the DBus path of the #MMSim object.
Packit d14447
 *
Packit d14447
 * Returns: (transfer none): The DBus path of the #MMSim object.
Packit d14447
 */
Packit d14447
const gchar *
Packit d14447
mm_sim_get_path (MMSim *self)
Packit d14447
{
Packit d14447
    g_return_val_if_fail (MM_IS_SIM (self), NULL);
Packit d14447
Packit d14447
    RETURN_NON_EMPTY_CONSTANT_STRING (
Packit d14447
        g_dbus_proxy_get_object_path (G_DBUS_PROXY (self)));
Packit d14447
}
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_dup_path:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 *
Packit d14447
 * Gets a copy of the DBus path of the #MMSim object.
Packit d14447
 *
Packit d14447
 * Returns: (transfer full): The DBus path of the #MMSim object. The returned value should be freed with g_free().
Packit d14447
 */
Packit d14447
gchar *
Packit d14447
mm_sim_dup_path (MMSim *self)
Packit d14447
{
Packit d14447
    gchar *value;
Packit d14447
Packit d14447
    g_return_val_if_fail (MM_IS_SIM (self), NULL);
Packit d14447
Packit d14447
    g_object_get (G_OBJECT (self),
Packit d14447
                  "g-object-path", &value,
Packit d14447
                  NULL);
Packit d14447
Packit d14447
    RETURN_NON_EMPTY_STRING (value);
Packit d14447
}
Packit d14447
Packit d14447
/*****************************************************************************/
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_get_identifier:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 *
Packit d14447
 * Gets the unique SIM identifier of the #MMSim object.
Packit d14447
 *
Packit d14447
 * <warning>The returned value is only valid until the property changes so
Packit d14447
 * it is only safe to use this function on the thread where
Packit d14447
 * @self was constructed. Use mm_sim_dup_identifier() if on another
Packit d14447
 * thread.</warning>
Packit d14447
 *
Packit d14447
 * Returns: (transfer none): The unique identifier of the #MMSim object, or %NULL if it couldn't be retrieved.
Packit d14447
 */
Packit d14447
const gchar *
Packit d14447
mm_sim_get_identifier (MMSim *self)
Packit d14447
{
Packit d14447
    g_return_val_if_fail (MM_IS_SIM (self), NULL);
Packit d14447
Packit d14447
    RETURN_NON_EMPTY_CONSTANT_STRING (
Packit d14447
        mm_gdbus_sim_get_sim_identifier (MM_GDBUS_SIM (self)));
Packit d14447
}
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_dup_identifier:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 *
Packit d14447
 * Gets a copy of the unique SIM identifier of the #MMSim object.
Packit d14447
 *
Packit d14447
 * 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().
Packit d14447
 */
Packit d14447
gchar *
Packit d14447
mm_sim_dup_identifier (MMSim *self)
Packit d14447
{
Packit d14447
    g_return_val_if_fail (MM_IS_SIM (self), NULL);
Packit d14447
Packit d14447
    RETURN_NON_EMPTY_STRING (
Packit d14447
        mm_gdbus_sim_dup_sim_identifier (MM_GDBUS_SIM (self)));
Packit d14447
}
Packit d14447
Packit d14447
/*****************************************************************************/
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_get_imsi:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 *
Packit d14447
 * Gets the International Mobile Subscriber Identity (IMSI) of the #MMSim object.
Packit d14447
 *
Packit d14447
 * <warning>The returned value is only valid until the property changes so
Packit d14447
 * it is only safe to use this function on the thread where
Packit d14447
 * @self was constructed. Use mm_sim_dup_imsi() if on another
Packit d14447
 * thread.</warning>
Packit d14447
 *
Packit d14447
 * Returns: (transfer none): The IMSI of the #MMSim object, or %NULL if it couldn't be retrieved.
Packit d14447
 */
Packit d14447
const gchar *
Packit d14447
mm_sim_get_imsi (MMSim *self)
Packit d14447
{
Packit d14447
    g_return_val_if_fail (MM_IS_SIM (self), NULL);
Packit d14447
Packit d14447
    RETURN_NON_EMPTY_CONSTANT_STRING (
Packit d14447
        mm_gdbus_sim_get_imsi (MM_GDBUS_SIM (self)));
Packit d14447
}
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_dup_imsi:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 *
Packit d14447
 * Gets a copy of the International Mobile Subscriber Identity (IMSI) of the #MMSim object.
Packit d14447
 *
Packit d14447
 * 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().
Packit d14447
 */
Packit d14447
gchar *
Packit d14447
mm_sim_dup_imsi (MMSim *self)
Packit d14447
{
Packit d14447
    g_return_val_if_fail (MM_IS_SIM (self), NULL);
Packit d14447
Packit d14447
    RETURN_NON_EMPTY_STRING (
Packit d14447
        mm_gdbus_sim_dup_imsi (MM_GDBUS_SIM (self)));
Packit d14447
}
Packit d14447
Packit d14447
/*****************************************************************************/
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_get_operator_identifier:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 *
Packit d14447
 * Gets the Operator Identifier of the #MMSim object.
Packit d14447
 *
Packit d14447
 * <warning>The returned value is only valid until the property changes so
Packit d14447
 * it is only safe to use this function on the thread where
Packit d14447
 * @self was constructed. Use mm_sim_dup_operator_identifier() if on another
Packit d14447
 * thread.</warning>
Packit d14447
 *
Packit d14447
 * Returns: (transfer none): The Operator Identifier of the #MMSim object, or %NULL if it couldn't be retrieved.
Packit d14447
 */
Packit d14447
const gchar *
Packit d14447
mm_sim_get_operator_identifier (MMSim *self)
Packit d14447
{
Packit d14447
    g_return_val_if_fail (MM_IS_SIM (self), NULL);
Packit d14447
Packit d14447
    RETURN_NON_EMPTY_CONSTANT_STRING (
Packit d14447
        mm_gdbus_sim_get_operator_identifier (MM_GDBUS_SIM (self)));
Packit d14447
}
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_dup_operator_identifier:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 *
Packit d14447
 * Gets a copy of the Operator Identifier of the #MMSim object.
Packit d14447
 *
Packit d14447
 * 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().
Packit d14447
 */
Packit d14447
gchar *
Packit d14447
mm_sim_dup_operator_identifier (MMSim *self)
Packit d14447
{
Packit d14447
    g_return_val_if_fail (MM_IS_SIM (self), NULL);
Packit d14447
Packit d14447
    RETURN_NON_EMPTY_STRING (
Packit d14447
        mm_gdbus_sim_dup_operator_identifier (MM_GDBUS_SIM (self)));
Packit d14447
}
Packit d14447
Packit d14447
/*****************************************************************************/
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_get_operator_name:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 *
Packit d14447
 * Gets the Operator Name of the #MMSim object.
Packit d14447
 *
Packit d14447
 * <warning>The returned value is only valid until the property changes so
Packit d14447
 * it is only safe to use this function on the thread where
Packit d14447
 * @self was constructed. Use mm_sim_dup_operator_name() if on another
Packit d14447
 * thread.</warning>
Packit d14447
 *
Packit d14447
 * Returns: (transfer none): The Operator Name of the #MMSim object, or %NULL if it couldn't be retrieved.
Packit d14447
 */
Packit d14447
const gchar *
Packit d14447
mm_sim_get_operator_name (MMSim *self)
Packit d14447
{
Packit d14447
    g_return_val_if_fail (MM_IS_SIM (self), NULL);
Packit d14447
Packit d14447
    RETURN_NON_EMPTY_CONSTANT_STRING (
Packit d14447
        mm_gdbus_sim_get_operator_name (MM_GDBUS_SIM (self)));
Packit d14447
}
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_dup_operator_name:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 *
Packit d14447
 * Gets a copy of the Operator Name of the #MMSim object.
Packit d14447
 *
Packit d14447
 * 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().
Packit d14447
 */
Packit d14447
gchar *
Packit d14447
mm_sim_dup_operator_name (MMSim *self)
Packit d14447
{
Packit d14447
    g_return_val_if_fail (MM_IS_SIM (self), NULL);
Packit d14447
Packit d14447
    RETURN_NON_EMPTY_STRING (
Packit d14447
        mm_gdbus_sim_dup_operator_name (MM_GDBUS_SIM (self)));
Packit d14447
}
Packit d14447
Packit d14447
/*****************************************************************************/
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_send_pin_finish:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_sim_send_pin().
Packit d14447
 * @error: Return location for error or %NULL.
Packit d14447
 *
Packit d14447
 * Finishes an operation started with mm_sim_send_pin().
Packit d14447
 *
Packit d14447
 * Returns: %TRUE if the operation succeeded, %FALSE if @error is set.
Packit d14447
 */
Packit d14447
gboolean
Packit d14447
mm_sim_send_pin_finish (MMSim *self,
Packit d14447
                        GAsyncResult *res,
Packit d14447
                        GError **error)
Packit d14447
{
Packit d14447
    g_return_val_if_fail (MM_IS_SIM (self), FALSE);
Packit d14447
Packit d14447
    return mm_gdbus_sim_call_send_pin_finish (MM_GDBUS_SIM (self), res, error);
Packit d14447
}
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_send_pin:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 * @pin: The PIN code.
Packit d14447
 * @cancellable: (allow-none): A #GCancellable or %NULL.
Packit d14447
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
Packit d14447
 * @user_data: User data to pass to @callback.
Packit d14447
 *
Packit d14447
 * Asynchronously sends the PIN code to the SIM card.
Packit d14447
 *
Packit d14447
 * 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.
Packit d14447
 * You can then call mm_sim_send_pin_finish() to get the result of the operation.
Packit d14447
 *
Packit d14447
 * See mm_sim_send_pin_sync() for the synchronous, blocking version of this method.
Packit d14447
 */
Packit d14447
void
Packit d14447
mm_sim_send_pin (MMSim *self,
Packit d14447
                 const gchar *pin,
Packit d14447
                 GCancellable *cancellable,
Packit d14447
                 GAsyncReadyCallback callback,
Packit d14447
                 gpointer user_data)
Packit d14447
{
Packit d14447
    g_return_if_fail (MM_IS_SIM (self));
Packit d14447
Packit d14447
    mm_gdbus_sim_call_send_pin (MM_GDBUS_SIM (self),
Packit d14447
                                pin,
Packit d14447
                                cancellable,
Packit d14447
                                callback,
Packit d14447
                                user_data);
Packit d14447
}
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_send_pin_sync:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 * @pin: The PIN code.
Packit d14447
 * @cancellable: (allow-none): A #GCancellable or %NULL.
Packit d14447
 * @error: Return location for error or %NULL.
Packit d14447
 *
Packit d14447
 * Synchronously sends the PIN to the SIM card.
Packit d14447
 *
Packit d14447
 * The calling thread is blocked until a reply is received.
Packit d14447
 * See mm_sim_send_pin() for the asynchronous version of this method.
Packit d14447
 *
Packit d14447
 * Returns: %TRUE if the operation succeeded, %FALSE if @error is set.
Packit d14447
 */
Packit d14447
gboolean
Packit d14447
mm_sim_send_pin_sync (MMSim *self,
Packit d14447
                      const gchar *pin,
Packit d14447
                      GCancellable *cancellable,
Packit d14447
                      GError **error)
Packit d14447
{
Packit d14447
    g_return_val_if_fail (MM_IS_SIM (self), FALSE);
Packit d14447
Packit d14447
    return (mm_gdbus_sim_call_send_pin_sync (MM_GDBUS_SIM (self),
Packit d14447
                                             pin,
Packit d14447
                                             cancellable,
Packit d14447
                                             error));
Packit d14447
}
Packit d14447
Packit d14447
/*****************************************************************************/
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_send_puk_finish:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_sim_send_puk().
Packit d14447
 * @error: Return location for error or %NULL.
Packit d14447
 *
Packit d14447
 * Finishes an operation started with mm_sim_send_puk().
Packit d14447
 *
Packit d14447
 * Returns: %TRUE if the operation succeeded, %FALSE if @error is set.
Packit d14447
 */
Packit d14447
gboolean
Packit d14447
mm_sim_send_puk_finish (MMSim *self,
Packit d14447
                        GAsyncResult *res,
Packit d14447
                        GError **error)
Packit d14447
{
Packit d14447
    g_return_val_if_fail (MM_IS_SIM (self), FALSE);
Packit d14447
Packit d14447
    return mm_gdbus_sim_call_send_puk_finish (MM_GDBUS_SIM (self), res, error);
Packit d14447
}
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_send_puk:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 * @puk: The PUK code.
Packit d14447
 * @pin: The PIN code.
Packit d14447
 * @cancellable: (allow-none): A #GCancellable or %NULL.
Packit d14447
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
Packit d14447
 * @user_data: User data to pass to @callback.
Packit d14447
 *
Packit d14447
 * Asynchronously sends the PUK code to the SIM card.
Packit d14447
 *
Packit d14447
 * 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.
Packit d14447
 * You can then call mm_sim_send_puk_finish() to get the result of the operation.
Packit d14447
 *
Packit d14447
 * See mm_sim_send_puk_sync() for the synchronous, blocking version of this method.
Packit d14447
 */
Packit d14447
void
Packit d14447
mm_sim_send_puk (MMSim *self,
Packit d14447
                 const gchar *puk,
Packit d14447
                 const gchar *pin,
Packit d14447
                 GCancellable *cancellable,
Packit d14447
                 GAsyncReadyCallback callback,
Packit d14447
                 gpointer user_data)
Packit d14447
{
Packit d14447
    g_return_if_fail (MM_IS_SIM (self));
Packit d14447
Packit d14447
    mm_gdbus_sim_call_send_puk (MM_GDBUS_SIM (self),
Packit d14447
                                puk,
Packit d14447
                                pin,
Packit d14447
                                cancellable,
Packit d14447
                                callback,
Packit d14447
                                user_data);
Packit d14447
}
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_send_puk_sync:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 * @puk: The PUK code.
Packit d14447
 * @pin: The PIN code.
Packit d14447
 * @cancellable: (allow-none): A #GCancellable or %NULL.
Packit d14447
 * @error: Return location for error or %NULL.
Packit d14447
 *
Packit d14447
 * Synchronously sends the PUK to the SIM card.
Packit d14447
 *
Packit d14447
 * The calling thread is blocked until a reply is received.
Packit d14447
 * See mm_sim_send_puk() for the asynchronous version of this method.
Packit d14447
 *
Packit d14447
 * Returns: %TRUE if the operation succeeded, %FALSE if @error is set.
Packit d14447
 */
Packit d14447
gboolean
Packit d14447
mm_sim_send_puk_sync (MMSim *self,
Packit d14447
                      const gchar *puk,
Packit d14447
                      const gchar *pin,
Packit d14447
                      GCancellable *cancellable,
Packit d14447
                      GError **error)
Packit d14447
{
Packit d14447
    g_return_val_if_fail (MM_IS_SIM (self), FALSE);
Packit d14447
Packit d14447
    return (mm_gdbus_sim_call_send_puk_sync (MM_GDBUS_SIM (self),
Packit d14447
                                             puk,
Packit d14447
                                             pin,
Packit d14447
                                             cancellable,
Packit d14447
                                             error));
Packit d14447
}
Packit d14447
Packit d14447
/*****************************************************************************/
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_enable_pin_finish:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_sim_enable_pin().
Packit d14447
 * @error: Return location for error or %NULL.
Packit d14447
 *
Packit d14447
 * Finishes an operation started with mm_sim_enable_pin().
Packit d14447
 *
Packit d14447
 * Returns: %TRUE if the operation succeeded, %FALSE if @error is set.
Packit d14447
 */
Packit d14447
gboolean
Packit d14447
mm_sim_enable_pin_finish (MMSim *self,
Packit d14447
                          GAsyncResult *res,
Packit d14447
                          GError **error)
Packit d14447
{
Packit d14447
    g_return_val_if_fail (MM_IS_SIM (self), FALSE);
Packit d14447
Packit d14447
    return mm_gdbus_sim_call_enable_pin_finish (MM_GDBUS_SIM (self), res, error);
Packit d14447
}
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_enable_pin:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 * @pin: The PIN code.
Packit d14447
 * @cancellable: (allow-none): A #GCancellable or %NULL.
Packit d14447
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
Packit d14447
 * @user_data: User data to pass to @callback.
Packit d14447
 *
Packit d14447
 * Asynchronously enables requesting the PIN code in the SIM card.
Packit d14447
 *
Packit d14447
 * 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.
Packit d14447
 * You can then call mm_sim_enable_pin_finish() to get the result of the operation.
Packit d14447
 *
Packit d14447
 * See mm_sim_enable_pin_sync() for the synchronous, blocking version of this method.
Packit d14447
 */
Packit d14447
void
Packit d14447
mm_sim_enable_pin (MMSim *self,
Packit d14447
                   const gchar *pin,
Packit d14447
                   GCancellable *cancellable,
Packit d14447
                   GAsyncReadyCallback callback,
Packit d14447
                   gpointer user_data)
Packit d14447
{
Packit d14447
    g_return_if_fail (MM_IS_SIM (self));
Packit d14447
Packit d14447
    mm_gdbus_sim_call_enable_pin (MM_GDBUS_SIM (self),
Packit d14447
                                  pin,
Packit d14447
                                  TRUE,
Packit d14447
                                  cancellable,
Packit d14447
                                  callback,
Packit d14447
                                  user_data);
Packit d14447
}
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_enable_pin_sync:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 * @pin: The PIN code.
Packit d14447
 * @cancellable: (allow-none): A #GCancellable or %NULL.
Packit d14447
 * @error: Return location for error or %NULL.
Packit d14447
 *
Packit d14447
 * Synchronously enables requesting the PIN code in the SIM card.
Packit d14447
 *
Packit d14447
 * The calling thread is blocked until a reply is received.
Packit d14447
 * See mm_sim_enable_pin() for the asynchronous version of this method.
Packit d14447
 *
Packit d14447
 * Returns: %TRUE if the operation succeeded, %FALSE if @error is set.
Packit d14447
 */
Packit d14447
gboolean
Packit d14447
mm_sim_enable_pin_sync (MMSim *self,
Packit d14447
                        const gchar *pin,
Packit d14447
                        GCancellable *cancellable,
Packit d14447
                        GError **error)
Packit d14447
{
Packit d14447
    g_return_val_if_fail (MM_IS_SIM (self), FALSE);
Packit d14447
Packit d14447
    return (mm_gdbus_sim_call_enable_pin_sync (MM_GDBUS_SIM (self),
Packit d14447
                                               pin,
Packit d14447
                                               TRUE,
Packit d14447
                                               cancellable,
Packit d14447
                                               error));
Packit d14447
}
Packit d14447
Packit d14447
/*****************************************************************************/
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_disable_pin_finish:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_sim_disable_pin().
Packit d14447
 * @error: Return location for error or %NULL.
Packit d14447
 *
Packit d14447
 * Finishes an operation started with mm_sim_disable_pin().
Packit d14447
 *
Packit d14447
 * Returns: %TRUE if the operation succeeded, %FALSE if @error is set.
Packit d14447
 */
Packit d14447
gboolean
Packit d14447
mm_sim_disable_pin_finish (MMSim *self,
Packit d14447
                           GAsyncResult *res,
Packit d14447
                           GError **error)
Packit d14447
{
Packit d14447
    g_return_val_if_fail (MM_IS_SIM (self), FALSE);
Packit d14447
Packit d14447
    return mm_gdbus_sim_call_enable_pin_finish (MM_GDBUS_SIM (self), res, error);
Packit d14447
}
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_disable_pin:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 * @pin: The PIN code.
Packit d14447
 * @cancellable: (allow-none): A #GCancellable or %NULL.
Packit d14447
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
Packit d14447
 * @user_data: User data to pass to @callback.
Packit d14447
 *
Packit d14447
 * Asynchronously disables requesting the PIN code in the SIM card.
Packit d14447
 *
Packit d14447
 * 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.
Packit d14447
 * You can then call mm_sim_disable_pin_finish() to get the result of the operation.
Packit d14447
 *
Packit d14447
 * See mm_sim_disable_pin_sync() for the synchronous, blocking version of this method.
Packit d14447
 */
Packit d14447
void
Packit d14447
mm_sim_disable_pin (MMSim *self,
Packit d14447
                    const gchar *pin,
Packit d14447
                    GCancellable *cancellable,
Packit d14447
                    GAsyncReadyCallback callback,
Packit d14447
                    gpointer user_data)
Packit d14447
{
Packit d14447
    g_return_if_fail (MM_IS_SIM (self));
Packit d14447
Packit d14447
    mm_gdbus_sim_call_enable_pin (MM_GDBUS_SIM (self),
Packit d14447
                                  pin,
Packit d14447
                                  FALSE,
Packit d14447
                                  cancellable,
Packit d14447
                                  callback,
Packit d14447
                                  user_data);
Packit d14447
}
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_disable_pin_sync:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 * @pin: The PIN code.
Packit d14447
 * @cancellable: (allow-none): A #GCancellable or %NULL.
Packit d14447
 * @error: Return location for error or %NULL.
Packit d14447
 *
Packit d14447
 * Synchronously disables requesting the PIN code in the SIM card.
Packit d14447
 *
Packit d14447
 * The calling thread is blocked until a reply is received.
Packit d14447
 * See mm_sim_disable_pin() for the asynchronous version of this method.
Packit d14447
 *
Packit d14447
 * Returns: %TRUE if the operation succeeded, %FALSE if @error is set.
Packit d14447
 */
Packit d14447
gboolean
Packit d14447
mm_sim_disable_pin_sync (MMSim *self,
Packit d14447
                         const gchar *pin,
Packit d14447
                         GCancellable *cancellable,
Packit d14447
                         GError **error)
Packit d14447
{
Packit d14447
    g_return_val_if_fail (MM_IS_SIM (self), FALSE);
Packit d14447
Packit d14447
    return (mm_gdbus_sim_call_enable_pin_sync (MM_GDBUS_SIM (self),
Packit d14447
                                               pin,
Packit d14447
                                               FALSE,
Packit d14447
                                               cancellable,
Packit d14447
                                               error));
Packit d14447
}
Packit d14447
Packit d14447
/*****************************************************************************/
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_change_pin_finish:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_sim_change_pin().
Packit d14447
 * @error: Return location for error or %NULL.
Packit d14447
 *
Packit d14447
 * Finishes an operation started with mm_sim_change_pin().
Packit d14447
 *
Packit d14447
 * Returns: %TRUE if the operation succeeded, %FALSE if @error is set.
Packit d14447
 */
Packit d14447
gboolean
Packit d14447
mm_sim_change_pin_finish (MMSim *self,
Packit d14447
                          GAsyncResult *res,
Packit d14447
                          GError **error)
Packit d14447
{
Packit d14447
    g_return_val_if_fail (MM_IS_SIM (self), FALSE);
Packit d14447
Packit d14447
    return mm_gdbus_sim_call_change_pin_finish (MM_GDBUS_SIM (self), res, error);
Packit d14447
}
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_change_pin:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 * @old_pin: The current PIN code.
Packit d14447
 * @new_pin: The new PIN code to be set.
Packit d14447
 * @cancellable: (allow-none): A #GCancellable or %NULL.
Packit d14447
 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
Packit d14447
 * @user_data: User data to pass to @callback.
Packit d14447
 *
Packit d14447
 * Asynchronously changes the PIN code in the SIM card.
Packit d14447
 *
Packit d14447
 * 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.
Packit d14447
 * You can then call mm_sim_change_pin_finish() to get the result of the operation.
Packit d14447
 *
Packit d14447
 * See mm_sim_change_pin_sync() for the synchronous, blocking version of this method.
Packit d14447
 */
Packit d14447
void
Packit d14447
mm_sim_change_pin (MMSim *self,
Packit d14447
                   const gchar *old_pin,
Packit d14447
                   const gchar *new_pin,
Packit d14447
                   GCancellable *cancellable,
Packit d14447
                   GAsyncReadyCallback callback,
Packit d14447
                   gpointer user_data)
Packit d14447
{
Packit d14447
    g_return_if_fail (MM_IS_SIM (self));
Packit d14447
Packit d14447
    mm_gdbus_sim_call_change_pin (MM_GDBUS_SIM (self),
Packit d14447
                                  old_pin,
Packit d14447
                                  new_pin,
Packit d14447
                                  cancellable,
Packit d14447
                                  callback,
Packit d14447
                                  user_data);
Packit d14447
}
Packit d14447
Packit d14447
/**
Packit d14447
 * mm_sim_change_pin_sync:
Packit d14447
 * @self: A #MMSim.
Packit d14447
 * @old_pin: The current PIN code.
Packit d14447
 * @new_pin: The new PIN code to be set.
Packit d14447
 * @cancellable: (allow-none): A #GCancellable or %NULL.
Packit d14447
 * @error: Return location for error or %NULL.
Packit d14447
 *
Packit d14447
 * Synchronously changes the PIN code in the SIM card.
Packit d14447
 *
Packit d14447
 * The calling thread is blocked until a reply is received.
Packit d14447
 * See mm_sim_change_pin() for the asynchronous version of this method.
Packit d14447
 *
Packit d14447
 * Returns: %TRUE if the operation succeeded, %FALSE if @error is set.
Packit d14447
 */
Packit d14447
gboolean
Packit d14447
mm_sim_change_pin_sync (MMSim *self,
Packit d14447
                        const gchar *old_pin,
Packit d14447
                        const gchar *new_pin,
Packit d14447
                        GCancellable *cancellable,
Packit d14447
                        GError **error)
Packit d14447
{
Packit d14447
    g_return_val_if_fail (MM_IS_SIM (self), FALSE);
Packit d14447
Packit d14447
    return (mm_gdbus_sim_call_change_pin_sync (MM_GDBUS_SIM (self),
Packit d14447
                                               old_pin,
Packit d14447
                                               new_pin,
Packit d14447
                                               cancellable,
Packit d14447
                                               error));
Packit d14447
}
Packit d14447
Packit d14447
/*****************************************************************************/
Packit d14447
Packit d14447
static void
Packit d14447
mm_sim_init (MMSim *self)
Packit d14447
{
Packit d14447
}
Packit d14447
Packit d14447
static void
Packit d14447
mm_sim_class_init (MMSimClass *sim_class)
Packit d14447
{
Packit d14447
}