diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2019-06-07 18:06:35 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2019-07-11 23:00:50 +0200 |
commit | ed7be29111e1178aef72909a03d180625b6f0540 (patch) | |
tree | 122a0ae5d653cdd9442aa8e8444cab94f6e23eab | |
parent | aa4ad459079419494e13f1a53754041c6d15c7c2 (diff) |
broadband-modem,voice: disable unsolicited events
-rw-r--r-- | plugins/huawei/mm-broadband-modem-huawei.c | 32 | ||||
-rw-r--r-- | plugins/ublox/mm-broadband-modem-ublox.c | 33 | ||||
-rw-r--r-- | src/mm-broadband-modem.c | 34 |
3 files changed, 83 insertions, 16 deletions
diff --git a/plugins/huawei/mm-broadband-modem-huawei.c b/plugins/huawei/mm-broadband-modem-huawei.c index d4c0e830..8433895a 100644 --- a/plugins/huawei/mm-broadband-modem-huawei.c +++ b/plugins/huawei/mm-broadband-modem-huawei.c @@ -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) */ diff --git a/plugins/ublox/mm-broadband-modem-ublox.c b/plugins/ublox/mm-broadband-modem-ublox.c index fe1c319d..75e1a401 100644 --- a/plugins/ublox/mm-broadband-modem-ublox.c +++ b/plugins/ublox/mm-broadband-modem-ublox.c @@ -1005,6 +1005,23 @@ modem_voice_disable_unsolicited_events_finish (MMIfaceModemVoice *self, } 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, GTask *task) @@ -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); + 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)), diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index d1275db4..52560060 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -7385,9 +7385,9 @@ voice_unsolicited_events_context_free (VoiceUnsolicitedEventsContext *ctx) } static gboolean -modem_voice_enable_unsolicited_events_finish (MMIfaceModemVoice *self, - GAsyncResult *res, - GError **error) +modem_voice_enable_disable_unsolicited_events_finish (MMIfaceModemVoice *self, + GAsyncResult *res, + GError **error) { return g_task_propagate_boolean (G_TASK (res), 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; |