diff options
-rw-r--r-- | plugins/simtech/77-mm-simtech-port-types.rules | 2 | ||||
-rw-r--r-- | plugins/simtech/mm-broadband-modem-qmi-simtech.c | 4 | ||||
-rw-r--r-- | plugins/simtech/mm-broadband-modem-simtech.c | 5 | ||||
-rw-r--r-- | plugins/simtech/mm-shared-simtech.c | 123 | ||||
-rw-r--r-- | plugins/simtech/mm-shared-simtech.h | 15 |
5 files changed, 146 insertions, 3 deletions
diff --git a/plugins/simtech/77-mm-simtech-port-types.rules b/plugins/simtech/77-mm-simtech-port-types.rules index 4d912768..c138ed96 100644 --- a/plugins/simtech/77-mm-simtech-port-types.rules +++ b/plugins/simtech/77-mm-simtech-port-types.rules @@ -35,6 +35,6 @@ ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="9001", ENV{.MM_USBIFNUM}=="00", ENV{ ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="9001", ENV{.MM_USBIFNUM}=="01", ENV{ID_MM_PORT_TYPE_GPS}="1" ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="9001", ENV{.MM_USBIFNUM}=="02", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1" ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="9001", ENV{.MM_USBIFNUM}=="03", ENV{ID_MM_PORT_TYPE_AT_SECONDARY}="1" -ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="9001", ENV{.MM_USBIFNUM}=="04", ENV{ID_MM_PORT_IGNORE}="1" +ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="9001", ENV{.MM_USBIFNUM}=="04", ENV{ID_MM_PORT_TYPE_AUDIO}="1" LABEL="mm_simtech_port_types_end" diff --git a/plugins/simtech/mm-broadband-modem-qmi-simtech.c b/plugins/simtech/mm-broadband-modem-qmi-simtech.c index 4ea84e9a..392f5626 100644 --- a/plugins/simtech/mm-broadband-modem-qmi-simtech.c +++ b/plugins/simtech/mm-broadband-modem-qmi-simtech.c @@ -99,6 +99,10 @@ iface_modem_voice_init (MMIfaceModemVoice *iface) iface->setup_unsolicited_events_finish = mm_shared_simtech_voice_setup_unsolicited_events_finish; iface->cleanup_unsolicited_events = mm_shared_simtech_voice_cleanup_unsolicited_events; iface->cleanup_unsolicited_events_finish = mm_shared_simtech_voice_cleanup_unsolicited_events_finish; + iface->setup_in_call_audio_channel = mm_shared_simtech_voice_setup_in_call_audio_channel; + iface->setup_in_call_audio_channel_finish = mm_shared_simtech_voice_setup_in_call_audio_channel_finish; + iface->cleanup_in_call_audio_channel = mm_shared_simtech_voice_cleanup_in_call_audio_channel; + iface->cleanup_in_call_audio_channel_finish = mm_shared_simtech_voice_cleanup_in_call_audio_channel_finish; } static MMIfaceModemVoice * diff --git a/plugins/simtech/mm-broadband-modem-simtech.c b/plugins/simtech/mm-broadband-modem-simtech.c index 6a8ae80d..21781dc9 100644 --- a/plugins/simtech/mm-broadband-modem-simtech.c +++ b/plugins/simtech/mm-broadband-modem-simtech.c @@ -1308,6 +1308,11 @@ iface_modem_voice_init (MMIfaceModemVoice *iface) iface->setup_unsolicited_events_finish = mm_shared_simtech_voice_setup_unsolicited_events_finish; iface->cleanup_unsolicited_events = mm_shared_simtech_voice_cleanup_unsolicited_events; iface->cleanup_unsolicited_events_finish = mm_shared_simtech_voice_cleanup_unsolicited_events_finish; + iface->setup_in_call_audio_channel = mm_shared_simtech_voice_setup_in_call_audio_channel; + iface->setup_in_call_audio_channel_finish = mm_shared_simtech_voice_setup_in_call_audio_channel_finish; + iface->cleanup_in_call_audio_channel = mm_shared_simtech_voice_cleanup_in_call_audio_channel; + iface->cleanup_in_call_audio_channel_finish = mm_shared_simtech_voice_cleanup_in_call_audio_channel_finish; + } static MMIfaceModemVoice * diff --git a/plugins/simtech/mm-shared-simtech.c b/plugins/simtech/mm-shared-simtech.c index ea24466e..5b1b852b 100644 --- a/plugins/simtech/mm-shared-simtech.c +++ b/plugins/simtech/mm-shared-simtech.c @@ -50,6 +50,7 @@ typedef struct { FeatureSupport cgps_support; /* voice */ MMIfaceModemVoice *iface_modem_voice_parent; + FeatureSupport cpcmreg_support; FeatureSupport clcc_urc_support; GRegex *clcc_urc_regex; GRegex *voice_call_regex; @@ -81,6 +82,7 @@ get_private (MMSharedSimtech *self) priv->supported_sources = MM_MODEM_LOCATION_SOURCE_NONE; priv->enabled_sources = MM_MODEM_LOCATION_SOURCE_NONE; priv->cgps_support = FEATURE_SUPPORT_UNKNOWN; + priv->cpcmreg_support = FEATURE_SUPPORT_UNKNOWN; priv->clcc_urc_support = FEATURE_SUPPORT_UNKNOWN; priv->clcc_urc_regex = mm_simtech_get_clcc_urc_regex (); priv->voice_call_regex = mm_simtech_get_voice_call_urc_regex (); @@ -1025,6 +1027,102 @@ mm_shared_simtech_voice_setup_unsolicited_events (MMIfaceModemVoice *self, } /*****************************************************************************/ +/* In-call audio channel setup/cleanup */ + +gboolean +mm_shared_simtech_voice_setup_in_call_audio_channel_finish (MMIfaceModemVoice *self, + GAsyncResult *res, + MMPort **audio_port, /* optional */ + MMCallAudioFormat **audio_format, /* optional */ + GError **error) +{ + Private *priv; + + priv = get_private (MM_SHARED_SIMTECH (self)); + + if (!g_task_propagate_boolean (G_TASK (res), error)) + return FALSE; + + if (audio_format) + *audio_format = NULL; + + if (audio_port) { + if (priv->cpcmreg_support == FEATURE_SUPPORTED) + *audio_port = MM_PORT (mm_base_modem_get_port_audio (MM_BASE_MODEM (self))); + else + *audio_port = NULL; + } + + return TRUE; +} + +gboolean +mm_shared_simtech_voice_cleanup_in_call_audio_channel_finish (MMIfaceModemVoice *self, + GAsyncResult *res, + GError **error) +{ + return g_task_propagate_boolean (G_TASK (res), error); +} + +static void +cpcmreg_set_ready (MMBaseModem *self, + GAsyncResult *res, + GTask *task) +{ + GError *error = NULL; + + if (!mm_base_modem_at_command_finish (self, res, &error)) + g_task_return_error (task, error); + else + g_task_return_boolean (task, TRUE); + g_object_unref (task); +} + +static void +common_setup_cleanup_in_call_audio_channel (MMSharedSimtech *self, + gboolean setup, + GAsyncReadyCallback callback, + gpointer user_data) +{ + GTask *task; + Private *priv; + + priv = get_private (MM_SHARED_SIMTECH (self)); + + task = g_task_new (self, NULL, callback, user_data); + + /* Do nothing if CPCMREG isn't supported */ + if (priv->cpcmreg_support != FEATURE_SUPPORTED) { + g_task_return_boolean (task, TRUE); + g_object_unref (task); + return; + } + + mm_base_modem_at_command (MM_BASE_MODEM (self), + setup ? "+CPCMREG=1" : "+CPCMREG=0", + 3, + FALSE, + (GAsyncReadyCallback) cpcmreg_set_ready, + task); +} + +void +mm_shared_simtech_voice_setup_in_call_audio_channel (MMIfaceModemVoice *self, + GAsyncReadyCallback callback, + gpointer user_data) +{ + common_setup_cleanup_in_call_audio_channel (MM_SHARED_SIMTECH (self), TRUE, callback, user_data); +} + +void +mm_shared_simtech_voice_cleanup_in_call_audio_channel (MMIfaceModemVoice *self, + GAsyncReadyCallback callback, + gpointer user_data) +{ + common_setup_cleanup_in_call_audio_channel (MM_SHARED_SIMTECH (self), FALSE, callback, user_data); +} + +/*****************************************************************************/ /* Check if Voice supported (Voice interface) */ gboolean @@ -1036,6 +1134,23 @@ mm_shared_simtech_voice_check_support_finish (MMIfaceModemVoice *self, } static void +cpcmreg_format_check_ready (MMBroadbandModem *self, + GAsyncResult *res, + GTask *task) +{ + Private *priv; + + priv = get_private (MM_SHARED_SIMTECH (self)); + + priv->cpcmreg_support = (mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, NULL) ? + FEATURE_SUPPORTED : FEATURE_NOT_SUPPORTED); + mm_dbg ("modem %s USB audio control", (priv->cpcmreg_support == FEATURE_SUPPORTED) ? "supports" : "doesn't support"); + + g_task_return_boolean (task, TRUE); + g_object_unref (task); +} + +static void clcc_format_check_ready (MMBroadbandModem *self, GAsyncResult *res, GTask *task) @@ -1061,8 +1176,12 @@ clcc_format_check_ready (MMBroadbandModem *self, MM_IFACE_MODEM_VOICE_PERIODIC_CALL_LIST_CHECK_DISABLED, (priv->clcc_urc_support == FEATURE_SUPPORTED), NULL); - g_task_return_boolean (task, TRUE); - g_object_unref (task); + mm_base_modem_at_command (MM_BASE_MODEM (self), + "+CPCMREG=?", + 3, + TRUE, + (GAsyncReadyCallback) cpcmreg_format_check_ready, + task); } static void diff --git a/plugins/simtech/mm-shared-simtech.h b/plugins/simtech/mm-shared-simtech.h index 3382869a..37a221ca 100644 --- a/plugins/simtech/mm-shared-simtech.h +++ b/plugins/simtech/mm-shared-simtech.h @@ -111,4 +111,19 @@ gboolean mm_shared_simtech_voice_disable_unsolicited_events_finish (MMIfaceModem GAsyncResult *res, GError **error); +void mm_shared_simtech_voice_setup_in_call_audio_channel (MMIfaceModemVoice *self, + GAsyncReadyCallback callback, + gpointer user_data); +gboolean mm_shared_simtech_voice_setup_in_call_audio_channel_finish (MMIfaceModemVoice *self, + GAsyncResult *res, + MMPort **audio_port, /* optional */ + MMCallAudioFormat **audio_format, /* optional */ + GError **error); +void mm_shared_simtech_voice_cleanup_in_call_audio_channel (MMIfaceModemVoice *self, + GAsyncReadyCallback callback, + gpointer user_data); +gboolean mm_shared_simtech_voice_cleanup_in_call_audio_channel_finish (MMIfaceModemVoice *self, + GAsyncResult *res, + GError **error); + #endif /* MM_SHARED_SIMTECH_H */ |