summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-10-31 12:34:46 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-11-02 08:23:11 +0100
commitd9241d08db31cf5bbb91ecc13c5b6839161a3804 (patch)
treed047a2a987cec71fee8887f6e92bf7f2f0d66fff
parent24c40e32bd6b5a9becbba05d18f8fbbdc3592d51 (diff)
libmm-glib: implement handling the CDMA BS location source
-rw-r--r--docs/reference/libmm-glib/libmm-glib-docs.xml1
-rw-r--r--docs/reference/libmm-glib/libmm-glib-sections.txt27
-rw-r--r--libmm-glib/Makefile.am3
-rw-r--r--libmm-glib/libmm-glib.h1
-rw-r--r--libmm-glib/mm-location-cdma-bs.c219
-rw-r--r--libmm-glib/mm-location-cdma-bs.h84
-rw-r--r--libmm-glib/mm-modem-location.c97
-rw-r--r--libmm-glib/mm-modem-location.h14
8 files changed, 438 insertions, 8 deletions
diff --git a/docs/reference/libmm-glib/libmm-glib-docs.xml b/docs/reference/libmm-glib/libmm-glib-docs.xml
index 6e3c7178..c9f498ca 100644
--- a/docs/reference/libmm-glib/libmm-glib-docs.xml
+++ b/docs/reference/libmm-glib/libmm-glib-docs.xml
@@ -93,6 +93,7 @@
<xi:include href="xml/mm-location-3gpp.xml"/>
<xi:include href="xml/mm-location-gps-nmea.xml"/>
<xi:include href="xml/mm-location-gps-raw.xml"/>
+ <xi:include href="xml/mm-location-cdma-bs.xml"/>
</section>
<section>
<title>Messaging support</title>
diff --git a/docs/reference/libmm-glib/libmm-glib-sections.txt b/docs/reference/libmm-glib/libmm-glib-sections.txt
index 1959ae4e..6b874e05 100644
--- a/docs/reference/libmm-glib/libmm-glib-sections.txt
+++ b/docs/reference/libmm-glib/libmm-glib-sections.txt
@@ -324,6 +324,9 @@ mm_modem_location_get_gps_nmea_sync
mm_modem_location_get_gps_raw
mm_modem_location_get_gps_raw_finish
mm_modem_location_get_gps_raw_sync
+mm_modem_location_get_cdma_bs
+mm_modem_location_get_cdma_bs_finish
+mm_modem_location_get_cdma_bs_sync
mm_modem_location_get_full
mm_modem_location_get_full_finish
mm_modem_location_get_full_sync
@@ -418,6 +421,30 @@ mm_location_gps_raw_get_type
</SECTION>
<SECTION>
+<FILE>mm-location-cdma-bs</FILE>
+<TITLE>MMLocationCdmaBs</TITLE>
+MMLocationCdmaBs
+<SUBSECTION Getters>
+mm_location_cdma_bs_get_latitude
+mm_location_cdma_bs_get_longitude
+<SUBSECTION Private>
+mm_location_cdma_bs_get_dictionary
+mm_location_cdma_bs_new
+mm_location_cdma_bs_set
+mm_location_cdma_bs_new_from_dictionary
+<SUBSECTION Standard>
+MMLocationCdmaBsClass
+MMLocationCdmaBsPrivate
+MM_IS_LOCATION_CDMA_BS
+MM_IS_LOCATION_CDMA_BS_CLASS
+MM_LOCATION_CDMA_BS
+MM_LOCATION_CDMA_BS_CLASS
+MM_LOCATION_CDMA_BS_GET_CLASS
+MM_TYPE_LOCATION_CDMA_BS
+mm_location_cdma_bs_get_type
+</SECTION>
+
+<SECTION>
<FILE>mm-modem-messaging</FILE>
<TITLE>MMModemMessaging</TITLE>
MMModemMessaging
diff --git a/libmm-glib/Makefile.am b/libmm-glib/Makefile.am
index 9d02835f..b0a83e0e 100644
--- a/libmm-glib/Makefile.am
+++ b/libmm-glib/Makefile.am
@@ -52,6 +52,8 @@ libmm_glib_la_SOURCES = \
mm-location-gps-raw.c \
mm-location-gps-nmea.h \
mm-location-gps-nmea.c \
+ mm-location-cdma-bs.h \
+ mm-location-cdma-bs.c \
mm-unlock-retries.h \
mm-unlock-retries.c \
mm-network-timezone.h \
@@ -98,6 +100,7 @@ include_HEADERS = \
mm-location-3gpp.h \
mm-location-gps-nmea.h \
mm-location-gps-raw.h \
+ mm-location-cdma-bs.h \
mm-unlock-retries.h \
mm-network-timezone.h \
mm-firmware-properties.h
diff --git a/libmm-glib/libmm-glib.h b/libmm-glib/libmm-glib.h
index ab00fdd1..468a3856 100644
--- a/libmm-glib/libmm-glib.h
+++ b/libmm-glib/libmm-glib.h
@@ -61,6 +61,7 @@
#include <mm-location-3gpp.h>
#include <mm-location-gps-raw.h>
#include <mm-location-gps-nmea.h>
+#include <mm-location-cdma-bs.h>
#include <mm-unlock-retries.h>
#include <mm-network-timezone.h>
#include <mm-firmware-properties.h>
diff --git a/libmm-glib/mm-location-cdma-bs.c b/libmm-glib/mm-location-cdma-bs.c
new file mode 100644
index 00000000..993f6bef
--- /dev/null
+++ b/libmm-glib/mm-location-cdma-bs.c
@@ -0,0 +1,219 @@
+/* -*- 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 Lanedo GmbH <aleksander@lanedo.com>
+ */
+
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+
+#include "mm-common-helpers.h"
+#include "mm-errors-types.h"
+#include "mm-location-cdma-bs.h"
+
+/**
+ * SECTION: mm-location-cdma-bs
+ * @title: MMLocationCdmaBs
+ * @short_description: Helper object to handle CDMA Base Station location information.
+ *
+ * The #MMLocationCdmaBs is an object handling the location information of the
+ * CDMA base station in which the modem is registered.
+ *
+ * This object is retrieved with either mm_modem_location_get_cdma_bs(),
+ * mm_modem_location_get_cdma_bs_sync(), mm_modem_location_get_full() or
+ * mm_modem_location_get_full_sync().
+ */
+
+G_DEFINE_TYPE (MMLocationCdmaBs, mm_location_cdma_bs, G_TYPE_OBJECT);
+
+#define PROPERTY_LATITUDE "latitude"
+#define PROPERTY_LONGITUDE "longitude"
+
+struct _MMLocationCdmaBsPrivate {
+ gdouble latitude;
+ gdouble longitude;
+};
+
+/*****************************************************************************/
+
+/**
+ * mm_location_cdma_bs_get_longitude:
+ * @self: a #MMLocationCdmaBs.
+ *
+ * Gets the longitude, in the [-180,180] range.
+ *
+ * Returns: the longitude, or %MM_LOCATION_LONGITUDE_UNKNOWN if unknown.
+ */
+gdouble
+mm_location_cdma_bs_get_longitude (MMLocationCdmaBs *self)
+{
+ g_return_val_if_fail (MM_IS_LOCATION_CDMA_BS (self),
+ MM_LOCATION_LONGITUDE_UNKNOWN);
+
+ return self->priv->longitude;
+}
+
+/*****************************************************************************/
+
+/**
+ * mm_location_cdma_bs_get_latitude:
+ * @self: a #MMLocationCdmaBs.
+ *
+ * Gets the latitude, in the [-90,90] range.
+ *
+ * Returns: the latitude, or %MM_LOCATION_LATITUDE_UNKNOWN if unknown.
+ */
+gdouble
+mm_location_cdma_bs_get_latitude (MMLocationCdmaBs *self)
+{
+ g_return_val_if_fail (MM_IS_LOCATION_CDMA_BS (self),
+ MM_LOCATION_LATITUDE_UNKNOWN);
+
+ return self->priv->latitude;
+}
+
+/*****************************************************************************/
+
+gboolean
+mm_location_cdma_bs_set (MMLocationCdmaBs *self,
+ gdouble longitude,
+ gdouble latitude)
+{
+ g_return_val_if_fail ((longitude == MM_LOCATION_LONGITUDE_UNKNOWN ||
+ (longitude >= -180.0 && longitude <= 180.0)),
+ FALSE);
+ g_return_val_if_fail ((latitude == MM_LOCATION_LATITUDE_UNKNOWN ||
+ (latitude >= -90.0 && latitude <= 90.0)),
+ FALSE);
+
+ if (self->priv->longitude == longitude &&
+ self->priv->latitude == latitude)
+ return FALSE;
+
+ self->priv->longitude = longitude;
+ self->priv->latitude = latitude;
+ return TRUE;
+}
+
+/*****************************************************************************/
+
+GVariant *
+mm_location_cdma_bs_get_dictionary (MMLocationCdmaBs *self)
+{
+ GVariantBuilder builder;
+
+ /* We do allow NULL */
+ if (!self)
+ return NULL;
+
+ g_return_val_if_fail (MM_IS_LOCATION_CDMA_BS (self), NULL);
+
+ /* If mandatory parameters are not found, return NULL */
+ if (self->priv->longitude == MM_LOCATION_LONGITUDE_UNKNOWN ||
+ self->priv->latitude == MM_LOCATION_LATITUDE_UNKNOWN)
+ return NULL;
+
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
+ g_variant_builder_add (&builder,
+ "{sv}",
+ PROPERTY_LONGITUDE,
+ g_variant_new_double (self->priv->longitude));
+ g_variant_builder_add (&builder,
+ "{sv}",
+ PROPERTY_LATITUDE,
+ g_variant_new_double (self->priv->latitude));
+
+ return g_variant_ref_sink (g_variant_builder_end (&builder));
+}
+
+/*****************************************************************************/
+
+MMLocationCdmaBs *
+mm_location_cdma_bs_new_from_dictionary (GVariant *dictionary,
+ GError **error)
+{
+ GError *inner_error = NULL;
+ MMLocationCdmaBs *self;
+ GVariantIter iter;
+ gchar *key;
+ GVariant *value;
+
+ self = mm_location_cdma_bs_new ();
+ if (!dictionary)
+ return self;
+
+ 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 CDMA BS location from dictionary: "
+ "invalid variant type received");
+ g_object_unref (self);
+ return NULL;
+ }
+
+ g_variant_iter_init (&iter, dictionary);
+ while (!inner_error &&
+ g_variant_iter_next (&iter, "{sv}", &key, &value)) {
+ if (g_str_equal (key, PROPERTY_LONGITUDE))
+ self->priv->longitude = g_variant_get_double (value);
+ else if (g_str_equal (key, PROPERTY_LATITUDE))
+ self->priv->latitude = g_variant_get_double (value);
+ g_free (key);
+ g_variant_unref (value);
+ }
+
+ /* If any of the mandatory parameters is missing, cleanup */
+ if (self->priv->longitude == MM_LOCATION_LONGITUDE_UNKNOWN ||
+ self->priv->latitude == MM_LOCATION_LATITUDE_UNKNOWN) {
+ g_set_error (error,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_INVALID_ARGS,
+ "Cannot create CDMA BS location from dictionary: "
+ "mandatory parameters missing "
+ "(longitude: %s, latitude: %s)",
+ (self->priv->longitude != MM_LOCATION_LONGITUDE_UNKNOWN) ? "yes" : "missing",
+ (self->priv->latitude != MM_LOCATION_LATITUDE_UNKNOWN) ? "yes" : "missing");
+ g_clear_object (&self);
+ }
+
+ return self;
+}
+
+/*****************************************************************************/
+
+MMLocationCdmaBs *
+mm_location_cdma_bs_new (void)
+{
+ return (MM_LOCATION_CDMA_BS (
+ g_object_new (MM_TYPE_LOCATION_CDMA_BS, NULL)));
+}
+
+static void
+mm_location_cdma_bs_init (MMLocationCdmaBs *self)
+{
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self),
+ MM_TYPE_LOCATION_CDMA_BS,
+ MMLocationCdmaBsPrivate);
+
+ self->priv->latitude = MM_LOCATION_LATITUDE_UNKNOWN;
+ self->priv->longitude = MM_LOCATION_LONGITUDE_UNKNOWN;
+}
+
+static void
+mm_location_cdma_bs_class_init (MMLocationCdmaBsClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (object_class, sizeof (MMLocationCdmaBsPrivate));
+}
diff --git a/libmm-glib/mm-location-cdma-bs.h b/libmm-glib/mm-location-cdma-bs.h
new file mode 100644
index 00000000..ca34e2fc
--- /dev/null
+++ b/libmm-glib/mm-location-cdma-bs.h
@@ -0,0 +1,84 @@
+/* -*- 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 Lanedo GmbH <aleksander@lanedo.com>
+ */
+
+#ifndef MM_LOCATION_CDMA_BS_H
+#define MM_LOCATION_CDMA_BS_H
+
+#if !defined (__LIBMM_GLIB_H_INSIDE__) && !defined (LIBMM_GLIB_COMPILATION)
+#error "Only <libmm-glib.h> can be included directly."
+#endif
+
+#include <ModemManager.h>
+#include <glib-object.h>
+
+#include "mm-location-common.h"
+
+G_BEGIN_DECLS
+
+#define MM_TYPE_LOCATION_CDMA_BS (mm_location_cdma_bs_get_type ())
+#define MM_LOCATION_CDMA_BS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_LOCATION_CDMA_BS, MMLocationCdmaBs))
+#define MM_LOCATION_CDMA_BS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_LOCATION_CDMA_BS, MMLocationCdmaBsClass))
+#define MM_IS_LOCATION_CDMA_BS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_LOCATION_CDMA_BS))
+#define MM_IS_LOCATION_CDMA_BS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_LOCATION_CDMA_BS))
+#define MM_LOCATION_CDMA_BS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_LOCATION_CDMA_BS, MMLocationCdmaBsClass))
+
+typedef struct _MMLocationCdmaBs MMLocationCdmaBs;
+typedef struct _MMLocationCdmaBsClass MMLocationCdmaBsClass;
+typedef struct _MMLocationCdmaBsPrivate MMLocationCdmaBsPrivate;
+
+/**
+ * MMLocationCdmaBs:
+ *
+ * The #MMLocationCdmaBs structure contains private data and should
+ * only be accessed using the provided API.
+ */
+struct _MMLocationCdmaBs {
+ /*< private >*/
+ GObject parent;
+ MMLocationCdmaBsPrivate *priv;
+};
+
+struct _MMLocationCdmaBsClass {
+ /*< private >*/
+ GObjectClass parent;
+};
+
+GType mm_location_cdma_bs_get_type (void);
+
+gdouble mm_location_cdma_bs_get_longitude (MMLocationCdmaBs *self);
+gdouble mm_location_cdma_bs_get_latitude (MMLocationCdmaBs *self);
+
+/*****************************************************************************/
+/* ModemManager/libmm-glib/mmcli specific methods */
+
+#if defined (_LIBMM_INSIDE_MM) || \
+ defined (_LIBMM_INSIDE_MMCLI) || \
+ defined (LIBMM_GLIB_COMPILATION)
+
+MMLocationCdmaBs *mm_location_cdma_bs_new (void);
+MMLocationCdmaBs *mm_location_cdma_bs_new_from_dictionary (GVariant *string,
+ GError **error);
+
+gboolean mm_location_cdma_bs_set (MMLocationCdmaBs *self,
+ gdouble longitude,
+ gdouble latitude);
+
+GVariant *mm_location_cdma_bs_get_dictionary (MMLocationCdmaBs *self);
+
+#endif
+
+G_END_DECLS
+
+#endif /* MM_LOCATION_CDMA_BS_H */
diff --git a/libmm-glib/mm-modem-location.c b/libmm-glib/mm-modem-location.c
index f77dcf58..1e5541a7 100644
--- a/libmm-glib/mm-modem-location.c
+++ b/libmm-glib/mm-modem-location.c
@@ -230,6 +230,7 @@ build_locations (GVariant *dictionary,
MMLocation3gpp **location_3gpp,
MMLocationGpsNmea **location_gps_nmea,
MMLocationGpsRaw **location_gps_raw,
+ MMLocationCdmaBs **location_cdma_bs,
GError **error)
{
GError *inner_error = NULL;
@@ -257,6 +258,10 @@ build_locations (GVariant *dictionary,
if (location_gps_raw)
*location_gps_raw = mm_location_gps_raw_new_from_dictionary (value, &inner_error);
break;
+ case MM_MODEM_LOCATION_SOURCE_CDMA_BS:
+ if (location_cdma_bs)
+ *location_cdma_bs = mm_location_cdma_bs_new_from_dictionary (value, &inner_error);
+ break;
default:
g_warn_if_reached ();
break;
@@ -283,6 +288,7 @@ build_locations (GVariant *dictionary,
* @location_3gpp: (out) (allow-none) (transfer full): Return location for a #MMLocation3gpp if 3GPP location is requested, or #NULL if not required. The returned value should be freed with g_object_unref().
* @location_gps_nmea: (out) (allow-none) (transfer full): Return location for a #MMLocationGpsNmea if GPS NMEA location is requested, or #NULL if not required. The returned value should be freed with g_object_unref().
* @location_gps_raw: (out) (allow-none) (transfer full): Return location for a #MMLocationGpsRaw if GPS raw location is requested, or #NULL if not required. The returned value should be freed with g_object_unref().
+ * @location_cdma_bs: (out) (allow-none) (transfer full): Return location for a #MMLocationCdmaBs if CDMA Base Station location is requested, or #NULL if not required. The returned value should be freed with g_object_unref().
* @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_modem_location_get_full().
* @error: Return location for error or %NULL.
*
@@ -296,6 +302,7 @@ mm_modem_location_get_full_finish (MMModemLocation *self,
MMLocation3gpp **location_3gpp,
MMLocationGpsNmea **location_gps_nmea,
MMLocationGpsRaw **location_gps_raw,
+ MMLocationCdmaBs **location_cdma_bs,
GError **error)
{
GVariant *dictionary = NULL;
@@ -305,7 +312,7 @@ mm_modem_location_get_full_finish (MMModemLocation *self,
if (!mm_gdbus_modem_location_call_get_location_finish (MM_GDBUS_MODEM_LOCATION (self), &dictionary, res, error))
return FALSE;
- return build_locations (dictionary, location_3gpp, location_gps_nmea, location_gps_raw, error);
+ return build_locations (dictionary, location_3gpp, location_gps_nmea, location_gps_raw, location_cdma_bs, error);
}
/**
@@ -342,6 +349,7 @@ mm_modem_location_get_full (MMModemLocation *self,
* @location_3gpp: (out) (allow-none) (transfer full): Return location for a #MMLocation3gpp if 3GPP location is requested, or #NULL if not required. The returned value should be freed with g_object_unref().
* @location_gps_nmea: (out) (allow-none) (transfer full): Return location for a #MMLocationGpsNmea if GPS NMEA location is requested, or #NULL if not required. The returned value should be freed with g_object_unref().
* @location_gps_raw: (out) (allow-none) (transfer full): Return location for a #MMLocationGpsRaw if GPS raw location is requested, or #NULL if not required. The returned value should be freed with g_object_unref().
+ * @location_cdma_bs: (out) (allow-none) (transfer full): Return location for a #MMLocationCdmaBs if CDMA Base Station location is requested, or #NULL if not required. The returned value should be freed with g_object_unref().
* @cancellable: (allow-none): A #GCancellable or %NULL.
* @error: Return location for error or %NULL.
*
@@ -357,6 +365,7 @@ mm_modem_location_get_full_sync (MMModemLocation *self,
MMLocation3gpp **location_3gpp,
MMLocationGpsNmea **location_gps_nmea,
MMLocationGpsRaw **location_gps_raw,
+ MMLocationCdmaBs **location_cdma_bs,
GCancellable *cancellable,
GError **error)
{
@@ -367,7 +376,7 @@ mm_modem_location_get_full_sync (MMModemLocation *self,
if (!mm_gdbus_modem_location_call_get_location_sync (MM_GDBUS_MODEM_LOCATION (self), &dictionary, cancellable, error))
return FALSE;
- return build_locations (dictionary, location_3gpp, location_gps_nmea, location_gps_raw, error);
+ return build_locations (dictionary, location_3gpp, location_gps_nmea, location_gps_raw, location_cdma_bs, error);
}
/*****************************************************************************/
@@ -389,7 +398,7 @@ mm_modem_location_get_3gpp_finish (MMModemLocation *self,
{
MMLocation3gpp *location = NULL;
- mm_modem_location_get_full_finish (self, res, &location, NULL, NULL, error);
+ mm_modem_location_get_full_finish (self, res, &location, NULL, NULL, NULL, error);
return location;
}
@@ -437,7 +446,7 @@ mm_modem_location_get_3gpp_sync (MMModemLocation *self,
{
MMLocation3gpp *location = NULL;
- mm_modem_location_get_full_sync (self, &location, NULL, NULL, cancellable, error);
+ mm_modem_location_get_full_sync (self, &location, NULL, NULL, NULL, cancellable, error);
return location;
}
@@ -461,7 +470,7 @@ mm_modem_location_get_gps_nmea_finish (MMModemLocation *self,
{
MMLocationGpsNmea *location = NULL;
- mm_modem_location_get_full_finish (self, res, NULL, &location, NULL, error);
+ mm_modem_location_get_full_finish (self, res, NULL, &location, NULL, NULL, error);
return location;
}
@@ -509,7 +518,7 @@ mm_modem_location_get_gps_nmea_sync (MMModemLocation *self,
{
MMLocationGpsNmea *location = NULL;
- mm_modem_location_get_full_sync (self, NULL, &location, NULL, cancellable, error);
+ mm_modem_location_get_full_sync (self, NULL, &location, NULL, NULL, cancellable, error);
return location;
}
@@ -533,7 +542,7 @@ mm_modem_location_get_gps_raw_finish (MMModemLocation *self,
{
MMLocationGpsRaw *location = NULL;
- mm_modem_location_get_full_finish (self, res, NULL, NULL, &location, error);
+ mm_modem_location_get_full_finish (self, res, NULL, NULL, &location, NULL, error);
return location;
}
@@ -581,7 +590,79 @@ mm_modem_location_get_gps_raw_sync (MMModemLocation *self,
{
MMLocationGpsRaw *location = NULL;
- mm_modem_location_get_full_sync (self, NULL, NULL, &location, cancellable, error);
+ mm_modem_location_get_full_sync (self, NULL, NULL, &location, NULL, cancellable, error);
+
+ return location;
+}
+
+/*****************************************************************************/
+
+/**
+ * mm_modem_location_get_cdma_bs_finish:
+ * @self: A #MMModemLocation.
+ * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_modem_location_get_cdma_bs().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes an operation started with mm_modem_location_get_cdma_bs().
+ *
+ * Returns: (transfer full) A #MMLocationCdmaBs, or #NULL if not available. The returned value should be freed with g_object_unref().
+ */
+MMLocationCdmaBs *
+mm_modem_location_get_cdma_bs_finish (MMModemLocation *self,
+ GAsyncResult *res,
+ GError **error)
+{
+ MMLocationCdmaBs *location = NULL;
+
+ mm_modem_location_get_full_finish (self, res, NULL, NULL, NULL, &location, error);
+
+ return location;
+}
+
+/**
+ * mm_modem_location_get_cdma_bs:
+ * @self: A #MMModemLocation.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
+ * @user_data: User data to pass to @callback.
+ *
+ * Asynchronously gets the current CDMA base station location information.
+ *
+ * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
+ * You can then call mm_modem_location_get_cdma_bs_finish() to get the result of the operation.
+ *
+ * See mm_modem_location_get_cdma_bs_sync() for the synchronous, blocking version of this method.
+ */
+void
+mm_modem_location_get_cdma_bs (MMModemLocation *self,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ mm_modem_location_get_full (self, cancellable, callback, user_data);
+}
+
+/**
+ * mm_modem_location_get_cdma_bs_sync:
+ * @self: A #MMModemLocation.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Synchronously gets the current CDMA base station location information.
+ *
+ * The calling thread is blocked until a reply is received. See mm_modem_location_get_cdma_bs()
+ * for the asynchronous version of this method.
+ *
+ * Returns: (transfer full) A #MMLocationCdmaBs, or #NULL if not available. The returned value should be freed with g_object_unref().
+ */
+MMLocationCdmaBs *
+mm_modem_location_get_cdma_bs_sync (MMModemLocation *self,
+ GCancellable *cancellable,
+ GError **error)
+{
+ MMLocationCdmaBs *location = NULL;
+
+ mm_modem_location_get_full_sync (self, NULL, NULL, NULL, &location, cancellable, error);
return location;
}
diff --git a/libmm-glib/mm-modem-location.h b/libmm-glib/mm-modem-location.h
index 7d033454..5f6393da 100644
--- a/libmm-glib/mm-modem-location.h
+++ b/libmm-glib/mm-modem-location.h
@@ -34,6 +34,7 @@
#include "mm-location-3gpp.h"
#include "mm-location-gps-nmea.h"
#include "mm-location-gps-raw.h"
+#include "mm-location-cdma-bs.h"
G_BEGIN_DECLS
@@ -123,6 +124,17 @@ MMLocationGpsRaw *mm_modem_location_get_gps_raw_sync (MMModemLocation *self,
GCancellable *cancellable,
GError **error);
+void mm_modem_location_get_cdma_bs (MMModemLocation *self,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+MMLocationCdmaBs *mm_modem_location_get_cdma_bs_finish (MMModemLocation *self,
+ GAsyncResult *res,
+ GError **error);
+MMLocationCdmaBs *mm_modem_location_get_cdma_bs_sync (MMModemLocation *self,
+ GCancellable *cancellable,
+ GError **error);
+
void mm_modem_location_get_full (MMModemLocation *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
@@ -132,11 +144,13 @@ gboolean mm_modem_location_get_full_finish (MMModemLocation *self,
MMLocation3gpp **location_3gpp,
MMLocationGpsNmea **location_gps_nmea,
MMLocationGpsRaw **location_gps_raw,
+ MMLocationCdmaBs **location_cdma_bs,
GError **error);
gboolean mm_modem_location_get_full_sync (MMModemLocation *self,
MMLocation3gpp **location_3gpp,
MMLocationGpsNmea **location_gps_nmea,
MMLocationGpsRaw **location_gps_raw,
+ MMLocationCdmaBs **location_cdma_bs,
GCancellable *cancellable,
GError **error);