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

Renamed `MMCommonBearerProperties' to `MMBearerProperties', and removed the
`MMBearerProperties' 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:14:44 +01:00
parent 323df60ed9
commit d306bb082f
29 changed files with 301 additions and 554 deletions

View File

@@ -151,7 +151,7 @@ $(mm_gdbus_bearer_generated): $(top_srcdir)/introspection/org.freedesktop.ModemM
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-common-connect-properties.c: mm-errors-types.h
mm-common-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
mm-common-location-3gpp.c: mm-errors-types.h mm-common-location-3gpp.c: mm-errors-types.h
@@ -165,7 +165,7 @@ include_HEADERS = \
mm-common-helpers.h \ mm-common-helpers.h \
mm-common-simple-properties.h \ mm-common-simple-properties.h \
mm-common-connect-properties.h \ mm-common-connect-properties.h \
mm-common-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 \
mm-common-location-3gpp.h \ mm-common-location-3gpp.h \
@@ -188,8 +188,8 @@ libmm_common_la_SOURCES = \
mm-common-simple-properties.c \ mm-common-simple-properties.c \
mm-common-connect-properties.h \ mm-common-connect-properties.h \
mm-common-connect-properties.c \ mm-common-connect-properties.c \
mm-common-bearer-properties.h \ mm-bearer-properties.h \
mm-common-bearer-properties.c \ mm-bearer-properties.c \
mm-sms-properties.h \ mm-sms-properties.h \
mm-sms-properties.c \ mm-sms-properties.c \
mm-bearer-ip-config.h \ mm-bearer-ip-config.h \

View File

@@ -29,7 +29,7 @@
#include "mm-common-simple-properties.h" #include "mm-common-simple-properties.h"
#include "mm-common-connect-properties.h" #include "mm-common-connect-properties.h"
#include "mm-sms-properties.h" #include "mm-sms-properties.h"
#include "mm-common-bearer-properties.h" #include "mm-bearer-properties.h"
#include "mm-bearer-ip-config.h" #include "mm-bearer-ip-config.h"
#include "mm-common-location-3gpp.h" #include "mm-common-location-3gpp.h"
#include "mm-unlock-retries.h" #include "mm-unlock-retries.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-bearer-properties.h" #include "mm-bearer-properties.h"
G_DEFINE_TYPE (MMCommonBearerProperties, mm_common_bearer_properties, G_TYPE_OBJECT); G_DEFINE_TYPE (MMBearerProperties, mm_bearer_properties, G_TYPE_OBJECT);
#define PROPERTY_APN "apn" #define PROPERTY_APN "apn"
#define PROPERTY_USER "user" #define PROPERTY_USER "user"
@@ -29,7 +29,7 @@ G_DEFINE_TYPE (MMCommonBearerProperties, mm_common_bearer_properties, G_TYPE_OBJ
#define PROPERTY_ALLOW_ROAMING "allow-roaming" #define PROPERTY_ALLOW_ROAMING "allow-roaming"
#define PROPERTY_RM_PROTOCOL "rm-protocol" #define PROPERTY_RM_PROTOCOL "rm-protocol"
struct _MMCommonBearerPropertiesPrivate { struct _MMBearerPropertiesPrivate {
/* APN */ /* APN */
gchar *apn; gchar *apn;
/* IP type */ /* IP type */
@@ -50,108 +50,136 @@ struct _MMCommonBearerPropertiesPrivate {
/*****************************************************************************/ /*****************************************************************************/
void void
mm_common_bearer_properties_set_apn (MMCommonBearerProperties *self, mm_bearer_properties_set_apn (MMBearerProperties *self,
const gchar *apn) const gchar *apn)
{ {
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
g_free (self->priv->apn); g_free (self->priv->apn);
self->priv->apn = g_strdup (apn); self->priv->apn = g_strdup (apn);
} }
void void
mm_common_bearer_properties_set_user (MMCommonBearerProperties *self, mm_bearer_properties_set_user (MMBearerProperties *self,
const gchar *user) const gchar *user)
{ {
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
g_free (self->priv->user); g_free (self->priv->user);
self->priv->user = g_strdup (user); self->priv->user = g_strdup (user);
} }
void void
mm_common_bearer_properties_set_password (MMCommonBearerProperties *self, mm_bearer_properties_set_password (MMBearerProperties *self,
const gchar *password) const gchar *password)
{ {
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
g_free (self->priv->password); g_free (self->priv->password);
self->priv->password = g_strdup (password); self->priv->password = g_strdup (password);
} }
void void
mm_common_bearer_properties_set_ip_type (MMCommonBearerProperties *self, mm_bearer_properties_set_ip_type (MMBearerProperties *self,
const gchar *ip_type) const gchar *ip_type)
{ {
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
g_free (self->priv->ip_type); g_free (self->priv->ip_type);
self->priv->ip_type = g_strdup (ip_type); self->priv->ip_type = g_strdup (ip_type);
} }
void void
mm_common_bearer_properties_set_allow_roaming (MMCommonBearerProperties *self, mm_bearer_properties_set_allow_roaming (MMBearerProperties *self,
gboolean allow_roaming) gboolean allow_roaming)
{ {
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
self->priv->allow_roaming = allow_roaming; self->priv->allow_roaming = allow_roaming;
self->priv->allow_roaming_set = TRUE; self->priv->allow_roaming_set = TRUE;
} }
void void
mm_common_bearer_properties_set_number (MMCommonBearerProperties *self, mm_bearer_properties_set_number (MMBearerProperties *self,
const gchar *number) const gchar *number)
{ {
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
g_free (self->priv->number); g_free (self->priv->number);
self->priv->number = g_strdup (number); self->priv->number = g_strdup (number);
} }
void void
mm_common_bearer_properties_set_rm_protocol (MMCommonBearerProperties *self, mm_bearer_properties_set_rm_protocol (MMBearerProperties *self,
MMModemCdmaRmProtocol protocol) MMModemCdmaRmProtocol protocol)
{ {
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
self->priv->rm_protocol = protocol; self->priv->rm_protocol = protocol;
} }
/*****************************************************************************/ /*****************************************************************************/
const gchar * const gchar *
mm_common_bearer_properties_get_apn (MMCommonBearerProperties *self) mm_bearer_properties_get_apn (MMBearerProperties *self)
{ {
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), NULL);
return self->priv->apn; return self->priv->apn;
} }
const gchar * const gchar *
mm_common_bearer_properties_get_user (MMCommonBearerProperties *self) mm_bearer_properties_get_user (MMBearerProperties *self)
{ {
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), NULL);
return self->priv->user; return self->priv->user;
} }
const gchar * const gchar *
mm_common_bearer_properties_get_password (MMCommonBearerProperties *self) mm_bearer_properties_get_password (MMBearerProperties *self)
{ {
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), NULL);
return self->priv->password; return self->priv->password;
} }
const gchar * const gchar *
mm_common_bearer_properties_get_ip_type (MMCommonBearerProperties *self) mm_bearer_properties_get_ip_type (MMBearerProperties *self)
{ {
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), NULL);
return self->priv->ip_type; return self->priv->ip_type;
} }
gboolean gboolean
mm_common_bearer_properties_get_allow_roaming (MMCommonBearerProperties *self) mm_bearer_properties_get_allow_roaming (MMBearerProperties *self)
{ {
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), FALSE);
return self->priv->allow_roaming; return self->priv->allow_roaming;
} }
const gchar * const gchar *
mm_common_bearer_properties_get_number (MMCommonBearerProperties *self) mm_bearer_properties_get_number (MMBearerProperties *self)
{ {
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), NULL);
return self->priv->number; return self->priv->number;
} }
MMModemCdmaRmProtocol MMModemCdmaRmProtocol
mm_common_bearer_properties_get_rm_protocol (MMCommonBearerProperties *self) mm_bearer_properties_get_rm_protocol (MMBearerProperties *self)
{ {
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), MM_MODEM_CDMA_RM_PROTOCOL_UNKNOWN);
return self->priv->rm_protocol; return self->priv->rm_protocol;
} }
/*****************************************************************************/ /*****************************************************************************/
GVariant * GVariant *
mm_common_bearer_properties_get_dictionary (MMCommonBearerProperties *self) mm_bearer_properties_get_dictionary (MMBearerProperties *self)
{ {
GVariantBuilder builder; GVariantBuilder builder;
@@ -159,6 +187,8 @@ mm_common_bearer_properties_get_dictionary (MMCommonBearerProperties *self)
if (!self) if (!self)
return NULL; return NULL;
g_return_val_if_fail (MM_IS_BEARER_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->apn) if (self->priv->apn)
@@ -209,19 +239,21 @@ mm_common_bearer_properties_get_dictionary (MMCommonBearerProperties *self)
/*****************************************************************************/ /*****************************************************************************/
gboolean gboolean
mm_common_bearer_properties_consume_string (MMCommonBearerProperties *self, mm_bearer_properties_consume_string (MMBearerProperties *self,
const gchar *key, const gchar *key,
const gchar *value, const gchar *value,
GError **error) GError **error)
{ {
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), FALSE);
if (g_str_equal (key, PROPERTY_APN)) if (g_str_equal (key, PROPERTY_APN))
mm_common_bearer_properties_set_apn (self, value); mm_bearer_properties_set_apn (self, value);
else if (g_str_equal (key, PROPERTY_USER)) else if (g_str_equal (key, PROPERTY_USER))
mm_common_bearer_properties_set_user (self, value); mm_bearer_properties_set_user (self, value);
else if (g_str_equal (key, PROPERTY_PASSWORD)) else if (g_str_equal (key, PROPERTY_PASSWORD))
mm_common_bearer_properties_set_password (self, value); mm_bearer_properties_set_password (self, value);
else if (g_str_equal (key, PROPERTY_IP_TYPE)) else if (g_str_equal (key, PROPERTY_IP_TYPE))
mm_common_bearer_properties_set_ip_type (self, value); mm_bearer_properties_set_ip_type (self, value);
else if (g_str_equal (key, PROPERTY_ALLOW_ROAMING)) { else if (g_str_equal (key, PROPERTY_ALLOW_ROAMING)) {
GError *inner_error = NULL; GError *inner_error = NULL;
gboolean allow_roaming; gboolean allow_roaming;
@@ -231,9 +263,9 @@ mm_common_bearer_properties_consume_string (MMCommonBearerProperties *self,
g_propagate_error (error, inner_error); g_propagate_error (error, inner_error);
return FALSE; return FALSE;
} }
mm_common_bearer_properties_set_allow_roaming (self, allow_roaming); mm_bearer_properties_set_allow_roaming (self, allow_roaming);
} else if (g_str_equal (key, PROPERTY_NUMBER)) } else if (g_str_equal (key, PROPERTY_NUMBER))
mm_common_bearer_properties_set_number (self, value); mm_bearer_properties_set_number (self, value);
else if (g_str_equal (key, PROPERTY_RM_PROTOCOL)) { else if (g_str_equal (key, PROPERTY_RM_PROTOCOL)) {
GError *inner_error = NULL; GError *inner_error = NULL;
MMModemCdmaRmProtocol protocol; MMModemCdmaRmProtocol protocol;
@@ -243,7 +275,7 @@ mm_common_bearer_properties_consume_string (MMCommonBearerProperties *self,
g_propagate_error (error, inner_error); g_propagate_error (error, inner_error);
return FALSE; return FALSE;
} }
mm_common_bearer_properties_set_rm_protocol (self, protocol); mm_bearer_properties_set_rm_protocol (self, protocol);
} else { } else {
g_set_error (error, g_set_error (error,
MM_CORE_ERROR, MM_CORE_ERROR,
@@ -257,7 +289,7 @@ mm_common_bearer_properties_consume_string (MMCommonBearerProperties *self,
} }
typedef struct { typedef struct {
MMCommonBearerProperties *properties; MMBearerProperties *properties;
GError *error; GError *error;
} ParseKeyValueContext; } ParseKeyValueContext;
@@ -266,20 +298,20 @@ key_value_foreach (const gchar *key,
const gchar *value, const gchar *value,
ParseKeyValueContext *ctx) ParseKeyValueContext *ctx)
{ {
return mm_common_bearer_properties_consume_string (ctx->properties, return mm_bearer_properties_consume_string (ctx->properties,
key, key,
value, value,
&ctx->error); &ctx->error);
} }
MMCommonBearerProperties * MMBearerProperties *
mm_common_bearer_properties_new_from_string (const gchar *str, mm_bearer_properties_new_from_string (const gchar *str,
GError **error) GError **error)
{ {
ParseKeyValueContext ctx; ParseKeyValueContext ctx;
ctx.error = NULL; ctx.error = NULL;
ctx.properties = mm_common_bearer_properties_new (); ctx.properties = mm_bearer_properties_new ();
mm_common_parse_key_value_string (str, mm_common_parse_key_value_string (str,
&ctx.error, &ctx.error,
@@ -298,33 +330,35 @@ mm_common_bearer_properties_new_from_string (const gchar *str,
/*****************************************************************************/ /*****************************************************************************/
gboolean gboolean
mm_common_bearer_properties_consume_variant (MMCommonBearerProperties *properties, mm_bearer_properties_consume_variant (MMBearerProperties *properties,
const gchar *key, const gchar *key,
GVariant *value, GVariant *value,
GError **error) GError **error)
{ {
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (properties), FALSE);
if (g_str_equal (key, PROPERTY_APN)) if (g_str_equal (key, PROPERTY_APN))
mm_common_bearer_properties_set_apn ( mm_bearer_properties_set_apn (
properties, properties,
g_variant_get_string (value, NULL)); g_variant_get_string (value, NULL));
else if (g_str_equal (key, PROPERTY_USER)) else if (g_str_equal (key, PROPERTY_USER))
mm_common_bearer_properties_set_user ( mm_bearer_properties_set_user (
properties, properties,
g_variant_get_string (value, NULL)); g_variant_get_string (value, NULL));
else if (g_str_equal (key, PROPERTY_PASSWORD)) else if (g_str_equal (key, PROPERTY_PASSWORD))
mm_common_bearer_properties_set_password ( mm_bearer_properties_set_password (
properties, properties,
g_variant_get_string (value, NULL)); g_variant_get_string (value, NULL));
else if (g_str_equal (key, PROPERTY_IP_TYPE)) else if (g_str_equal (key, PROPERTY_IP_TYPE))
mm_common_bearer_properties_set_ip_type ( mm_bearer_properties_set_ip_type (
properties, properties,
g_variant_get_string (value, NULL)); g_variant_get_string (value, NULL));
else if (g_str_equal (key, PROPERTY_NUMBER)) else if (g_str_equal (key, PROPERTY_NUMBER))
mm_common_bearer_properties_set_number ( mm_bearer_properties_set_number (
properties, properties,
g_variant_get_string (value, NULL)); g_variant_get_string (value, NULL));
else if (g_str_equal (key, PROPERTY_ALLOW_ROAMING)) else if (g_str_equal (key, PROPERTY_ALLOW_ROAMING))
mm_common_bearer_properties_set_allow_roaming ( mm_bearer_properties_set_allow_roaming (
properties, properties,
g_variant_get_boolean (value)); g_variant_get_boolean (value));
else { else {
@@ -340,24 +374,34 @@ mm_common_bearer_properties_consume_variant (MMCommonBearerProperties *propertie
return TRUE; return TRUE;
} }
MMCommonBearerProperties * MMBearerProperties *
mm_common_bearer_properties_new_from_dictionary (GVariant *dictionary, mm_bearer_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;
MMCommonBearerProperties *properties; MMBearerProperties *properties;
properties = mm_common_bearer_properties_new (); properties = mm_bearer_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 Bearer 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)) {
mm_common_bearer_properties_consume_variant (properties, mm_bearer_properties_consume_variant (properties,
key, key,
value, value,
&inner_error); &inner_error);
@@ -377,15 +421,17 @@ mm_common_bearer_properties_new_from_dictionary (GVariant *dictionary,
/*****************************************************************************/ /*****************************************************************************/
MMCommonBearerProperties * MMBearerProperties *
mm_common_bearer_properties_dup (MMCommonBearerProperties *orig) mm_bearer_properties_dup (MMBearerProperties *orig)
{ {
GVariant *dict; GVariant *dict;
MMCommonBearerProperties *copy; MMBearerProperties *copy;
GError *error = NULL; GError *error = NULL;
dict = mm_common_bearer_properties_get_dictionary (orig); g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (orig), NULL);
copy = mm_common_bearer_properties_new_from_dictionary (dict, &error);
dict = mm_bearer_properties_get_dictionary (orig);
copy = mm_bearer_properties_new_from_dictionary (dict, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_variant_unref (dict); g_variant_unref (dict);
@@ -394,19 +440,19 @@ mm_common_bearer_properties_dup (MMCommonBearerProperties *orig)
/*****************************************************************************/ /*****************************************************************************/
MMCommonBearerProperties * MMBearerProperties *
mm_common_bearer_properties_new (void) mm_bearer_properties_new (void)
{ {
return (MM_COMMON_BEARER_PROPERTIES ( return (MM_BEARER_PROPERTIES (
g_object_new (MM_TYPE_COMMON_BEARER_PROPERTIES, NULL))); g_object_new (MM_TYPE_BEARER_PROPERTIES, NULL)));
} }
static void static void
mm_common_bearer_properties_init (MMCommonBearerProperties *self) mm_bearer_properties_init (MMBearerProperties *self)
{ {
self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self), self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self),
MM_TYPE_COMMON_BEARER_PROPERTIES, MM_TYPE_BEARER_PROPERTIES,
MMCommonBearerPropertiesPrivate); MMBearerPropertiesPrivate);
/* Some defaults */ /* Some defaults */
self->priv->allow_roaming = TRUE; self->priv->allow_roaming = TRUE;
@@ -416,7 +462,7 @@ mm_common_bearer_properties_init (MMCommonBearerProperties *self)
static void static void
finalize (GObject *object) finalize (GObject *object)
{ {
MMCommonBearerProperties *self = MM_COMMON_BEARER_PROPERTIES (object); MMBearerProperties *self = MM_BEARER_PROPERTIES (object);
g_free (self->priv->apn); g_free (self->priv->apn);
g_free (self->priv->user); g_free (self->priv->user);
@@ -424,15 +470,15 @@ finalize (GObject *object)
g_free (self->priv->ip_type); g_free (self->priv->ip_type);
g_free (self->priv->number); g_free (self->priv->number);
G_OBJECT_CLASS (mm_common_bearer_properties_parent_class)->finalize (object); G_OBJECT_CLASS (mm_bearer_properties_parent_class)->finalize (object);
} }
static void static void
mm_common_bearer_properties_class_init (MMCommonBearerPropertiesClass *klass) mm_bearer_properties_class_init (MMBearerPropertiesClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (object_class, sizeof (MMCommonBearerPropertiesPrivate)); g_type_class_add_private (object_class, sizeof (MMBearerPropertiesPrivate));
object_class->finalize = finalize; object_class->finalize = finalize;
} }

View File

@@ -0,0 +1,91 @@
/* -*- 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_BEARER_PROPERTIES_H
#define MM_BEARER_PROPERTIES_H
#include <ModemManager.h>
#include <glib-object.h>
G_BEGIN_DECLS
#define MM_TYPE_BEARER_PROPERTIES (mm_bearer_properties_get_type ())
#define MM_BEARER_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BEARER_PROPERTIES, MMBearerProperties))
#define MM_BEARER_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BEARER_PROPERTIES, MMBearerPropertiesClass))
#define MM_IS_BEARER_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BEARER_PROPERTIES))
#define MM_IS_BEARER_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BEARER_PROPERTIES))
#define MM_BEARER_PROPERTIES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BEARER_PROPERTIES, MMBearerPropertiesClass))
typedef struct _MMBearerProperties MMBearerProperties;
typedef struct _MMBearerPropertiesClass MMBearerPropertiesClass;
typedef struct _MMBearerPropertiesPrivate MMBearerPropertiesPrivate;
struct _MMBearerProperties {
GObject parent;
MMBearerPropertiesPrivate *priv;
};
struct _MMBearerPropertiesClass {
GObjectClass parent;
};
GType mm_bearer_properties_get_type (void);
MMBearerProperties *mm_bearer_properties_new (void);
MMBearerProperties *mm_bearer_properties_new_from_string (const gchar *str,
GError **error);
MMBearerProperties *mm_bearer_properties_new_from_dictionary (GVariant *dictionary,
GError **error);
MMBearerProperties *mm_bearer_properties_dup (MMBearerProperties *orig);
void mm_bearer_properties_set_apn (MMBearerProperties *properties,
const gchar *apn);
void mm_bearer_properties_set_user (MMBearerProperties *properties,
const gchar *user);
void mm_bearer_properties_set_password (MMBearerProperties *properties,
const gchar *password);
void mm_bearer_properties_set_ip_type (MMBearerProperties *properties,
const gchar *ip_type);
void mm_bearer_properties_set_allow_roaming (MMBearerProperties *properties,
gboolean allow_roaming);
void mm_bearer_properties_set_number (MMBearerProperties *properties,
const gchar *number);
void mm_bearer_properties_set_rm_protocol (MMBearerProperties *properties,
MMModemCdmaRmProtocol protocol);
const gchar *mm_bearer_properties_get_apn (MMBearerProperties *properties);
const gchar *mm_bearer_properties_get_user (MMBearerProperties *properties);
const gchar *mm_bearer_properties_get_password (MMBearerProperties *properties);
const gchar *mm_bearer_properties_get_ip_type (MMBearerProperties *properties);
gboolean mm_bearer_properties_get_allow_roaming (MMBearerProperties *properties);
const gchar *mm_bearer_properties_get_number (MMBearerProperties *properties);
MMModemCdmaRmProtocol mm_bearer_properties_get_rm_protocol (MMBearerProperties *properties);
gboolean mm_bearer_properties_consume_string (MMBearerProperties *self,
const gchar *key,
const gchar *value,
GError **error);
gboolean mm_bearer_properties_consume_variant (MMBearerProperties *self,
const gchar *key,
GVariant *value,
GError **error);
GVariant *mm_bearer_properties_get_dictionary (MMBearerProperties *self);
G_END_DECLS
#endif /* MM_BEARER_PROPERTIES_H */

View File

@@ -1,107 +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_BEARER_PROPERTIES_H
#define MM_COMMON_BEARER_PROPERTIES_H
#include <ModemManager.h>
#include <glib-object.h>
G_BEGIN_DECLS
#define MM_TYPE_COMMON_BEARER_PROPERTIES (mm_common_bearer_properties_get_type ())
#define MM_COMMON_BEARER_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_COMMON_BEARER_PROPERTIES, MMCommonBearerProperties))
#define MM_COMMON_BEARER_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_COMMON_BEARER_PROPERTIES, MMCommonBearerPropertiesClass))
#define MM_IS_COMMON_BEARER_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_COMMON_BEARER_PROPERTIES))
#define MM_IS_COMMON_BEARER_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_COMMON_BEARER_PROPERTIES))
#define MM_COMMON_BEARER_PROPERTIES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_COMMON_BEARER_PROPERTIES, MMCommonBearerPropertiesClass))
typedef struct _MMCommonBearerProperties MMCommonBearerProperties;
typedef struct _MMCommonBearerPropertiesClass MMCommonBearerPropertiesClass;
typedef struct _MMCommonBearerPropertiesPrivate MMCommonBearerPropertiesPrivate;
struct _MMCommonBearerProperties {
GObject parent;
MMCommonBearerPropertiesPrivate *priv;
};
struct _MMCommonBearerPropertiesClass {
GObjectClass parent;
};
GType mm_common_bearer_properties_get_type (void);
MMCommonBearerProperties *mm_common_bearer_properties_new (void);
MMCommonBearerProperties *mm_common_bearer_properties_new_from_string (
const gchar *str,
GError **error);
MMCommonBearerProperties *mm_common_bearer_properties_new_from_dictionary (
GVariant *dictionary,
GError **error);
MMCommonBearerProperties *mm_common_bearer_properties_dup (MMCommonBearerProperties *orig);
void mm_common_bearer_properties_set_apn (
MMCommonBearerProperties *properties,
const gchar *apn);
void mm_common_bearer_properties_set_user (
MMCommonBearerProperties *properties,
const gchar *user);
void mm_common_bearer_properties_set_password (
MMCommonBearerProperties *properties,
const gchar *password);
void mm_common_bearer_properties_set_ip_type (
MMCommonBearerProperties *properties,
const gchar *ip_type);
void mm_common_bearer_properties_set_allow_roaming (
MMCommonBearerProperties *properties,
gboolean allow_roaming);
void mm_common_bearer_properties_set_number (
MMCommonBearerProperties *properties,
const gchar *number);
void mm_common_bearer_properties_set_rm_protocol (
MMCommonBearerProperties *properties,
MMModemCdmaRmProtocol protocol);
const gchar *mm_common_bearer_properties_get_apn (
MMCommonBearerProperties *properties);
const gchar *mm_common_bearer_properties_get_user (
MMCommonBearerProperties *properties);
const gchar *mm_common_bearer_properties_get_password (
MMCommonBearerProperties *properties);
const gchar *mm_common_bearer_properties_get_ip_type (
MMCommonBearerProperties *properties);
gboolean mm_common_bearer_properties_get_allow_roaming (
MMCommonBearerProperties *properties);
const gchar *mm_common_bearer_properties_get_number (
MMCommonBearerProperties *properties);
MMModemCdmaRmProtocol mm_common_bearer_properties_get_rm_protocol (
MMCommonBearerProperties *properties);
gboolean mm_common_bearer_properties_consume_string (MMCommonBearerProperties *self,
const gchar *key,
const gchar *value,
GError **error);
gboolean mm_common_bearer_properties_consume_variant (MMCommonBearerProperties *self,
const gchar *key,
GVariant *value,
GError **error);
GVariant *mm_common_bearer_properties_get_dictionary (MMCommonBearerProperties *self);
G_END_DECLS
#endif /* MM_COMMON_BEARER_PROPERTIES_H */

View File

@@ -40,7 +40,7 @@ struct _MMCommonConnectPropertiesPrivate {
MMModemMode allowed_modes; MMModemMode allowed_modes;
MMModemMode preferred_mode; MMModemMode preferred_mode;
/* Bearer properties */ /* Bearer properties */
MMCommonBearerProperties *bearer_properties; MMBearerProperties *bearer_properties;
}; };
/*****************************************************************************/ /*****************************************************************************/
@@ -88,53 +88,53 @@ void
mm_common_connect_properties_set_apn (MMCommonConnectProperties *self, mm_common_connect_properties_set_apn (MMCommonConnectProperties *self,
const gchar *apn) const gchar *apn)
{ {
mm_common_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_common_connect_properties_set_user (MMCommonConnectProperties *self,
const gchar *user) const gchar *user)
{ {
mm_common_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_common_connect_properties_set_password (MMCommonConnectProperties *self,
const gchar *password) const gchar *password)
{ {
mm_common_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_common_connect_properties_set_ip_type (MMCommonConnectProperties *self,
const gchar *ip_type) const gchar *ip_type)
{ {
mm_common_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_common_connect_properties_set_allow_roaming (MMCommonConnectProperties *self,
gboolean allow_roaming) gboolean allow_roaming)
{ {
mm_common_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_common_connect_properties_set_number (MMCommonConnectProperties *self,
const gchar *number) const gchar *number)
{ {
mm_common_bearer_properties_set_number (self->priv->bearer_properties, mm_bearer_properties_set_number (self->priv->bearer_properties,
number); number);
} }
/*****************************************************************************/ /*****************************************************************************/
MMCommonBearerProperties * MMBearerProperties *
mm_common_connect_properties_get_bearer_properties (MMCommonConnectProperties *self) mm_common_connect_properties_get_bearer_properties (MMCommonConnectProperties *self)
{ {
return g_object_ref (self->priv->bearer_properties); return g_object_ref (self->priv->bearer_properties);
@@ -173,37 +173,37 @@ mm_common_connect_properties_get_allowed_modes (MMCommonConnectProperties *self,
const gchar * const gchar *
mm_common_connect_properties_get_apn (MMCommonConnectProperties *self) mm_common_connect_properties_get_apn (MMCommonConnectProperties *self)
{ {
return mm_common_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_common_connect_properties_get_user (MMCommonConnectProperties *self)
{ {
return mm_common_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_common_connect_properties_get_password (MMCommonConnectProperties *self)
{ {
return mm_common_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_common_connect_properties_get_ip_type (MMCommonConnectProperties *self)
{ {
return mm_common_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_common_connect_properties_get_allow_roaming (MMCommonConnectProperties *self)
{ {
return mm_common_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_common_connect_properties_get_number (MMCommonConnectProperties *self)
{ {
return mm_common_bearer_properties_get_number (self->priv->bearer_properties); return mm_bearer_properties_get_number (self->priv->bearer_properties);
} }
/*****************************************************************************/ /*****************************************************************************/
@@ -254,7 +254,7 @@ mm_common_connect_properties_get_dictionary (MMCommonConnectProperties *self)
} }
/* Merge dictionaries */ /* Merge dictionaries */
bearer_properties_dictionary = mm_common_bearer_properties_get_dictionary (self->priv->bearer_properties); bearer_properties_dictionary = mm_bearer_properties_get_dictionary (self->priv->bearer_properties);
g_variant_iter_init (&iter, bearer_properties_dictionary); g_variant_iter_init (&iter, bearer_properties_dictionary);
while (g_variant_iter_next (&iter, "{sv}", &key, &value)) { while (g_variant_iter_next (&iter, "{sv}", &key, &value)) {
g_variant_builder_add (&builder, g_variant_builder_add (&builder,
@@ -284,9 +284,9 @@ key_value_foreach (const gchar *key,
ParseKeyValueContext *ctx) ParseKeyValueContext *ctx)
{ {
/* First, check if we can consume this as bearer properties */ /* First, check if we can consume this as bearer properties */
if (mm_common_bearer_properties_consume_string (ctx->properties->priv->bearer_properties, if (mm_bearer_properties_consume_string (ctx->properties->priv->bearer_properties,
key, value, key, value,
NULL)) NULL))
return TRUE; return TRUE;
if (g_str_equal (key, PROPERTY_PIN)) if (g_str_equal (key, PROPERTY_PIN))
@@ -394,9 +394,9 @@ mm_common_connect_properties_new_from_dictionary (GVariant *dictionary,
g_variant_iter_next (&iter, "{sv}", &key, &value)) { g_variant_iter_next (&iter, "{sv}", &key, &value)) {
/* First, check if we can consume this as bearer properties */ /* First, check if we can consume this as bearer properties */
if (!mm_common_bearer_properties_consume_variant (properties->priv->bearer_properties, if (!mm_bearer_properties_consume_variant (properties->priv->bearer_properties,
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_common_connect_properties_set_pin (
properties, properties,
@@ -480,7 +480,7 @@ mm_common_connect_properties_init (MMCommonConnectProperties *self)
MMCommonConnectPropertiesPrivate); MMCommonConnectPropertiesPrivate);
/* Some defaults */ /* Some defaults */
self->priv->bearer_properties = mm_common_bearer_properties_new (); self->priv->bearer_properties = mm_bearer_properties_new ();
self->priv->allowed_modes = MM_MODEM_MODE_ANY; self->priv->allowed_modes = MM_MODEM_MODE_ANY;
self->priv->preferred_mode = MM_MODEM_MODE_NONE; self->priv->preferred_mode = MM_MODEM_MODE_NONE;
self->priv->bands = g_new (MMModemBand, 1); self->priv->bands = g_new (MMModemBand, 1);

View File

@@ -19,7 +19,7 @@
#include <ModemManager.h> #include <ModemManager.h>
#include <glib-object.h> #include <glib-object.h>
#include "mm-common-bearer-properties.h" #include "mm-bearer-properties.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@@ -111,7 +111,7 @@ gboolean mm_common_connect_properties_get_allow_roaming (
const gchar *mm_common_connect_properties_get_number ( const gchar *mm_common_connect_properties_get_number (
MMCommonConnectProperties *properties); MMCommonConnectProperties *properties);
MMCommonBearerProperties *mm_common_connect_properties_get_bearer_properties ( MMBearerProperties *mm_common_connect_properties_get_bearer_properties (
MMCommonConnectProperties *properties); MMCommonConnectProperties *properties);
GVariant *mm_common_connect_properties_get_dictionary (MMCommonConnectProperties *self); GVariant *mm_common_connect_properties_get_dictionary (MMCommonConnectProperties *self);

View File

@@ -40,8 +40,6 @@ libmm_glib_la_SOURCES = \
mm-sms.c \ mm-sms.c \
mm-modem-messaging.h \ mm-modem-messaging.h \
mm-modem-messaging.c \ mm-modem-messaging.c \
mm-bearer-properties.h \
mm-bearer-properties.c \
mm-bearer.h \ mm-bearer.h \
mm-bearer.c mm-bearer.c
@@ -61,5 +59,4 @@ include_HEADERS = \
mm-modem-simple.h \ mm-modem-simple.h \
mm-sim.h \ mm-sim.h \
mm-sms.h \ mm-sms.h \
mm-bearer-properties.h \
mm-bearer.h mm-bearer.h

View File

@@ -1,190 +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-bearer-properties.h"
void
mm_bearer_properties_set_apn (MMBearerProperties *self,
const gchar *apn)
{
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
mm_common_bearer_properties_set_apn (self, apn);
}
void
mm_bearer_properties_set_user (MMBearerProperties *self,
const gchar *user)
{
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
mm_common_bearer_properties_set_user (self, user);
}
void
mm_bearer_properties_set_password (MMBearerProperties *self,
const gchar *password)
{
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
mm_common_bearer_properties_set_password (self, password);
}
void
mm_bearer_properties_set_ip_type (MMBearerProperties *self,
const gchar *ip_type)
{
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
mm_common_bearer_properties_set_ip_type (self, ip_type);
}
void
mm_bearer_properties_set_allow_roaming (MMBearerProperties *self,
gboolean allow_roaming)
{
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
mm_common_bearer_properties_set_allow_roaming (self, allow_roaming);
}
void
mm_bearer_properties_set_number (MMBearerProperties *self,
const gchar *number)
{
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
mm_common_bearer_properties_set_number (self, number);
}
void
mm_bearer_properties_set_rm_protocol (MMBearerProperties *self,
MMModemCdmaRmProtocol protocol)
{
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
mm_common_bearer_properties_set_rm_protocol (self, protocol);
}
const gchar *
mm_bearer_properties_get_apn (MMBearerProperties *self)
{
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), NULL);
return mm_common_bearer_properties_get_apn (self);
}
gchar *
mm_bearer_properties_dup_apn (MMBearerProperties *self)
{
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), NULL);
return g_strdup (mm_common_bearer_properties_get_apn (self));
}
const gchar *
mm_bearer_properties_get_user (MMBearerProperties *self)
{
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), NULL);
return mm_common_bearer_properties_get_user (self);
}
gchar *
mm_bearer_properties_dup_user (MMBearerProperties *self)
{
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), NULL);
return g_strdup (mm_common_bearer_properties_get_user (self));
}
const gchar *
mm_bearer_properties_get_password (MMBearerProperties *self)
{
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), NULL);
return mm_common_bearer_properties_get_password (self);
}
gchar *
mm_bearer_properties_dup_password (MMBearerProperties *self)
{
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), NULL);
return g_strdup (mm_common_bearer_properties_get_password (self));
}
const gchar *
mm_bearer_properties_get_ip_type (MMBearerProperties *self)
{
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), NULL);
return mm_common_bearer_properties_get_ip_type (self);
}
gchar *
mm_bearer_properties_dup_ip_type (MMBearerProperties *self)
{
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), NULL);
return g_strdup (mm_common_bearer_properties_get_ip_type (self));
}
gboolean
mm_bearer_properties_get_allow_roaming (MMBearerProperties *self)
{
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), FALSE);
return mm_common_bearer_properties_get_allow_roaming (self);
}
const gchar *
mm_bearer_properties_get_number (MMBearerProperties *self)
{
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), NULL);
return mm_common_bearer_properties_get_number (self);
}
gchar *
mm_bearer_properties_dup_number (MMBearerProperties *self)
{
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), NULL);
return g_strdup (mm_common_bearer_properties_get_number (self));
}
MMModemCdmaRmProtocol
mm_bearer_properties_get_rm_protocol (MMBearerProperties *self)
{
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), MM_MODEM_CDMA_RM_PROTOCOL_UNKNOWN);
return mm_common_bearer_properties_get_rm_protocol (self);
}
/*****************************************************************************/
MMBearerProperties *
mm_bearer_properties_new_from_string (const gchar *str,
GError **error)
{
return mm_common_bearer_properties_new_from_string (str, error);
}
MMBearerProperties *
mm_bearer_properties_new (void)
{
return mm_common_bearer_properties_new ();
}

View File

@@ -1,85 +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_BEARER_PROPERTIES_H
#define MM_BEARER_PROPERTIES_H
#include <ModemManager.h>
#include <glib-object.h>
#include <libmm-common.h>
G_BEGIN_DECLS
typedef MMCommonBearerProperties MMBearerProperties;
#define MM_TYPE_BEARER_PROPERTIES(o) MM_TYPE_COMMON_BEARER_PROPERTIES (o)
#define MM_BEARER_PROPERTIES(o) MM_COMMON_BEARER_PROPERTIES(o)
#define MM_IS_BEARER_PROPERTIES(o) MM_IS_COMMON_BEARER_PROPERTIES(o)
MMBearerProperties *mm_bearer_properties_new (void);
MMBearerProperties *mm_bearer_properties_new_from_string (
const gchar *str,
GError **error);
void mm_bearer_properties_set_apn (
MMBearerProperties *properties,
const gchar *apn);
void mm_bearer_properties_set_user (
MMBearerProperties *properties,
const gchar *user);
void mm_bearer_properties_set_password (
MMBearerProperties *properties,
const gchar *password);
void mm_bearer_properties_set_ip_type (
MMBearerProperties *properties,
const gchar *ip_type);
void mm_bearer_properties_set_allow_roaming (
MMBearerProperties *properties,
gboolean allow_roaming);
void mm_bearer_properties_set_number (
MMBearerProperties *properties,
const gchar *number);
void mm_bearer_properties_set_rm_protocol (
MMBearerProperties *properties,
MMModemCdmaRmProtocol protocol);
const gchar *mm_bearer_properties_get_apn (
MMBearerProperties *properties);
gchar *mm_bearer_properties_dup_apn (
MMBearerProperties *properties);
const gchar *mm_bearer_properties_get_user (
MMBearerProperties *properties);
gchar *mm_bearer_properties_dup_user (
MMBearerProperties *properties);
const gchar *mm_bearer_properties_get_password (
MMBearerProperties *properties);
gchar *mm_bearer_properties_dup_password (
MMBearerProperties *properties);
const gchar *mm_bearer_properties_get_ip_type (
MMBearerProperties *properties);
gchar *mm_bearer_properties_dup_ip_type (
MMBearerProperties *properties);
gboolean mm_bearer_properties_get_allow_roaming (
MMBearerProperties *properties);
const gchar *mm_bearer_properties_get_number (
MMBearerProperties *properties);
gchar *mm_bearer_properties_dup_number (
MMBearerProperties *properties);
MMModemCdmaRmProtocol mm_bearer_properties_get_rm_protocol (
MMBearerProperties *properties);
G_END_DECLS
#endif /* MM_BEARER_PROPERTIES_H */

View File

@@ -193,7 +193,7 @@ mm_bearer_get_properties (MMBearer *self)
g_return_val_if_fail (MM_IS_BEARER (self), NULL); g_return_val_if_fail (MM_IS_BEARER (self), NULL);
properties = (mm_common_bearer_properties_new_from_dictionary ( properties = (mm_bearer_properties_new_from_dictionary (
mm_gdbus_bearer_get_properties (MM_GDBUS_BEARER (self)), mm_gdbus_bearer_get_properties (MM_GDBUS_BEARER (self)),
&error)); &error));
if (!properties) { if (!properties) {

View File

@@ -26,8 +26,6 @@
#include <ModemManager.h> #include <ModemManager.h>
#include <libmm-common.h> #include <libmm-common.h>
#include "mm-bearer-properties.h"
G_BEGIN_DECLS G_BEGIN_DECLS
typedef MmGdbusBearer MMBearer; typedef MmGdbusBearer MMBearer;

View File

@@ -1225,8 +1225,7 @@ mm_modem_create_bearer (MMModem *self,
if (cancellable) if (cancellable)
ctx->cancellable = g_object_ref (cancellable); ctx->cancellable = g_object_ref (cancellable);
dictionary = (mm_common_bearer_properties_get_dictionary ( dictionary = mm_bearer_properties_get_dictionary (properties);
MM_COMMON_BEARER_PROPERTIES (properties)));
mm_gdbus_modem_call_create_bearer ( mm_gdbus_modem_call_create_bearer (
self, self,
dictionary, dictionary,
@@ -1268,8 +1267,7 @@ mm_modem_create_bearer_sync (MMModem *self,
g_return_val_if_fail (MM_GDBUS_IS_MODEM (self), NULL); g_return_val_if_fail (MM_GDBUS_IS_MODEM (self), NULL);
dictionary = (mm_common_bearer_properties_get_dictionary ( dictionary = mm_bearer_properties_get_dictionary (properties);
MM_COMMON_BEARER_PROPERTIES (properties)));
mm_gdbus_modem_call_create_bearer_sync (self, mm_gdbus_modem_call_create_bearer_sync (self,
dictionary, dictionary,
&bearer_path, &bearer_path,

View File

@@ -28,7 +28,6 @@
#include "mm-sim.h" #include "mm-sim.h"
#include "mm-bearer.h" #include "mm-bearer.h"
#include "mm-bearer-properties.h"
G_BEGIN_DECLS G_BEGIN_DECLS

View File

@@ -378,13 +378,13 @@ disconnect (MMBearer *self,
static gboolean static gboolean
cmp_properties (MMBearer *self, cmp_properties (MMBearer *self,
MMCommonBearerProperties *properties) MMBearerProperties *properties)
{ {
return (mm_common_bearer_properties_get_apn (properties) == NULL && return (mm_bearer_properties_get_apn (properties) == NULL &&
mm_common_bearer_properties_get_ip_type (properties) == NULL && mm_bearer_properties_get_ip_type (properties) == NULL &&
mm_common_bearer_properties_get_number (properties) == NULL && mm_bearer_properties_get_number (properties) == NULL &&
mm_common_bearer_properties_get_rm_protocol (properties) == MM_MODEM_CDMA_RM_PROTOCOL_UNKNOWN && mm_bearer_properties_get_rm_protocol (properties) == MM_MODEM_CDMA_RM_PROTOCOL_UNKNOWN &&
mm_common_bearer_properties_get_allow_roaming (properties)); mm_bearer_properties_get_allow_roaming (properties));
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@@ -354,7 +354,7 @@ create_bearer_finish (MMIfaceModem *self,
static void static void
create_bearer (MMIfaceModem *self, create_bearer (MMIfaceModem *self,
MMCommonBearerProperties *properties, MMBearerProperties *properties,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {

View File

@@ -406,7 +406,7 @@ mm_broadband_bearer_novatel_new_finish (GAsyncResult *res,
} }
void mm_broadband_bearer_novatel_new (MMBroadbandModemNovatel *modem, void mm_broadband_bearer_novatel_new (MMBroadbandModemNovatel *modem,
MMCommonBearerProperties *properties, MMBearerProperties *properties,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)

View File

@@ -49,12 +49,12 @@ GType mm_broadband_bearer_novatel_get_type (void);
/* Default 3GPP bearer creation implementation */ /* Default 3GPP bearer creation implementation */
void mm_broadband_bearer_novatel_new (MMBroadbandModemNovatel *modem, void mm_broadband_bearer_novatel_new (MMBroadbandModemNovatel *modem,
MMCommonBearerProperties *properties, MMBearerProperties *properties,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
MMBearer *mm_broadband_bearer_novatel_new_finish (GAsyncResult *res, MMBearer *mm_broadband_bearer_novatel_new_finish (GAsyncResult *res,
GError **error); GError **error);
#endif /* MM_BROADBAND_BEARER_NOVATEL_H */ #endif /* MM_BROADBAND_BEARER_NOVATEL_H */

View File

@@ -72,7 +72,7 @@ broadband_bearer_new_ready (GObject *source,
static void static void
modem_create_bearer (MMIfaceModem *self, modem_create_bearer (MMIfaceModem *self,
MMCommonBearerProperties *properties, MMBearerProperties *properties,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {

View File

@@ -165,7 +165,7 @@ mm_bearer_list_foreach (MMBearerList *self,
MMBearer * MMBearer *
mm_bearer_list_find (MMBearerList *self, mm_bearer_list_find (MMBearerList *self,
MMCommonBearerProperties *properties) MMBearerProperties *properties)
{ {
GList *l; GList *l;

View File

@@ -73,7 +73,7 @@ void mm_bearer_list_foreach (MMBearerList *self,
gpointer user_data); gpointer user_data);
MMBearer *mm_bearer_list_find (MMBearerList *self, MMBearer *mm_bearer_list_find (MMBearerList *self,
MMCommonBearerProperties *properties); MMBearerProperties *properties);
void mm_bearer_list_disconnect_all_bearers (MMBearerList *self, void mm_bearer_list_disconnect_all_bearers (MMBearerList *self,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,

View File

@@ -630,7 +630,7 @@ mm_bearer_disconnect_force (MMBearer *self)
gboolean gboolean
mm_bearer_cmp_properties (MMBearer *self, mm_bearer_cmp_properties (MMBearer *self,
MMCommonBearerProperties *properties) MMBearerProperties *properties)
{ {
return MM_BEARER_GET_CLASS (self)->cmp_properties (self, properties); return MM_BEARER_GET_CLASS (self)->cmp_properties (self, properties);
} }
@@ -639,12 +639,12 @@ mm_bearer_cmp_properties (MMBearer *self,
void void
mm_bearer_expose_properties (MMBearer *bearer, mm_bearer_expose_properties (MMBearer *bearer,
MMCommonBearerProperties *properties) MMBearerProperties *properties)
{ {
GVariant *dictionary; GVariant *dictionary;
/* Keep the whole list of properties in the interface */ /* Keep the whole list of properties in the interface */
dictionary = mm_common_bearer_properties_get_dictionary (properties); dictionary = mm_bearer_properties_get_dictionary (properties);
mm_gdbus_bearer_set_properties (MM_GDBUS_BEARER (bearer), mm_gdbus_bearer_set_properties (MM_GDBUS_BEARER (bearer),
dictionary); dictionary);
g_variant_unref (dictionary); g_variant_unref (dictionary);

View File

@@ -78,7 +78,7 @@ struct _MMBearerClass {
/* Check if the bearer has the exact same properties */ /* Check if the bearer has the exact same properties */
gboolean (* cmp_properties) (MMBearer *self, gboolean (* cmp_properties) (MMBearer *self,
MMCommonBearerProperties *properties); MMBearerProperties *properties);
}; };
GType mm_bearer_get_type (void); GType mm_bearer_get_type (void);
@@ -87,7 +87,7 @@ void mm_bearer_export (MMBearer *self);
const gchar *mm_bearer_get_path (MMBearer *bearer); const gchar *mm_bearer_get_path (MMBearer *bearer);
void mm_bearer_expose_properties (MMBearer *bearer, void mm_bearer_expose_properties (MMBearer *bearer,
MMCommonBearerProperties *properties); MMBearerProperties *properties);
MMBearerStatus mm_bearer_get_status (MMBearer *bearer); MMBearerStatus mm_bearer_get_status (MMBearer *bearer);
@@ -108,6 +108,6 @@ gboolean mm_bearer_disconnect_finish (MMBearer *self,
void mm_bearer_disconnect_force (MMBearer *self); void mm_bearer_disconnect_force (MMBearer *self);
gboolean mm_bearer_cmp_properties (MMBearer *self, gboolean mm_bearer_cmp_properties (MMBearer *self,
MMCommonBearerProperties *properties); MMBearerProperties *properties);
#endif /* MM_BEARER_H */ #endif /* MM_BEARER_H */

View File

@@ -1614,20 +1614,20 @@ disconnect (MMBearer *self,
static gboolean static gboolean
cmp_properties (MMBearer *self, cmp_properties (MMBearer *self,
MMCommonBearerProperties *properties) MMBearerProperties *properties)
{ {
MMBroadbandBearer *broadband = MM_BROADBAND_BEARER (self); MMBroadbandBearer *broadband = MM_BROADBAND_BEARER (self);
return ((!g_strcmp0 (broadband->priv->apn, return ((!g_strcmp0 (broadband->priv->apn,
mm_common_bearer_properties_get_apn (properties))) && mm_bearer_properties_get_apn (properties))) &&
(!g_strcmp0 (broadband->priv->ip_type, (!g_strcmp0 (broadband->priv->ip_type,
mm_common_bearer_properties_get_ip_type (properties))) && mm_bearer_properties_get_ip_type (properties))) &&
(broadband->priv->allow_roaming == (broadband->priv->allow_roaming ==
mm_common_bearer_properties_get_allow_roaming (properties)) && mm_bearer_properties_get_allow_roaming (properties)) &&
(!g_strcmp0 (broadband->priv->number, (!g_strcmp0 (broadband->priv->number,
mm_common_bearer_properties_get_number (properties))) && mm_bearer_properties_get_number (properties))) &&
(broadband->priv->rm_protocol == (broadband->priv->rm_protocol ==
mm_common_bearer_properties_get_rm_protocol (properties))); mm_bearer_properties_get_rm_protocol (properties)));
} }
/*****************************************************************************/ /*****************************************************************************/
@@ -1843,15 +1843,15 @@ interface_initialization_step (InitAsyncContext *ctx)
ctx->step++; ctx->step++;
case INITIALIZATION_STEP_EXPOSE_PROPERTIES: { case INITIALIZATION_STEP_EXPOSE_PROPERTIES: {
MMCommonBearerProperties *properties; MMBearerProperties *properties;
/* We create a new properties object just with the stuff we really used */ /* We create a new properties object just with the stuff we really used */
properties = mm_common_bearer_properties_new (); properties = mm_bearer_properties_new ();
mm_common_bearer_properties_set_apn (properties, ctx->self->priv->apn); mm_bearer_properties_set_apn (properties, ctx->self->priv->apn);
mm_common_bearer_properties_set_number (properties, ctx->self->priv->number); mm_bearer_properties_set_number (properties, ctx->self->priv->number);
mm_common_bearer_properties_set_rm_protocol (properties, ctx->self->priv->rm_protocol); mm_bearer_properties_set_rm_protocol (properties, ctx->self->priv->rm_protocol);
mm_common_bearer_properties_set_ip_type (properties, ctx->self->priv->ip_type); mm_bearer_properties_set_ip_type (properties, ctx->self->priv->ip_type);
mm_common_bearer_properties_set_allow_roaming (properties, ctx->self->priv->allow_roaming); mm_bearer_properties_set_allow_roaming (properties, ctx->self->priv->allow_roaming);
mm_bearer_expose_properties (MM_BEARER (ctx->self), properties); mm_bearer_expose_properties (MM_BEARER (ctx->self), properties);
g_object_unref (properties); g_object_unref (properties);
@@ -1931,7 +1931,7 @@ initable_init_async (GAsyncInitable *initable,
void void
mm_broadband_bearer_new (MMBroadbandModem *modem, mm_broadband_bearer_new (MMBroadbandModem *modem,
MMCommonBearerProperties *properties, MMBearerProperties *properties,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
@@ -1943,11 +1943,11 @@ mm_broadband_bearer_new (MMBroadbandModem *modem,
callback, callback,
user_data, user_data,
MM_BEARER_MODEM, modem, MM_BEARER_MODEM, modem,
MM_BROADBAND_BEARER_3GPP_APN, mm_common_bearer_properties_get_apn (properties), MM_BROADBAND_BEARER_3GPP_APN, mm_bearer_properties_get_apn (properties),
MM_BROADBAND_BEARER_CDMA_NUMBER, mm_common_bearer_properties_get_number (properties), MM_BROADBAND_BEARER_CDMA_NUMBER, mm_bearer_properties_get_number (properties),
MM_BROADBAND_BEARER_CDMA_RM_PROTOCOL, mm_common_bearer_properties_get_rm_protocol (properties), MM_BROADBAND_BEARER_CDMA_RM_PROTOCOL, mm_bearer_properties_get_rm_protocol (properties),
MM_BROADBAND_BEARER_IP_TYPE, mm_common_bearer_properties_get_ip_type (properties), MM_BROADBAND_BEARER_IP_TYPE, mm_bearer_properties_get_ip_type (properties),
MM_BROADBAND_BEARER_ALLOW_ROAMING, mm_common_bearer_properties_get_allow_roaming (properties), MM_BROADBAND_BEARER_ALLOW_ROAMING, mm_bearer_properties_get_allow_roaming (properties),
NULL); NULL);
} }

View File

@@ -122,7 +122,7 @@ GType mm_broadband_bearer_get_type (void);
/* Default 3GPP bearer creation implementation */ /* Default 3GPP bearer creation implementation */
void mm_broadband_bearer_new (MMBroadbandModem *modem, void mm_broadband_bearer_new (MMBroadbandModem *modem,
MMCommonBearerProperties *properties, MMBearerProperties *properties,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);

View File

@@ -231,7 +231,7 @@ broadband_bearer_new_ready (GObject *source,
static void static void
modem_create_bearer (MMIfaceModem *self, modem_create_bearer (MMIfaceModem *self,
MMCommonBearerProperties *properties, MMBearerProperties *properties,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {

View File

@@ -498,7 +498,7 @@ connection_step (ConnectionContext *ctx)
case CONNECTION_STEP_BEARER: { case CONNECTION_STEP_BEARER: {
MMBearerList *list = NULL; MMBearerList *list = NULL;
MMCommonBearerProperties *bearer_properties; MMBearerProperties *bearer_properties;
mm_info ("Simple connect state (%d/%d): Bearer", mm_info ("Simple connect state (%d/%d): Bearer",
ctx->step, CONNECTION_STEP_LAST); ctx->step, CONNECTION_STEP_LAST);

View File

@@ -196,7 +196,7 @@ create_bearer_ready (MMIfaceModem *self,
void void
mm_iface_modem_create_bearer (MMIfaceModem *self, mm_iface_modem_create_bearer (MMIfaceModem *self,
MMCommonBearerProperties *properties, MMBearerProperties *properties,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
@@ -270,7 +270,7 @@ handle_create_bearer_auth_ready (MMBaseModem *self,
GAsyncResult *res, GAsyncResult *res,
HandleCreateBearerContext *ctx) HandleCreateBearerContext *ctx)
{ {
MMCommonBearerProperties *properties; MMBearerProperties *properties;
GError *error = NULL; GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) { if (!mm_base_modem_authorize_finish (self, res, &error)) {
@@ -279,7 +279,7 @@ handle_create_bearer_auth_ready (MMBaseModem *self,
return; return;
} }
properties = mm_common_bearer_properties_new_from_dictionary (ctx->dictionary, &error); properties = mm_bearer_properties_new_from_dictionary (ctx->dictionary, &error);
if (!properties) { if (!properties) {
g_dbus_method_invocation_take_error (ctx->invocation, error); g_dbus_method_invocation_take_error (ctx->invocation, error);
handle_create_bearer_context_free (ctx); handle_create_bearer_context_free (ctx);

View File

@@ -280,7 +280,7 @@ struct _MMIfaceModem {
/* Create bearer */ /* Create bearer */
void (*create_bearer) (MMIfaceModem *self, void (*create_bearer) (MMIfaceModem *self,
MMCommonBearerProperties *properties, MMBearerProperties *properties,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
MMBearer * (*create_bearer_finish) (MMIfaceModem *self, MMBearer * (*create_bearer_finish) (MMIfaceModem *self,
@@ -395,7 +395,7 @@ gboolean mm_iface_modem_set_bands_finish (MMIfaceModem *self,
/* Allow creating bearers */ /* Allow creating bearers */
void mm_iface_modem_create_bearer (MMIfaceModem *self, void mm_iface_modem_create_bearer (MMIfaceModem *self,
MMCommonBearerProperties *properties, MMBearerProperties *properties,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
MMBearer *mm_iface_modem_create_bearer_finish (MMIfaceModem *self, MMBearer *mm_iface_modem_create_bearer_finish (MMIfaceModem *self,