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.
This commit is contained in:
Aleksander Morgado
2019-10-17 08:31:46 +00:00
parent 7971844318
commit 657833a400
8 changed files with 82 additions and 3 deletions
+27 -1
View File
@@ -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;
}
@@ -197,6 +206,13 @@ build_call_properties_from_input (const gchar *properties_string)
return properties;
}
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)
{
@@ -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;
+2
View File
@@ -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, },
+3
View File
@@ -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,