aboutsummaryrefslogtreecommitdiff
path: root/src/mm-iface-modem-location.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2019-03-14 09:22:30 +0100
committerAleksander Morgado <aleksander@gnu.org>2019-04-09 12:24:39 +0000
commitd5dc9751b6e5d8472dec7b4ef076297e1df3d1f1 (patch)
tree41056704ea48548c88e17442f8248c410fc78c2f /src/mm-iface-modem-location.c
parentcaa1f8fdc1ad8c489a5584a4a0c50b1d0ff62f2a (diff)
location,agps: include support for MSB A-GPS
Diffstat (limited to 'src/mm-iface-modem-location.c')
-rw-r--r--src/mm-iface-modem-location.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/mm-iface-modem-location.c b/src/mm-iface-modem-location.c
index 779d2dc1..83915063 100644
--- a/src/mm-iface-modem-location.c
+++ b/src/mm-iface-modem-location.c
@@ -11,7 +11,8 @@
* GNU General Public License for more details:
*
* Copyright (C) 2012 Google, Inc.
- * Copyright (C) 2012 Lanedo GmbH <aleksander@lanedo.com>
+ * Copyright (C) 2012 Lanedo GmbH
+ * Copyright (C) 2012-2019 Aleksander Morgado <aleksander@aleksander.es>
*/
#include <ModemManager.h>
@@ -142,6 +143,8 @@ build_location_dictionary (GVariant *previous,
g_assert_not_reached ();
case MM_MODEM_LOCATION_SOURCE_AGPS_MSA:
g_assert_not_reached ();
+ case MM_MODEM_LOCATION_SOURCE_AGPS_MSB:
+ g_assert_not_reached ();
default:
g_warn_if_reached ();
break;
@@ -507,6 +510,7 @@ update_location_source_status (MMIfaceModemLocation *self,
break;
case MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED:
case MM_MODEM_LOCATION_SOURCE_AGPS_MSA:
+ case MM_MODEM_LOCATION_SOURCE_AGPS_MSB:
/* Nothing to setup in the context */
default:
break;
@@ -765,6 +769,21 @@ setup_gathering (MMIfaceModemLocation *self,
return;
}
+ /* MSA A-GPS and MSB A-GPS cannot be set at the same time */
+ if ((ctx->to_enable & MM_MODEM_LOCATION_SOURCE_AGPS_MSA &&
+ currently_enabled & MM_MODEM_LOCATION_SOURCE_AGPS_MSB) ||
+ (ctx->to_enable & MM_MODEM_LOCATION_SOURCE_AGPS_MSB &&
+ currently_enabled & MM_MODEM_LOCATION_SOURCE_AGPS_MSA) ||
+ (ctx->to_enable & MM_MODEM_LOCATION_SOURCE_AGPS_MSA &&
+ ctx->to_enable & MM_MODEM_LOCATION_SOURCE_AGPS_MSB)) {
+ g_task_return_new_error (task,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_FAILED,
+ "Cannot have both MSA A-GPS and MSB A-GPS enabled at the same time");
+ g_object_unref (task);
+ return;
+ }
+
if (ctx->to_enable != MM_MODEM_LOCATION_SOURCE_NONE) {
str = mm_modem_location_source_build_string_from_mask (ctx->to_enable);
mm_dbg ("Need to enable the following location sources: '%s'", str);
@@ -982,7 +1001,7 @@ handle_set_supl_server_auth_ready (MMBaseModem *self,
}
/* If A-GPS is NOT supported, set error */
- if (!(mm_gdbus_modem_location_get_capabilities (ctx->skeleton) & MM_MODEM_LOCATION_SOURCE_AGPS_MSA)) {
+ if (!(mm_gdbus_modem_location_get_capabilities (ctx->skeleton) & (MM_MODEM_LOCATION_SOURCE_AGPS_MSA | MM_MODEM_LOCATION_SOURCE_AGPS_MSB))) {
g_dbus_method_invocation_return_error (ctx->invocation,
MM_CORE_ERROR,
MM_CORE_ERROR_UNSUPPORTED,
@@ -1496,7 +1515,8 @@ interface_enabling_step (GTask *task)
default_sources &= ~(MM_MODEM_LOCATION_SOURCE_GPS_RAW |
MM_MODEM_LOCATION_SOURCE_GPS_NMEA |
MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED |
- MM_MODEM_LOCATION_SOURCE_AGPS_MSA);
+ MM_MODEM_LOCATION_SOURCE_AGPS_MSA |
+ MM_MODEM_LOCATION_SOURCE_AGPS_MSB);
setup_gathering (self,
default_sources,
@@ -1723,7 +1743,8 @@ interface_initialization_step (GTask *task)
case INITIALIZATION_STEP_SUPL_SERVER:
/* If the modem supports A-GPS, load SUPL server */
- if (ctx->capabilities & MM_MODEM_LOCATION_SOURCE_AGPS_MSA &&
+ if ((ctx->capabilities & (MM_MODEM_LOCATION_SOURCE_AGPS_MSA |
+ MM_MODEM_LOCATION_SOURCE_AGPS_MSB)) &&
MM_IFACE_MODEM_LOCATION_GET_INTERFACE (self)->load_supl_server &&
MM_IFACE_MODEM_LOCATION_GET_INTERFACE (self)->load_supl_server_finish) {
MM_IFACE_MODEM_LOCATION_GET_INTERFACE (self)->load_supl_server (
@@ -1738,6 +1759,7 @@ interface_initialization_step (GTask *task)
case INITIALIZATION_STEP_SUPPORTED_ASSISTANCE_DATA:
/* If the modem supports any GPS-related technology, check assistance data types supported */
if ((ctx->capabilities & (MM_MODEM_LOCATION_SOURCE_AGPS_MSA |
+ MM_MODEM_LOCATION_SOURCE_AGPS_MSB |
MM_MODEM_LOCATION_SOURCE_GPS_RAW |
MM_MODEM_LOCATION_SOURCE_GPS_NMEA)) &&
MM_IFACE_MODEM_LOCATION_GET_INTERFACE (self)->load_supported_assistance_data &&