cli,location: allow enabling/disabling A-GPS

This commit is contained in:
Aleksander Morgado
2014-02-06 12:04:35 +01:00
parent 9dc5cdf78e
commit 72f4aa75d7

View File

@@ -49,6 +49,8 @@ static gboolean status_flag;
static gboolean enable_3gpp_flag;
static gboolean disable_3gpp_flag;
static gboolean get_3gpp_flag;
static gboolean enable_agps_flag;
static gboolean disable_agps_flag;
static gboolean enable_gps_nmea_flag;
static gboolean disable_gps_nmea_flag;
static gboolean get_gps_nmea_flag;
@@ -84,6 +86,14 @@ static GOptionEntry entries[] = {
"Get 3GPP-based location.",
NULL
},
{ "location-enable-agps", 0, 0, G_OPTION_ARG_NONE, &enable_agps_flag,
"Enable A-GPS location gathering.",
NULL
},
{ "location-disable-agps", 0, 0, G_OPTION_ARG_NONE, &disable_agps_flag,
"Disable 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
@@ -160,6 +170,7 @@ mmcli_modem_location_options_enabled (void)
return !!n_actions;
if ((enable_3gpp_flag && disable_3gpp_flag) ||
(enable_agps_flag && disable_agps_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) ||
@@ -178,6 +189,8 @@ mmcli_modem_location_options_enabled (void)
n_actions = (status_flag +
!!(enable_3gpp_flag +
disable_3gpp_flag +
enable_agps_flag +
disable_agps_flag +
enable_gps_nmea_flag +
disable_gps_nmea_flag +
enable_gps_raw_flag +
@@ -339,6 +352,11 @@ build_sources_from_flags (void)
if (disable_3gpp_flag)
sources &= ~MM_MODEM_LOCATION_SOURCE_3GPP_LAC_CI;
if (enable_agps_flag)
sources |= MM_MODEM_LOCATION_SOURCE_AGPS;
if (disable_agps_flag)
sources &= ~MM_MODEM_LOCATION_SOURCE_AGPS;
if (enable_gps_nmea_flag)
sources |= MM_MODEM_LOCATION_SOURCE_GPS_NMEA;
if (disable_gps_nmea_flag)
@@ -525,6 +543,8 @@ get_modem_ready (GObject *source,
/* Request to setup location gathering? */
if (enable_3gpp_flag ||
disable_3gpp_flag ||
enable_agps_flag ||
disable_agps_flag ||
enable_gps_nmea_flag ||
disable_gps_nmea_flag ||
enable_gps_raw_flag ||
@@ -615,6 +635,8 @@ mmcli_modem_location_run_synchronous (GDBusConnection *connection)
/* Request to setup location gathering? */
if (enable_3gpp_flag ||
disable_3gpp_flag ||
enable_agps_flag ||
disable_agps_flag ||
enable_gps_nmea_flag ||
disable_gps_nmea_flag ||
enable_gps_raw_flag ||