aboutsummaryrefslogtreecommitdiff
path: root/src/mm-iface-modem-voice.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2019-09-23 10:30:43 +0200
committerAleksander Morgado <aleksander@aleksander.es>2019-10-17 08:31:46 +0000
commit657833a40050d1a7fe53b94dd394d0f0ad008f9a (patch)
tree4772ff314e32cab440f009a2eedc5df6e0112495 /src/mm-iface-modem-voice.c
parent7971844318b01851bc9565b8adb9fdbeef686451 (diff)
voice,api: new 'EmergencyOnly' boolean flag
This new flag allows users of the API to know whether general purpose voice calls are allowed or otherwise only voice calls to the registered emergency numbers should be performed. ModemManager won't really do any distinction between emergency and non-emergency calls at this point, this flag is just an early indication for the user of the API that no normal voice call should be attempted.
Diffstat (limited to 'src/mm-iface-modem-voice.c')
-rw-r--r--src/mm-iface-modem-voice.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mm-iface-modem-voice.c b/src/mm-iface-modem-voice.c
index 733facd2..5dc2fec6 100644
--- a/src/mm-iface-modem-voice.c
+++ b/src/mm-iface-modem-voice.c
@@ -2879,6 +2879,20 @@ mm_iface_modem_voice_initialize_finish (MMIfaceModemVoice *self,
return g_task_propagate_boolean (G_TASK (res), error);
}
+static gboolean
+modem_state_to_emergency_only (GBinding *binding,
+ const GValue *from_value,
+ GValue *to_value)
+{
+ MMModemState state;
+
+ /* If the modem is REGISTERED, we allow any kind of call, otherwise
+ * only emergency calls */
+ state = g_value_get_enum (from_value);
+ g_value_set_boolean (to_value, (state < MM_MODEM_STATE_REGISTERED));
+ return TRUE;
+}
+
void
mm_iface_modem_voice_initialize (MMIfaceModemVoice *self,
GCancellable *cancellable,
@@ -2899,6 +2913,12 @@ mm_iface_modem_voice_initialize (MMIfaceModemVoice *self,
g_object_set (self,
MM_IFACE_MODEM_VOICE_DBUS_SKELETON, skeleton,
NULL);
+
+ g_object_bind_property_full (self, MM_IFACE_MODEM_STATE,
+ skeleton, "emergency-only",
+ G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE,
+ (GBindingTransformFunc) modem_state_to_emergency_only,
+ NULL, NULL, NULL);
}
/* Perform async initialization here */