aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2013-07-12 13:35:39 +0200
committerAleksander Morgado <aleksander@lanedo.com>2013-08-08 09:50:04 +0200
commitb769d48ed88d0dd69c70dffce23b21fa99814791 (patch)
treec855d77fab56e2b95e9aea6f8216ac9a49aadff8
parentc0d4f3157aeb2452155e558fb11daa6b7ef860dd (diff)
iface-modem-cdma: use the new 'MMCdmaManualActivationProperties'
-rw-r--r--src/mm-iface-modem-cdma.c24
-rw-r--r--src/mm-iface-modem-cdma.h2
2 files changed, 18 insertions, 8 deletions
diff --git a/src/mm-iface-modem-cdma.c b/src/mm-iface-modem-cdma.c
index b1f2f55f..853f1dbc 100644
--- a/src/mm-iface-modem-cdma.c
+++ b/src/mm-iface-modem-cdma.c
@@ -227,7 +227,7 @@ typedef struct {
MmGdbusModemCdma *skeleton;
GDBusMethodInvocation *invocation;
MMIfaceModemCdma *self;
- GVariant *properties;
+ GVariant *dictionary;
} HandleActivateManualContext;
static void
@@ -236,7 +236,7 @@ handle_activate_manual_context_free (HandleActivateManualContext *ctx)
g_object_unref (ctx->skeleton);
g_object_unref (ctx->invocation);
g_object_unref (ctx->self);
- g_variant_unref (ctx->properties);
+ g_variant_unref (ctx->dictionary);
g_free (ctx);
}
@@ -260,6 +260,7 @@ handle_activate_manual_auth_ready (MMBaseModem *self,
GAsyncResult *res,
HandleActivateManualContext *ctx)
{
+ MMCdmaManualActivationProperties *properties;
MMModemState modem_state;
GError *error = NULL;
@@ -289,6 +290,14 @@ handle_activate_manual_auth_ready (MMBaseModem *self,
return;
}
+ /* Parse input properties */
+ properties = mm_cdma_manual_activation_properties_new_from_dictionary (ctx->dictionary, &error);
+ if (!properties) {
+ g_dbus_method_invocation_take_error (ctx->invocation, error);
+ handle_activate_manual_context_free (ctx);
+ return;
+ }
+
modem_state = MM_MODEM_STATE_UNKNOWN;
g_object_get (self,
MM_IFACE_MODEM_STATE, &modem_state,
@@ -308,17 +317,17 @@ handle_activate_manual_auth_ready (MMBaseModem *self,
MM_CORE_ERROR_WRONG_STATE,
"Cannot perform manual activation: "
"device not fully initialized yet");
- handle_activate_manual_context_free (ctx);
- return;
+ break;
case MM_MODEM_STATE_ENABLED:
case MM_MODEM_STATE_SEARCHING:
case MM_MODEM_STATE_REGISTERED:
MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->activate_manual (
MM_IFACE_MODEM_CDMA (self),
- ctx->properties,
+ properties,
(GAsyncReadyCallback)handle_activate_manual_ready,
ctx);
+ g_object_unref (properties);
return;
case MM_MODEM_STATE_DISABLING:
@@ -349,13 +358,14 @@ handle_activate_manual_auth_ready (MMBaseModem *self,
break;
}
+ g_object_unref (properties);
handle_activate_manual_context_free (ctx);
}
static gboolean
handle_activate_manual (MmGdbusModemCdma *skeleton,
GDBusMethodInvocation *invocation,
- GVariant *properties,
+ GVariant *dictionary,
MMIfaceModemCdma *self)
{
HandleActivateManualContext *ctx;
@@ -364,7 +374,7 @@ handle_activate_manual (MmGdbusModemCdma *skeleton,
ctx->skeleton = g_object_ref (skeleton);
ctx->invocation = g_object_ref (invocation);
ctx->self = g_object_ref (self);
- ctx->properties = g_variant_ref (properties);
+ ctx->dictionary = g_variant_ref (dictionary);
mm_base_modem_authorize (MM_BASE_MODEM (self),
invocation,
diff --git a/src/mm-iface-modem-cdma.h b/src/mm-iface-modem-cdma.h
index e6a6cddd..a7efe91a 100644
--- a/src/mm-iface-modem-cdma.h
+++ b/src/mm-iface-modem-cdma.h
@@ -120,7 +120,7 @@ struct _MMIfaceModemCdma {
/* Manual activation */
void (* activate_manual) (MMIfaceModemCdma *self,
- GVariant *properties,
+ MMCdmaManualActivationProperties *properties,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (* activate_manual_finish) (MMIfaceModemCdma *self,