simtech: setup USB audio channel when in-call
We'll use +CPCMREG=1/0 to start/stop USB audio function, and we will also report the specific ttyUSB port to be used for audio in the Call interface.
This commit is contained in:
@@ -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}=="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}=="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}=="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"
|
LABEL="mm_simtech_port_types_end"
|
||||||
|
@@ -99,6 +99,10 @@ iface_modem_voice_init (MMIfaceModemVoice *iface)
|
|||||||
iface->setup_unsolicited_events_finish = mm_shared_simtech_voice_setup_unsolicited_events_finish;
|
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 = mm_shared_simtech_voice_cleanup_unsolicited_events;
|
||||||
iface->cleanup_unsolicited_events_finish = mm_shared_simtech_voice_cleanup_unsolicited_events_finish;
|
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 *
|
static MMIfaceModemVoice *
|
||||||
|
@@ -1308,6 +1308,11 @@ iface_modem_voice_init (MMIfaceModemVoice *iface)
|
|||||||
iface->setup_unsolicited_events_finish = mm_shared_simtech_voice_setup_unsolicited_events_finish;
|
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 = mm_shared_simtech_voice_cleanup_unsolicited_events;
|
||||||
iface->cleanup_unsolicited_events_finish = mm_shared_simtech_voice_cleanup_unsolicited_events_finish;
|
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 *
|
static MMIfaceModemVoice *
|
||||||
|
@@ -50,6 +50,7 @@ typedef struct {
|
|||||||
FeatureSupport cgps_support;
|
FeatureSupport cgps_support;
|
||||||
/* voice */
|
/* voice */
|
||||||
MMIfaceModemVoice *iface_modem_voice_parent;
|
MMIfaceModemVoice *iface_modem_voice_parent;
|
||||||
|
FeatureSupport cpcmreg_support;
|
||||||
FeatureSupport clcc_urc_support;
|
FeatureSupport clcc_urc_support;
|
||||||
GRegex *clcc_urc_regex;
|
GRegex *clcc_urc_regex;
|
||||||
GRegex *voice_call_regex;
|
GRegex *voice_call_regex;
|
||||||
@@ -81,6 +82,7 @@ get_private (MMSharedSimtech *self)
|
|||||||
priv->supported_sources = MM_MODEM_LOCATION_SOURCE_NONE;
|
priv->supported_sources = MM_MODEM_LOCATION_SOURCE_NONE;
|
||||||
priv->enabled_sources = MM_MODEM_LOCATION_SOURCE_NONE;
|
priv->enabled_sources = MM_MODEM_LOCATION_SOURCE_NONE;
|
||||||
priv->cgps_support = FEATURE_SUPPORT_UNKNOWN;
|
priv->cgps_support = FEATURE_SUPPORT_UNKNOWN;
|
||||||
|
priv->cpcmreg_support = FEATURE_SUPPORT_UNKNOWN;
|
||||||
priv->clcc_urc_support = FEATURE_SUPPORT_UNKNOWN;
|
priv->clcc_urc_support = FEATURE_SUPPORT_UNKNOWN;
|
||||||
priv->clcc_urc_regex = mm_simtech_get_clcc_urc_regex ();
|
priv->clcc_urc_regex = mm_simtech_get_clcc_urc_regex ();
|
||||||
priv->voice_call_regex = mm_simtech_get_voice_call_urc_regex ();
|
priv->voice_call_regex = mm_simtech_get_voice_call_urc_regex ();
|
||||||
@@ -1024,6 +1026,102 @@ mm_shared_simtech_voice_setup_unsolicited_events (MMIfaceModemVoice *self,
|
|||||||
task);
|
task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* 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) */
|
/* Check if Voice supported (Voice interface) */
|
||||||
|
|
||||||
@@ -1035,6 +1133,23 @@ mm_shared_simtech_voice_check_support_finish (MMIfaceModemVoice *self,
|
|||||||
return g_task_propagate_boolean (G_TASK (res), error);
|
return g_task_propagate_boolean (G_TASK (res), error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
static void
|
||||||
clcc_format_check_ready (MMBroadbandModem *self,
|
clcc_format_check_ready (MMBroadbandModem *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
@@ -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),
|
MM_IFACE_MODEM_VOICE_PERIODIC_CALL_LIST_CHECK_DISABLED, (priv->clcc_urc_support == FEATURE_SUPPORTED),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_task_return_boolean (task, TRUE);
|
mm_base_modem_at_command (MM_BASE_MODEM (self),
|
||||||
g_object_unref (task);
|
"+CPCMREG=?",
|
||||||
|
3,
|
||||||
|
TRUE,
|
||||||
|
(GAsyncReadyCallback) cpcmreg_format_check_ready,
|
||||||
|
task);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -111,4 +111,19 @@ gboolean mm_shared_simtech_voice_disable_unsolicited_events_finish (MMIfaceModem
|
|||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error);
|
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 */
|
#endif /* MM_SHARED_SIMTECH_H */
|
||||||
|
Reference in New Issue
Block a user