aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-10-02 13:24:05 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-10-03 20:45:20 +0200
commitba075e48f4c4470022f0eec28918e14b499dd681 (patch)
tree5a974ff295f42a11a408d3a4f296a555d67d7c00
parent41ece5a021cc2b3f53db465a06d60267bada3c5e (diff)
libmm-glib,sim: `MMSim' is now a real object
Not just a typedef of the gdbus-codegen generated `MmGdbusSim'.
-rw-r--r--libmm-glib/mm-modem.c48
-rw-r--r--libmm-glib/mm-sim.c355
-rw-r--r--libmm-glib/mm-sim.h50
3 files changed, 275 insertions, 178 deletions
diff --git a/libmm-glib/mm-modem.c b/libmm-glib/mm-modem.c
index 37c5ab79..0f2f420a 100644
--- a/libmm-glib/mm-modem.c
+++ b/libmm-glib/mm-modem.c
@@ -2226,9 +2226,13 @@ modem_get_sim_ready (GDBusConnection *connection,
GSimpleAsyncResult *simple)
{
GError *error = NULL;
- MMSim *sim;
+ GObject *sim;
+ GObject *source_object;
+
+ source_object = g_async_result_get_source_object (res);
+ sim = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, &error);
+ g_object_unref (source_object);
- sim = mm_gdbus_sim_proxy_new_finish (res, &error);
if (error)
g_simple_async_result_take_error (simple, error);
else
@@ -2278,15 +2282,17 @@ mm_modem_get_sim (MMModem *self,
return;
}
- mm_gdbus_sim_proxy_new (
- g_dbus_proxy_get_connection (
- G_DBUS_PROXY (self)),
- G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
- MM_DBUS_SERVICE,
- sim_path,
- cancellable,
- (GAsyncReadyCallback)modem_get_sim_ready,
- result);
+ g_async_initable_new_async (MM_TYPE_SIM,
+ G_PRIORITY_DEFAULT,
+ cancellable,
+ (GAsyncReadyCallback)modem_get_sim_ready,
+ result,
+ "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
+ "g-name", MM_DBUS_SERVICE,
+ "g-connection", g_dbus_proxy_get_connection (G_DBUS_PROXY (self)),
+ "g-object-path", sim_path,
+ "g-interface-name", "org.freedesktop.ModemManager1.Sim",
+ NULL);
}
/**
@@ -2307,6 +2313,7 @@ mm_modem_get_sim_sync (MMModem *self,
GCancellable *cancellable,
GError **error)
{
+ GObject *sim;
const gchar *sim_path;
g_return_val_if_fail (MM_IS_MODEM (self), NULL);
@@ -2315,14 +2322,17 @@ mm_modem_get_sim_sync (MMModem *self,
if (!sim_path)
return NULL;
- return (MMSim *)(mm_gdbus_sim_proxy_new_sync (
- g_dbus_proxy_get_connection (
- G_DBUS_PROXY (self)),
- G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
- MM_DBUS_SERVICE,
- sim_path,
- cancellable,
- error));
+ sim = g_initable_new (MM_TYPE_SIM,
+ cancellable,
+ error,
+ "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
+ "g-name", MM_DBUS_SERVICE,
+ "g-connection", g_dbus_proxy_get_connection (G_DBUS_PROXY (self)),
+ "g-object-path", sim_path,
+ "g-interface-name", "org.freedesktop.ModemManager1.Sim",
+ NULL);
+
+ return (sim ? MM_SIM (sim) : NULL);
}
/*****************************************************************************/
diff --git a/libmm-glib/mm-sim.c b/libmm-glib/mm-sim.c
index 40bb93b0..74cb3f0b 100644
--- a/libmm-glib/mm-sim.c
+++ b/libmm-glib/mm-sim.c
@@ -17,13 +17,30 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
- * Copyright (C) 2011 Aleksander Morgado <aleksander@gnu.org>
+ * Copyright (C) 2011 - 2012 Aleksander Morgado <aleksander@gnu.org>
+ * Copyright (C) 2012 Google, Inc.
*/
#include "mm-helpers.h"
#include "mm-sim.h"
/**
+ * SECTION: mm-sim
+ * @title: MMSim
+ * @short_description: The SIM interface
+ *
+ * The #MMSim is an object providing access to the methods, signals and
+ * properties of the SIM interface.
+ *
+ * When the SIM is exposed and available in the bus, it is ensured that at
+ * least this interface is also available.
+ */
+
+G_DEFINE_TYPE (MMSim, mm_sim, MM_GDBUS_TYPE_SIM_PROXY)
+
+/*****************************************************************************/
+
+/**
* mm_sim_get_path:
* @self: A #MMSim.
*
@@ -34,7 +51,7 @@
const gchar *
mm_sim_get_path (MMSim *self)
{
- g_return_val_if_fail (G_IS_DBUS_PROXY (self), NULL);
+ g_return_val_if_fail (MM_IS_SIM (self), NULL);
RETURN_NON_EMPTY_CONSTANT_STRING (
g_dbus_proxy_get_object_path (G_DBUS_PROXY (self)));
@@ -53,7 +70,7 @@ mm_sim_dup_path (MMSim *self)
{
gchar *value;
- g_return_val_if_fail (G_IS_DBUS_PROXY (self), NULL);
+ g_return_val_if_fail (MM_IS_SIM (self), NULL);
g_object_get (G_OBJECT (self),
"g-object-path", &value,
@@ -62,23 +79,28 @@ mm_sim_dup_path (MMSim *self)
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>
+ * <warning>The returned value is only valid until the property changes so
+ * 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);
+ g_return_val_if_fail (MM_IS_SIM (self), NULL);
RETURN_NON_EMPTY_CONSTANT_STRING (
- mm_gdbus_sim_get_sim_identifier (self));
+ mm_gdbus_sim_get_sim_identifier (MM_GDBUS_SIM (self)));
}
/**
@@ -92,29 +114,34 @@ mm_sim_get_identifier (MMSim *self)
gchar *
mm_sim_dup_identifier (MMSim *self)
{
- g_return_val_if_fail (MM_GDBUS_IS_SIM (self), NULL);
+ g_return_val_if_fail (MM_IS_SIM (self), NULL);
RETURN_NON_EMPTY_STRING (
- mm_gdbus_sim_dup_sim_identifier (self));
+ mm_gdbus_sim_dup_sim_identifier (MM_GDBUS_SIM (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>
+ * <warning>The returned value is only valid until the property changes so
+ * 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);
+ g_return_val_if_fail (MM_IS_SIM (self), NULL);
RETURN_NON_EMPTY_CONSTANT_STRING (
- mm_gdbus_sim_get_imsi (self));
+ mm_gdbus_sim_get_imsi (MM_GDBUS_SIM (self)));
}
/**
@@ -128,29 +155,34 @@ mm_sim_get_imsi (MMSim *self)
gchar *
mm_sim_dup_imsi (MMSim *self)
{
- g_return_val_if_fail (MM_GDBUS_IS_SIM (self), NULL);
+ g_return_val_if_fail (MM_IS_SIM (self), NULL);
RETURN_NON_EMPTY_STRING (
- mm_gdbus_sim_dup_imsi (self));
+ mm_gdbus_sim_dup_imsi (MM_GDBUS_SIM (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>
+ * <warning>The returned value is only valid until the property changes so
+ * 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);
+ g_return_val_if_fail (MM_IS_SIM (self), NULL);
RETURN_NON_EMPTY_CONSTANT_STRING (
- mm_gdbus_sim_get_operator_identifier (self));
+ mm_gdbus_sim_get_operator_identifier (MM_GDBUS_SIM (self)));
}
/**
@@ -164,29 +196,34 @@ mm_sim_get_operator_identifier (MMSim *self)
gchar *
mm_sim_dup_operator_identifier (MMSim *self)
{
- g_return_val_if_fail (MM_GDBUS_IS_SIM (self), NULL);
+ g_return_val_if_fail (MM_IS_SIM (self), NULL);
RETURN_NON_EMPTY_STRING (
- mm_gdbus_sim_dup_operator_identifier (self));
+ mm_gdbus_sim_dup_operator_identifier (MM_GDBUS_SIM (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>
+ * <warning>The returned value is only valid until the property changes so
+ * 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);
+ g_return_val_if_fail (MM_IS_SIM (self), NULL);
RETURN_NON_EMPTY_CONSTANT_STRING (
- mm_gdbus_sim_get_operator_name (self));
+ mm_gdbus_sim_get_operator_name (MM_GDBUS_SIM (self)));
}
/**
@@ -200,10 +237,32 @@ mm_sim_get_operator_name (MMSim *self)
gchar *
mm_sim_dup_operator_name (MMSim *self)
{
- g_return_val_if_fail (MM_GDBUS_IS_SIM (self), NULL);
+ g_return_val_if_fail (MM_IS_SIM (self), NULL);
RETURN_NON_EMPTY_STRING (
- mm_gdbus_sim_dup_operator_name (self));
+ mm_gdbus_sim_dup_operator_name (MM_GDBUS_SIM (self)));
+}
+
+/*****************************************************************************/
+
+/**
+ * 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: %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_IS_SIM (self), FALSE);
+
+ return mm_gdbus_sim_call_send_pin_finish (MM_GDBUS_SIM (self), res, error);
}
/**
@@ -228,9 +287,9 @@ mm_sim_send_pin (MMSim *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
- g_return_if_fail (MM_GDBUS_IS_SIM (self));
+ g_return_if_fail (MM_IS_SIM (self));
- mm_gdbus_sim_call_send_pin (self,
+ mm_gdbus_sim_call_send_pin (MM_GDBUS_SIM (self),
pin,
cancellable,
callback,
@@ -238,26 +297,6 @@ mm_sim_send_pin (MMSim *self,
}
/**
- * 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.
@@ -269,7 +308,7 @@ mm_sim_send_pin_finish (MMSim *self,
* 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.
+ * Returns: %TRUE if the operation succeded, %FALSE if @error is set.
*/
gboolean
mm_sim_send_pin_sync (MMSim *self,
@@ -277,14 +316,36 @@ mm_sim_send_pin_sync (MMSim *self,
GCancellable *cancellable,
GError **error)
{
- g_return_val_if_fail (MM_GDBUS_IS_SIM (self), FALSE);
+ g_return_val_if_fail (MM_IS_SIM (self), FALSE);
- return (mm_gdbus_sim_call_send_pin_sync (self,
+ return (mm_gdbus_sim_call_send_pin_sync (MM_GDBUS_SIM (self),
pin,
cancellable,
error));
}
+/*****************************************************************************/
+
+/**
+ * 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: %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_IS_SIM (self), FALSE);
+
+ return mm_gdbus_sim_call_send_puk_finish (MM_GDBUS_SIM (self), res, error);
+}
+
/**
* mm_sim_send_puk:
* @self: A #MMSim.
@@ -309,9 +370,9 @@ mm_sim_send_puk (MMSim *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
- g_return_if_fail (MM_GDBUS_IS_SIM (self));
+ g_return_if_fail (MM_IS_SIM (self));
- mm_gdbus_sim_call_send_puk (self,
+ mm_gdbus_sim_call_send_puk (MM_GDBUS_SIM (self),
puk,
pin,
cancellable,
@@ -320,26 +381,6 @@ mm_sim_send_puk (MMSim *self,
}
/**
- * 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.
@@ -352,7 +393,7 @@ mm_sim_send_puk_finish (MMSim *self,
* 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.
+ * Returns: %TRUE if the operation succeded, %FALSE if @error is set.
*/
gboolean
mm_sim_send_puk_sync (MMSim *self,
@@ -361,15 +402,37 @@ mm_sim_send_puk_sync (MMSim *self,
GCancellable *cancellable,
GError **error)
{
- g_return_val_if_fail (MM_GDBUS_IS_SIM (self), FALSE);
+ g_return_val_if_fail (MM_IS_SIM (self), FALSE);
- return (mm_gdbus_sim_call_send_puk_sync (self,
+ return (mm_gdbus_sim_call_send_puk_sync (MM_GDBUS_SIM (self),
puk,
pin,
cancellable,
error));
}
+/*****************************************************************************/
+
+/**
+ * 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: %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_IS_SIM (self), FALSE);
+
+ return mm_gdbus_sim_call_enable_pin_finish (MM_GDBUS_SIM (self), res, error);
+}
+
/**
* mm_sim_enable_pin:
* @self: A #MMSim.
@@ -392,9 +455,9 @@ mm_sim_enable_pin (MMSim *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
- g_return_if_fail (MM_GDBUS_IS_SIM (self));
+ g_return_if_fail (MM_IS_SIM (self));
- mm_gdbus_sim_call_enable_pin (self,
+ mm_gdbus_sim_call_enable_pin (MM_GDBUS_SIM (self),
pin,
TRUE,
cancellable,
@@ -403,26 +466,6 @@ mm_sim_enable_pin (MMSim *self,
}
/**
- * 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.
@@ -434,7 +477,7 @@ mm_sim_enable_pin_finish (MMSim *self,
* 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.
+ * Returns: %TRUE if the operation succeded, %FALSE if @error is set.
*/
gboolean
mm_sim_enable_pin_sync (MMSim *self,
@@ -442,15 +485,37 @@ mm_sim_enable_pin_sync (MMSim *self,
GCancellable *cancellable,
GError **error)
{
- g_return_val_if_fail (MM_GDBUS_IS_SIM (self), FALSE);
+ g_return_val_if_fail (MM_IS_SIM (self), FALSE);
- return (mm_gdbus_sim_call_enable_pin_sync (self,
+ return (mm_gdbus_sim_call_enable_pin_sync (MM_GDBUS_SIM (self),
pin,
TRUE,
cancellable,
error));
}
+/*****************************************************************************/
+
+/**
+ * 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: %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_IS_SIM (self), FALSE);
+
+ return mm_gdbus_sim_call_enable_pin_finish (MM_GDBUS_SIM (self), res, error);
+}
+
/**
* mm_sim_disable_pin:
* @self: A #MMSim.
@@ -473,9 +538,9 @@ mm_sim_disable_pin (MMSim *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
- g_return_if_fail (MM_GDBUS_IS_SIM (self));
+ g_return_if_fail (MM_IS_SIM (self));
- mm_gdbus_sim_call_enable_pin (self,
+ mm_gdbus_sim_call_enable_pin (MM_GDBUS_SIM (self),
pin,
FALSE,
cancellable,
@@ -484,26 +549,6 @@ mm_sim_disable_pin (MMSim *self,
}
/**
- * 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.
@@ -515,7 +560,7 @@ mm_sim_disable_pin_finish (MMSim *self,
* 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.
+ * Returns: %TRUE if the operation succeded, %FALSE if @error is set.
*/
gboolean
mm_sim_disable_pin_sync (MMSim *self,
@@ -523,15 +568,37 @@ mm_sim_disable_pin_sync (MMSim *self,
GCancellable *cancellable,
GError **error)
{
- g_return_val_if_fail (MM_GDBUS_IS_SIM (self), FALSE);
+ g_return_val_if_fail (MM_IS_SIM (self), FALSE);
- return (mm_gdbus_sim_call_enable_pin_sync (self,
+ return (mm_gdbus_sim_call_enable_pin_sync (MM_GDBUS_SIM (self),
pin,
FALSE,
cancellable,
error));
}
+/*****************************************************************************/
+
+/**
+ * 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: %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_IS_SIM (self), FALSE);
+
+ return mm_gdbus_sim_call_change_pin_finish (MM_GDBUS_SIM (self), res, error);
+}
+
/**
* mm_sim_change_pin:
* @self: A #MMSim.
@@ -556,9 +623,9 @@ mm_sim_change_pin (MMSim *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
- g_return_if_fail (MM_GDBUS_IS_SIM (self));
+ g_return_if_fail (MM_IS_SIM (self));
- mm_gdbus_sim_call_change_pin (self,
+ mm_gdbus_sim_call_change_pin (MM_GDBUS_SIM (self),
old_pin,
new_pin,
cancellable,
@@ -567,26 +634,6 @@ mm_sim_change_pin (MMSim *self,
}
/**
- * 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.
@@ -599,7 +646,7 @@ mm_sim_change_pin_finish (MMSim *self,
* 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.
+ * Returns: %TRUE if the operation succeded, %FALSE if @error is set.
*/
gboolean
mm_sim_change_pin_sync (MMSim *self,
@@ -608,11 +655,23 @@ mm_sim_change_pin_sync (MMSim *self,
GCancellable *cancellable,
GError **error)
{
- g_return_val_if_fail (MM_GDBUS_IS_SIM (self), FALSE);
+ g_return_val_if_fail (MM_IS_SIM (self), FALSE);
- return (mm_gdbus_sim_call_change_pin_sync (self,
+ return (mm_gdbus_sim_call_change_pin_sync (MM_GDBUS_SIM (self),
old_pin,
new_pin,
cancellable,
error));
}
+
+/*****************************************************************************/
+
+static void
+mm_sim_init (MMSim *self)
+{
+}
+
+static void
+mm_sim_class_init (MMSimClass *sim_class)
+{
+}
diff --git a/libmm-glib/mm-sim.h b/libmm-glib/mm-sim.h
index 73014349..43b5d971 100644
--- a/libmm-glib/mm-sim.h
+++ b/libmm-glib/mm-sim.h
@@ -17,7 +17,8 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
- * Copyright (C) 2011 Aleksander Morgado <aleksander@gnu.org>
+ * Copyright (C) 2011 - 2012 Aleksander Morgado <aleksander@gnu.org>
+ * Copyright (C) 2012 Google, Inc.
*/
#ifndef _MM_SIM_H_
@@ -28,22 +29,49 @@
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)
+#define MM_TYPE_SIM (mm_sim_get_type ())
+#define MM_SIM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_SIM, MMSim))
+#define MM_SIM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_SIM, MMSimClass))
+#define MM_IS_SIM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_SIM))
+#define MM_IS_SIM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), MM_TYPE_SIM))
+#define MM_SIM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_SIM, MMSimClass))
+
+typedef struct _MMSim MMSim;
+typedef struct _MMSimClass MMSimClass;
+
+/**
+ * MMSim:
+ *
+ * The #MMSim structure contains private data and should only be accessed
+ * using the provided API.
+ */
+struct _MMSim {
+ /*< private >*/
+ MmGdbusSimProxy parent;
+ gpointer unused;
+};
+
+struct _MMSimClass {
+ /*< private >*/
+ MmGdbusSimProxyClass parent;
+};
+
+GType mm_sim_get_type (void);
const gchar *mm_sim_get_path (MMSim *self);
+gchar *mm_sim_dup_path (MMSim *self);
+
const gchar *mm_sim_get_identifier (MMSim *self);
+gchar *mm_sim_dup_identifier (MMSim *self);
+
const gchar *mm_sim_get_imsi (MMSim *self);
+gchar *mm_sim_dup_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_operator_identifier (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);
+const gchar *mm_sim_get_operator_name (MMSim *self);
+gchar *mm_sim_dup_operator_name (MMSim *self);
void mm_sim_send_pin (MMSim *self,
const gchar *pin,