location,agps: include support for MSB A-GPS
This commit is contained in:

committed by
Aleksander Morgado

parent
caa1f8fdc1
commit
d5dc9751b6
@@ -16,7 +16,8 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 "config.h"
|
||||
@@ -51,6 +52,8 @@ static gboolean enable_3gpp_flag;
|
||||
static gboolean disable_3gpp_flag;
|
||||
static gboolean enable_agps_msa_flag;
|
||||
static gboolean disable_agps_msa_flag;
|
||||
static gboolean enable_agps_msb_flag;
|
||||
static gboolean disable_agps_msb_flag;
|
||||
static gboolean enable_gps_nmea_flag;
|
||||
static gboolean disable_gps_nmea_flag;
|
||||
static gboolean enable_gps_raw_flag;
|
||||
@@ -91,6 +94,14 @@ static GOptionEntry entries[] = {
|
||||
"Disable MSA A-GPS location gathering.",
|
||||
NULL
|
||||
},
|
||||
{ "location-enable-agps-msb", 0, 0, G_OPTION_ARG_NONE, &enable_agps_msb_flag,
|
||||
"Enable MSB A-GPS location gathering.",
|
||||
NULL
|
||||
},
|
||||
{ "location-disable-agps-msb", 0, 0, G_OPTION_ARG_NONE, &disable_agps_msb_flag,
|
||||
"Disable MSB A-GPS location gathering.",
|
||||
NULL
|
||||
},
|
||||
{ "location-enable-gps-nmea", 0, 0, G_OPTION_ARG_NONE, &enable_gps_nmea_flag,
|
||||
"Enable NMEA-based GPS location gathering.",
|
||||
NULL
|
||||
@@ -164,6 +175,7 @@ mmcli_modem_location_get_option_group (void)
|
||||
#define any_location_setup_flag ( \
|
||||
enable_3gpp_flag || disable_3gpp_flag || \
|
||||
enable_agps_msa_flag || disable_agps_msa_flag || \
|
||||
enable_agps_msb_flag || disable_agps_msb_flag || \
|
||||
enable_gps_nmea_flag || disable_gps_nmea_flag || \
|
||||
enable_gps_raw_flag || disable_gps_raw_flag || \
|
||||
enable_cdma_bs_flag || disable_cdma_bs_flag || \
|
||||
@@ -181,6 +193,7 @@ mmcli_modem_location_options_enabled (void)
|
||||
|
||||
if ((enable_3gpp_flag && disable_3gpp_flag) ||
|
||||
(enable_agps_msa_flag && disable_agps_msa_flag) ||
|
||||
(enable_agps_msb_flag && disable_agps_msb_flag) ||
|
||||
(enable_gps_nmea_flag && disable_gps_nmea_flag) ||
|
||||
(enable_gps_raw_flag && disable_gps_raw_flag) ||
|
||||
(enable_gps_unmanaged_flag && disable_gps_unmanaged_flag) ||
|
||||
@@ -276,7 +289,7 @@ print_location_status (void)
|
||||
gps_refresh_rate = g_strdup_printf ("%u", rate);
|
||||
|
||||
/* If A-GPS supported, show SUPL server setup */
|
||||
if (mm_modem_location_get_capabilities (ctx->modem_location) & MM_MODEM_LOCATION_SOURCE_AGPS_MSA)
|
||||
if (mm_modem_location_get_capabilities (ctx->modem_location) & (MM_MODEM_LOCATION_SOURCE_AGPS_MSA | MM_MODEM_LOCATION_SOURCE_AGPS_MSB))
|
||||
gps_supl_server = mm_modem_location_get_supl_server (ctx->modem_location);
|
||||
|
||||
mask = mm_modem_location_get_supported_assistance_data (ctx->modem_location);
|
||||
@@ -452,6 +465,11 @@ build_sources_from_flags (void)
|
||||
if (disable_agps_msa_flag)
|
||||
sources &= ~MM_MODEM_LOCATION_SOURCE_AGPS_MSA;
|
||||
|
||||
if (enable_agps_msb_flag)
|
||||
sources |= MM_MODEM_LOCATION_SOURCE_AGPS_MSB;
|
||||
if (disable_agps_msb_flag)
|
||||
sources &= ~MM_MODEM_LOCATION_SOURCE_AGPS_MSB;
|
||||
|
||||
if (enable_gps_nmea_flag)
|
||||
sources |= MM_MODEM_LOCATION_SOURCE_GPS_NMEA;
|
||||
if (disable_gps_nmea_flag)
|
||||
|
@@ -400,6 +400,16 @@ or NMEA outputs are enabled with \fB\-\-location\-enable\-gps\-raw\fR or
|
||||
.B \-\-location\-disable\-agps-msa
|
||||
Disable A-GPS (MSA) support.
|
||||
.TP
|
||||
.B \-\-location\-enable\-agps-msb
|
||||
Enable A-GPS (MSB) support. This command does not implicitly start the GPS
|
||||
engine, it just specifies that A-GPS should be enabled when the engine is
|
||||
started. Therefore, the user should request enabling A-GPS before the raw
|
||||
or NMEA outputs are enabled with \fB\-\-location\-enable\-gps\-raw\fR or
|
||||
\fB\-\-location\-enable\-gps\-nmea\fR.
|
||||
.TP
|
||||
.B \-\-location\-disable\-agps-msb
|
||||
Disable A-GPS (MSB) support.
|
||||
.TP
|
||||
.B \-\-location\-enable\-gps\-nmea
|
||||
Enable location discovery using GPS and reported with NMEA traces.
|
||||
|
||||
@@ -893,7 +903,7 @@ to start the GPS engine.
|
||||
.Bd -literal -compact
|
||||
$ mmcli -m 0 --location-status
|
||||
--------------------------------
|
||||
Location | capabilities: 3gpp-lac-ci, gps-raw, gps-nmea, agps-msa
|
||||
Location | capabilities: 3gpp-lac-ci, gps-raw, gps-nmea, agps-msa, agps-msb
|
||||
| enabled: 3gpp-lac-ci
|
||||
| signals: no
|
||||
-----------------------------
|
||||
@@ -924,7 +934,7 @@ XTRA assistance data is usually valid for several days.
|
||||
.Bd -literal -compact
|
||||
$ mmcli -m 0 --location-status
|
||||
--------------------------------
|
||||
Location | capabilities: 3gpp-lac-ci, gps-raw, gps-nmea, agps-msa
|
||||
Location | capabilities: 3gpp-lac-ci, gps-raw, gps-nmea, agps-msa, agps-msb
|
||||
| enabled: 3gpp-lac-ci
|
||||
| signals: no
|
||||
--------------------------------
|
||||
|
@@ -929,6 +929,7 @@ typedef enum { /*< underscore_name=mm_sms_cdma_service_category >*/
|
||||
* @MM_MODEM_LOCATION_SOURCE_CDMA_BS: CDMA base station position.
|
||||
* @MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED: No location given, just GPS module setup.
|
||||
* @MM_MODEM_LOCATION_SOURCE_AGPS_MSA: Mobile Station Assisted A-GPS location requested. Since 1.12.
|
||||
* @MM_MODEM_LOCATION_SOURCE_AGPS_MSB: Mobile Station Based A-GPS location requested. Since 1.12.
|
||||
*
|
||||
* Sources of location information supported by the modem.
|
||||
*/
|
||||
@@ -940,10 +941,11 @@ typedef enum { /*< underscore_name=mm_modem_location_source >*/
|
||||
MM_MODEM_LOCATION_SOURCE_CDMA_BS = 1 << 3,
|
||||
MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED = 1 << 4,
|
||||
MM_MODEM_LOCATION_SOURCE_AGPS_MSA = 1 << 5,
|
||||
MM_MODEM_LOCATION_SOURCE_AGPS_MSB = 1 << 6,
|
||||
#if defined (MM_COMPILATION)
|
||||
/* MM internal methods, not part of the API */
|
||||
MM_MODEM_LOCATION_SOURCE_FIRST = MM_MODEM_LOCATION_SOURCE_3GPP_LAC_CI, /*< skip >*/
|
||||
MM_MODEM_LOCATION_SOURCE_LAST = MM_MODEM_LOCATION_SOURCE_AGPS_MSA, /*< skip >*/
|
||||
MM_MODEM_LOCATION_SOURCE_LAST = MM_MODEM_LOCATION_SOURCE_AGPS_MSB, /*< skip >*/
|
||||
#endif
|
||||
} MMModemLocationSource;
|
||||
|
||||
|
@@ -48,11 +48,19 @@
|
||||
|
||||
The optional
|
||||
<link linkend="MM-MODEM-LOCATION-SOURCE-AGPS:CAPS">MM_MODEM_LOCATION_SOURCE_AGPS_MSA</link>
|
||||
allows to request MSA A-GPS operation, and it must be given along with either
|
||||
and
|
||||
<link linkend="MM-MODEM-LOCATION-SOURCE-AGPS:CAPS">MM_MODEM_LOCATION_SOURCE_AGPS_MSB</link>
|
||||
allow to request MSA/MSB A-GPS operation, and they must be given along with either
|
||||
<link linkend="MM-MODEM-LOCATION-SOURCE-GPS-RAW:CAPS">MM_MODEM_LOCATION_SOURCE_GPS_RAW</link>
|
||||
or
|
||||
<link linkend="MM-MODEM-LOCATION-SOURCE-GPS-NMEA:CAPS">MM_MODEM_LOCATION_SOURCE_GPS_NMEA</link>.
|
||||
|
||||
Both
|
||||
<link linkend="MM-MODEM-LOCATION-SOURCE-AGPS:CAPS">MM_MODEM_LOCATION_SOURCE_AGPS_MSA</link>
|
||||
and
|
||||
<link linkend="MM-MODEM-LOCATION-SOURCE-AGPS:CAPS">MM_MODEM_LOCATION_SOURCE_AGPS_MSB</link>
|
||||
cannot be given at the same time, and if none given, standalone GPS is assumed.
|
||||
|
||||
-->
|
||||
<method name="Setup">
|
||||
<arg name="sources" type="u" direction="in" />
|
||||
|
@@ -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 &&
|
||||
|
Reference in New Issue
Block a user