base-call: ACTIVE after start() if detailed transitions unavailable

The most detailed call state transition flow for a new outgoing call
would be:

  UNKNOWN -> DIALING -> RINGING -> ACTIVE

But, if the modem doesn't support reporting intermediate states
(e.g. DIALING or RINGING) then a successful start() should imply
getting into ACTIVE state right away.

For now, only the Huawei plugin implements the detailed transition
support, so make them configurable via call object properties.
This commit is contained in:
Aleksander Morgado
2018-06-14 14:58:28 +02:00
committed by Dan Williams
parent 7c10db26c2
commit 0090124ec0
3 changed files with 50 additions and 7 deletions

View File

@@ -124,6 +124,8 @@ mm_call_huawei_new (MMBaseModem *modem)
{ {
return MM_BASE_CALL (g_object_new (MM_TYPE_CALL_HUAWEI, return MM_BASE_CALL (g_object_new (MM_TYPE_CALL_HUAWEI,
MM_BASE_CALL_MODEM, modem, MM_BASE_CALL_MODEM, modem,
MM_BASE_CALL_SUPPORTS_DIALING_TO_RINGING, TRUE,
MM_BASE_CALL_SUPPORTS_RINGING_TO_ACTIVE, TRUE,
NULL)); NULL));
} }

View File

@@ -40,6 +40,8 @@ enum {
PROP_PATH, PROP_PATH,
PROP_CONNECTION, PROP_CONNECTION,
PROP_MODEM, PROP_MODEM,
PROP_SUPPORTS_DIALING_TO_RINGING,
PROP_SUPPORTS_RINGING_TO_ACTIVE,
PROP_LAST PROP_LAST
}; };
@@ -52,6 +54,9 @@ struct _MMBaseCallPrivate {
MMBaseModem *modem; MMBaseModem *modem;
/* The path where the call object is exported */ /* The path where the call object is exported */
gchar *path; gchar *path;
/* Features */
gboolean supports_dialing_to_ringing;
gboolean supports_ringing_to_active;
}; };
/*****************************************************************************/ /*****************************************************************************/
@@ -92,8 +97,15 @@ handle_start_ready (MMBaseCall *self,
mm_base_call_change_state (self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_UNKNOWN); mm_base_call_change_state (self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_UNKNOWN);
g_dbus_method_invocation_take_error (ctx->invocation, error); g_dbus_method_invocation_take_error (ctx->invocation, error);
} else { } else {
mm_dbg ("Call started"); /* If dialing to ringing supported, leave it dialing */
mm_base_call_change_state (self, MM_CALL_STATE_DIALING, MM_CALL_STATE_REASON_OUTGOING_STARTED); if (!self->priv->supports_dialing_to_ringing) {
/* If ringing to active supported, set it ringing */
if (self->priv->supports_ringing_to_active)
mm_base_call_change_state (self, MM_CALL_STATE_RINGING_OUT, MM_CALL_STATE_REASON_OUTGOING_STARTED);
else
/* Otherwise, active right away */
mm_base_call_change_state (self, MM_CALL_STATE_ACTIVE, MM_CALL_STATE_REASON_OUTGOING_STARTED);
}
mm_gdbus_call_complete_start (MM_GDBUS_CALL (ctx->self), ctx->invocation); mm_gdbus_call_complete_start (MM_GDBUS_CALL (ctx->self), ctx->invocation);
} }
handle_start_context_free (ctx); handle_start_context_free (ctx);
@@ -136,7 +148,7 @@ handle_start_auth_ready (MMBaseModem *modem,
return; return;
} }
mm_base_call_change_state (ctx->self, MM_CALL_STATE_RINGING_OUT, MM_CALL_STATE_REASON_OUTGOING_STARTED); mm_base_call_change_state (ctx->self, MM_CALL_STATE_DIALING, MM_CALL_STATE_REASON_OUTGOING_STARTED);
MM_BASE_CALL_GET_CLASS (ctx->self)->start (ctx->self, MM_BASE_CALL_GET_CLASS (ctx->self)->start (ctx->self,
(GAsyncReadyCallback)handle_start_ready, (GAsyncReadyCallback)handle_start_ready,
@@ -887,6 +899,12 @@ set_property (GObject *object,
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
} }
break; break;
case PROP_SUPPORTS_DIALING_TO_RINGING:
self->priv->supports_dialing_to_ringing = g_value_get_boolean (value);
break;
case PROP_SUPPORTS_RINGING_TO_ACTIVE:
self->priv->supports_ringing_to_active = g_value_get_boolean (value);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@@ -911,6 +929,12 @@ get_property (GObject *object,
case PROP_MODEM: case PROP_MODEM:
g_value_set_object (value, self->priv->modem); g_value_set_object (value, self->priv->modem);
break; break;
case PROP_SUPPORTS_DIALING_TO_RINGING:
g_value_set_boolean (value, self->priv->supports_dialing_to_ringing);
break;
case PROP_SUPPORTS_RINGING_TO_ACTIVE:
g_value_set_boolean (value, self->priv->supports_ringing_to_active);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@@ -973,7 +997,6 @@ mm_base_call_class_init (MMBaseCallClass *klass)
klass->send_dtmf = call_send_dtmf; klass->send_dtmf = call_send_dtmf;
klass->send_dtmf_finish = call_send_dtmf_finish; klass->send_dtmf_finish = call_send_dtmf_finish;
properties[PROP_CONNECTION] = properties[PROP_CONNECTION] =
g_param_spec_object (MM_BASE_CALL_CONNECTION, g_param_spec_object (MM_BASE_CALL_CONNECTION,
"Connection", "Connection",
@@ -997,4 +1020,20 @@ mm_base_call_class_init (MMBaseCallClass *klass)
MM_TYPE_BASE_MODEM, MM_TYPE_BASE_MODEM,
G_PARAM_READWRITE); G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_MODEM, properties[PROP_MODEM]); g_object_class_install_property (object_class, PROP_MODEM, properties[PROP_MODEM]);
properties[PROP_SUPPORTS_DIALING_TO_RINGING] =
g_param_spec_boolean (MM_BASE_CALL_SUPPORTS_DIALING_TO_RINGING,
"Dialing to ringing",
"Whether the call implementation reports dialing to ringing state updates",
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_SUPPORTS_DIALING_TO_RINGING, properties[PROP_SUPPORTS_DIALING_TO_RINGING]);
properties[PROP_SUPPORTS_RINGING_TO_ACTIVE] =
g_param_spec_boolean (MM_BASE_CALL_SUPPORTS_RINGING_TO_ACTIVE,
"Ringing to active",
"Whether the call implementation reports ringing to active state updates",
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_SUPPORTS_RINGING_TO_ACTIVE, properties[PROP_SUPPORTS_RINGING_TO_ACTIVE]);
} }

View File

@@ -38,6 +38,8 @@ typedef struct _MMBaseCallPrivate MMBaseCallPrivate;
#define MM_BASE_CALL_PATH "call-path" #define MM_BASE_CALL_PATH "call-path"
#define MM_BASE_CALL_CONNECTION "call-connection" #define MM_BASE_CALL_CONNECTION "call-connection"
#define MM_BASE_CALL_MODEM "call-modem" #define MM_BASE_CALL_MODEM "call-modem"
#define MM_BASE_CALL_SUPPORTS_DIALING_TO_RINGING "call-supports-dialing-to-ringing"
#define MM_BASE_CALL_SUPPORTS_RINGING_TO_ACTIVE "call-supports-ringing-to-active"
struct _MMBaseCall { struct _MMBaseCall {
MmGdbusCallSkeleton parent; MmGdbusCallSkeleton parent;