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.
This commit is contained in:
Aleksander Morgado
2012-03-01 12:50:23 +01:00
parent 1385eb394f
commit bb352d5da3
12 changed files with 177 additions and 256 deletions

View File

@@ -186,7 +186,7 @@ disable_ready (MMModemLocation *modem_location,
} }
static void static void
get_3gpp_process_reply (MMModemLocation3gpp *location, get_3gpp_process_reply (MMLocation3gpp *location,
const GError *error) const GError *error)
{ {
if (!location) { if (!location) {
@@ -200,10 +200,10 @@ get_3gpp_process_reply (MMModemLocation3gpp *location,
" | Mobile network code: '%u'\n" " | Mobile network code: '%u'\n"
" | Location area code: '%lu'\n" " | Location area code: '%lu'\n"
" | Cell ID: '%lu'\n", " | Cell ID: '%lu'\n",
mm_modem_location_3gpp_get_mobile_country_code (location), mm_location_3gpp_get_mobile_country_code (location),
mm_modem_location_3gpp_get_mobile_network_code (location), mm_location_3gpp_get_mobile_network_code (location),
mm_modem_location_3gpp_get_location_area_code (location), mm_location_3gpp_get_location_area_code (location),
mm_modem_location_3gpp_get_cell_id (location)); mm_location_3gpp_get_cell_id (location));
g_object_unref (location); g_object_unref (location);
} }
@@ -212,7 +212,7 @@ static void
get_3gpp_ready (MMModemLocation *modem_location, get_3gpp_ready (MMModemLocation *modem_location,
GAsyncResult *result) GAsyncResult *result)
{ {
MMModemLocation3gpp *operation_result; MMLocation3gpp *operation_result;
GError *error = NULL; GError *error = NULL;
operation_result = mm_modem_location_get_3gpp_finish (modem_location, result, &error); 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? */ /* Request to get 3GPP based location from the modem? */
if (get_3gpp_flag) { if (get_3gpp_flag) {
MMModemLocation3gpp *result; MMLocation3gpp *result;
g_debug ("Synchronously getting 3GPP-based location from the modem..."); g_debug ("Synchronously getting 3GPP-based location from the modem...");

View File

@@ -154,7 +154,7 @@ mm-simple-connect-properties.c: mm-errors-types.h
mm-bearer-properties.c: mm-errors-types.h mm-bearer-properties.c: mm-errors-types.h
mm-sms-properties.c: mm-errors-types.h mm-sms-properties.c: mm-errors-types.h
mm-bearer-ip-config.c: mm-errors-types.h mm-bearer-ip-config.c: mm-errors-types.h
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-errors-quarks.c: mm-errors-types.h
mm-unlock-retries.c: mm-enums-types.h mm-unlock-retries.c: mm-enums-types.h
@@ -168,7 +168,7 @@ include_HEADERS = \
mm-bearer-properties.h \ mm-bearer-properties.h \
mm-sms-properties.h \ mm-sms-properties.h \
mm-bearer-ip-config.h \ mm-bearer-ip-config.h \
mm-common-location-3gpp.h \ mm-location-3gpp.h \
mm-unlock-retries.h \ mm-unlock-retries.h \
mm-gdbus-manager.h \ mm-gdbus-manager.h \
mm-gdbus-modem.h \ mm-gdbus-modem.h \
@@ -194,8 +194,8 @@ libmm_common_la_SOURCES = \
mm-sms-properties.c \ mm-sms-properties.c \
mm-bearer-ip-config.h \ mm-bearer-ip-config.h \
mm-bearer-ip-config.c \ mm-bearer-ip-config.c \
mm-common-location-3gpp.h \ mm-location-3gpp.h \
mm-common-location-3gpp.c \ mm-location-3gpp.c \
mm-unlock-retries.h \ mm-unlock-retries.h \
mm-unlock-retries.c \ mm-unlock-retries.c \
libmm-common.h libmm-common.h

View File

@@ -31,7 +31,7 @@
#include "mm-sms-properties.h" #include "mm-sms-properties.h"
#include "mm-bearer-properties.h" #include "mm-bearer-properties.h"
#include "mm-bearer-ip-config.h" #include "mm-bearer-ip-config.h"
#include "mm-common-location-3gpp.h" #include "mm-location-3gpp.h"
#include "mm-unlock-retries.h" #include "mm-unlock-retries.h"
#include "mm-gdbus-manager.h" #include "mm-gdbus-manager.h"
#include "mm-gdbus-modem.h" #include "mm-gdbus-modem.h"

View File

@@ -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 */

View File

@@ -19,11 +19,11 @@
#include "mm-errors-types.h" #include "mm-errors-types.h"
#include "mm-common-helpers.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_country_code;
guint mobile_network_code; guint mobile_network_code;
gulong location_area_code; gulong location_area_code;
@@ -33,42 +33,43 @@ struct _MMCommonLocation3gppPrivate {
/*****************************************************************************/ /*****************************************************************************/
guint 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; return self->priv->mobile_country_code;
} }
guint 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; return self->priv->mobile_network_code;
} }
gulong 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; return self->priv->location_area_code;
} }
gulong 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; 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 gboolean
mm_common_location_3gpp_set_mobile_country_code (MMCommonLocation3gpp *self, mm_location_3gpp_set_mobile_country_code (MMLocation3gpp *self,
guint mobile_country_code) 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 no change in the location info, don't do anything */
if (self->priv->mobile_country_code == mobile_country_code) if (self->priv->mobile_country_code == mobile_country_code)
return FALSE; return FALSE;
@@ -78,9 +79,11 @@ mm_common_location_3gpp_set_mobile_country_code (MMCommonLocation3gpp *self,
} }
gboolean gboolean
mm_common_location_3gpp_set_mobile_network_code (MMCommonLocation3gpp *self, mm_location_3gpp_set_mobile_network_code (MMLocation3gpp *self,
guint mobile_network_code) 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 no change in the location info, don't do anything */
if (self->priv->mobile_network_code == mobile_network_code) if (self->priv->mobile_network_code == mobile_network_code)
return FALSE; return FALSE;
@@ -90,9 +93,11 @@ mm_common_location_3gpp_set_mobile_network_code (MMCommonLocation3gpp *self,
} }
gboolean gboolean
mm_common_location_3gpp_set_location_area_code (MMCommonLocation3gpp *self, mm_location_3gpp_set_location_area_code (MMLocation3gpp *self,
gulong location_area_code) 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 no change in the location info, don't do anything */
if (self->priv->location_area_code == location_area_code) if (self->priv->location_area_code == location_area_code)
return FALSE; return FALSE;
@@ -103,9 +108,11 @@ mm_common_location_3gpp_set_location_area_code (MMCommonLocation3gpp *self,
gboolean gboolean
mm_common_location_3gpp_set_cell_id (MMCommonLocation3gpp *self, mm_location_3gpp_set_cell_id (MMLocation3gpp *self,
gulong cell_id) 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 no change in the location info, don't do anything */
if (self->priv->cell_id == cell_id) if (self->priv->cell_id == cell_id)
return FALSE; return FALSE;
@@ -117,10 +124,12 @@ mm_common_location_3gpp_set_cell_id (MMCommonLocation3gpp *self,
/*****************************************************************************/ /*****************************************************************************/
GVariant * GVariant *
mm_common_location_3gpp_get_string_variant (MMCommonLocation3gpp *self) mm_location_3gpp_get_string_variant (MMLocation3gpp *self)
{ {
GVariant *variant = NULL; GVariant *variant = NULL;
g_return_val_if_fail (MM_IS_LOCATION_3GPP (self), NULL);
if (self->priv->mobile_country_code && if (self->priv->mobile_country_code &&
self->priv->mobile_network_code && self->priv->mobile_network_code &&
self->priv->location_area_code && self->priv->location_area_code &&
@@ -198,13 +207,22 @@ validate_numeric_string_content (const gchar *display,
return TRUE; return TRUE;
} }
MMCommonLocation3gpp * MMLocation3gpp *
mm_common_location_3gpp_new_from_string_variant (GVariant *string, mm_location_3gpp_new_from_string_variant (GVariant *string,
GError **error) GError **error)
{ {
MMCommonLocation3gpp *self = NULL; MMLocation3gpp *self = NULL;
gchar **split; 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); split = g_strsplit (g_variant_get_string (string, NULL), ",", -1);
if (!split) { if (!split) {
g_set_error (error, 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_string_length ("Cell ID", split[3], 8, error) &&
validate_numeric_string_content ("Cell ID", split[3], TRUE, error)) { validate_numeric_string_content ("Cell ID", split[3], TRUE, error)) {
/* Create new location object */ /* 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_country_code = strtol (split[0], NULL, 10);
self->priv->mobile_network_code = strtol (split[1], NULL, 10); self->priv->mobile_network_code = strtol (split[1], NULL, 10);
self->priv->location_area_code = strtol (split[2], NULL, 16); 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 * MMLocation3gpp *
mm_common_location_3gpp_new (void) mm_location_3gpp_new (void)
{ {
return (MM_COMMON_LOCATION_3GPP ( return (MM_LOCATION_3GPP (
g_object_new (MM_TYPE_COMMON_LOCATION_3GPP, NULL))); g_object_new (MM_TYPE_LOCATION_3GPP, NULL)));
} }
static void static void
mm_common_location_3gpp_init (MMCommonLocation3gpp *self) mm_location_3gpp_init (MMLocation3gpp *self)
{ {
self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self), self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self),
MM_TYPE_COMMON_LOCATION_3GPP, MM_TYPE_LOCATION_3GPP,
MMCommonLocation3gppPrivate); MMLocation3gppPrivate);
} }
static void static void
mm_common_location_3gpp_class_init (MMCommonLocation3gppClass *klass) mm_location_3gpp_class_init (MMLocation3gppClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (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));
} }

View File

@@ -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 */

View File

@@ -28,8 +28,6 @@ libmm_glib_la_SOURCES = \
mm-modem-simple-status-properties.c \ mm-modem-simple-status-properties.c \
mm-modem-simple.h \ mm-modem-simple.h \
mm-modem-simple.c \ mm-modem-simple.c \
mm-modem-location-3gpp.h \
mm-modem-location-3gpp.c \
mm-modem-location.h \ mm-modem-location.h \
mm-modem-location.c \ mm-modem-location.c \
mm-sim.h \ mm-sim.h \

View File

@@ -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);
}

View File

@@ -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_ */

View File

@@ -160,11 +160,11 @@ mm_modem_location_enable_sync (MMModemLocation *self,
error); error);
} }
static MMModemLocation3gpp * static MMLocation3gpp *
build_3gpp_location (GVariant *dictionary, build_3gpp_location (GVariant *dictionary,
GError **error) GError **error)
{ {
MMCommonLocation3gpp *location = NULL; MMLocation3gpp *location = NULL;
GError *inner_error = NULL; GError *inner_error = NULL;
GVariant *value; GVariant *value;
guint source; guint source;
@@ -179,7 +179,7 @@ build_3gpp_location (GVariant *dictionary,
g_variant_iter_next (&iter, "{uv}", &source, &value)) { g_variant_iter_next (&iter, "{uv}", &source, &value)) {
/* If we have 3GPP LAC/CI location, build result */ /* If we have 3GPP LAC/CI location, build result */
if (source == MM_MODEM_LOCATION_SOURCE_3GPP_LAC_CI) 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); g_variant_unref (value);
} }
@@ -189,10 +189,10 @@ build_3gpp_location (GVariant *dictionary,
if (inner_error) if (inner_error)
g_propagate_error (error, inner_error); g_propagate_error (error, inner_error);
return (MMModemLocation3gpp *)location; return (MMLocation3gpp *)location;
} }
MMModemLocation3gpp * MMLocation3gpp *
mm_modem_location_get_3gpp_finish (MMModemLocation *self, mm_modem_location_get_3gpp_finish (MMModemLocation *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
@@ -222,7 +222,7 @@ mm_modem_location_get_3gpp (MMModemLocation *self,
user_data); user_data);
} }
MMModemLocation3gpp * MMLocation3gpp *
mm_modem_location_get_3gpp_sync (MMModemLocation *self, mm_modem_location_get_3gpp_sync (MMModemLocation *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)

View File

@@ -24,9 +24,7 @@
#define _MM_MODEM_LOCATION_H_ #define _MM_MODEM_LOCATION_H_
#include <ModemManager.h> #include <ModemManager.h>
#include <mm-gdbus-modem.h> #include <libmm-common.h>
#include "mm-modem-location-3gpp.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@@ -63,16 +61,16 @@ gboolean mm_modem_location_disable_sync (MMModemLocation *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);
void mm_modem_location_get_3gpp (MMModemLocation *self, void mm_modem_location_get_3gpp (MMModemLocation *self,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
MMModemLocation3gpp *mm_modem_location_get_3gpp_finish (MMModemLocation *self, MMLocation3gpp *mm_modem_location_get_3gpp_finish (MMModemLocation *self,
GAsyncResult *res, GAsyncResult *res,
GError **error); GError **error);
MMModemLocation3gpp *mm_modem_location_get_3gpp_sync (MMModemLocation *self, MMLocation3gpp *mm_modem_location_get_3gpp_sync (MMModemLocation *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);
G_END_DECLS G_END_DECLS
#endif /* _MM_MODEM_LOCATION_H_ */ #endif /* _MM_MODEM_LOCATION_H_ */

View File

@@ -36,7 +36,7 @@ mm_iface_modem_location_bind_simple_status (MMIfaceModemLocation *self,
typedef struct { typedef struct {
/* 3GPP location */ /* 3GPP location */
MMCommonLocation3gpp *location_3gpp; MMLocation3gpp *location_3gpp;
} LocationContext; } LocationContext;
static void static void
@@ -87,13 +87,13 @@ get_location_context (MMIfaceModemLocation *self)
/*****************************************************************************/ /*****************************************************************************/
static GVariant * static GVariant *
build_location_dictionary (MMCommonLocation3gpp *location_3gpp) build_location_dictionary (MMLocation3gpp *location_3gpp)
{ {
GVariant *location_3gpp_value = NULL; GVariant *location_3gpp_value = NULL;
GVariantBuilder builder; GVariantBuilder builder;
if (location_3gpp) 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}")); g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{uv}"));
if (location_3gpp_value) if (location_3gpp_value)
@@ -107,7 +107,7 @@ build_location_dictionary (MMCommonLocation3gpp *location_3gpp)
static void static void
notify_location_update (MMIfaceModemLocation *self, notify_location_update (MMIfaceModemLocation *self,
MmGdbusModemLocation *skeleton, MmGdbusModemLocation *skeleton,
MMCommonLocation3gpp *location_3gpp) MMLocation3gpp *location_3gpp)
{ {
const gchar *dbus_path; const gchar *dbus_path;
@@ -115,10 +115,10 @@ notify_location_update (MMIfaceModemLocation *self,
mm_info ("Modem %s: 3GPP location updated " mm_info ("Modem %s: 3GPP location updated "
"(MCC: '%u', MNC: '%u', Location area code: '%lX', Cell ID: '%lX')", "(MCC: '%u', MNC: '%u', Location area code: '%lX', Cell ID: '%lX')",
dbus_path, dbus_path,
mm_common_location_3gpp_get_mobile_country_code (location_3gpp), mm_location_3gpp_get_mobile_country_code (location_3gpp),
mm_common_location_3gpp_get_mobile_network_code (location_3gpp), mm_location_3gpp_get_mobile_network_code (location_3gpp),
mm_common_location_3gpp_get_location_area_code (location_3gpp), mm_location_3gpp_get_location_area_code (location_3gpp),
mm_common_location_3gpp_get_cell_id (location_3gpp)); mm_location_3gpp_get_cell_id (location_3gpp));
/* We only update the property if we are supposed to signal /* We only update the property if we are supposed to signal
* location */ * location */
@@ -145,12 +145,12 @@ mm_iface_modem_location_3gpp_update_mcc_mnc (MMIfaceModemLocation *self,
guint changed = 0; guint changed = 0;
if (G_UNLIKELY (!ctx->location_3gpp)) 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, changed += mm_location_3gpp_set_mobile_country_code (ctx->location_3gpp,
mobile_country_code); mobile_country_code);
changed += mm_common_location_3gpp_set_mobile_network_code (ctx->location_3gpp, changed += mm_location_3gpp_set_mobile_network_code (ctx->location_3gpp,
mobile_network_code); mobile_network_code);
if (changed) if (changed)
notify_location_update (self, skeleton, ctx->location_3gpp); 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; guint changed = 0;
if (G_UNLIKELY (!ctx->location_3gpp)) 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, changed += mm_location_3gpp_set_location_area_code (ctx->location_3gpp,
location_area_code); location_area_code);
changed += mm_common_location_3gpp_set_cell_id (ctx->location_3gpp, changed += mm_location_3gpp_set_cell_id (ctx->location_3gpp,
cell_id); cell_id);
if (changed) if (changed)
notify_location_update (self, skeleton, ctx->location_3gpp); notify_location_update (self, skeleton, ctx->location_3gpp);
} }
@@ -203,12 +203,12 @@ mm_iface_modem_location_3gpp_clear (MMIfaceModemLocation *self)
guint changed = 0; guint changed = 0;
if (G_UNLIKELY (!ctx->location_3gpp)) 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_location_3gpp_set_location_area_code (ctx->location_3gpp, 0);
changed += mm_common_location_3gpp_set_cell_id (ctx->location_3gpp, 0); changed += mm_location_3gpp_set_cell_id (ctx->location_3gpp, 0);
changed += mm_common_location_3gpp_set_mobile_country_code (ctx->location_3gpp, 0); changed += mm_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_mobile_network_code (ctx->location_3gpp, 0);
if (changed) if (changed)
notify_location_update (self, skeleton, ctx->location_3gpp); notify_location_update (self, skeleton, ctx->location_3gpp);
} }