aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-03-01 12:50:23 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-03-16 14:53:19 +0100
commitbb352d5da30413e70a71d14acb952b7bedfe6f99 (patch)
treec854f548d55fa078fd6d4ec95b7e762601840f83
parent1385eb394f977ee3a7014bd0025fa65cd7e4a25a (diff)
libmm-common: `MMLocation3gpp' won't be considered internal any more
Renamed `MMCommonLocation3gpp' to `MMLocation3gpp', and removed the `MMModemLocation3gpp' provided in libmm-glib. We'll just use the original one from libmm-common always.
-rw-r--r--cli/mmcli-modem-location.c14
-rw-r--r--libmm-common/Makefile.am8
-rw-r--r--libmm-common/libmm-common.h2
-rw-r--r--libmm-common/mm-common-location-3gpp.h68
-rw-r--r--libmm-common/mm-location-3gpp.c (renamed from libmm-common/mm-common-location-3gpp.c)96
-rw-r--r--libmm-common/mm-location-3gpp.h68
-rw-r--r--libmm-glib/Makefile.am2
-rw-r--r--libmm-glib/mm-modem-location-3gpp.c48
-rw-r--r--libmm-glib/mm-modem-location-3gpp.h45
-rw-r--r--libmm-glib/mm-modem-location.c12
-rw-r--r--libmm-glib/mm-modem-location.h24
-rw-r--r--src/mm-iface-modem-location.c46
12 files changed, 177 insertions, 256 deletions
diff --git a/cli/mmcli-modem-location.c b/cli/mmcli-modem-location.c
index dbd4e666..49afd0ac 100644
--- a/cli/mmcli-modem-location.c
+++ b/cli/mmcli-modem-location.c
@@ -186,7 +186,7 @@ disable_ready (MMModemLocation *modem_location,
}
static void
-get_3gpp_process_reply (MMModemLocation3gpp *location,
+get_3gpp_process_reply (MMLocation3gpp *location,
const GError *error)
{
if (!location) {
@@ -200,10 +200,10 @@ get_3gpp_process_reply (MMModemLocation3gpp *location,
" | Mobile network code: '%u'\n"
" | Location area code: '%lu'\n"
" | Cell ID: '%lu'\n",
- mm_modem_location_3gpp_get_mobile_country_code (location),
- mm_modem_location_3gpp_get_mobile_network_code (location),
- mm_modem_location_3gpp_get_location_area_code (location),
- mm_modem_location_3gpp_get_cell_id (location));
+ mm_location_3gpp_get_mobile_country_code (location),
+ mm_location_3gpp_get_mobile_network_code (location),
+ mm_location_3gpp_get_location_area_code (location),
+ mm_location_3gpp_get_cell_id (location));
g_object_unref (location);
}
@@ -212,7 +212,7 @@ static void
get_3gpp_ready (MMModemLocation *modem_location,
GAsyncResult *result)
{
- MMModemLocation3gpp *operation_result;
+ MMLocation3gpp *operation_result;
GError *error = NULL;
operation_result = mm_modem_location_get_3gpp_finish (modem_location, result, &error);
@@ -326,7 +326,7 @@ mmcli_modem_location_run_synchronous (GDBusConnection *connection)
/* Request to get 3GPP based location from the modem? */
if (get_3gpp_flag) {
- MMModemLocation3gpp *result;
+ MMLocation3gpp *result;
g_debug ("Synchronously getting 3GPP-based location from the modem...");
diff --git a/libmm-common/Makefile.am b/libmm-common/Makefile.am
index 56db3257..b9699726 100644
--- a/libmm-common/Makefile.am
+++ b/libmm-common/Makefile.am
@@ -154,7 +154,7 @@ mm-simple-connect-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
+mm-location-3gpp.c: mm-errors-types.h
mm-errors-quarks.c: mm-errors-types.h
mm-unlock-retries.c: mm-enums-types.h
@@ -168,7 +168,7 @@ include_HEADERS = \
mm-bearer-properties.h \
mm-sms-properties.h \
mm-bearer-ip-config.h \
- mm-common-location-3gpp.h \
+ mm-location-3gpp.h \
mm-unlock-retries.h \
mm-gdbus-manager.h \
mm-gdbus-modem.h \
@@ -194,8 +194,8 @@ libmm_common_la_SOURCES = \
mm-sms-properties.c \
mm-bearer-ip-config.h \
mm-bearer-ip-config.c \
- mm-common-location-3gpp.h \
- mm-common-location-3gpp.c \
+ mm-location-3gpp.h \
+ mm-location-3gpp.c \
mm-unlock-retries.h \
mm-unlock-retries.c \
libmm-common.h
diff --git a/libmm-common/libmm-common.h b/libmm-common/libmm-common.h
index 04c1bfd7..743ad6ec 100644
--- a/libmm-common/libmm-common.h
+++ b/libmm-common/libmm-common.h
@@ -31,7 +31,7 @@
#include "mm-sms-properties.h"
#include "mm-bearer-properties.h"
#include "mm-bearer-ip-config.h"
-#include "mm-common-location-3gpp.h"
+#include "mm-location-3gpp.h"
#include "mm-unlock-retries.h"
#include "mm-gdbus-manager.h"
#include "mm-gdbus-modem.h"
diff --git a/libmm-common/mm-common-location-3gpp.h b/libmm-common/mm-common-location-3gpp.h
deleted file mode 100644
index 1f5c4633..00000000
--- a/libmm-common/mm-common-location-3gpp.h
+++ /dev/null
@@ -1,68 +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) 2012 Google, Inc.
- */
-
-#ifndef MM_COMMON_LOCATION_3GPP_H
-#define MM_COMMON_LOCATION_3GPP_H
-
-#include <ModemManager.h>
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define MM_TYPE_COMMON_LOCATION_3GPP (mm_common_location_3gpp_get_type ())
-#define MM_COMMON_LOCATION_3GPP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_COMMON_LOCATION_3GPP, MMCommonLocation3gpp))
-#define MM_COMMON_LOCATION_3GPP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_COMMON_LOCATION_3GPP, MMCommonLocation3gppClass))
-#define MM_IS_COMMON_LOCATION_3GPP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_COMMON_LOCATION_3GPP))
-#define MM_IS_COMMON_LOCATION_3GPP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_COMMON_LOCATION_3GPP))
-#define MM_COMMON_LOCATION_3GPP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_COMMON_LOCATION_3GPP, MMCommonLocation3gppClass))
-
-typedef struct _MMCommonLocation3gpp MMCommonLocation3gpp;
-typedef struct _MMCommonLocation3gppClass MMCommonLocation3gppClass;
-typedef struct _MMCommonLocation3gppPrivate MMCommonLocation3gppPrivate;
-
-struct _MMCommonLocation3gpp {
- GObject parent;
- MMCommonLocation3gppPrivate *priv;
-};
-
-struct _MMCommonLocation3gppClass {
- GObjectClass parent;
-};
-
-GType mm_common_location_3gpp_get_type (void);
-
-MMCommonLocation3gpp *mm_common_location_3gpp_new (void);
-MMCommonLocation3gpp *mm_common_location_3gpp_new_from_string_variant (GVariant *string,
- GError **error);
-
-gboolean mm_common_location_3gpp_set_mobile_country_code (MMCommonLocation3gpp *self,
- guint mobile_country_code);
-gboolean mm_common_location_3gpp_set_mobile_network_code (MMCommonLocation3gpp *self,
- guint mobile_network_code);
-gboolean mm_common_location_3gpp_set_location_area_code (MMCommonLocation3gpp *self,
- gulong location_area_code);
-gboolean mm_common_location_3gpp_set_cell_id (MMCommonLocation3gpp *self,
- gulong cell_id);
-
-guint mm_common_location_3gpp_get_mobile_country_code (MMCommonLocation3gpp *self);
-guint mm_common_location_3gpp_get_mobile_network_code (MMCommonLocation3gpp *self);
-gulong mm_common_location_3gpp_get_location_area_code (MMCommonLocation3gpp *self);
-gulong mm_common_location_3gpp_get_cell_id (MMCommonLocation3gpp *self);
-
-GVariant *mm_common_location_3gpp_get_string_variant (MMCommonLocation3gpp *self);
-
-G_END_DECLS
-
-#endif /* MM_COMMON_LOCATION_3GPP_H */
diff --git a/libmm-common/mm-common-location-3gpp.c b/libmm-common/mm-location-3gpp.c
index 395015b3..8ac599f4 100644
--- a/libmm-common/mm-common-location-3gpp.c
+++ b/libmm-common/mm-location-3gpp.c
@@ -19,11 +19,11 @@
#include "mm-errors-types.h"
#include "mm-common-helpers.h"
-#include "mm-common-location-3gpp.h"
+#include "mm-location-3gpp.h"
-G_DEFINE_TYPE (MMCommonLocation3gpp, mm_common_location_3gpp, G_TYPE_OBJECT);
+G_DEFINE_TYPE (MMLocation3gpp, mm_location_3gpp, G_TYPE_OBJECT);
-struct _MMCommonLocation3gppPrivate {
+struct _MMLocation3gppPrivate {
guint mobile_country_code;
guint mobile_network_code;
gulong location_area_code;
@@ -33,42 +33,43 @@ struct _MMCommonLocation3gppPrivate {
/*****************************************************************************/
guint
-mm_common_location_3gpp_get_mobile_country_code (MMCommonLocation3gpp *self)
+mm_location_3gpp_get_mobile_country_code (MMLocation3gpp *self)
{
+ g_return_val_if_fail (MM_IS_LOCATION_3GPP (self), 0);
+
return self->priv->mobile_country_code;
}
guint
-mm_common_location_3gpp_get_mobile_network_code (MMCommonLocation3gpp *self)
+mm_location_3gpp_get_mobile_network_code (MMLocation3gpp *self)
{
+ g_return_val_if_fail (MM_IS_LOCATION_3GPP (self), 0);
+
return self->priv->mobile_network_code;
}
gulong
-mm_common_location_3gpp_get_location_area_code (MMCommonLocation3gpp *self)
+mm_location_3gpp_get_location_area_code (MMLocation3gpp *self)
{
+ g_return_val_if_fail (MM_IS_LOCATION_3GPP (self), 0);
+
return self->priv->location_area_code;
}
gulong
-mm_common_location_3gpp_get_cell_id (MMCommonLocation3gpp *self)
+mm_location_3gpp_get_cell_id (MMLocation3gpp *self)
{
+ g_return_val_if_fail (MM_IS_LOCATION_3GPP (self), 0);
+
return self->priv->cell_id;
}
-/* void */
-/* mm_common_location_3gpp_clear (MMCommonLocation3gpp *self) */
-/* { */
-/* self->priv->mobile_country_code = 0; */
-/* self->priv->mobile_network_code = 0; */
-/* self->priv->location_area_code = 0; */
-/* self->priv->cell_id = 0; */
-/* } */
-
gboolean
-mm_common_location_3gpp_set_mobile_country_code (MMCommonLocation3gpp *self,
- guint mobile_country_code)
+mm_location_3gpp_set_mobile_country_code (MMLocation3gpp *self,
+ guint mobile_country_code)
{
+ g_return_val_if_fail (MM_IS_LOCATION_3GPP (self), FALSE);
+
/* If no change in the location info, don't do anything */
if (self->priv->mobile_country_code == mobile_country_code)
return FALSE;
@@ -78,9 +79,11 @@ mm_common_location_3gpp_set_mobile_country_code (MMCommonLocation3gpp *self,
}
gboolean
-mm_common_location_3gpp_set_mobile_network_code (MMCommonLocation3gpp *self,
- guint mobile_network_code)
+mm_location_3gpp_set_mobile_network_code (MMLocation3gpp *self,
+ guint mobile_network_code)
{
+ g_return_val_if_fail (MM_IS_LOCATION_3GPP (self), FALSE);
+
/* If no change in the location info, don't do anything */
if (self->priv->mobile_network_code == mobile_network_code)
return FALSE;
@@ -90,9 +93,11 @@ mm_common_location_3gpp_set_mobile_network_code (MMCommonLocation3gpp *self,
}
gboolean
-mm_common_location_3gpp_set_location_area_code (MMCommonLocation3gpp *self,
- gulong location_area_code)
+mm_location_3gpp_set_location_area_code (MMLocation3gpp *self,
+ gulong location_area_code)
{
+ g_return_val_if_fail (MM_IS_LOCATION_3GPP (self), FALSE);
+
/* If no change in the location info, don't do anything */
if (self->priv->location_area_code == location_area_code)
return FALSE;
@@ -103,9 +108,11 @@ mm_common_location_3gpp_set_location_area_code (MMCommonLocation3gpp *self,
gboolean
-mm_common_location_3gpp_set_cell_id (MMCommonLocation3gpp *self,
- gulong cell_id)
+mm_location_3gpp_set_cell_id (MMLocation3gpp *self,
+ gulong cell_id)
{
+ g_return_val_if_fail (MM_IS_LOCATION_3GPP (self), FALSE);
+
/* If no change in the location info, don't do anything */
if (self->priv->cell_id == cell_id)
return FALSE;
@@ -117,10 +124,12 @@ mm_common_location_3gpp_set_cell_id (MMCommonLocation3gpp *self,
/*****************************************************************************/
GVariant *
-mm_common_location_3gpp_get_string_variant (MMCommonLocation3gpp *self)
+mm_location_3gpp_get_string_variant (MMLocation3gpp *self)
{
GVariant *variant = NULL;
+ g_return_val_if_fail (MM_IS_LOCATION_3GPP (self), NULL);
+
if (self->priv->mobile_country_code &&
self->priv->mobile_network_code &&
self->priv->location_area_code &&
@@ -198,13 +207,22 @@ validate_numeric_string_content (const gchar *display,
return TRUE;
}
-MMCommonLocation3gpp *
-mm_common_location_3gpp_new_from_string_variant (GVariant *string,
- GError **error)
+MMLocation3gpp *
+mm_location_3gpp_new_from_string_variant (GVariant *string,
+ GError **error)
{
- MMCommonLocation3gpp *self = NULL;
+ MMLocation3gpp *self = NULL;
gchar **split;
+ if (!g_variant_is_of_type (string, G_VARIANT_TYPE_STRING)) {
+ g_set_error (error,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_INVALID_ARGS,
+ "Cannot create 3GPP location from string: "
+ "invalid variant type received");
+ return NULL;
+ }
+
split = g_strsplit (g_variant_get_string (string, NULL), ",", -1);
if (!split) {
g_set_error (error,
@@ -225,7 +243,7 @@ mm_common_location_3gpp_new_from_string_variant (GVariant *string,
validate_string_length ("Cell ID", split[3], 8, error) &&
validate_numeric_string_content ("Cell ID", split[3], TRUE, error)) {
/* Create new location object */
- self = mm_common_location_3gpp_new ();
+ self = mm_location_3gpp_new ();
self->priv->mobile_country_code = strtol (split[0], NULL, 10);
self->priv->mobile_network_code = strtol (split[1], NULL, 10);
self->priv->location_area_code = strtol (split[2], NULL, 16);
@@ -238,25 +256,25 @@ mm_common_location_3gpp_new_from_string_variant (GVariant *string,
/*****************************************************************************/
-MMCommonLocation3gpp *
-mm_common_location_3gpp_new (void)
+MMLocation3gpp *
+mm_location_3gpp_new (void)
{
- return (MM_COMMON_LOCATION_3GPP (
- g_object_new (MM_TYPE_COMMON_LOCATION_3GPP, NULL)));
+ return (MM_LOCATION_3GPP (
+ g_object_new (MM_TYPE_LOCATION_3GPP, NULL)));
}
static void
-mm_common_location_3gpp_init (MMCommonLocation3gpp *self)
+mm_location_3gpp_init (MMLocation3gpp *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self),
- MM_TYPE_COMMON_LOCATION_3GPP,
- MMCommonLocation3gppPrivate);
+ MM_TYPE_LOCATION_3GPP,
+ MMLocation3gppPrivate);
}
static void
-mm_common_location_3gpp_class_init (MMCommonLocation3gppClass *klass)
+mm_location_3gpp_class_init (MMLocation3gppClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (object_class, sizeof (MMCommonLocation3gppPrivate));
+ g_type_class_add_private (object_class, sizeof (MMLocation3gppPrivate));
}
diff --git a/libmm-common/mm-location-3gpp.h b/libmm-common/mm-location-3gpp.h
new file mode 100644
index 00000000..41469c85
--- /dev/null
+++ b/libmm-common/mm-location-3gpp.h
@@ -0,0 +1,68 @@
+/* -*- 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) 2012 Google, Inc.
+ */
+
+#ifndef MM_LOCATION_3GPP_H
+#define MM_LOCATION_3GPP_H
+
+#include <ModemManager.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define MM_TYPE_LOCATION_3GPP (mm_location_3gpp_get_type ())
+#define MM_LOCATION_3GPP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_LOCATION_3GPP, MMLocation3gpp))
+#define MM_LOCATION_3GPP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_LOCATION_3GPP, MMLocation3gppClass))
+#define MM_IS_LOCATION_3GPP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_LOCATION_3GPP))
+#define MM_IS_LOCATION_3GPP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_LOCATION_3GPP))
+#define MM_LOCATION_3GPP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_LOCATION_3GPP, MMLocation3gppClass))
+
+typedef struct _MMLocation3gpp MMLocation3gpp;
+typedef struct _MMLocation3gppClass MMLocation3gppClass;
+typedef struct _MMLocation3gppPrivate MMLocation3gppPrivate;
+
+struct _MMLocation3gpp {
+ GObject parent;
+ MMLocation3gppPrivate *priv;
+};
+
+struct _MMLocation3gppClass {
+ GObjectClass parent;
+};
+
+GType mm_location_3gpp_get_type (void);
+
+MMLocation3gpp *mm_location_3gpp_new (void);
+MMLocation3gpp *mm_location_3gpp_new_from_string_variant (GVariant *string,
+ GError **error);
+
+gboolean mm_location_3gpp_set_mobile_country_code (MMLocation3gpp *self,
+ guint mobile_country_code);
+gboolean mm_location_3gpp_set_mobile_network_code (MMLocation3gpp *self,
+ guint mobile_network_code);
+gboolean mm_location_3gpp_set_location_area_code (MMLocation3gpp *self,
+ gulong location_area_code);
+gboolean mm_location_3gpp_set_cell_id (MMLocation3gpp *self,
+ gulong cell_id);
+
+guint mm_location_3gpp_get_mobile_country_code (MMLocation3gpp *self);
+guint mm_location_3gpp_get_mobile_network_code (MMLocation3gpp *self);
+gulong mm_location_3gpp_get_location_area_code (MMLocation3gpp *self);
+gulong mm_location_3gpp_get_cell_id (MMLocation3gpp *self);
+
+GVariant *mm_location_3gpp_get_string_variant (MMLocation3gpp *self);
+
+G_END_DECLS
+
+#endif /* MM_LOCATION_3GPP_H */
diff --git a/libmm-glib/Makefile.am b/libmm-glib/Makefile.am
index 7e8e1a3d..f9c18a4a 100644
--- a/libmm-glib/Makefile.am
+++ b/libmm-glib/Makefile.am
@@ -28,8 +28,6 @@ libmm_glib_la_SOURCES = \
mm-modem-simple-status-properties.c \
mm-modem-simple.h \
mm-modem-simple.c \
- mm-modem-location-3gpp.h \
- mm-modem-location-3gpp.c \
mm-modem-location.h \
mm-modem-location.c \
mm-sim.h \
diff --git a/libmm-glib/mm-modem-location-3gpp.c b/libmm-glib/mm-modem-location-3gpp.c
deleted file mode 100644
index af090889..00000000
--- a/libmm-glib/mm-modem-location-3gpp.c
+++ /dev/null
@@ -1,48 +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) 2012 Google, Inc.
- */
-
-#include "mm-modem-location-3gpp.h"
-
-guint
-mm_modem_location_3gpp_get_mobile_country_code (MMModemLocation3gpp *self)
-{
- g_return_val_if_fail (MM_IS_COMMON_LOCATION_3GPP (self), 0);
-
- return mm_common_location_3gpp_get_mobile_country_code (self);
-}
-
-guint
-mm_modem_location_3gpp_get_mobile_network_code (MMModemLocation3gpp *self)
-{
- g_return_val_if_fail (MM_IS_COMMON_LOCATION_3GPP (self), 0);
-
- return mm_common_location_3gpp_get_mobile_network_code (self);
-}
-
-gulong
-mm_modem_location_3gpp_get_location_area_code (MMModemLocation3gpp *self)
-{
- g_return_val_if_fail (MM_IS_COMMON_LOCATION_3GPP (self), 0);
-
- return mm_common_location_3gpp_get_location_area_code (self);
-}
-
-gulong
-mm_modem_location_3gpp_get_cell_id (MMModemLocation3gpp *self)
-{
- g_return_val_if_fail (MM_IS_COMMON_LOCATION_3GPP (self), 0);
-
- return mm_common_location_3gpp_get_cell_id (self);
-}
diff --git a/libmm-glib/mm-modem-location-3gpp.h b/libmm-glib/mm-modem-location-3gpp.h
deleted file mode 100644
index 869799cb..00000000
--- a/libmm-glib/mm-modem-location-3gpp.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * libmm -- Access modem status & information from glib applications
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA.
- *
- * Copyright (C) 2012 Google, Inc.
- */
-
-#ifndef _MM_MODEM_LOCATION_3GPP_H_
-#define _MM_MODEM_LOCATION_3GPP_H_
-
-#include <ModemManager.h>
-#include <glib-object.h>
-
-#include <libmm-common.h>
-
-G_BEGIN_DECLS
-
-typedef MMCommonLocation3gpp MMModemLocation3gpp;
-#define MM_TYPE_MODEM_LOCATION_3GPP(o) MM_TYPE_LOCATION_3GPP (o)
-#define MM_MODEM_LOCATION_3GPP(o) MM_LOCATION_3GPP(o)
-#define MM_IS_MODEM_LOCATION_3GPP(o) MM_IS_LOCATION_3GPP(o)
-
-guint mm_modem_location_3gpp_get_mobile_country_code (MMModemLocation3gpp *self);
-guint mm_modem_location_3gpp_get_mobile_network_code (MMModemLocation3gpp *self);
-gulong mm_modem_location_3gpp_get_location_area_code (MMModemLocation3gpp *self);
-gulong mm_modem_location_3gpp_get_cell_id (MMModemLocation3gpp *self);
-
-G_END_DECLS
-
-#endif /* _MM_MODEM_LOCATION_3GPP_H_ */
diff --git a/libmm-glib/mm-modem-location.c b/libmm-glib/mm-modem-location.c
index 1f2bdbb7..c800fa3b 100644
--- a/libmm-glib/mm-modem-location.c
+++ b/libmm-glib/mm-modem-location.c
@@ -160,11 +160,11 @@ mm_modem_location_enable_sync (MMModemLocation *self,
error);
}
-static MMModemLocation3gpp *
+static MMLocation3gpp *
build_3gpp_location (GVariant *dictionary,
GError **error)
{
- MMCommonLocation3gpp *location = NULL;
+ MMLocation3gpp *location = NULL;
GError *inner_error = NULL;
GVariant *value;
guint source;
@@ -179,7 +179,7 @@ build_3gpp_location (GVariant *dictionary,
g_variant_iter_next (&iter, "{uv}", &source, &value)) {
/* If we have 3GPP LAC/CI location, build result */
if (source == MM_MODEM_LOCATION_SOURCE_3GPP_LAC_CI)
- location = mm_common_location_3gpp_new_from_string_variant (value, &inner_error);
+ location = mm_location_3gpp_new_from_string_variant (value, &inner_error);
g_variant_unref (value);
}
@@ -189,10 +189,10 @@ build_3gpp_location (GVariant *dictionary,
if (inner_error)
g_propagate_error (error, inner_error);
- return (MMModemLocation3gpp *)location;
+ return (MMLocation3gpp *)location;
}
-MMModemLocation3gpp *
+MMLocation3gpp *
mm_modem_location_get_3gpp_finish (MMModemLocation *self,
GAsyncResult *res,
GError **error)
@@ -222,7 +222,7 @@ mm_modem_location_get_3gpp (MMModemLocation *self,
user_data);
}
-MMModemLocation3gpp *
+MMLocation3gpp *
mm_modem_location_get_3gpp_sync (MMModemLocation *self,
GCancellable *cancellable,
GError **error)
diff --git a/libmm-glib/mm-modem-location.h b/libmm-glib/mm-modem-location.h
index 2c93cb45..b92040db 100644
--- a/libmm-glib/mm-modem-location.h
+++ b/libmm-glib/mm-modem-location.h
@@ -24,9 +24,7 @@
#define _MM_MODEM_LOCATION_H_
#include <ModemManager.h>
-#include <mm-gdbus-modem.h>
-
-#include "mm-modem-location-3gpp.h"
+#include <libmm-common.h>
G_BEGIN_DECLS
@@ -63,16 +61,16 @@ gboolean mm_modem_location_disable_sync (MMModemLocation *self,
GCancellable *cancellable,
GError **error);
-void mm_modem_location_get_3gpp (MMModemLocation *self,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-MMModemLocation3gpp *mm_modem_location_get_3gpp_finish (MMModemLocation *self,
- GAsyncResult *res,
- GError **error);
-MMModemLocation3gpp *mm_modem_location_get_3gpp_sync (MMModemLocation *self,
- GCancellable *cancellable,
- GError **error);
+void mm_modem_location_get_3gpp (MMModemLocation *self,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+MMLocation3gpp *mm_modem_location_get_3gpp_finish (MMModemLocation *self,
+ GAsyncResult *res,
+ GError **error);
+MMLocation3gpp *mm_modem_location_get_3gpp_sync (MMModemLocation *self,
+ GCancellable *cancellable,
+ GError **error);
G_END_DECLS
#endif /* _MM_MODEM_LOCATION_H_ */
diff --git a/src/mm-iface-modem-location.c b/src/mm-iface-modem-location.c
index 60dbcb8b..5ff3ef3d 100644
--- a/src/mm-iface-modem-location.c
+++ b/src/mm-iface-modem-location.c
@@ -36,7 +36,7 @@ mm_iface_modem_location_bind_simple_status (MMIfaceModemLocation *self,
typedef struct {
/* 3GPP location */
- MMCommonLocation3gpp *location_3gpp;
+ MMLocation3gpp *location_3gpp;
} LocationContext;
static void
@@ -87,13 +87,13 @@ get_location_context (MMIfaceModemLocation *self)
/*****************************************************************************/
static GVariant *
-build_location_dictionary (MMCommonLocation3gpp *location_3gpp)
+build_location_dictionary (MMLocation3gpp *location_3gpp)
{
GVariant *location_3gpp_value = NULL;
GVariantBuilder builder;
if (location_3gpp)
- location_3gpp_value = mm_common_location_3gpp_get_string_variant (location_3gpp);
+ location_3gpp_value = mm_location_3gpp_get_string_variant (location_3gpp);
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{uv}"));
if (location_3gpp_value)
@@ -107,7 +107,7 @@ build_location_dictionary (MMCommonLocation3gpp *location_3gpp)
static void
notify_location_update (MMIfaceModemLocation *self,
MmGdbusModemLocation *skeleton,
- MMCommonLocation3gpp *location_3gpp)
+ MMLocation3gpp *location_3gpp)
{
const gchar *dbus_path;
@@ -115,10 +115,10 @@ notify_location_update (MMIfaceModemLocation *self,
mm_info ("Modem %s: 3GPP location updated "
"(MCC: '%u', MNC: '%u', Location area code: '%lX', Cell ID: '%lX')",
dbus_path,
- mm_common_location_3gpp_get_mobile_country_code (location_3gpp),
- mm_common_location_3gpp_get_mobile_network_code (location_3gpp),
- mm_common_location_3gpp_get_location_area_code (location_3gpp),
- mm_common_location_3gpp_get_cell_id (location_3gpp));
+ mm_location_3gpp_get_mobile_country_code (location_3gpp),
+ mm_location_3gpp_get_mobile_network_code (location_3gpp),
+ mm_location_3gpp_get_location_area_code (location_3gpp),
+ mm_location_3gpp_get_cell_id (location_3gpp));
/* We only update the property if we are supposed to signal
* location */
@@ -145,12 +145,12 @@ mm_iface_modem_location_3gpp_update_mcc_mnc (MMIfaceModemLocation *self,
guint changed = 0;
if (G_UNLIKELY (!ctx->location_3gpp))
- ctx->location_3gpp = mm_common_location_3gpp_new ();
+ ctx->location_3gpp = mm_location_3gpp_new ();
- changed += mm_common_location_3gpp_set_mobile_country_code (ctx->location_3gpp,
- mobile_country_code);
- changed += mm_common_location_3gpp_set_mobile_network_code (ctx->location_3gpp,
- mobile_network_code);
+ changed += mm_location_3gpp_set_mobile_country_code (ctx->location_3gpp,
+ mobile_country_code);
+ changed += mm_location_3gpp_set_mobile_network_code (ctx->location_3gpp,
+ mobile_network_code);
if (changed)
notify_location_update (self, skeleton, ctx->location_3gpp);
}
@@ -175,12 +175,12 @@ mm_iface_modem_location_3gpp_update_lac_ci (MMIfaceModemLocation *self,
guint changed = 0;
if (G_UNLIKELY (!ctx->location_3gpp))
- ctx->location_3gpp = mm_common_location_3gpp_new ();
+ ctx->location_3gpp = mm_location_3gpp_new ();
- changed += mm_common_location_3gpp_set_location_area_code (ctx->location_3gpp,
- location_area_code);
- changed += mm_common_location_3gpp_set_cell_id (ctx->location_3gpp,
- cell_id);
+ changed += mm_location_3gpp_set_location_area_code (ctx->location_3gpp,
+ location_area_code);
+ changed += mm_location_3gpp_set_cell_id (ctx->location_3gpp,
+ cell_id);
if (changed)
notify_location_update (self, skeleton, ctx->location_3gpp);
}
@@ -203,12 +203,12 @@ mm_iface_modem_location_3gpp_clear (MMIfaceModemLocation *self)
guint changed = 0;
if (G_UNLIKELY (!ctx->location_3gpp))
- ctx->location_3gpp = mm_common_location_3gpp_new ();
+ ctx->location_3gpp = mm_location_3gpp_new ();
- changed += mm_common_location_3gpp_set_location_area_code (ctx->location_3gpp, 0);
- changed += mm_common_location_3gpp_set_cell_id (ctx->location_3gpp, 0);
- changed += mm_common_location_3gpp_set_mobile_country_code (ctx->location_3gpp, 0);
- changed += mm_common_location_3gpp_set_mobile_network_code (ctx->location_3gpp, 0);
+ changed += mm_location_3gpp_set_location_area_code (ctx->location_3gpp, 0);
+ changed += mm_location_3gpp_set_cell_id (ctx->location_3gpp, 0);
+ changed += mm_location_3gpp_set_mobile_country_code (ctx->location_3gpp, 0);
+ changed += mm_location_3gpp_set_mobile_network_code (ctx->location_3gpp, 0);
if (changed)
notify_location_update (self, skeleton, ctx->location_3gpp);
}