diff options
Diffstat (limited to 'plugins/cinterion')
-rw-r--r-- | plugins/cinterion/mm-broadband-modem-cinterion.c | 2 | ||||
-rw-r--r-- | plugins/cinterion/mm-broadband-modem-qmi-cinterion.c | 2 | ||||
-rw-r--r-- | plugins/cinterion/mm-shared-cinterion.c | 89 | ||||
-rw-r--r-- | plugins/cinterion/mm-shared-cinterion.h | 7 |
4 files changed, 93 insertions, 7 deletions
diff --git a/plugins/cinterion/mm-broadband-modem-cinterion.c b/plugins/cinterion/mm-broadband-modem-cinterion.c index 0021d444..ef799ebc 100644 --- a/plugins/cinterion/mm-broadband-modem-cinterion.c +++ b/plugins/cinterion/mm-broadband-modem-cinterion.c @@ -1967,6 +1967,8 @@ iface_modem_voice_init (MMIfaceModemVoice *iface) iface->create_call = mm_shared_cinterion_create_call; + iface->check_support = mm_shared_cinterion_voice_check_support; + iface->check_support_finish = mm_shared_cinterion_voice_check_support_finish; iface->enable_unsolicited_events = mm_shared_cinterion_voice_enable_unsolicited_events; iface->enable_unsolicited_events_finish = mm_shared_cinterion_voice_enable_unsolicited_events_finish; iface->disable_unsolicited_events = mm_shared_cinterion_voice_disable_unsolicited_events; diff --git a/plugins/cinterion/mm-broadband-modem-qmi-cinterion.c b/plugins/cinterion/mm-broadband-modem-qmi-cinterion.c index ff864082..de2eff7f 100644 --- a/plugins/cinterion/mm-broadband-modem-qmi-cinterion.c +++ b/plugins/cinterion/mm-broadband-modem-qmi-cinterion.c @@ -91,6 +91,8 @@ iface_modem_voice_init (MMIfaceModemVoice *iface) iface->create_call = mm_shared_cinterion_create_call; + iface->check_support = mm_shared_cinterion_voice_check_support; + iface->check_support_finish = mm_shared_cinterion_voice_check_support_finish; iface->enable_unsolicited_events = mm_shared_cinterion_voice_enable_unsolicited_events; iface->enable_unsolicited_events_finish = mm_shared_cinterion_voice_enable_unsolicited_events_finish; iface->disable_unsolicited_events = mm_shared_cinterion_voice_disable_unsolicited_events; diff --git a/plugins/cinterion/mm-shared-cinterion.c b/plugins/cinterion/mm-shared-cinterion.c index cfc5b0ca..d736903c 100644 --- a/plugins/cinterion/mm-shared-cinterion.c +++ b/plugins/cinterion/mm-shared-cinterion.c @@ -863,22 +863,17 @@ slcc_command_ready (MMBaseModem *self, GAsyncResult *res, GTask *task) { - Private *priv; VoiceUnsolicitedEventsContext *ctx; GError *error = NULL; - priv = get_private (MM_SHARED_CINTERION (self)); - ctx = g_task_get_task_data (task); + ctx = g_task_get_task_data (task); if (!mm_base_modem_at_command_finish (self, res, &error)) { - if (priv->slcc_support == FEATURE_SUPPORT_UNKNOWN) - priv->slcc_support = FEATURE_NOT_SUPPORTED; mm_dbg ("Couldn't %s ^SLCC reporting: '%s'", ctx->enable ? "enable" : "disable", error->message); g_error_free (error); - } else if (priv->slcc_support == FEATURE_SUPPORT_UNKNOWN) - priv->slcc_support = FEATURE_SUPPORTED; + } /* Continue on next port */ run_voice_enable_disable_unsolicited_events (task); @@ -1259,6 +1254,86 @@ mm_shared_cinterion_voice_setup_unsolicited_events (MMIfaceModemVoice *self, } /*****************************************************************************/ +/* Check if Voice supported (Voice interface) */ + +gboolean +mm_shared_cinterion_voice_check_support_finish (MMIfaceModemVoice *self, + GAsyncResult *res, + GError **error) +{ + return g_task_propagate_boolean (G_TASK (res), error); +} + +static void +slcc_format_check_ready (MMBroadbandModem *self, + GAsyncResult *res, + GTask *task) +{ + Private *priv; + + priv = get_private (MM_SHARED_CINTERION (self)); + + /* ^SLCC supported unless we got any error response */ + priv->slcc_support = (!!mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, NULL) ? + FEATURE_SUPPORTED : FEATURE_NOT_SUPPORTED); + + /* If ^SLCC supported we won't need polling in the parent */ + g_object_set (self, + MM_IFACE_MODEM_VOICE_PERIODIC_CALL_LIST_CHECK_DISABLED, (priv->slcc_support == FEATURE_SUPPORTED), + NULL); + + /* ^SLCC command is supported; assume we have full voice capabilities */ + g_task_return_boolean (task, TRUE); + g_object_unref (task); +} + +static void +parent_voice_check_support_ready (MMIfaceModemVoice *self, + GAsyncResult *res, + GTask *task) +{ + Private *priv; + GError *error = NULL; + + priv = get_private (MM_SHARED_CINTERION (self)); + if (!priv->iface_modem_voice_parent->check_support_finish (self, res, &error)) { + g_task_return_error (task, error); + g_object_unref (task); + return; + } + + /* voice is supported, check if ^SLCC is available */ + mm_base_modem_at_command (MM_BASE_MODEM (self), + "^SLCC=?", + 3, + TRUE, + (GAsyncReadyCallback) slcc_format_check_ready, + task); +} + +void +mm_shared_cinterion_voice_check_support (MMIfaceModemVoice *self, + GAsyncReadyCallback callback, + gpointer user_data) +{ + Private *priv; + GTask *task; + + task = g_task_new (self, NULL, callback, user_data); + + priv = get_private (MM_SHARED_CINTERION (self)); + g_assert (priv->iface_modem_voice_parent); + g_assert (priv->iface_modem_voice_parent->check_support); + g_assert (priv->iface_modem_voice_parent->check_support_finish); + + /* chain up parent's setup first */ + priv->iface_modem_voice_parent->check_support ( + self, + (GAsyncReadyCallback)parent_voice_check_support_ready, + task); +} + +/*****************************************************************************/ static void shared_cinterion_init (gpointer g_iface) diff --git a/plugins/cinterion/mm-shared-cinterion.h b/plugins/cinterion/mm-shared-cinterion.h index 8569419d..52c154f3 100644 --- a/plugins/cinterion/mm-shared-cinterion.h +++ b/plugins/cinterion/mm-shared-cinterion.h @@ -77,6 +77,13 @@ MMBaseCall *mm_shared_cinterion_create_call (MMIfaceModemVoice *self, MMCallDirection direction, const gchar *number); +void mm_shared_cinterion_voice_check_support (MMIfaceModemVoice *self, + GAsyncReadyCallback callback, + gpointer user_data); +gboolean mm_shared_cinterion_voice_check_support_finish (MMIfaceModemVoice *self, + GAsyncResult *res, + GError **error); + void mm_shared_cinterion_voice_setup_unsolicited_events (MMIfaceModemVoice *self, GAsyncReadyCallback callback, gpointer user_data); |