diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-26 19:24:25 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-29 09:17:53 +0200 |
commit | ceefa2c356ae270c7dda4b5e771d225502d4913d (patch) | |
tree | 5caa9ef50a9d633d00a91a371f165b0af72acd86 /libmm-glib | |
parent | 090e3492095cf6d663bfb3f83b3ed0cb19121f1a (diff) |
location: rework to allow multiple location sources
Location sources can now be enabled or disabled by using the mask of sources
given in Setup() (similar previous Enable()).
Diffstat (limited to 'libmm-glib')
-rw-r--r-- | libmm-glib/mm-modem-location.c | 87 | ||||
-rw-r--r-- | libmm-glib/mm-modem-location.h | 39 |
2 files changed, 47 insertions, 79 deletions
diff --git a/libmm-glib/mm-modem-location.c b/libmm-glib/mm-modem-location.c index c800fa3b..4f88d7ee 100644 --- a/libmm-glib/mm-modem-location.c +++ b/libmm-glib/mm-modem-location.c @@ -18,6 +18,7 @@ * Boston, MA 02110-1301 USA. * * Copyright (C) 2012 Google, Inc. + * Copyright (C) 2012 Lanedo GmbH <aleksander@lanedo.com> */ #include <gio/gio.h> @@ -72,92 +73,64 @@ mm_modem_location_get_capabilities (MMModemLocation *self) return (MMModemLocationSource) mm_gdbus_modem_location_get_capabilities (self); } -gboolean +MMModemLocationSource mm_modem_location_get_enabled (MMModemLocation *self) { g_return_val_if_fail (MM_GDBUS_IS_MODEM_LOCATION (self), FALSE); - return mm_gdbus_modem_location_get_enabled (self); + return (MMModemLocationSource) mm_gdbus_modem_location_get_enabled (self); } gboolean -mm_modem_location_disable_finish (MMModemLocation *self, - GAsyncResult *res, - GError **error) +mm_modem_location_signals_location (MMModemLocation *self) { g_return_val_if_fail (MM_GDBUS_IS_MODEM_LOCATION (self), FALSE); - return mm_gdbus_modem_location_call_enable_finish (self, res, error); -} - -void -mm_modem_location_disable (MMModemLocation *self, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_return_if_fail (MM_GDBUS_IS_MODEM_LOCATION (self)); - - mm_gdbus_modem_location_call_enable (self, - FALSE, - FALSE, - cancellable, - callback, - user_data); + return mm_gdbus_modem_location_get_signals_location (self); } gboolean -mm_modem_location_disable_sync (MMModemLocation *self, - GCancellable *cancellable, +mm_modem_location_setup_finish (MMModemLocation *self, + GAsyncResult *res, GError **error) { g_return_val_if_fail (MM_GDBUS_IS_MODEM_LOCATION (self), FALSE); - return mm_gdbus_modem_location_call_enable_sync (self, - FALSE, - FALSE, - cancellable, - error); -} - -gboolean -mm_modem_location_enable_finish (MMModemLocation *self, - GAsyncResult *res, - GError **error) -{ - g_return_val_if_fail (MM_GDBUS_IS_MODEM_LOCATION (self), FALSE); - - return mm_gdbus_modem_location_call_enable_finish (self, res, error); + return mm_gdbus_modem_location_call_setup_finish (self, res, error); } void -mm_modem_location_enable (MMModemLocation *self, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) +mm_modem_location_setup (MMModemLocation *self, + MMModemLocationSource sources, + gboolean signal_location, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) { g_return_if_fail (MM_GDBUS_IS_MODEM_LOCATION (self)); - mm_gdbus_modem_location_call_enable (self, - TRUE, - FALSE /* signal_location */, - cancellable, - callback, - user_data); + mm_gdbus_modem_location_call_setup (self, + sources, + signal_location, + cancellable, + callback, + user_data); } gboolean -mm_modem_location_enable_sync (MMModemLocation *self, - GCancellable *cancellable, - GError **error) +mm_modem_location_setup_sync (MMModemLocation *self, + MMModemLocationSource sources, + gboolean signal_location, + GCancellable *cancellable, + GError **error) { g_return_val_if_fail (MM_GDBUS_IS_MODEM_LOCATION (self), FALSE); - return mm_gdbus_modem_location_call_enable_sync (self, - TRUE, - FALSE /* signal_location */, - cancellable, - error); + return mm_gdbus_modem_location_call_setup_sync (self, + sources, + signal_location, + cancellable, + error); } static MMLocation3gpp * diff --git a/libmm-glib/mm-modem-location.h b/libmm-glib/mm-modem-location.h index b92040db..216704c0 100644 --- a/libmm-glib/mm-modem-location.h +++ b/libmm-glib/mm-modem-location.h @@ -18,6 +18,7 @@ * Boston, MA 02110-1301 USA. * * Copyright (C) 2012 Google, Inc. + * Copyright (C) 2012 Lanedo GmbH <aleksander@lanedo.com> */ #ifndef _MM_MODEM_LOCATION_H_ @@ -37,29 +38,23 @@ const gchar *mm_modem_location_get_path (MMModemLocation *self); gchar *mm_modem_location_dup_path (MMModemLocation *self); MMModemLocationSource mm_modem_location_get_capabilities (MMModemLocation *self); -gboolean mm_modem_location_get_enabled (MMModemLocation *self); +MMModemLocationSource mm_modem_location_get_enabled (MMModemLocation *self); +gboolean mm_modem_location_signals_location (MMModemLocation *self); -void mm_modem_location_enable (MMModemLocation *self, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); -gboolean mm_modem_location_enable_finish (MMModemLocation *self, - GAsyncResult *res, - GError **error); -gboolean mm_modem_location_enable_sync (MMModemLocation *self, - GCancellable *cancellable, - GError **error); - -void mm_modem_location_disable (MMModemLocation *self, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); -gboolean mm_modem_location_disable_finish (MMModemLocation *self, - GAsyncResult *res, - GError **error); -gboolean mm_modem_location_disable_sync (MMModemLocation *self, - GCancellable *cancellable, - GError **error); +void mm_modem_location_setup (MMModemLocation *self, + MMModemLocationSource sources, + gboolean signal_location, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +gboolean mm_modem_location_setup_finish (MMModemLocation *self, + GAsyncResult *res, + GError **error); +gboolean mm_modem_location_setup_sync (MMModemLocation *self, + MMModemLocationSource sources, + gboolean signal_location, + GCancellable *cancellable, + GError **error); void mm_modem_location_get_3gpp (MMModemLocation *self, GCancellable *cancellable, |