broadband-modem,voice: disable unsolicited events

This commit is contained in:
Aleksander Morgado
2019-06-07 18:06:35 +02:00
parent aa4ad45907
commit ed7be29111
3 changed files with 83 additions and 16 deletions

View File

@@ -3039,15 +3039,19 @@ static const MMBaseModemAtCommand unsolicited_voice_disable_sequence[] = {
};
static void
modem_voice_disable_unsolicited_events (MMIfaceModemVoice *self,
GAsyncReadyCallback callback,
gpointer user_data)
parent_voice_disable_unsolicited_events_ready (MMIfaceModemVoice *self,
GAsyncResult *res,
GTask *task)
{
GTask *task;
GError *error = NULL;
task = g_task_new (self, NULL, callback, user_data);
if (!iface_modem_voice_parent->disable_unsolicited_events_finish (self, res, &error)) {
g_task_return_error (task, error);
g_object_unref (task);
return;
}
/* No unsolicited events disabling in parent */
/* our own disable now */
mm_base_modem_at_sequence_full (
MM_BASE_MODEM (self),
@@ -3060,6 +3064,22 @@ modem_voice_disable_unsolicited_events (MMIfaceModemVoice *self,
task);
}
static void
modem_voice_disable_unsolicited_events (MMIfaceModemVoice *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
task = g_task_new (self, NULL, callback, user_data);
/* Chain up parent's disable */
iface_modem_voice_parent->disable_unsolicited_events (
self,
(GAsyncReadyCallback)parent_voice_disable_unsolicited_events_ready,
task);
}
/*****************************************************************************/
/* Create call (Voice interface) */

View File

@@ -1004,6 +1004,23 @@ modem_voice_disable_unsolicited_events_finish (MMIfaceModemVoice *self,
return g_task_propagate_boolean (G_TASK (res), error);
}
static void
parent_voice_disable_unsolicited_events_ready (MMIfaceModemVoice *self,
GAsyncResult *res,
GTask *task)
{
GError *error = NULL;
if (!iface_modem_voice_parent->disable_unsolicited_events_finish (self, res, &error)) {
g_task_return_error (task, error);
g_object_unref (task);
return;
}
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}
static void
own_voice_disable_unsolicited_events_ready (MMBaseModem *self,
GAsyncResult *res,
@@ -1012,11 +1029,17 @@ own_voice_disable_unsolicited_events_ready (MMBaseModem *self,
GError *error = NULL;
mm_base_modem_at_command_full_finish (self, res, &error);
if (error)
if (error) {
g_task_return_error (task, error);
else
g_task_return_boolean (task, TRUE);
g_object_unref (task);
return;
}
/* Chain up parent's disable */
iface_modem_voice_parent->disable_unsolicited_events (
MM_IFACE_MODEM_VOICE (self),
(GAsyncReadyCallback)parent_voice_disable_unsolicited_events_ready,
task);
}
static void
@@ -1028,8 +1051,6 @@ modem_voice_disable_unsolicited_events (MMIfaceModemVoice *self,
task = g_task_new (self, NULL, callback, user_data);
/* Note: no parent disable method */
mm_base_modem_at_command_full (
MM_BASE_MODEM (self),
mm_base_modem_peek_port_primary (MM_BASE_MODEM (self)),

View File

@@ -7385,7 +7385,7 @@ voice_unsolicited_events_context_free (VoiceUnsolicitedEventsContext *ctx)
}
static gboolean
modem_voice_enable_unsolicited_events_finish (MMIfaceModemVoice *self,
modem_voice_enable_disable_unsolicited_events_finish (MMIfaceModemVoice *self,
GAsyncResult *res,
GError **error)
{
@@ -7500,6 +7500,30 @@ modem_voice_enable_unsolicited_events (MMIfaceModemVoice *self,
run_voice_unsolicited_events_setup (task);
}
static void
modem_voice_disable_unsolicited_events (MMIfaceModemVoice *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
VoiceUnsolicitedEventsContext *ctx;
GTask *task;
task = g_task_new (self, NULL, callback, user_data);
ctx = g_slice_new0 (VoiceUnsolicitedEventsContext);
ctx->primary = mm_base_modem_get_port_primary (MM_BASE_MODEM (self));
ctx->secondary = mm_base_modem_get_port_secondary (MM_BASE_MODEM (self));
/* disable +CLIP URCs with calling line identity */
ctx->clip_command = g_strdup ("+CLIP=0");
/* disable +CRING URCs instead of plain RING */
ctx->crc_command = g_strdup ("+CRC=0");
g_task_set_task_data (task, ctx, (GDestroyNotify) voice_unsolicited_events_context_free);
run_voice_unsolicited_events_setup (task);
}
/*****************************************************************************/
/* Create CALL (Voice interface) */
@@ -11718,7 +11742,9 @@ iface_modem_voice_init (MMIfaceModemVoice *iface)
iface->setup_unsolicited_events = modem_voice_setup_unsolicited_events;
iface->setup_unsolicited_events_finish = modem_voice_setup_cleanup_unsolicited_events_finish;
iface->enable_unsolicited_events = modem_voice_enable_unsolicited_events;
iface->enable_unsolicited_events_finish = modem_voice_enable_unsolicited_events_finish;
iface->enable_unsolicited_events_finish = modem_voice_enable_disable_unsolicited_events_finish;
iface->disable_unsolicited_events = modem_voice_disable_unsolicited_events;
iface->disable_unsolicited_events_finish = modem_voice_enable_disable_unsolicited_events_finish;
iface->cleanup_unsolicited_events = modem_voice_cleanup_unsolicited_events;
iface->cleanup_unsolicited_events_finish = modem_voice_setup_cleanup_unsolicited_events_finish;
iface->create_call = modem_voice_create_call;