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:
@@ -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-simple-properties.c: mm-errors-types.h mm-enums-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-bearer-ip-config.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-simple-properties.h \
|
||||
mm-common-connect-properties.h \
|
||||
mm-common-bearer-properties.h \
|
||||
mm-bearer-properties.h \
|
||||
mm-sms-properties.h \
|
||||
mm-bearer-ip-config.h \
|
||||
mm-common-location-3gpp.h \
|
||||
@@ -188,8 +188,8 @@ libmm_common_la_SOURCES = \
|
||||
mm-common-simple-properties.c \
|
||||
mm-common-connect-properties.h \
|
||||
mm-common-connect-properties.c \
|
||||
mm-common-bearer-properties.h \
|
||||
mm-common-bearer-properties.c \
|
||||
mm-bearer-properties.h \
|
||||
mm-bearer-properties.c \
|
||||
mm-sms-properties.h \
|
||||
mm-sms-properties.c \
|
||||
mm-bearer-ip-config.h \
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "mm-common-simple-properties.h"
|
||||
#include "mm-common-connect-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-common-location-3gpp.h"
|
||||
#include "mm-unlock-retries.h"
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
|
||||
#include "mm-errors-types.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_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_RM_PROTOCOL "rm-protocol"
|
||||
|
||||
struct _MMCommonBearerPropertiesPrivate {
|
||||
struct _MMBearerPropertiesPrivate {
|
||||
/* APN */
|
||||
gchar *apn;
|
||||
/* IP type */
|
||||
@@ -50,108 +50,136 @@ struct _MMCommonBearerPropertiesPrivate {
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
mm_common_bearer_properties_set_apn (MMCommonBearerProperties *self,
|
||||
const gchar *apn)
|
||||
mm_bearer_properties_set_apn (MMBearerProperties *self,
|
||||
const gchar *apn)
|
||||
{
|
||||
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
|
||||
|
||||
g_free (self->priv->apn);
|
||||
self->priv->apn = g_strdup (apn);
|
||||
}
|
||||
|
||||
void
|
||||
mm_common_bearer_properties_set_user (MMCommonBearerProperties *self,
|
||||
const gchar *user)
|
||||
mm_bearer_properties_set_user (MMBearerProperties *self,
|
||||
const gchar *user)
|
||||
{
|
||||
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
|
||||
|
||||
g_free (self->priv->user);
|
||||
self->priv->user = g_strdup (user);
|
||||
}
|
||||
|
||||
void
|
||||
mm_common_bearer_properties_set_password (MMCommonBearerProperties *self,
|
||||
const gchar *password)
|
||||
mm_bearer_properties_set_password (MMBearerProperties *self,
|
||||
const gchar *password)
|
||||
{
|
||||
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
|
||||
|
||||
g_free (self->priv->password);
|
||||
self->priv->password = g_strdup (password);
|
||||
}
|
||||
|
||||
void
|
||||
mm_common_bearer_properties_set_ip_type (MMCommonBearerProperties *self,
|
||||
const gchar *ip_type)
|
||||
mm_bearer_properties_set_ip_type (MMBearerProperties *self,
|
||||
const gchar *ip_type)
|
||||
{
|
||||
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
|
||||
|
||||
g_free (self->priv->ip_type);
|
||||
self->priv->ip_type = g_strdup (ip_type);
|
||||
}
|
||||
|
||||
void
|
||||
mm_common_bearer_properties_set_allow_roaming (MMCommonBearerProperties *self,
|
||||
gboolean allow_roaming)
|
||||
mm_bearer_properties_set_allow_roaming (MMBearerProperties *self,
|
||||
gboolean allow_roaming)
|
||||
{
|
||||
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
|
||||
|
||||
self->priv->allow_roaming = allow_roaming;
|
||||
self->priv->allow_roaming_set = TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
mm_common_bearer_properties_set_number (MMCommonBearerProperties *self,
|
||||
const gchar *number)
|
||||
mm_bearer_properties_set_number (MMBearerProperties *self,
|
||||
const gchar *number)
|
||||
{
|
||||
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
|
||||
|
||||
g_free (self->priv->number);
|
||||
self->priv->number = g_strdup (number);
|
||||
}
|
||||
|
||||
void
|
||||
mm_common_bearer_properties_set_rm_protocol (MMCommonBearerProperties *self,
|
||||
MMModemCdmaRmProtocol protocol)
|
||||
mm_bearer_properties_set_rm_protocol (MMBearerProperties *self,
|
||||
MMModemCdmaRmProtocol protocol)
|
||||
{
|
||||
g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
|
||||
|
||||
self->priv->rm_protocol = protocol;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
GVariant *
|
||||
mm_common_bearer_properties_get_dictionary (MMCommonBearerProperties *self)
|
||||
mm_bearer_properties_get_dictionary (MMBearerProperties *self)
|
||||
{
|
||||
GVariantBuilder builder;
|
||||
|
||||
@@ -159,6 +187,8 @@ mm_common_bearer_properties_get_dictionary (MMCommonBearerProperties *self)
|
||||
if (!self)
|
||||
return NULL;
|
||||
|
||||
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), NULL);
|
||||
|
||||
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
|
||||
|
||||
if (self->priv->apn)
|
||||
@@ -209,19 +239,21 @@ mm_common_bearer_properties_get_dictionary (MMCommonBearerProperties *self)
|
||||
/*****************************************************************************/
|
||||
|
||||
gboolean
|
||||
mm_common_bearer_properties_consume_string (MMCommonBearerProperties *self,
|
||||
const gchar *key,
|
||||
const gchar *value,
|
||||
GError **error)
|
||||
mm_bearer_properties_consume_string (MMBearerProperties *self,
|
||||
const gchar *key,
|
||||
const gchar *value,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), FALSE);
|
||||
|
||||
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))
|
||||
mm_common_bearer_properties_set_user (self, value);
|
||||
mm_bearer_properties_set_user (self, value);
|
||||
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))
|
||||
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)) {
|
||||
GError *inner_error = NULL;
|
||||
gboolean allow_roaming;
|
||||
@@ -231,9 +263,9 @@ mm_common_bearer_properties_consume_string (MMCommonBearerProperties *self,
|
||||
g_propagate_error (error, inner_error);
|
||||
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))
|
||||
mm_common_bearer_properties_set_number (self, value);
|
||||
mm_bearer_properties_set_number (self, value);
|
||||
else if (g_str_equal (key, PROPERTY_RM_PROTOCOL)) {
|
||||
GError *inner_error = NULL;
|
||||
MMModemCdmaRmProtocol protocol;
|
||||
@@ -243,7 +275,7 @@ mm_common_bearer_properties_consume_string (MMCommonBearerProperties *self,
|
||||
g_propagate_error (error, inner_error);
|
||||
return FALSE;
|
||||
}
|
||||
mm_common_bearer_properties_set_rm_protocol (self, protocol);
|
||||
mm_bearer_properties_set_rm_protocol (self, protocol);
|
||||
} else {
|
||||
g_set_error (error,
|
||||
MM_CORE_ERROR,
|
||||
@@ -257,7 +289,7 @@ mm_common_bearer_properties_consume_string (MMCommonBearerProperties *self,
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
MMCommonBearerProperties *properties;
|
||||
MMBearerProperties *properties;
|
||||
GError *error;
|
||||
} ParseKeyValueContext;
|
||||
|
||||
@@ -266,20 +298,20 @@ key_value_foreach (const gchar *key,
|
||||
const gchar *value,
|
||||
ParseKeyValueContext *ctx)
|
||||
{
|
||||
return mm_common_bearer_properties_consume_string (ctx->properties,
|
||||
key,
|
||||
value,
|
||||
&ctx->error);
|
||||
return mm_bearer_properties_consume_string (ctx->properties,
|
||||
key,
|
||||
value,
|
||||
&ctx->error);
|
||||
}
|
||||
|
||||
MMCommonBearerProperties *
|
||||
mm_common_bearer_properties_new_from_string (const gchar *str,
|
||||
GError **error)
|
||||
MMBearerProperties *
|
||||
mm_bearer_properties_new_from_string (const gchar *str,
|
||||
GError **error)
|
||||
{
|
||||
ParseKeyValueContext ctx;
|
||||
|
||||
ctx.error = NULL;
|
||||
ctx.properties = mm_common_bearer_properties_new ();
|
||||
ctx.properties = mm_bearer_properties_new ();
|
||||
|
||||
mm_common_parse_key_value_string (str,
|
||||
&ctx.error,
|
||||
@@ -298,33 +330,35 @@ mm_common_bearer_properties_new_from_string (const gchar *str,
|
||||
/*****************************************************************************/
|
||||
|
||||
gboolean
|
||||
mm_common_bearer_properties_consume_variant (MMCommonBearerProperties *properties,
|
||||
const gchar *key,
|
||||
GVariant *value,
|
||||
GError **error)
|
||||
mm_bearer_properties_consume_variant (MMBearerProperties *properties,
|
||||
const gchar *key,
|
||||
GVariant *value,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (properties), FALSE);
|
||||
|
||||
if (g_str_equal (key, PROPERTY_APN))
|
||||
mm_common_bearer_properties_set_apn (
|
||||
mm_bearer_properties_set_apn (
|
||||
properties,
|
||||
g_variant_get_string (value, NULL));
|
||||
else if (g_str_equal (key, PROPERTY_USER))
|
||||
mm_common_bearer_properties_set_user (
|
||||
mm_bearer_properties_set_user (
|
||||
properties,
|
||||
g_variant_get_string (value, NULL));
|
||||
else if (g_str_equal (key, PROPERTY_PASSWORD))
|
||||
mm_common_bearer_properties_set_password (
|
||||
mm_bearer_properties_set_password (
|
||||
properties,
|
||||
g_variant_get_string (value, NULL));
|
||||
else if (g_str_equal (key, PROPERTY_IP_TYPE))
|
||||
mm_common_bearer_properties_set_ip_type (
|
||||
mm_bearer_properties_set_ip_type (
|
||||
properties,
|
||||
g_variant_get_string (value, NULL));
|
||||
else if (g_str_equal (key, PROPERTY_NUMBER))
|
||||
mm_common_bearer_properties_set_number (
|
||||
mm_bearer_properties_set_number (
|
||||
properties,
|
||||
g_variant_get_string (value, NULL));
|
||||
else if (g_str_equal (key, PROPERTY_ALLOW_ROAMING))
|
||||
mm_common_bearer_properties_set_allow_roaming (
|
||||
mm_bearer_properties_set_allow_roaming (
|
||||
properties,
|
||||
g_variant_get_boolean (value));
|
||||
else {
|
||||
@@ -340,24 +374,34 @@ mm_common_bearer_properties_consume_variant (MMCommonBearerProperties *propertie
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
MMCommonBearerProperties *
|
||||
mm_common_bearer_properties_new_from_dictionary (GVariant *dictionary,
|
||||
GError **error)
|
||||
MMBearerProperties *
|
||||
mm_bearer_properties_new_from_dictionary (GVariant *dictionary,
|
||||
GError **error)
|
||||
{
|
||||
GError *inner_error = NULL;
|
||||
GVariantIter iter;
|
||||
gchar *key;
|
||||
GVariant *value;
|
||||
MMCommonBearerProperties *properties;
|
||||
MMBearerProperties *properties;
|
||||
|
||||
properties = mm_common_bearer_properties_new ();
|
||||
properties = mm_bearer_properties_new ();
|
||||
if (!dictionary)
|
||||
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);
|
||||
while (!inner_error &&
|
||||
g_variant_iter_next (&iter, "{sv}", &key, &value)) {
|
||||
mm_common_bearer_properties_consume_variant (properties,
|
||||
mm_bearer_properties_consume_variant (properties,
|
||||
key,
|
||||
value,
|
||||
&inner_error);
|
||||
@@ -377,15 +421,17 @@ mm_common_bearer_properties_new_from_dictionary (GVariant *dictionary,
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
MMCommonBearerProperties *
|
||||
mm_common_bearer_properties_dup (MMCommonBearerProperties *orig)
|
||||
MMBearerProperties *
|
||||
mm_bearer_properties_dup (MMBearerProperties *orig)
|
||||
{
|
||||
GVariant *dict;
|
||||
MMCommonBearerProperties *copy;
|
||||
MMBearerProperties *copy;
|
||||
GError *error = NULL;
|
||||
|
||||
dict = mm_common_bearer_properties_get_dictionary (orig);
|
||||
copy = mm_common_bearer_properties_new_from_dictionary (dict, &error);
|
||||
g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (orig), NULL);
|
||||
|
||||
dict = mm_bearer_properties_get_dictionary (orig);
|
||||
copy = mm_bearer_properties_new_from_dictionary (dict, &error);
|
||||
g_assert_no_error (error);
|
||||
g_variant_unref (dict);
|
||||
|
||||
@@ -394,19 +440,19 @@ mm_common_bearer_properties_dup (MMCommonBearerProperties *orig)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
MMCommonBearerProperties *
|
||||
mm_common_bearer_properties_new (void)
|
||||
MMBearerProperties *
|
||||
mm_bearer_properties_new (void)
|
||||
{
|
||||
return (MM_COMMON_BEARER_PROPERTIES (
|
||||
g_object_new (MM_TYPE_COMMON_BEARER_PROPERTIES, NULL)));
|
||||
return (MM_BEARER_PROPERTIES (
|
||||
g_object_new (MM_TYPE_BEARER_PROPERTIES, NULL)));
|
||||
}
|
||||
|
||||
static void
|
||||
mm_common_bearer_properties_init (MMCommonBearerProperties *self)
|
||||
mm_bearer_properties_init (MMBearerProperties *self)
|
||||
{
|
||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self),
|
||||
MM_TYPE_COMMON_BEARER_PROPERTIES,
|
||||
MMCommonBearerPropertiesPrivate);
|
||||
MM_TYPE_BEARER_PROPERTIES,
|
||||
MMBearerPropertiesPrivate);
|
||||
|
||||
/* Some defaults */
|
||||
self->priv->allow_roaming = TRUE;
|
||||
@@ -416,7 +462,7 @@ mm_common_bearer_properties_init (MMCommonBearerProperties *self)
|
||||
static void
|
||||
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->user);
|
||||
@@ -424,15 +470,15 @@ finalize (GObject *object)
|
||||
g_free (self->priv->ip_type);
|
||||
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
|
||||
mm_common_bearer_properties_class_init (MMCommonBearerPropertiesClass *klass)
|
||||
mm_bearer_properties_class_init (MMBearerPropertiesClass *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;
|
||||
}
|
||||
@@ -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 */
|
||||
@@ -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 */
|
||||
@@ -40,7 +40,7 @@ struct _MMCommonConnectPropertiesPrivate {
|
||||
MMModemMode allowed_modes;
|
||||
MMModemMode preferred_mode;
|
||||
/* Bearer properties */
|
||||
MMCommonBearerProperties *bearer_properties;
|
||||
MMBearerProperties *bearer_properties;
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -88,53 +88,53 @@ void
|
||||
mm_common_connect_properties_set_apn (MMCommonConnectProperties *self,
|
||||
const gchar *apn)
|
||||
{
|
||||
mm_common_bearer_properties_set_apn (self->priv->bearer_properties,
|
||||
apn);
|
||||
mm_bearer_properties_set_apn (self->priv->bearer_properties,
|
||||
apn);
|
||||
}
|
||||
|
||||
void
|
||||
mm_common_connect_properties_set_user (MMCommonConnectProperties *self,
|
||||
const gchar *user)
|
||||
{
|
||||
mm_common_bearer_properties_set_user (self->priv->bearer_properties,
|
||||
user);
|
||||
mm_bearer_properties_set_user (self->priv->bearer_properties,
|
||||
user);
|
||||
}
|
||||
|
||||
void
|
||||
mm_common_connect_properties_set_password (MMCommonConnectProperties *self,
|
||||
const gchar *password)
|
||||
{
|
||||
mm_common_bearer_properties_set_password (self->priv->bearer_properties,
|
||||
password);
|
||||
mm_bearer_properties_set_password (self->priv->bearer_properties,
|
||||
password);
|
||||
}
|
||||
|
||||
void
|
||||
mm_common_connect_properties_set_ip_type (MMCommonConnectProperties *self,
|
||||
const gchar *ip_type)
|
||||
{
|
||||
mm_common_bearer_properties_set_ip_type (self->priv->bearer_properties,
|
||||
ip_type);
|
||||
mm_bearer_properties_set_ip_type (self->priv->bearer_properties,
|
||||
ip_type);
|
||||
}
|
||||
|
||||
void
|
||||
mm_common_connect_properties_set_allow_roaming (MMCommonConnectProperties *self,
|
||||
gboolean allow_roaming)
|
||||
{
|
||||
mm_common_bearer_properties_set_allow_roaming (self->priv->bearer_properties,
|
||||
allow_roaming);
|
||||
mm_bearer_properties_set_allow_roaming (self->priv->bearer_properties,
|
||||
allow_roaming);
|
||||
}
|
||||
|
||||
void
|
||||
mm_common_connect_properties_set_number (MMCommonConnectProperties *self,
|
||||
const gchar *number)
|
||||
{
|
||||
mm_common_bearer_properties_set_number (self->priv->bearer_properties,
|
||||
number);
|
||||
mm_bearer_properties_set_number (self->priv->bearer_properties,
|
||||
number);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
MMCommonBearerProperties *
|
||||
MMBearerProperties *
|
||||
mm_common_connect_properties_get_bearer_properties (MMCommonConnectProperties *self)
|
||||
{
|
||||
return g_object_ref (self->priv->bearer_properties);
|
||||
@@ -173,37 +173,37 @@ mm_common_connect_properties_get_allowed_modes (MMCommonConnectProperties *self,
|
||||
const gchar *
|
||||
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 *
|
||||
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 *
|
||||
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 *
|
||||
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
|
||||
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 *
|
||||
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 */
|
||||
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);
|
||||
while (g_variant_iter_next (&iter, "{sv}", &key, &value)) {
|
||||
g_variant_builder_add (&builder,
|
||||
@@ -284,9 +284,9 @@ key_value_foreach (const gchar *key,
|
||||
ParseKeyValueContext *ctx)
|
||||
{
|
||||
/* First, check if we can consume this as bearer properties */
|
||||
if (mm_common_bearer_properties_consume_string (ctx->properties->priv->bearer_properties,
|
||||
key, value,
|
||||
NULL))
|
||||
if (mm_bearer_properties_consume_string (ctx->properties->priv->bearer_properties,
|
||||
key, value,
|
||||
NULL))
|
||||
return TRUE;
|
||||
|
||||
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)) {
|
||||
|
||||
/* First, check if we can consume this as bearer properties */
|
||||
if (!mm_common_bearer_properties_consume_variant (properties->priv->bearer_properties,
|
||||
key, value,
|
||||
NULL)) {
|
||||
if (!mm_bearer_properties_consume_variant (properties->priv->bearer_properties,
|
||||
key, value,
|
||||
NULL)) {
|
||||
if (g_str_equal (key, PROPERTY_PIN))
|
||||
mm_common_connect_properties_set_pin (
|
||||
properties,
|
||||
@@ -480,7 +480,7 @@ mm_common_connect_properties_init (MMCommonConnectProperties *self)
|
||||
MMCommonConnectPropertiesPrivate);
|
||||
|
||||
/* 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->preferred_mode = MM_MODEM_MODE_NONE;
|
||||
self->priv->bands = g_new (MMModemBand, 1);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <ModemManager.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "mm-common-bearer-properties.h"
|
||||
#include "mm-bearer-properties.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -111,7 +111,7 @@ gboolean mm_common_connect_properties_get_allow_roaming (
|
||||
const gchar *mm_common_connect_properties_get_number (
|
||||
MMCommonConnectProperties *properties);
|
||||
|
||||
MMCommonBearerProperties *mm_common_connect_properties_get_bearer_properties (
|
||||
MMBearerProperties *mm_common_connect_properties_get_bearer_properties (
|
||||
MMCommonConnectProperties *properties);
|
||||
|
||||
GVariant *mm_common_connect_properties_get_dictionary (MMCommonConnectProperties *self);
|
||||
|
||||
Reference in New Issue
Block a user