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:
@@ -47,6 +47,7 @@ typedef struct {
|
|||||||
static Context *ctx;
|
static Context *ctx;
|
||||||
|
|
||||||
/* Options */
|
/* Options */
|
||||||
|
static gboolean status_flag;
|
||||||
static gboolean list_flag;
|
static gboolean list_flag;
|
||||||
static gchar *create_str;
|
static gchar *create_str;
|
||||||
static gchar *delete_str;
|
static gchar *delete_str;
|
||||||
@@ -59,6 +60,10 @@ static gboolean call_waiting_disable_flag;
|
|||||||
static gboolean call_waiting_query_flag;
|
static gboolean call_waiting_query_flag;
|
||||||
|
|
||||||
static GOptionEntry entries[] = {
|
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,
|
{ "voice-list-calls", 0, 0, G_OPTION_ARG_NONE, &list_flag,
|
||||||
"List calls available in a given modem",
|
"List calls available in a given modem",
|
||||||
NULL
|
NULL
|
||||||
@@ -126,7 +131,8 @@ mmcli_modem_voice_options_enabled (void)
|
|||||||
if (checked)
|
if (checked)
|
||||||
return !!n_actions;
|
return !!n_actions;
|
||||||
|
|
||||||
n_actions = (list_flag +
|
n_actions = (status_flag +
|
||||||
|
list_flag +
|
||||||
!!create_str +
|
!!create_str +
|
||||||
!!delete_str +
|
!!delete_str +
|
||||||
hold_and_accept_flag +
|
hold_and_accept_flag +
|
||||||
@@ -142,6 +148,9 @@ mmcli_modem_voice_options_enabled (void)
|
|||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (status_flag)
|
||||||
|
mmcli_force_sync_operation ();
|
||||||
|
|
||||||
checked = TRUE;
|
checked = TRUE;
|
||||||
return !!n_actions;
|
return !!n_actions;
|
||||||
}
|
}
|
||||||
@@ -197,6 +206,13 @@ build_call_properties_from_input (const gchar *properties_string)
|
|||||||
return properties;
|
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
|
static void
|
||||||
output_call_info (MMCall *call)
|
output_call_info (MMCall *call)
|
||||||
{
|
{
|
||||||
@@ -488,6 +504,9 @@ get_modem_ready (GObject *source,
|
|||||||
|
|
||||||
ensure_modem_voice ();
|
ensure_modem_voice ();
|
||||||
|
|
||||||
|
if (status_flag)
|
||||||
|
g_assert_not_reached ();
|
||||||
|
|
||||||
/* Request to list call? */
|
/* Request to list call? */
|
||||||
if (list_flag) {
|
if (list_flag) {
|
||||||
g_debug ("Asynchronously listing calls in modem...");
|
g_debug ("Asynchronously listing calls in modem...");
|
||||||
@@ -634,6 +653,13 @@ mmcli_modem_voice_run_synchronous (GDBusConnection *connection)
|
|||||||
|
|
||||||
ensure_modem_voice ();
|
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? */
|
/* Request to list the call? */
|
||||||
if (list_flag) {
|
if (list_flag) {
|
||||||
GList *result;
|
GList *result;
|
||||||
|
@@ -66,6 +66,7 @@ static SectionInfo section_infos[] = {
|
|||||||
[MMC_S_MODEM_LOCATION_CDMABS] = { "CDMA BS" },
|
[MMC_S_MODEM_LOCATION_CDMABS] = { "CDMA BS" },
|
||||||
[MMC_S_MODEM_FIRMWARE] = { "Firmware" },
|
[MMC_S_MODEM_FIRMWARE] = { "Firmware" },
|
||||||
[MMC_S_MODEM_FIRMWARE_FASTBOOT] = { "Fastboot settings" },
|
[MMC_S_MODEM_FIRMWARE_FASTBOOT] = { "Fastboot settings" },
|
||||||
|
[MMC_S_MODEM_VOICE] = { "Voice" },
|
||||||
[MMC_S_BEARER_GENERAL] = { "General" },
|
[MMC_S_BEARER_GENERAL] = { "General" },
|
||||||
[MMC_S_BEARER_STATUS] = { "Status" },
|
[MMC_S_BEARER_STATUS] = { "Status" },
|
||||||
[MMC_S_BEARER_PROPERTIES] = { "Properties" },
|
[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_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_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_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_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_GENERAL_TYPE] = { "bearer.type", "type", MMC_S_BEARER_GENERAL, },
|
||||||
[MMC_F_BEARER_STATUS_CONNECTED] = { "bearer.status.connected", "connected", MMC_S_BEARER_STATUS, },
|
[MMC_F_BEARER_STATUS_CONNECTED] = { "bearer.status.connected", "connected", MMC_S_BEARER_STATUS, },
|
||||||
|
@@ -63,6 +63,7 @@ typedef enum {
|
|||||||
MMC_S_MODEM_LOCATION_CDMABS,
|
MMC_S_MODEM_LOCATION_CDMABS,
|
||||||
MMC_S_MODEM_FIRMWARE,
|
MMC_S_MODEM_FIRMWARE,
|
||||||
MMC_S_MODEM_FIRMWARE_FASTBOOT,
|
MMC_S_MODEM_FIRMWARE_FASTBOOT,
|
||||||
|
MMC_S_MODEM_VOICE,
|
||||||
MMC_S_BEARER_GENERAL,
|
MMC_S_BEARER_GENERAL,
|
||||||
MMC_S_BEARER_STATUS,
|
MMC_S_BEARER_STATUS,
|
||||||
MMC_S_BEARER_PROPERTIES,
|
MMC_S_BEARER_PROPERTIES,
|
||||||
@@ -209,6 +210,8 @@ typedef enum {
|
|||||||
MMC_F_FIRMWARE_DEVICE_IDS,
|
MMC_F_FIRMWARE_DEVICE_IDS,
|
||||||
MMC_F_FIRMWARE_VERSION,
|
MMC_F_FIRMWARE_VERSION,
|
||||||
MMC_F_FIRMWARE_FASTBOOT_AT,
|
MMC_F_FIRMWARE_FASTBOOT_AT,
|
||||||
|
/* Voice section */
|
||||||
|
MMC_F_VOICE_EMERGENCY_ONLY,
|
||||||
/* Bearer general section */
|
/* Bearer general section */
|
||||||
MMC_F_BEARER_GENERAL_DBUS_PATH,
|
MMC_F_BEARER_GENERAL_DBUS_PATH,
|
||||||
MMC_F_BEARER_GENERAL_TYPE,
|
MMC_F_BEARER_GENERAL_TYPE,
|
||||||
|
@@ -1001,6 +1001,7 @@ MMModemVoice
|
|||||||
<SUBSECTION Getters>
|
<SUBSECTION Getters>
|
||||||
mm_modem_voice_get_path
|
mm_modem_voice_get_path
|
||||||
mm_modem_voice_dup_path
|
mm_modem_voice_dup_path
|
||||||
|
mm_modem_voice_get_emergency_only
|
||||||
|
|
||||||
<SUBSECTION Methods>
|
<SUBSECTION Methods>
|
||||||
mm_modem_voice_create_call
|
mm_modem_voice_create_call
|
||||||
@@ -2853,6 +2854,7 @@ MmGdbusModemVoiceIface
|
|||||||
<SUBSECTION Getters>
|
<SUBSECTION Getters>
|
||||||
mm_gdbus_modem_voice_get_calls
|
mm_gdbus_modem_voice_get_calls
|
||||||
mm_gdbus_modem_voice_dup_calls
|
mm_gdbus_modem_voice_dup_calls
|
||||||
|
mm_gdbus_modem_voice_get_emergency_only
|
||||||
<SUBSECTION Methods>
|
<SUBSECTION Methods>
|
||||||
mm_gdbus_modem_voice_call_create_call
|
mm_gdbus_modem_voice_call_create_call
|
||||||
mm_gdbus_modem_voice_call_create_call_finish
|
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
|
mm_gdbus_modem_voice_call_call_waiting_setup_sync
|
||||||
<SUBSECTION Private>
|
<SUBSECTION Private>
|
||||||
mm_gdbus_modem_voice_set_calls
|
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_added
|
||||||
mm_gdbus_modem_voice_emit_call_deleted
|
mm_gdbus_modem_voice_emit_call_deleted
|
||||||
mm_gdbus_modem_voice_complete_create_call
|
mm_gdbus_modem_voice_complete_create_call
|
||||||
|
@@ -176,5 +176,15 @@
|
|||||||
-->
|
-->
|
||||||
<property name="Calls" type="ao" access="read" />
|
<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>
|
</interface>
|
||||||
</node>
|
</node>
|
||||||
|
@@ -81,6 +81,20 @@ mm_modem_voice_dup_path (MMModemVoice *self)
|
|||||||
RETURN_NON_EMPTY_STRING (value);
|
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 {
|
typedef struct {
|
||||||
|
@@ -70,8 +70,9 @@ GType mm_modem_voice_get_type (void);
|
|||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMModemVoice, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMModemVoice, g_object_unref)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const gchar *mm_modem_voice_get_path (MMModemVoice *self);
|
const gchar *mm_modem_voice_get_path (MMModemVoice *self);
|
||||||
gchar *mm_modem_voice_dup_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,
|
void mm_modem_voice_create_call (MMModemVoice *self,
|
||||||
MMCallProperties *properties,
|
MMCallProperties *properties,
|
||||||
|
@@ -2879,6 +2879,20 @@ mm_iface_modem_voice_initialize_finish (MMIfaceModemVoice *self,
|
|||||||
return g_task_propagate_boolean (G_TASK (res), error);
|
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
|
void
|
||||||
mm_iface_modem_voice_initialize (MMIfaceModemVoice *self,
|
mm_iface_modem_voice_initialize (MMIfaceModemVoice *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
@@ -2899,6 +2913,12 @@ mm_iface_modem_voice_initialize (MMIfaceModemVoice *self,
|
|||||||
g_object_set (self,
|
g_object_set (self,
|
||||||
MM_IFACE_MODEM_VOICE_DBUS_SKELETON, skeleton,
|
MM_IFACE_MODEM_VOICE_DBUS_SKELETON, skeleton,
|
||||||
NULL);
|
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 */
|
/* Perform async initialization here */
|
||||||
|
Reference in New Issue
Block a user