aboutsummaryrefslogtreecommitdiff
path: root/cli/mmcli-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 /cli/mmcli-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 'cli/mmcli-modem-voice.c')
-rw-r--r--cli/mmcli-modem-voice.c28
1 files changed, 27 insertions, 1 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;