aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/mmcli-modem-voice.c28
-rw-r--r--cli/mmcli-output.c2
-rw-r--r--cli/mmcli-output.h3
-rw-r--r--docs/reference/libmm-glib/libmm-glib-sections.txt3
-rw-r--r--introspection/org.freedesktop.ModemManager1.Modem.Voice.xml10
-rw-r--r--libmm-glib/mm-modem-voice.c14
-rw-r--r--libmm-glib/mm-modem-voice.h5
-rw-r--r--src/mm-iface-modem-voice.c20
8 files changed, 82 insertions, 3 deletions
diff --git a/cli/mmcli-modem-voice.c b/cli/mmcli-modem-voice.c
index 9e54f8ea..878984b3 100644
--- a/cli/mmcli-modem-voice.c
+++ b/cli/mmcli-modem-voice.c
@@ -47,6 +47,7 @@ typedef struct {
static Context *ctx;
/* Options */
+static gboolean status_flag;
static gboolean list_flag;
static gchar *create_str;
static gchar *delete_str;
@@ -59,6 +60,10 @@ static gboolean call_waiting_disable_flag;
static gboolean call_waiting_query_flag;
static GOptionEntry entries[] = {
+ { "voice-status", 0, 0, G_OPTION_ARG_NONE, &status_flag,
+ "Show status of voice support.",
+ NULL
+ },
{ "voice-list-calls", 0, 0, G_OPTION_ARG_NONE, &list_flag,
"List calls available in a given modem",
NULL
@@ -126,7 +131,8 @@ mmcli_modem_voice_options_enabled (void)
if (checked)
return !!n_actions;
- n_actions = (list_flag +
+ n_actions = (status_flag +
+ list_flag +
!!create_str +
!!delete_str +
hold_and_accept_flag +
@@ -142,6 +148,9 @@ mmcli_modem_voice_options_enabled (void)
exit (EXIT_FAILURE);
}
+ if (status_flag)
+ mmcli_force_sync_operation ();
+
checked = TRUE;
return !!n_actions;
}
@@ -198,6 +207,13 @@ build_call_properties_from_input (const gchar *properties_string)
}
static void
+print_voice_status (void)
+{
+ mmcli_output_string (MMC_F_VOICE_EMERGENCY_ONLY, mm_modem_voice_get_emergency_only (ctx->modem_voice) ? "yes" : "no");
+ mmcli_output_dump ();
+}
+
+static void
output_call_info (MMCall *call)
{
gchar *extra;
@@ -488,6 +504,9 @@ get_modem_ready (GObject *source,
ensure_modem_voice ();
+ if (status_flag)
+ g_assert_not_reached ();
+
/* Request to list call? */
if (list_flag) {
g_debug ("Asynchronously listing calls in modem...");
@@ -634,6 +653,13 @@ mmcli_modem_voice_run_synchronous (GDBusConnection *connection)
ensure_modem_voice ();
+ /* Request to get voice status? */
+ if (status_flag) {
+ g_debug ("Printing voice status...");
+ print_voice_status ();
+ return;
+ }
+
/* Request to list the call? */
if (list_flag) {
GList *result;
diff --git a/cli/mmcli-output.c b/cli/mmcli-output.c
index 09722094..4f91950f 100644
--- a/cli/mmcli-output.c
+++ b/cli/mmcli-output.c
@@ -66,6 +66,7 @@ static SectionInfo section_infos[] = {
[MMC_S_MODEM_LOCATION_CDMABS] = { "CDMA BS" },
[MMC_S_MODEM_FIRMWARE] = { "Firmware" },
[MMC_S_MODEM_FIRMWARE_FASTBOOT] = { "Fastboot settings" },
+ [MMC_S_MODEM_VOICE] = { "Voice" },
[MMC_S_BEARER_GENERAL] = { "General" },
[MMC_S_BEARER_STATUS] = { "Status" },
[MMC_S_BEARER_PROPERTIES] = { "Properties" },
@@ -196,6 +197,7 @@ static FieldInfo field_infos[] = {
[MMC_F_FIRMWARE_DEVICE_IDS] = { "modem.firmware.device-ids", "device ids", MMC_S_MODEM_FIRMWARE, },
[MMC_F_FIRMWARE_VERSION] = { "modem.firmware.version", "version", MMC_S_MODEM_FIRMWARE, },
[MMC_F_FIRMWARE_FASTBOOT_AT] = { "modem.firmware.fastboot.at", "at command", MMC_S_MODEM_FIRMWARE_FASTBOOT, },
+ [MMC_F_VOICE_EMERGENCY_ONLY] = { "modem.voice.emergency-only", "emergency only", MMC_S_MODEM_VOICE, },
[MMC_F_BEARER_GENERAL_DBUS_PATH] = { "bearer.dbus-path", "dbus path", MMC_S_BEARER_GENERAL, },
[MMC_F_BEARER_GENERAL_TYPE] = { "bearer.type", "type", MMC_S_BEARER_GENERAL, },
[MMC_F_BEARER_STATUS_CONNECTED] = { "bearer.status.connected", "connected", MMC_S_BEARER_STATUS, },
diff --git a/cli/mmcli-output.h b/cli/mmcli-output.h
index 135d429a..3c30b170 100644
--- a/cli/mmcli-output.h
+++ b/cli/mmcli-output.h
@@ -63,6 +63,7 @@ typedef enum {
MMC_S_MODEM_LOCATION_CDMABS,
MMC_S_MODEM_FIRMWARE,
MMC_S_MODEM_FIRMWARE_FASTBOOT,
+ MMC_S_MODEM_VOICE,
MMC_S_BEARER_GENERAL,
MMC_S_BEARER_STATUS,
MMC_S_BEARER_PROPERTIES,
@@ -209,6 +210,8 @@ typedef enum {
MMC_F_FIRMWARE_DEVICE_IDS,
MMC_F_FIRMWARE_VERSION,
MMC_F_FIRMWARE_FASTBOOT_AT,
+ /* Voice section */
+ MMC_F_VOICE_EMERGENCY_ONLY,
/* Bearer general section */
MMC_F_BEARER_GENERAL_DBUS_PATH,
MMC_F_BEARER_GENERAL_TYPE,
diff --git a/docs/reference/libmm-glib/libmm-glib-sections.txt b/docs/reference/libmm-glib/libmm-glib-sections.txt
index 2b6b17a2..bc3eeb9c 100644
--- a/docs/reference/libmm-glib/libmm-glib-sections.txt
+++ b/docs/reference/libmm-glib/libmm-glib-sections.txt
@@ -1001,6 +1001,7 @@ MMModemVoice
<SUBSECTION Getters>
mm_modem_voice_get_path
mm_modem_voice_dup_path
+mm_modem_voice_get_emergency_only
<SUBSECTION Methods>
mm_modem_voice_create_call
@@ -2853,6 +2854,7 @@ MmGdbusModemVoiceIface
<SUBSECTION Getters>
mm_gdbus_modem_voice_get_calls
mm_gdbus_modem_voice_dup_calls
+mm_gdbus_modem_voice_get_emergency_only
<SUBSECTION Methods>
mm_gdbus_modem_voice_call_create_call
mm_gdbus_modem_voice_call_create_call_finish
@@ -2883,6 +2885,7 @@ mm_gdbus_modem_voice_call_call_waiting_setup_finish
mm_gdbus_modem_voice_call_call_waiting_setup_sync
<SUBSECTION Private>
mm_gdbus_modem_voice_set_calls
+mm_gdbus_modem_voice_set_emergency_only
mm_gdbus_modem_voice_emit_call_added
mm_gdbus_modem_voice_emit_call_deleted
mm_gdbus_modem_voice_complete_create_call
diff --git a/introspection/org.freedesktop.ModemManager1.Modem.Voice.xml b/introspection/org.freedesktop.ModemManager1.Modem.Voice.xml
index 59f11e9d..698b8e3a 100644
--- a/introspection/org.freedesktop.ModemManager1.Modem.Voice.xml
+++ b/introspection/org.freedesktop.ModemManager1.Modem.Voice.xml
@@ -176,5 +176,15 @@
-->
<property name="Calls" type="ao" access="read" />
+ <!--
+ EmergencyOnly:
+
+ A flag indicating whether emergency calls are the only allowed ones.
+
+ If this flag is set, users should only attempt voice calls to
+ emergency numbers, as standard voice calls will likely fail.
+ -->
+ <property name="EmergencyOnly" type="b" access="read" />
+
</interface>
</node>
diff --git a/libmm-glib/mm-modem-voice.c b/libmm-glib/mm-modem-voice.c
index e23a7306..ce22e0b8 100644
--- a/libmm-glib/mm-modem-voice.c
+++ b/libmm-glib/mm-modem-voice.c
@@ -81,6 +81,20 @@ mm_modem_voice_dup_path (MMModemVoice *self)
RETURN_NON_EMPTY_STRING (value);
}
+/**
+ * mm_modem_voice_get_emergency_only:
+ * @self: A #MMModemVoice.
+ *
+ * Checks whether emergency calls only are allowed.
+ *
+ * Returns: %TRUE if only emergency calls are allowed, %FALSE otherwise..
+ */
+gboolean
+mm_modem_voice_get_emergency_only (MMModemVoice *self)
+{
+ return mm_gdbus_modem_voice_get_emergency_only (MM_GDBUS_MODEM_VOICE (self));
+}
+
/*****************************************************************************/
typedef struct {
diff --git a/libmm-glib/mm-modem-voice.h b/libmm-glib/mm-modem-voice.h
index f43a60a1..d3a8fc94 100644
--- a/libmm-glib/mm-modem-voice.h
+++ b/libmm-glib/mm-modem-voice.h
@@ -70,8 +70,9 @@ GType mm_modem_voice_get_type (void);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMModemVoice, g_object_unref)
#endif
-const gchar *mm_modem_voice_get_path (MMModemVoice *self);
-gchar *mm_modem_voice_dup_path (MMModemVoice *self);
+const gchar *mm_modem_voice_get_path (MMModemVoice *self);
+gchar *mm_modem_voice_dup_path (MMModemVoice *self);
+gboolean mm_modem_voice_get_emergency_only (MMModemVoice *self);
void mm_modem_voice_create_call (MMModemVoice *self,
MMCallProperties *properties,
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 */