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)) if (!MM_BASE_CALL_GET_CLASS (self)->hangup_finish (self, res, &error))
g_dbus_method_invocation_take_error (ctx->invocation, error); g_dbus_method_invocation_take_error (ctx->invocation, error);
else { else {
if (ctx->self->priv->incoming_timeout) { /* note: timeouts are already removed when setting state as TERMINATED */
g_source_remove (ctx->self->priv->incoming_timeout);
ctx->self->priv->incoming_timeout = 0;
}
mm_gdbus_call_complete_hangup (MM_GDBUS_CALL (ctx->self), ctx->invocation); mm_gdbus_call_complete_hangup (MM_GDBUS_CALL (ctx->self), ctx->invocation);
} }
@@ -1121,12 +1118,18 @@ call_send_dtmf (MMBaseCall *self,
MMBaseCall * MMBaseCall *
mm_base_call_new (MMBaseModem *modem, mm_base_call_new (MMBaseModem *modem,
MMCallDirection direction, 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, return MM_BASE_CALL (g_object_new (MM_TYPE_BASE_CALL,
MM_BASE_CALL_MODEM, modem, MM_BASE_CALL_MODEM, modem,
"direction", direction, "direction", direction,
"number", number, "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)); NULL));
} }

View File

@@ -112,7 +112,10 @@ GType mm_base_call_get_type (void);
/* This one can be overriden by plugins */ /* This one can be overriden by plugins */
MMBaseCall *mm_base_call_new (MMBaseModem *modem, MMBaseCall *mm_base_call_new (MMBaseModem *modem,
MMCallDirection direction, 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_export (MMBaseCall *self);
void mm_base_call_unexport (MMBaseCall *self); void mm_base_call_unexport (MMBaseCall *self);

View File

@@ -223,8 +223,9 @@ struct _MMBroadbandModemPrivate {
/*<--- Modem Voice interface --->*/ /*<--- Modem Voice interface --->*/
/* Properties */ /* Properties */
GObject *modem_voice_dbus_skeleton; GObject *modem_voice_dbus_skeleton;
MMCallList *modem_voice_call_list; MMCallList *modem_voice_call_list;
gboolean clcc_supported;
/*<--- Modem Time interface --->*/ /*<--- Modem Time interface --->*/
/* Properties */ /* Properties */
@@ -7199,6 +7200,19 @@ modem_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
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 static void
ath_format_check_ready (MMBroadbandModem *self, ath_format_check_ready (MMBroadbandModem *self,
GAsyncResult *res, GAsyncResult *res,
@@ -7213,9 +7227,13 @@ ath_format_check_ready (MMBroadbandModem *self,
return; return;
} }
/* ATH command is supported; assume we have full voice capabilities */ /* Also check if +CLCC is supported */
g_task_return_boolean (task, TRUE); mm_base_modem_at_command (MM_BASE_MODEM (self),
g_object_unref (task); "+CLCC=?",
3,
TRUE,
(GAsyncReadyCallback)clcc_format_check_ready,
task);
} }
static void static void
@@ -7572,11 +7590,21 @@ modem_voice_disable_unsolicited_events (MMIfaceModemVoice *self,
/* Create CALL (Voice interface) */ /* Create CALL (Voice interface) */
static MMBaseCall * static MMBaseCall *
modem_voice_create_call (MMIfaceModemVoice *self, modem_voice_create_call (MMIfaceModemVoice *_self,
MMCallDirection direction, MMCallDirection direction,
const gchar *number) 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 */
} }
/*****************************************************************************/ /*****************************************************************************/