iface-modem-location: allow enabling unmanaged gps even if raw/nmea enabled
But only if the plugin implementation allows to do so.
This commit is contained in:
committed by
Aleksander Morgado
parent
5bbcfa8318
commit
a0cb8b4dd5
@@ -114,6 +114,7 @@ enum {
|
||||
PROP_MODEM_MESSAGING_SMS_LIST,
|
||||
PROP_MODEM_MESSAGING_SMS_PDU_MODE,
|
||||
PROP_MODEM_MESSAGING_SMS_DEFAULT_STORAGE,
|
||||
PROP_MODEM_LOCATION_ALLOW_GPS_UNMANAGED_ALWAYS,
|
||||
PROP_MODEM_VOICE_CALL_LIST,
|
||||
PROP_MODEM_SIMPLE_STATUS,
|
||||
PROP_MODEM_SIM_HOT_SWAP_SUPPORTED,
|
||||
@@ -203,6 +204,7 @@ struct _MMBroadbandModemPrivate {
|
||||
/*<--- Modem Location interface --->*/
|
||||
/* Properties */
|
||||
GObject *modem_location_dbus_skeleton;
|
||||
gboolean modem_location_allow_gps_unmanaged_always;
|
||||
|
||||
/*<--- Modem Messaging interface --->*/
|
||||
/* Properties */
|
||||
@@ -11167,6 +11169,9 @@ set_property (GObject *object,
|
||||
case PROP_MODEM_MESSAGING_SMS_DEFAULT_STORAGE:
|
||||
self->priv->modem_messaging_sms_default_storage = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_MODEM_LOCATION_ALLOW_GPS_UNMANAGED_ALWAYS:
|
||||
self->priv->modem_location_allow_gps_unmanaged_always = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_MODEM_VOICE_CALL_LIST:
|
||||
g_clear_object (&self->priv->modem_voice_call_list);
|
||||
self->priv->modem_voice_call_list = g_value_dup_object (value);
|
||||
@@ -11286,6 +11291,9 @@ get_property (GObject *object,
|
||||
case PROP_MODEM_MESSAGING_SMS_DEFAULT_STORAGE:
|
||||
g_value_set_enum (value, self->priv->modem_messaging_sms_default_storage);
|
||||
break;
|
||||
case PROP_MODEM_LOCATION_ALLOW_GPS_UNMANAGED_ALWAYS:
|
||||
g_value_set_boolean (value, self->priv->modem_location_allow_gps_unmanaged_always);
|
||||
break;
|
||||
case PROP_MODEM_VOICE_CALL_LIST:
|
||||
g_value_set_object (value, self->priv->modem_voice_call_list);
|
||||
break;
|
||||
@@ -11809,6 +11817,10 @@ mm_broadband_modem_class_init (MMBroadbandModemClass *klass)
|
||||
PROP_MODEM_MESSAGING_SMS_DEFAULT_STORAGE,
|
||||
MM_IFACE_MODEM_MESSAGING_SMS_DEFAULT_STORAGE);
|
||||
|
||||
g_object_class_override_property (object_class,
|
||||
PROP_MODEM_LOCATION_ALLOW_GPS_UNMANAGED_ALWAYS,
|
||||
MM_IFACE_MODEM_LOCATION_ALLOW_GPS_UNMANAGED_ALWAYS);
|
||||
|
||||
g_object_class_override_property (object_class,
|
||||
PROP_MODEM_VOICE_CALL_LIST,
|
||||
MM_IFACE_MODEM_VOICE_CALL_LIST);
|
||||
|
||||
@@ -692,6 +692,7 @@ setup_gathering (MMIfaceModemLocation *self,
|
||||
MMModemLocationSource currently_enabled;
|
||||
MMModemLocationSource source;
|
||||
gchar *str;
|
||||
gboolean allow_gps_unmanaged_always = FALSE;
|
||||
|
||||
ctx = g_new (SetupGatheringContext, 1);
|
||||
|
||||
@@ -699,7 +700,8 @@ setup_gathering (MMIfaceModemLocation *self,
|
||||
g_task_set_task_data (task, ctx, (GDestroyNotify)setup_gathering_context_free);
|
||||
|
||||
g_object_get (self,
|
||||
MM_IFACE_MODEM_LOCATION_DBUS_SKELETON, &ctx->skeleton,
|
||||
MM_IFACE_MODEM_LOCATION_DBUS_SKELETON, &ctx->skeleton,
|
||||
MM_IFACE_MODEM_LOCATION_ALLOW_GPS_UNMANAGED_ALWAYS, &allow_gps_unmanaged_always,
|
||||
NULL);
|
||||
if (!ctx->skeleton) {
|
||||
g_task_return_new_error (task,
|
||||
@@ -745,13 +747,16 @@ setup_gathering (MMIfaceModemLocation *self,
|
||||
}
|
||||
|
||||
/* When standard GPS retrieval (RAW/NMEA) is enabled, we cannot enable the
|
||||
* UNMANAGED setup, and viceversa. */
|
||||
if ((ctx->to_enable & MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED &&
|
||||
currently_enabled & (MM_MODEM_LOCATION_SOURCE_GPS_RAW | MM_MODEM_LOCATION_SOURCE_GPS_NMEA)) ||
|
||||
(ctx->to_enable & (MM_MODEM_LOCATION_SOURCE_GPS_RAW | MM_MODEM_LOCATION_SOURCE_GPS_NMEA) &&
|
||||
currently_enabled & MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED) ||
|
||||
(ctx->to_enable & (MM_MODEM_LOCATION_SOURCE_GPS_RAW | MM_MODEM_LOCATION_SOURCE_GPS_NMEA) &&
|
||||
ctx->to_enable & MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED)) {
|
||||
* UNMANAGED setup, and viceversa, unless explicitly allowed to do so by the
|
||||
* plugin implementation (e.g. if the RAW/NMEA sources don't use the same TTY
|
||||
* as the GPS UNMANAGED setup. */
|
||||
if (!allow_gps_unmanaged_always &&
|
||||
((ctx->to_enable & MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED &&
|
||||
currently_enabled & (MM_MODEM_LOCATION_SOURCE_GPS_RAW | MM_MODEM_LOCATION_SOURCE_GPS_NMEA)) ||
|
||||
(ctx->to_enable & (MM_MODEM_LOCATION_SOURCE_GPS_RAW | MM_MODEM_LOCATION_SOURCE_GPS_NMEA) &&
|
||||
currently_enabled & MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED) ||
|
||||
(ctx->to_enable & (MM_MODEM_LOCATION_SOURCE_GPS_RAW | MM_MODEM_LOCATION_SOURCE_GPS_NMEA) &&
|
||||
ctx->to_enable & MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED))) {
|
||||
g_task_return_new_error (task,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_FAILED,
|
||||
@@ -1887,6 +1892,14 @@ iface_modem_location_init (gpointer g_iface)
|
||||
MM_GDBUS_TYPE_MODEM_LOCATION_SKELETON,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_interface_install_property
|
||||
(g_iface,
|
||||
g_param_spec_boolean (MM_IFACE_MODEM_LOCATION_ALLOW_GPS_UNMANAGED_ALWAYS,
|
||||
"Allow unmanaged GPS always",
|
||||
"Whether to always allow GPS unmanaged, even when raw/nmea GPS sources are enabled",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
initialized = TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
#define MM_IS_IFACE_MODEM_LOCATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_IFACE_MODEM_LOCATION))
|
||||
#define MM_IFACE_MODEM_LOCATION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MM_TYPE_IFACE_MODEM_LOCATION, MMIfaceModemLocation))
|
||||
|
||||
#define MM_IFACE_MODEM_LOCATION_DBUS_SKELETON "iface-modem-location-dbus-skeleton"
|
||||
#define MM_IFACE_MODEM_LOCATION_DBUS_SKELETON "iface-modem-location-dbus-skeleton"
|
||||
#define MM_IFACE_MODEM_LOCATION_ALLOW_GPS_UNMANAGED_ALWAYS "iface-modem-location-allow-gps-unmanaged-always"
|
||||
|
||||
typedef struct _MMIfaceModemLocation MMIfaceModemLocation;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user