libmm-common: `MMSimpleConnectProperties' won't be considered internal any more

Renamed `MMCommonConnectProperties' to `MMSimpleConnectProperties', and removed
the `MMModemSimpleConnectProperties' provided in libmm-glib. We'll just use the
original one from libmm-common always.
This commit is contained in:
Aleksander Morgado
2012-03-01 12:31:17 +01:00
parent d306bb082f
commit 1385eb394f
12 changed files with 230 additions and 396 deletions

View File

@@ -316,11 +316,11 @@ get_modem_ready (GObject *source,
/* Request to connect the modem? */ /* Request to connect the modem? */
if (connect_str) { if (connect_str) {
GError *error = NULL; GError *error = NULL;
MMModemSimpleConnectProperties *properties; MMSimpleConnectProperties *properties;
g_debug ("Asynchronously connecting the modem..."); g_debug ("Asynchronously connecting the modem...");
properties = mm_modem_simple_connect_properties_new_from_string (connect_str, &error); properties = mm_simple_connect_properties_new_from_string (connect_str, &error);
if (!properties) { if (!properties) {
g_printerr ("Error parsing connect string: '%s'\n", error->message); g_printerr ("Error parsing connect string: '%s'\n", error->message);
exit (EXIT_FAILURE); exit (EXIT_FAILURE);

View File

@@ -150,7 +150,7 @@ $(mm_gdbus_bearer_generated): $(top_srcdir)/introspection/org.freedesktop.ModemM
# Additional dependency rules # Additional dependency rules
mm-common-helpers.c: mm-errors-types.h mm-enums-types.h mm-common-helpers.c: mm-errors-types.h mm-enums-types.h
mm-common-simple-properties.c: mm-errors-types.h mm-enums-types.h mm-common-simple-properties.c: mm-errors-types.h mm-enums-types.h
mm-common-connect-properties.c: mm-errors-types.h mm-simple-connect-properties.c: mm-errors-types.h
mm-bearer-properties.c: mm-errors-types.h mm-bearer-properties.c: mm-errors-types.h
mm-sms-properties.c: mm-errors-types.h mm-sms-properties.c: mm-errors-types.h
mm-bearer-ip-config.c: mm-errors-types.h mm-bearer-ip-config.c: mm-errors-types.h
@@ -164,7 +164,7 @@ include_HEADERS = \
mm-enums-types.h \ mm-enums-types.h \
mm-common-helpers.h \ mm-common-helpers.h \
mm-common-simple-properties.h \ mm-common-simple-properties.h \
mm-common-connect-properties.h \ mm-simple-connect-properties.h \
mm-bearer-properties.h \ mm-bearer-properties.h \
mm-sms-properties.h \ mm-sms-properties.h \
mm-bearer-ip-config.h \ mm-bearer-ip-config.h \
@@ -186,8 +186,8 @@ libmm_common_la_SOURCES = \
mm-common-helpers.c \ mm-common-helpers.c \
mm-common-simple-properties.h \ mm-common-simple-properties.h \
mm-common-simple-properties.c \ mm-common-simple-properties.c \
mm-common-connect-properties.h \ mm-simple-connect-properties.h \
mm-common-connect-properties.c \ mm-simple-connect-properties.c \
mm-bearer-properties.h \ mm-bearer-properties.h \
mm-bearer-properties.c \ mm-bearer-properties.c \
mm-sms-properties.h \ mm-sms-properties.h \

View File

@@ -27,7 +27,7 @@
#include "mm-enums-types.h" #include "mm-enums-types.h"
#include "mm-common-helpers.h" #include "mm-common-helpers.h"
#include "mm-common-simple-properties.h" #include "mm-common-simple-properties.h"
#include "mm-common-connect-properties.h" #include "mm-simple-connect-properties.h"
#include "mm-sms-properties.h" #include "mm-sms-properties.h"
#include "mm-bearer-properties.h" #include "mm-bearer-properties.h"
#include "mm-bearer-ip-config.h" #include "mm-bearer-ip-config.h"

View File

@@ -1,121 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details:
*
* Copyright (C) 2011 Aleksander Morgado <aleksander@gnu.org>
*/
#ifndef MM_COMMON_CONNECT_PROPERTIES_H
#define MM_COMMON_CONNECT_PROPERTIES_H
#include <ModemManager.h>
#include <glib-object.h>
#include "mm-bearer-properties.h"
G_BEGIN_DECLS
#define MM_TYPE_COMMON_CONNECT_PROPERTIES (mm_common_connect_properties_get_type ())
#define MM_COMMON_CONNECT_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_COMMON_CONNECT_PROPERTIES, MMCommonConnectProperties))
#define MM_COMMON_CONNECT_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_COMMON_CONNECT_PROPERTIES, MMCommonConnectPropertiesClass))
#define MM_IS_COMMON_CONNECT_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_COMMON_CONNECT_PROPERTIES))
#define MM_IS_COMMON_CONNECT_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_COMMON_CONNECT_PROPERTIES))
#define MM_COMMON_CONNECT_PROPERTIES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_COMMON_CONNECT_PROPERTIES, MMCommonConnectPropertiesClass))
typedef struct _MMCommonConnectProperties MMCommonConnectProperties;
typedef struct _MMCommonConnectPropertiesClass MMCommonConnectPropertiesClass;
typedef struct _MMCommonConnectPropertiesPrivate MMCommonConnectPropertiesPrivate;
struct _MMCommonConnectProperties {
GObject parent;
MMCommonConnectPropertiesPrivate *priv;
};
struct _MMCommonConnectPropertiesClass {
GObjectClass parent;
};
GType mm_common_connect_properties_get_type (void);
MMCommonConnectProperties *mm_common_connect_properties_new (void);
MMCommonConnectProperties *mm_common_connect_properties_new_from_string (
const gchar *str,
GError **error);
MMCommonConnectProperties *mm_common_connect_properties_new_from_dictionary (
GVariant *dictionary,
GError **error);
void mm_common_connect_properties_set_pin (
MMCommonConnectProperties *properties,
const gchar *pin);
void mm_common_connect_properties_set_operator_id (
MMCommonConnectProperties *properties,
const gchar *operator_id);
void mm_common_connect_properties_set_bands (
MMCommonConnectProperties *properties,
const MMModemBand *bands,
guint n_bands);
void mm_common_connect_properties_set_allowed_modes (
MMCommonConnectProperties *properties,
MMModemMode allowed,
MMModemMode preferred);
void mm_common_connect_properties_set_apn (
MMCommonConnectProperties *properties,
const gchar *apn);
void mm_common_connect_properties_set_user (
MMCommonConnectProperties *properties,
const gchar *user);
void mm_common_connect_properties_set_password (
MMCommonConnectProperties *properties,
const gchar *password);
void mm_common_connect_properties_set_ip_type (
MMCommonConnectProperties *properties,
const gchar *ip_type);
void mm_common_connect_properties_set_allow_roaming (
MMCommonConnectProperties *properties,
gboolean allow_roaming);
void mm_common_connect_properties_set_number (
MMCommonConnectProperties *properties,
const gchar *number);
const gchar *mm_common_connect_properties_get_pin (
MMCommonConnectProperties *properties);
const gchar *mm_common_connect_properties_get_operator_id (
MMCommonConnectProperties *properties);
void mm_common_connect_properties_get_bands (
MMCommonConnectProperties *properties,
const MMModemBand **bands,
guint *n_bands);
void mm_common_connect_properties_get_allowed_modes (
MMCommonConnectProperties *properties,
MMModemMode *allowed,
MMModemMode *preferred);
const gchar *mm_common_connect_properties_get_apn (
MMCommonConnectProperties *properties);
const gchar *mm_common_connect_properties_get_user (
MMCommonConnectProperties *properties);
const gchar *mm_common_connect_properties_get_password (
MMCommonConnectProperties *properties);
const gchar *mm_common_connect_properties_get_ip_type (
MMCommonConnectProperties *properties);
gboolean mm_common_connect_properties_get_allow_roaming (
MMCommonConnectProperties *properties);
const gchar *mm_common_connect_properties_get_number (
MMCommonConnectProperties *properties);
MMBearerProperties *mm_common_connect_properties_get_bearer_properties (
MMCommonConnectProperties *properties);
GVariant *mm_common_connect_properties_get_dictionary (MMCommonConnectProperties *self);
G_END_DECLS
#endif /* MM_COMMON_CONNECT_PROPERTIES_H */

View File

@@ -17,9 +17,9 @@
#include "mm-errors-types.h" #include "mm-errors-types.h"
#include "mm-common-helpers.h" #include "mm-common-helpers.h"
#include "mm-common-connect-properties.h" #include "mm-simple-connect-properties.h"
G_DEFINE_TYPE (MMCommonConnectProperties, mm_common_connect_properties, G_TYPE_OBJECT); G_DEFINE_TYPE (MMSimpleConnectProperties, mm_simple_connect_properties, G_TYPE_OBJECT);
#define PROPERTY_PIN "pin" #define PROPERTY_PIN "pin"
#define PROPERTY_OPERATOR_ID "operator-id" #define PROPERTY_OPERATOR_ID "operator-id"
@@ -27,7 +27,7 @@ G_DEFINE_TYPE (MMCommonConnectProperties, mm_common_connect_properties, G_TYPE_O
#define PROPERTY_ALLOWED_MODES "allowed-modes" #define PROPERTY_ALLOWED_MODES "allowed-modes"
#define PROPERTY_PREFERRED_MODE "preferred-mode" #define PROPERTY_PREFERRED_MODE "preferred-mode"
struct _MMCommonConnectPropertiesPrivate { struct _MMSimpleConnectPropertiesPrivate {
/* PIN */ /* PIN */
gchar *pin; gchar *pin;
/* Operator ID */ /* Operator ID */
@@ -46,26 +46,32 @@ struct _MMCommonConnectPropertiesPrivate {
/*****************************************************************************/ /*****************************************************************************/
void void
mm_common_connect_properties_set_pin (MMCommonConnectProperties *self, mm_simple_connect_properties_set_pin (MMSimpleConnectProperties *self,
const gchar *pin) const gchar *pin)
{ {
g_return_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self));
g_free (self->priv->pin); g_free (self->priv->pin);
self->priv->pin = g_strdup (pin); self->priv->pin = g_strdup (pin);
} }
void void
mm_common_connect_properties_set_operator_id (MMCommonConnectProperties *self, mm_simple_connect_properties_set_operator_id (MMSimpleConnectProperties *self,
const gchar *operator_id) const gchar *operator_id)
{ {
g_return_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self));
g_free (self->priv->operator_id); g_free (self->priv->operator_id);
self->priv->operator_id = g_strdup (operator_id); self->priv->operator_id = g_strdup (operator_id);
} }
void void
mm_common_connect_properties_set_bands (MMCommonConnectProperties *self, mm_simple_connect_properties_set_bands (MMSimpleConnectProperties *self,
const MMModemBand *bands, const MMModemBand *bands,
guint n_bands) guint n_bands)
{ {
g_return_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self));
g_free (self->priv->bands); g_free (self->priv->bands);
self->priv->n_bands = n_bands; self->priv->n_bands = n_bands;
self->priv->bands = g_new (MMModemBand, self->priv->n_bands); self->priv->bands = g_new (MMModemBand, self->priv->n_bands);
@@ -75,59 +81,73 @@ mm_common_connect_properties_set_bands (MMCommonConnectProperties *self,
} }
void void
mm_common_connect_properties_set_allowed_modes (MMCommonConnectProperties *self, mm_simple_connect_properties_set_allowed_modes (MMSimpleConnectProperties *self,
MMModemMode allowed, MMModemMode allowed,
MMModemMode preferred) MMModemMode preferred)
{ {
g_return_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self));
self->priv->allowed_modes = allowed; self->priv->allowed_modes = allowed;
self->priv->preferred_mode = preferred; self->priv->preferred_mode = preferred;
self->priv->allowed_modes_set = TRUE; self->priv->allowed_modes_set = TRUE;
} }
void void
mm_common_connect_properties_set_apn (MMCommonConnectProperties *self, mm_simple_connect_properties_set_apn (MMSimpleConnectProperties *self,
const gchar *apn) const gchar *apn)
{ {
g_return_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self));
mm_bearer_properties_set_apn (self->priv->bearer_properties, mm_bearer_properties_set_apn (self->priv->bearer_properties,
apn); apn);
} }
void void
mm_common_connect_properties_set_user (MMCommonConnectProperties *self, mm_simple_connect_properties_set_user (MMSimpleConnectProperties *self,
const gchar *user) const gchar *user)
{ {
g_return_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self));
mm_bearer_properties_set_user (self->priv->bearer_properties, mm_bearer_properties_set_user (self->priv->bearer_properties,
user); user);
} }
void void
mm_common_connect_properties_set_password (MMCommonConnectProperties *self, mm_simple_connect_properties_set_password (MMSimpleConnectProperties *self,
const gchar *password) const gchar *password)
{ {
g_return_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self));
mm_bearer_properties_set_password (self->priv->bearer_properties, mm_bearer_properties_set_password (self->priv->bearer_properties,
password); password);
} }
void void
mm_common_connect_properties_set_ip_type (MMCommonConnectProperties *self, mm_simple_connect_properties_set_ip_type (MMSimpleConnectProperties *self,
const gchar *ip_type) const gchar *ip_type)
{ {
g_return_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self));
mm_bearer_properties_set_ip_type (self->priv->bearer_properties, mm_bearer_properties_set_ip_type (self->priv->bearer_properties,
ip_type); ip_type);
} }
void void
mm_common_connect_properties_set_allow_roaming (MMCommonConnectProperties *self, mm_simple_connect_properties_set_allow_roaming (MMSimpleConnectProperties *self,
gboolean allow_roaming) gboolean allow_roaming)
{ {
g_return_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self));
mm_bearer_properties_set_allow_roaming (self->priv->bearer_properties, mm_bearer_properties_set_allow_roaming (self->priv->bearer_properties,
allow_roaming); allow_roaming);
} }
void void
mm_common_connect_properties_set_number (MMCommonConnectProperties *self, mm_simple_connect_properties_set_number (MMSimpleConnectProperties *self,
const gchar *number) const gchar *number)
{ {
g_return_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self));
mm_bearer_properties_set_number (self->priv->bearer_properties, mm_bearer_properties_set_number (self->priv->bearer_properties,
number); number);
} }
@@ -135,81 +155,107 @@ mm_common_connect_properties_set_number (MMCommonConnectProperties *self,
/*****************************************************************************/ /*****************************************************************************/
MMBearerProperties * MMBearerProperties *
mm_common_connect_properties_get_bearer_properties (MMCommonConnectProperties *self) mm_simple_connect_properties_get_bearer_properties (MMSimpleConnectProperties *self)
{ {
g_return_val_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self), NULL);
return g_object_ref (self->priv->bearer_properties); return g_object_ref (self->priv->bearer_properties);
} }
const gchar * const gchar *
mm_common_connect_properties_get_pin (MMCommonConnectProperties *self) mm_simple_connect_properties_get_pin (MMSimpleConnectProperties *self)
{ {
g_return_val_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self), NULL);
return self->priv->pin; return self->priv->pin;
} }
const gchar * const gchar *
mm_common_connect_properties_get_operator_id (MMCommonConnectProperties *self) mm_simple_connect_properties_get_operator_id (MMSimpleConnectProperties *self)
{ {
g_return_val_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self), NULL);
return self->priv->operator_id; return self->priv->operator_id;
} }
void void
mm_common_connect_properties_get_bands (MMCommonConnectProperties *self, mm_simple_connect_properties_get_bands (MMSimpleConnectProperties *self,
const MMModemBand **bands, const MMModemBand **bands,
guint *n_bands) guint *n_bands)
{ {
g_return_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self));
g_return_if_fail (bands != NULL);
g_return_if_fail (n_bands != NULL);
*bands = self->priv->bands; *bands = self->priv->bands;
*n_bands = self->priv->n_bands; *n_bands = self->priv->n_bands;
} }
void void
mm_common_connect_properties_get_allowed_modes (MMCommonConnectProperties *self, mm_simple_connect_properties_get_allowed_modes (MMSimpleConnectProperties *self,
MMModemMode *allowed, MMModemMode *allowed,
MMModemMode *preferred) MMModemMode *preferred)
{ {
g_return_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self));
g_return_if_fail (allowed != NULL);
g_return_if_fail (preferred != NULL);
*allowed = self->priv->allowed_modes; *allowed = self->priv->allowed_modes;
*preferred = self->priv->preferred_mode; *preferred = self->priv->preferred_mode;
} }
const gchar * const gchar *
mm_common_connect_properties_get_apn (MMCommonConnectProperties *self) mm_simple_connect_properties_get_apn (MMSimpleConnectProperties *self)
{ {
g_return_val_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self), NULL);
return mm_bearer_properties_get_apn (self->priv->bearer_properties); return mm_bearer_properties_get_apn (self->priv->bearer_properties);
} }
const gchar * const gchar *
mm_common_connect_properties_get_user (MMCommonConnectProperties *self) mm_simple_connect_properties_get_user (MMSimpleConnectProperties *self)
{ {
g_return_val_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self), NULL);
return mm_bearer_properties_get_user (self->priv->bearer_properties); return mm_bearer_properties_get_user (self->priv->bearer_properties);
} }
const gchar * const gchar *
mm_common_connect_properties_get_password (MMCommonConnectProperties *self) mm_simple_connect_properties_get_password (MMSimpleConnectProperties *self)
{ {
g_return_val_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self), NULL);
return mm_bearer_properties_get_password (self->priv->bearer_properties); return mm_bearer_properties_get_password (self->priv->bearer_properties);
} }
const gchar * const gchar *
mm_common_connect_properties_get_ip_type (MMCommonConnectProperties *self) mm_simple_connect_properties_get_ip_type (MMSimpleConnectProperties *self)
{ {
g_return_val_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self), NULL);
return mm_bearer_properties_get_ip_type (self->priv->bearer_properties); return mm_bearer_properties_get_ip_type (self->priv->bearer_properties);
} }
gboolean gboolean
mm_common_connect_properties_get_allow_roaming (MMCommonConnectProperties *self) mm_simple_connect_properties_get_allow_roaming (MMSimpleConnectProperties *self)
{ {
g_return_val_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self), FALSE);
return mm_bearer_properties_get_allow_roaming (self->priv->bearer_properties); return mm_bearer_properties_get_allow_roaming (self->priv->bearer_properties);
} }
const gchar * const gchar *
mm_common_connect_properties_get_number (MMCommonConnectProperties *self) mm_simple_connect_properties_get_number (MMSimpleConnectProperties *self)
{ {
g_return_val_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self), NULL);
return mm_bearer_properties_get_number (self->priv->bearer_properties); return mm_bearer_properties_get_number (self->priv->bearer_properties);
} }
/*****************************************************************************/ /*****************************************************************************/
GVariant * GVariant *
mm_common_connect_properties_get_dictionary (MMCommonConnectProperties *self) mm_simple_connect_properties_get_dictionary (MMSimpleConnectProperties *self)
{ {
GVariantBuilder builder; GVariantBuilder builder;
GVariantIter iter; GVariantIter iter;
@@ -221,6 +267,8 @@ mm_common_connect_properties_get_dictionary (MMCommonConnectProperties *self)
if (!self) if (!self)
return NULL; return NULL;
g_return_val_if_fail (MM_IS_SIMPLE_CONNECT_PROPERTIES (self), NULL);
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
if (self->priv->pin) if (self->priv->pin)
@@ -272,7 +320,7 @@ mm_common_connect_properties_get_dictionary (MMCommonConnectProperties *self)
/*****************************************************************************/ /*****************************************************************************/
typedef struct { typedef struct {
MMCommonConnectProperties *properties; MMSimpleConnectProperties *properties;
GError *error; GError *error;
gchar *allowed_modes_str; gchar *allowed_modes_str;
gchar *preferred_mode_str; gchar *preferred_mode_str;
@@ -290,16 +338,16 @@ key_value_foreach (const gchar *key,
return TRUE; return TRUE;
if (g_str_equal (key, PROPERTY_PIN)) if (g_str_equal (key, PROPERTY_PIN))
mm_common_connect_properties_set_pin (ctx->properties, value); mm_simple_connect_properties_set_pin (ctx->properties, value);
else if (g_str_equal (key, PROPERTY_OPERATOR_ID)) else if (g_str_equal (key, PROPERTY_OPERATOR_ID))
mm_common_connect_properties_set_operator_id (ctx->properties, value); mm_simple_connect_properties_set_operator_id (ctx->properties, value);
else if (g_str_equal (key, PROPERTY_BANDS)) { else if (g_str_equal (key, PROPERTY_BANDS)) {
MMModemBand *bands = NULL; MMModemBand *bands = NULL;
guint n_bands = 0; guint n_bands = 0;
mm_common_get_bands_from_string (value, &bands, &n_bands, &ctx->error); mm_common_get_bands_from_string (value, &bands, &n_bands, &ctx->error);
if (!ctx->error) { if (!ctx->error) {
mm_common_connect_properties_set_bands (ctx->properties, bands, n_bands); mm_simple_connect_properties_set_bands (ctx->properties, bands, n_bands);
g_free (bands); g_free (bands);
} }
} else if (g_str_equal (key, PROPERTY_ALLOWED_MODES)) { } else if (g_str_equal (key, PROPERTY_ALLOWED_MODES)) {
@@ -316,8 +364,8 @@ key_value_foreach (const gchar *key,
return !ctx->error; return !ctx->error;
} }
MMCommonConnectProperties * MMSimpleConnectProperties *
mm_common_connect_properties_new_from_string (const gchar *str, mm_simple_connect_properties_new_from_string (const gchar *str,
GError **error) GError **error)
{ {
ParseKeyValueContext ctx; ParseKeyValueContext ctx;
@@ -325,7 +373,7 @@ mm_common_connect_properties_new_from_string (const gchar *str,
ctx.error = NULL; ctx.error = NULL;
ctx.allowed_modes_str = NULL; ctx.allowed_modes_str = NULL;
ctx.preferred_mode_str = NULL; ctx.preferred_mode_str = NULL;
ctx.properties = mm_common_connect_properties_new (); ctx.properties = mm_simple_connect_properties_new ();
mm_common_parse_key_value_string (str, mm_common_parse_key_value_string (str,
&ctx.error, &ctx.error,
@@ -358,7 +406,7 @@ mm_common_connect_properties_new_from_string (const gchar *str,
g_object_unref (ctx.properties); g_object_unref (ctx.properties);
ctx.properties = NULL; ctx.properties = NULL;
} else { } else {
mm_common_connect_properties_set_allowed_modes ( mm_simple_connect_properties_set_allowed_modes (
ctx.properties, ctx.properties,
allowed_modes, allowed_modes,
preferred_mode); preferred_mode);
@@ -373,22 +421,32 @@ mm_common_connect_properties_new_from_string (const gchar *str,
/*****************************************************************************/ /*****************************************************************************/
MMCommonConnectProperties * MMSimpleConnectProperties *
mm_common_connect_properties_new_from_dictionary (GVariant *dictionary, mm_simple_connect_properties_new_from_dictionary (GVariant *dictionary,
GError **error) GError **error)
{ {
GError *inner_error = NULL; GError *inner_error = NULL;
GVariantIter iter; GVariantIter iter;
gchar *key; gchar *key;
GVariant *value; GVariant *value;
MMCommonConnectProperties *properties; MMSimpleConnectProperties *properties;
GVariant *allowed_modes_variant = NULL; GVariant *allowed_modes_variant = NULL;
GVariant *preferred_mode_variant = NULL; GVariant *preferred_mode_variant = NULL;
properties = mm_common_connect_properties_new (); properties = mm_simple_connect_properties_new ();
if (!dictionary) if (!dictionary)
return properties; return properties;
if (!g_variant_is_of_type (dictionary, G_VARIANT_TYPE ("a{sv}"))) {
g_set_error (error,
MM_CORE_ERROR,
MM_CORE_ERROR_INVALID_ARGS,
"Cannot create Simple Connect properties from dictionary: "
"invalid variant type received");
g_object_unref (properties);
return NULL;
}
g_variant_iter_init (&iter, dictionary); g_variant_iter_init (&iter, dictionary);
while (!inner_error && while (!inner_error &&
g_variant_iter_next (&iter, "{sv}", &key, &value)) { g_variant_iter_next (&iter, "{sv}", &key, &value)) {
@@ -398,18 +456,18 @@ mm_common_connect_properties_new_from_dictionary (GVariant *dictionary,
key, value, key, value,
NULL)) { NULL)) {
if (g_str_equal (key, PROPERTY_PIN)) if (g_str_equal (key, PROPERTY_PIN))
mm_common_connect_properties_set_pin ( mm_simple_connect_properties_set_pin (
properties, properties,
g_variant_get_string (value, NULL)); g_variant_get_string (value, NULL));
else if (g_str_equal (key, PROPERTY_OPERATOR_ID)) else if (g_str_equal (key, PROPERTY_OPERATOR_ID))
mm_common_connect_properties_set_operator_id ( mm_simple_connect_properties_set_operator_id (
properties, properties,
g_variant_get_string (value, NULL)); g_variant_get_string (value, NULL));
else if (g_str_equal (key, PROPERTY_BANDS)) { else if (g_str_equal (key, PROPERTY_BANDS)) {
GArray *array; GArray *array;
array = mm_common_bands_variant_to_garray (value); array = mm_common_bands_variant_to_garray (value);
mm_common_connect_properties_set_bands ( mm_simple_connect_properties_set_bands (
properties, properties,
(MMModemBand *)array->data, (MMModemBand *)array->data,
array->len); array->len);
@@ -439,7 +497,7 @@ mm_common_connect_properties_new_from_dictionary (GVariant *dictionary,
} }
/* If we got allowed modes variant, check if we got preferred mode */ /* If we got allowed modes variant, check if we got preferred mode */
else if (allowed_modes_variant) { else if (allowed_modes_variant) {
mm_common_connect_properties_set_allowed_modes ( mm_simple_connect_properties_set_allowed_modes (
properties, properties,
g_variant_get_uint32 (allowed_modes_variant), g_variant_get_uint32 (allowed_modes_variant),
(preferred_mode_variant ? (preferred_mode_variant ?
@@ -448,7 +506,7 @@ mm_common_connect_properties_new_from_dictionary (GVariant *dictionary,
} }
/* If we only got preferred mode, assume allowed is ANY */ /* If we only got preferred mode, assume allowed is ANY */
else if (preferred_mode_variant) { else if (preferred_mode_variant) {
mm_common_connect_properties_set_allowed_modes ( mm_simple_connect_properties_set_allowed_modes (
properties, properties,
MM_MODEM_MODE_ANY, MM_MODEM_MODE_ANY,
g_variant_get_uint32 (preferred_mode_variant)); g_variant_get_uint32 (preferred_mode_variant));
@@ -465,19 +523,19 @@ mm_common_connect_properties_new_from_dictionary (GVariant *dictionary,
/*****************************************************************************/ /*****************************************************************************/
MMCommonConnectProperties * MMSimpleConnectProperties *
mm_common_connect_properties_new (void) mm_simple_connect_properties_new (void)
{ {
return (MM_COMMON_CONNECT_PROPERTIES ( return (MM_SIMPLE_CONNECT_PROPERTIES (
g_object_new (MM_TYPE_COMMON_CONNECT_PROPERTIES, NULL))); g_object_new (MM_TYPE_SIMPLE_CONNECT_PROPERTIES, NULL)));
} }
static void static void
mm_common_connect_properties_init (MMCommonConnectProperties *self) mm_simple_connect_properties_init (MMSimpleConnectProperties *self)
{ {
self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self), self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self),
MM_TYPE_COMMON_CONNECT_PROPERTIES, MM_TYPE_SIMPLE_CONNECT_PROPERTIES,
MMCommonConnectPropertiesPrivate); MMSimpleConnectPropertiesPrivate);
/* Some defaults */ /* Some defaults */
self->priv->bearer_properties = mm_bearer_properties_new (); self->priv->bearer_properties = mm_bearer_properties_new ();
@@ -491,22 +549,22 @@ mm_common_connect_properties_init (MMCommonConnectProperties *self)
static void static void
finalize (GObject *object) finalize (GObject *object)
{ {
MMCommonConnectProperties *self = MM_COMMON_CONNECT_PROPERTIES (object); MMSimpleConnectProperties *self = MM_SIMPLE_CONNECT_PROPERTIES (object);
g_free (self->priv->pin); g_free (self->priv->pin);
g_free (self->priv->operator_id); g_free (self->priv->operator_id);
g_free (self->priv->bands); g_free (self->priv->bands);
g_object_unref (self->priv->bearer_properties); g_object_unref (self->priv->bearer_properties);
G_OBJECT_CLASS (mm_common_connect_properties_parent_class)->finalize (object); G_OBJECT_CLASS (mm_simple_connect_properties_parent_class)->finalize (object);
} }
static void static void
mm_common_connect_properties_class_init (MMCommonConnectPropertiesClass *klass) mm_simple_connect_properties_class_init (MMSimpleConnectPropertiesClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (object_class, sizeof (MMCommonConnectPropertiesPrivate)); g_type_class_add_private (object_class, sizeof (MMSimpleConnectPropertiesPrivate));
object_class->finalize = finalize; object_class->finalize = finalize;
} }

View File

@@ -0,0 +1,98 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details:
*
* Copyright (C) 2011 Aleksander Morgado <aleksander@gnu.org>
*/
#ifndef MM_SIMPLE_CONNECT_PROPERTIES_H
#define MM_SIMPLE_CONNECT_PROPERTIES_H
#include <ModemManager.h>
#include <glib-object.h>
#include "mm-bearer-properties.h"
G_BEGIN_DECLS
#define MM_TYPE_SIMPLE_CONNECT_PROPERTIES (mm_simple_connect_properties_get_type ())
#define MM_SIMPLE_CONNECT_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_SIMPLE_CONNECT_PROPERTIES, MMSimpleConnectProperties))
#define MM_SIMPLE_CONNECT_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_SIMPLE_CONNECT_PROPERTIES, MMSimpleConnectPropertiesClass))
#define MM_IS_SIMPLE_CONNECT_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_SIMPLE_CONNECT_PROPERTIES))
#define MM_IS_SIMPLE_CONNECT_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_SIMPLE_CONNECT_PROPERTIES))
#define MM_SIMPLE_CONNECT_PROPERTIES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_SIMPLE_CONNECT_PROPERTIES, MMSimpleConnectPropertiesClass))
typedef struct _MMSimpleConnectProperties MMSimpleConnectProperties;
typedef struct _MMSimpleConnectPropertiesClass MMSimpleConnectPropertiesClass;
typedef struct _MMSimpleConnectPropertiesPrivate MMSimpleConnectPropertiesPrivate;
struct _MMSimpleConnectProperties {
GObject parent;
MMSimpleConnectPropertiesPrivate *priv;
};
struct _MMSimpleConnectPropertiesClass {
GObjectClass parent;
};
GType mm_simple_connect_properties_get_type (void);
MMSimpleConnectProperties *mm_simple_connect_properties_new (void);
MMSimpleConnectProperties *mm_simple_connect_properties_new_from_string (const gchar *str,
GError **error);
MMSimpleConnectProperties *mm_simple_connect_properties_new_from_dictionary (GVariant *dictionary,
GError **error);
void mm_simple_connect_properties_set_pin (MMSimpleConnectProperties *properties,
const gchar *pin);
void mm_simple_connect_properties_set_operator_id (MMSimpleConnectProperties *properties,
const gchar *operator_id);
void mm_simple_connect_properties_set_bands (MMSimpleConnectProperties *properties,
const MMModemBand *bands,
guint n_bands);
void mm_simple_connect_properties_set_allowed_modes (MMSimpleConnectProperties *properties,
MMModemMode allowed,
MMModemMode preferred);
void mm_simple_connect_properties_set_apn (MMSimpleConnectProperties *properties,
const gchar *apn);
void mm_simple_connect_properties_set_user (MMSimpleConnectProperties *properties,
const gchar *user);
void mm_simple_connect_properties_set_password (MMSimpleConnectProperties *properties,
const gchar *password);
void mm_simple_connect_properties_set_ip_type (MMSimpleConnectProperties *properties,
const gchar *ip_type);
void mm_simple_connect_properties_set_allow_roaming (MMSimpleConnectProperties *properties,
gboolean allow_roaming);
void mm_simple_connect_properties_set_number (MMSimpleConnectProperties *properties,
const gchar *number);
const gchar *mm_simple_connect_properties_get_pin (MMSimpleConnectProperties *properties);
const gchar *mm_simple_connect_properties_get_operator_id (MMSimpleConnectProperties *properties);
void mm_simple_connect_properties_get_bands (MMSimpleConnectProperties *properties,
const MMModemBand **bands,
guint *n_bands);
void mm_simple_connect_properties_get_allowed_modes (MMSimpleConnectProperties *properties,
MMModemMode *allowed,
MMModemMode *preferred);
const gchar *mm_simple_connect_properties_get_apn (MMSimpleConnectProperties *properties);
const gchar *mm_simple_connect_properties_get_user (MMSimpleConnectProperties *properties);
const gchar *mm_simple_connect_properties_get_password (MMSimpleConnectProperties *properties);
const gchar *mm_simple_connect_properties_get_ip_type (MMSimpleConnectProperties *properties);
gboolean mm_simple_connect_properties_get_allow_roaming (MMSimpleConnectProperties *properties);
const gchar *mm_simple_connect_properties_get_number (MMSimpleConnectProperties *properties);
MMBearerProperties *mm_simple_connect_properties_get_bearer_properties (MMSimpleConnectProperties *properties);
GVariant *mm_simple_connect_properties_get_dictionary (MMSimpleConnectProperties *self);
G_END_DECLS
#endif /* MM_SIMPLE_CONNECT_PROPERTIES_H */

View File

@@ -24,8 +24,6 @@ libmm_glib_la_SOURCES = \
mm-modem-3gpp-ussd.c \ mm-modem-3gpp-ussd.c \
mm-modem-cdma.h \ mm-modem-cdma.h \
mm-modem-cdma.c \ mm-modem-cdma.c \
mm-modem-simple-connect-properties.h \
mm-modem-simple-connect-properties.c \
mm-modem-simple-status-properties.h \ mm-modem-simple-status-properties.h \
mm-modem-simple-status-properties.c \ mm-modem-simple-status-properties.c \
mm-modem-simple.h \ mm-modem-simple.h \
@@ -54,7 +52,6 @@ include_HEADERS = \
mm-object.h \ mm-object.h \
mm-modem.h \ mm-modem.h \
mm-modem-3gpp.h \ mm-modem-3gpp.h \
mm-modem-simple-connect-properties.h \
mm-modem-simple-status-properties.h \ mm-modem-simple-status-properties.h \
mm-modem-simple.h \ mm-modem-simple.h \
mm-sim.h \ mm-sim.h \

View File

@@ -1,123 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details:
*
* Copyright (C) 2011 Aleksander Morgado <aleksander@gnu.org>
*/
#include "mm-modem-simple-connect-properties.h"
void
mm_modem_simple_connect_properties_set_pin (MMModemSimpleConnectProperties *self,
const gchar *pin)
{
g_return_if_fail (MM_IS_MODEM_SIMPLE_CONNECT_PROPERTIES (self));
mm_common_connect_properties_set_pin (self, pin);
}
void
mm_modem_simple_connect_properties_set_operator_id (MMModemSimpleConnectProperties *self,
const gchar *operator_id)
{
g_return_if_fail (MM_IS_MODEM_SIMPLE_CONNECT_PROPERTIES (self));
mm_common_connect_properties_set_operator_id (self, operator_id);
}
void
mm_modem_simple_connect_properties_set_bands (MMModemSimpleConnectProperties *self,
const MMModemBand *bands,
guint n_bands)
{
g_return_if_fail (MM_IS_MODEM_SIMPLE_CONNECT_PROPERTIES (self));
mm_common_connect_properties_set_bands (self, bands, n_bands);
}
void
mm_modem_simple_connect_properties_set_allowed_modes (MMModemSimpleConnectProperties *self,
MMModemMode allowed,
MMModemMode preferred)
{
g_return_if_fail (MM_IS_MODEM_SIMPLE_CONNECT_PROPERTIES (self));
mm_common_connect_properties_set_allowed_modes (self, allowed, preferred);
}
void
mm_modem_simple_connect_properties_set_apn (MMModemSimpleConnectProperties *self,
const gchar *apn)
{
g_return_if_fail (MM_IS_MODEM_SIMPLE_CONNECT_PROPERTIES (self));
mm_common_connect_properties_set_apn (self, apn);
}
void
mm_modem_simple_connect_properties_set_user (MMModemSimpleConnectProperties *self,
const gchar *user)
{
g_return_if_fail (MM_IS_MODEM_SIMPLE_CONNECT_PROPERTIES (self));
mm_common_connect_properties_set_user (self, user);
}
void
mm_modem_simple_connect_properties_set_password (MMModemSimpleConnectProperties *self,
const gchar *password)
{
g_return_if_fail (MM_IS_MODEM_SIMPLE_CONNECT_PROPERTIES (self));
mm_common_connect_properties_set_password (self, password);
}
void
mm_modem_simple_connect_properties_set_ip_type (MMModemSimpleConnectProperties *self,
const gchar *ip_type)
{
g_return_if_fail (MM_IS_MODEM_SIMPLE_CONNECT_PROPERTIES (self));
mm_common_connect_properties_set_ip_type (self, ip_type);
}
void
mm_modem_simple_connect_properties_set_allow_roaming (MMModemSimpleConnectProperties *self,
gboolean allow_roaming)
{
g_return_if_fail (MM_IS_MODEM_SIMPLE_CONNECT_PROPERTIES (self));
mm_common_connect_properties_set_allow_roaming (self, allow_roaming);
}
void
mm_modem_simple_connect_properties_set_number (MMModemSimpleConnectProperties *self,
const gchar *number)
{
g_return_if_fail (MM_IS_MODEM_SIMPLE_CONNECT_PROPERTIES (self));
mm_common_connect_properties_set_number (self, number);
}
/*****************************************************************************/
MMModemSimpleConnectProperties *
mm_modem_simple_connect_properties_new_from_string (const gchar *str,
GError **error)
{
return mm_common_connect_properties_new_from_string (str, error);
}
MMModemSimpleConnectProperties *
mm_modem_simple_connect_properties_new (void)
{
return mm_common_connect_properties_new ();
}

View File

@@ -1,71 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details:
*
* Copyright (C) 2011 Aleksander Morgado <aleksander@gnu.org>
*/
#ifndef MM_MODEM_SIMPLE_CONNECT_PROPERTIES_H
#define MM_MODEM_SIMPLE_CONNECT_PROPERTIES_H
#include <ModemManager.h>
#include <glib-object.h>
#include <libmm-common.h>
G_BEGIN_DECLS
typedef MMCommonConnectProperties MMModemSimpleConnectProperties;
#define MM_TYPE_MODEM_SIMPLE_CONNECT_PROPERTIES(o) MM_TYPE_COMMON_CONNECT_PROPERTIES (o)
#define MM_MODEM_SIMPLE_CONNECT_PROPERTIES(o) MM_COMMON_CONNECT_PROPERTIES(o)
#define MM_IS_MODEM_SIMPLE_CONNECT_PROPERTIES(o) MM_IS_COMMON_CONNECT_PROPERTIES(o)
MMModemSimpleConnectProperties *mm_modem_simple_connect_properties_new (void);
MMModemSimpleConnectProperties *mm_modem_simple_connect_properties_new_from_string (
const gchar *str,
GError **error);
void mm_modem_simple_connect_properties_set_pin (
MMModemSimpleConnectProperties *properties,
const gchar *pin);
void mm_modem_simple_connect_properties_set_operator_id (
MMModemSimpleConnectProperties *properties,
const gchar *operator_id);
void mm_modem_simple_connect_properties_set_bands (
MMModemSimpleConnectProperties *properties,
const MMModemBand *bands,
guint n_bands);
void mm_modem_simple_connect_properties_set_allowed_modes (
MMModemSimpleConnectProperties *properties,
MMModemMode allowed,
MMModemMode preferred);
void mm_modem_simple_connect_properties_set_apn (
MMModemSimpleConnectProperties *properties,
const gchar *apn);
void mm_modem_simple_connect_properties_set_user (
MMModemSimpleConnectProperties *properties,
const gchar *user);
void mm_modem_simple_connect_properties_set_password (
MMModemSimpleConnectProperties *properties,
const gchar *password);
void mm_modem_simple_connect_properties_set_ip_type (
MMModemSimpleConnectProperties *properties,
const gchar *ip_type);
void mm_modem_simple_connect_properties_set_allow_roaming (
MMModemSimpleConnectProperties *properties,
gboolean allow_roaming);
void mm_modem_simple_connect_properties_set_number (
MMModemSimpleConnectProperties *properties,
const gchar *number);
G_END_DECLS
#endif /* MM_MODEM_SIMPLE_CONNECT_PROPERTIES_H */

View File

@@ -140,7 +140,7 @@ simple_connect_ready (MMModemSimple *self,
void void
mm_modem_simple_connect (MMModemSimple *self, mm_modem_simple_connect (MMModemSimple *self,
MMModemSimpleConnectProperties *properties, MMSimpleConnectProperties *properties,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
@@ -158,8 +158,7 @@ mm_modem_simple_connect (MMModemSimple *self,
if (cancellable) if (cancellable)
ctx->cancellable = g_object_ref (cancellable); ctx->cancellable = g_object_ref (cancellable);
variant = mm_common_connect_properties_get_dictionary ( variant = mm_simple_connect_properties_get_dictionary (properties);
MM_COMMON_CONNECT_PROPERTIES (properties));
mm_gdbus_modem_simple_call_connect ( mm_gdbus_modem_simple_call_connect (
self, self,
variant, variant,
@@ -172,7 +171,7 @@ mm_modem_simple_connect (MMModemSimple *self,
MMBearer * MMBearer *
mm_modem_simple_connect_sync (MMModemSimple *self, mm_modem_simple_connect_sync (MMModemSimple *self,
MMModemSimpleConnectProperties *properties, MMSimpleConnectProperties *properties,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
@@ -182,8 +181,7 @@ mm_modem_simple_connect_sync (MMModemSimple *self,
g_return_val_if_fail (MM_GDBUS_IS_MODEM_SIMPLE (self), NULL); g_return_val_if_fail (MM_GDBUS_IS_MODEM_SIMPLE (self), NULL);
variant = mm_common_connect_properties_get_dictionary ( variant = mm_simple_connect_properties_get_dictionary (properties);
MM_COMMON_CONNECT_PROPERTIES (properties));
mm_gdbus_modem_simple_call_connect_sync (self, mm_gdbus_modem_simple_call_connect_sync (self,
variant, variant,
&bearer_path, &bearer_path,

View File

@@ -27,7 +27,6 @@
#include <mm-gdbus-modem.h> #include <mm-gdbus-modem.h>
#include "mm-bearer.h" #include "mm-bearer.h"
#include "mm-modem-simple-connect-properties.h"
#include "mm-modem-simple-status-properties.h" #include "mm-modem-simple-status-properties.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@@ -41,7 +40,7 @@ const gchar *mm_modem_simple_get_path (MMModemSimple *self);
gchar *mm_modem_simple_dup_path (MMModemSimple *self); gchar *mm_modem_simple_dup_path (MMModemSimple *self);
void mm_modem_simple_connect (MMModemSimple *self, void mm_modem_simple_connect (MMModemSimple *self,
MMModemSimpleConnectProperties *properties, MMSimpleConnectProperties *properties,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
@@ -49,7 +48,7 @@ MMBearer *mm_modem_simple_connect_finish (MMModemSimple *self,
GAsyncResult *res, GAsyncResult *res,
GError **error); GError **error);
MMBearer *mm_modem_simple_connect_sync (MMModemSimple *self, MMBearer *mm_modem_simple_connect_sync (MMModemSimple *self,
MMModemSimpleConnectProperties *properties, MMSimpleConnectProperties *properties,
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);

View File

@@ -187,7 +187,7 @@ typedef struct {
/* Expected input properties */ /* Expected input properties */
GVariant *dictionary; GVariant *dictionary;
MMCommonConnectProperties *properties; MMSimpleConnectProperties *properties;
/* Results to set */ /* Results to set */
MMBearer *bearer; MMBearer *bearer;
@@ -375,7 +375,7 @@ unlock_check_ready (MMIfaceModem *self,
/* During simple connect we are only allowed to use SIM PIN */ /* During simple connect we are only allowed to use SIM PIN */
if (lock != MM_MODEM_LOCK_SIM_PIN || if (lock != MM_MODEM_LOCK_SIM_PIN ||
!mm_common_connect_properties_get_pin (ctx->properties)) { !mm_simple_connect_properties_get_pin (ctx->properties)) {
g_dbus_method_invocation_return_error ( g_dbus_method_invocation_return_error (
ctx->invocation, ctx->invocation,
MM_CORE_ERROR, MM_CORE_ERROR,
@@ -402,7 +402,7 @@ unlock_check_ready (MMIfaceModem *self,
} }
mm_sim_send_pin (sim, mm_sim_send_pin (sim,
mm_common_connect_properties_get_pin (ctx->properties), mm_simple_connect_properties_get_pin (ctx->properties),
(GAsyncReadyCallback)send_pin_ready, (GAsyncReadyCallback)send_pin_ready,
ctx); ctx);
g_object_unref (sim); g_object_unref (sim);
@@ -440,7 +440,7 @@ connection_step (ConnectionContext *ctx)
mm_info ("Simple connect state (%d/%d): Allowed mode", mm_info ("Simple connect state (%d/%d): Allowed mode",
ctx->step, CONNECTION_STEP_LAST); ctx->step, CONNECTION_STEP_LAST);
mm_common_connect_properties_get_allowed_modes (ctx->properties, mm_simple_connect_properties_get_allowed_modes (ctx->properties,
&allowed_modes, &allowed_modes,
&preferred_mode); &preferred_mode);
mm_iface_modem_set_allowed_modes (MM_IFACE_MODEM (ctx->self), mm_iface_modem_set_allowed_modes (MM_IFACE_MODEM (ctx->self),
@@ -460,7 +460,7 @@ connection_step (ConnectionContext *ctx)
mm_info ("Simple connect state (%d/%d): Bands", mm_info ("Simple connect state (%d/%d): Bands",
ctx->step, CONNECTION_STEP_LAST); ctx->step, CONNECTION_STEP_LAST);
mm_common_connect_properties_get_bands (ctx->properties, mm_simple_connect_properties_get_bands (ctx->properties,
&bands, &bands,
&n_bands); &n_bands);
@@ -485,7 +485,7 @@ connection_step (ConnectionContext *ctx)
/* 3GPP or CDMA registration */ /* 3GPP or CDMA registration */
register_in_3gpp_or_cdma_network ( register_in_3gpp_or_cdma_network (
ctx->self, ctx->self,
mm_common_connect_properties_get_operator_id (ctx->properties), mm_simple_connect_properties_get_operator_id (ctx->properties),
(GAsyncReadyCallback)register_in_3gpp_or_cdma_network_ready, (GAsyncReadyCallback)register_in_3gpp_or_cdma_network_ready,
ctx); ctx);
return; return;
@@ -507,8 +507,7 @@ connection_step (ConnectionContext *ctx)
MM_IFACE_MODEM_BEARER_LIST, &list, MM_IFACE_MODEM_BEARER_LIST, &list,
NULL); NULL);
bearer_properties = (mm_common_connect_properties_get_bearer_properties ( bearer_properties = mm_simple_connect_properties_get_bearer_properties (ctx->properties);
ctx->properties));
/* Check if the bearer we want to create is already in the list */ /* Check if the bearer we want to create is already in the list */
ctx->bearer = mm_bearer_list_find (list, bearer_properties); ctx->bearer = mm_bearer_list_find (list, bearer_properties);
@@ -575,7 +574,7 @@ connect_auth_ready (MMBaseModem *self,
return; return;
} }
ctx->properties = mm_common_connect_properties_new_from_dictionary (ctx->dictionary, &error); ctx->properties = mm_simple_connect_properties_new_from_dictionary (ctx->dictionary, &error);
if (!ctx->properties) { if (!ctx->properties) {
g_dbus_method_invocation_take_error (ctx->invocation, error); g_dbus_method_invocation_take_error (ctx->invocation, error);
connection_context_free (ctx); connection_context_free (ctx);