broadband-modem: if +CLCC is supported, call supports detailed events

This commit is contained in:
Aleksander Morgado
2019-06-16 16:15:02 +02:00
parent 47dd9fffac
commit b22f90c4c4
3 changed files with 46 additions and 12 deletions

View File

@@ -542,10 +542,7 @@ handle_hangup_ready (MMBaseCall *self,
if (!MM_BASE_CALL_GET_CLASS (self)->hangup_finish (self, res, &error))
g_dbus_method_invocation_take_error (ctx->invocation, error);
else {
if (ctx->self->priv->incoming_timeout) {
g_source_remove (ctx->self->priv->incoming_timeout);
ctx->self->priv->incoming_timeout = 0;
}
/* note: timeouts are already removed when setting state as TERMINATED */
mm_gdbus_call_complete_hangup (MM_GDBUS_CALL (ctx->self), ctx->invocation);
}
@@ -1121,12 +1118,18 @@ call_send_dtmf (MMBaseCall *self,
MMBaseCall *
mm_base_call_new (MMBaseModem *modem,
MMCallDirection direction,
const gchar *number)
const gchar *number,
gboolean skip_incoming_timeout,
gboolean supports_dialing_to_ringing,
gboolean supports_ringing_to_active)
{
return MM_BASE_CALL (g_object_new (MM_TYPE_BASE_CALL,
MM_BASE_CALL_MODEM, modem,
"direction", direction,
"number", number,
MM_BASE_CALL_SKIP_INCOMING_TIMEOUT, skip_incoming_timeout,
MM_BASE_CALL_SUPPORTS_DIALING_TO_RINGING, supports_dialing_to_ringing,
MM_BASE_CALL_SUPPORTS_RINGING_TO_ACTIVE, supports_ringing_to_active,
NULL));
}

View File

@@ -112,7 +112,10 @@ GType mm_base_call_get_type (void);
/* This one can be overriden by plugins */
MMBaseCall *mm_base_call_new (MMBaseModem *modem,
MMCallDirection direction,
const gchar *number);
const gchar *number,
gboolean skip_incoming_timeout,
gboolean supports_dialing_to_ringing,
gboolean supports_ringing_to_active);
void mm_base_call_export (MMBaseCall *self);
void mm_base_call_unexport (MMBaseCall *self);

View File

@@ -225,6 +225,7 @@ struct _MMBroadbandModemPrivate {
/* Properties */
GObject *modem_voice_dbus_skeleton;
MMCallList *modem_voice_call_list;
gboolean clcc_supported;
/*<--- Modem Time interface --->*/
/* Properties */
@@ -7199,6 +7200,19 @@ modem_voice_check_support_finish (MMIfaceModemVoice *self,
return g_task_propagate_boolean (G_TASK (res), error);
}
static void
clcc_format_check_ready (MMBroadbandModem *self,
GAsyncResult *res,
GTask *task)
{
/* +CLCC supported unless we got any error response */
self->priv->clcc_supported = !!mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, NULL);
/* ATH command is supported; assume we have full voice capabilities */
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}
static void
ath_format_check_ready (MMBroadbandModem *self,
GAsyncResult *res,
@@ -7213,9 +7227,13 @@ ath_format_check_ready (MMBroadbandModem *self,
return;
}
/* ATH command is supported; assume we have full voice capabilities */
g_task_return_boolean (task, TRUE);
g_object_unref (task);
/* Also check if +CLCC is supported */
mm_base_modem_at_command (MM_BASE_MODEM (self),
"+CLCC=?",
3,
TRUE,
(GAsyncReadyCallback)clcc_format_check_ready,
task);
}
static void
@@ -7572,11 +7590,21 @@ modem_voice_disable_unsolicited_events (MMIfaceModemVoice *self,
/* Create CALL (Voice interface) */
static MMBaseCall *
modem_voice_create_call (MMIfaceModemVoice *self,
modem_voice_create_call (MMIfaceModemVoice *_self,
MMCallDirection direction,
const gchar *number)
{
return mm_base_call_new (MM_BASE_MODEM (self), direction, number);
MMBroadbandModem *self = MM_BROADBAND_MODEM (_self);
return mm_base_call_new (MM_BASE_MODEM (self),
direction,
number,
/* If +CLCC is supported, we want no incoming timeout.
* Also, we're able to support detailed call state updates without
* additional vendor-specific commands. */
self->priv->clcc_supported, /* skip incoming timeout */
self->priv->clcc_supported, /* dialing->ringing supported */
self->priv->clcc_supported); /* ringing->active supported */
}
/*****************************************************************************/