huawei,call: handle in-call URCs in the call object itself

Instead of handling the URCs in the modem object and using the
MMIfaceModem as a bridge to report the status read from the URC to a
call obtained from the MMCallList... just handle the URCs in the call
object itself.
This commit is contained in:
Aleksander Morgado
2018-10-16 17:09:21 +00:00
committed by Dan Williams
parent f71e120fb7
commit fc0feee654
8 changed files with 205 additions and 435 deletions
-93
View File
@@ -109,99 +109,6 @@ mm_call_list_get_first_ringing_in_call (MMCallList *self)
return NULL;
}
MMBaseCall *
mm_call_list_get_first_ringing_out_call (MMCallList *self)
{
MMBaseCall *call = NULL;
GList *l;
for (l = self->priv->list; l; l = g_list_next (l)) {
MMCallState state;
g_object_get (MM_BASE_CALL (l->data),
"state", &state,
NULL);
if (state == MM_CALL_STATE_RINGING_IN ||
state == MM_CALL_STATE_RINGING_OUT) {
call = MM_BASE_CALL (l->data);
break;
}
}
return call;
}
MMBaseCall *
mm_call_list_get_first_outgoing_dialing_call (MMCallList *self)
{
MMBaseCall *call = NULL;
GList *l;
for (l = self->priv->list; l; l = g_list_next (l)) {
MMCallState state;
MMCallDirection direction;
g_object_get (MM_BASE_CALL (l->data),
"state", &state,
"direction", &direction,
NULL);
if (direction == MM_CALL_DIRECTION_OUTGOING &&
state == MM_CALL_STATE_DIALING) {
call = MM_BASE_CALL (l->data);
break;
}
}
return call;
}
MMBaseCall *
mm_call_list_get_first_non_terminated_call (MMCallList *self)
{
MMBaseCall *call = NULL;
GList *l;
for (l = self->priv->list; l; l = g_list_next (l)) {
MMCallState state;
g_object_get (MM_BASE_CALL (l->data),
"state", &state,
NULL);
if (state != MM_CALL_STATE_TERMINATED) {
call = MM_BASE_CALL (l->data);
break;
}
}
return call;
}
gboolean
mm_call_list_send_dtmf_to_active_calls (MMCallList *self,
const gchar *dtmf)
{
gboolean signaled = FALSE;
GList *l;
for (l = self->priv->list; l; l = g_list_next (l)) {
MMCallState state;
g_object_get (MM_BASE_CALL (l->data),
"state", &state,
NULL);
if (state == MM_CALL_STATE_ACTIVE) {
signaled = TRUE;
mm_base_call_received_dtmf (MM_BASE_CALL (l->data), dtmf);
}
}
return signaled;
}
/*****************************************************************************/
static guint
+1 -6
View File
@@ -68,11 +68,6 @@ gboolean mm_call_list_delete_call (MMCallList *self,
const gchar *call_path,
GError **error);
MMBaseCall *mm_call_list_get_first_ringing_in_call (MMCallList *self);
MMBaseCall *mm_call_list_get_first_ringing_out_call (MMCallList *self);
MMBaseCall *mm_call_list_get_first_outgoing_dialing_call (MMCallList *self);
MMBaseCall *mm_call_list_get_first_non_terminated_call (MMCallList *self);
gboolean mm_call_list_send_dtmf_to_active_calls (MMCallList *self,
const gchar *dtmf);
MMBaseCall *mm_call_list_get_first_ringing_in_call (MMCallList *self);
#endif /* MM_CALL_LIST_H */
-93
View File
@@ -123,99 +123,6 @@ mm_iface_modem_voice_update_incoming_call_number (MMIfaceModemVoice *self,
return updated;
}
gboolean
mm_iface_modem_voice_call_dialing_to_ringing (MMIfaceModemVoice *self)
{
gboolean updated = FALSE;
MMBaseCall *call = NULL;
MMCallList *list = NULL;
g_object_get (MM_BASE_MODEM (self),
MM_IFACE_MODEM_VOICE_CALL_LIST, &list,
NULL);
if (list) {
call = mm_call_list_get_first_outgoing_dialing_call (list);
if (call) {
mm_base_call_change_state (call, MM_CALL_STATE_RINGING_OUT, MM_CALL_STATE_REASON_OUTGOING_STARTED);
updated = TRUE;
} else {
mm_dbg ("Outgoing dialing call does not exist");
}
}
return updated;
}
gboolean
mm_iface_modem_voice_call_ringing_to_active (MMIfaceModemVoice *self)
{
gboolean updated = FALSE;
MMBaseCall *call = NULL;
MMCallList *list = NULL;
g_object_get (MM_BASE_MODEM (self),
MM_IFACE_MODEM_VOICE_CALL_LIST, &list,
NULL);
if (list) {
call = mm_call_list_get_first_ringing_out_call (list);
if (call) {
mm_base_call_change_state (call, MM_CALL_STATE_ACTIVE, MM_CALL_STATE_REASON_ACCEPTED);
updated = TRUE;
} else {
mm_dbg ("Ringing call does not exist");
}
}
return updated;
}
gboolean
mm_iface_modem_voice_network_hangup (MMIfaceModemVoice *self)
{
gboolean updated = FALSE;
MMBaseCall *call = NULL;
MMCallList *list = NULL;
g_object_get (MM_BASE_MODEM (self),
MM_IFACE_MODEM_VOICE_CALL_LIST, &list,
NULL);
if (list) {
call = mm_call_list_get_first_non_terminated_call (list);
if (call) {
mm_base_call_change_state (call, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_TERMINATED);
updated = TRUE;
} else {
mm_dbg ("No call to hangup");
}
}
return updated;
}
gboolean
mm_iface_modem_voice_received_dtmf (MMIfaceModemVoice *self,
gchar *dtmf)
{
gboolean updated = FALSE;
MMCallList *list = NULL;
g_object_get (MM_BASE_MODEM (self),
MM_IFACE_MODEM_VOICE_CALL_LIST, &list,
NULL);
if (list) {
updated = mm_call_list_send_dtmf_to_active_calls (list, dtmf);
}
return updated;
}
/*****************************************************************************/
typedef struct {
-5
View File
@@ -123,11 +123,6 @@ gboolean mm_iface_modem_voice_update_incoming_call_number (MMIfaceModemVoi
gchar *number,
guint type,
guint validity);
gboolean mm_iface_modem_voice_call_dialing_to_ringing (MMIfaceModemVoice *self);
gboolean mm_iface_modem_voice_call_ringing_to_active (MMIfaceModemVoice *self);
gboolean mm_iface_modem_voice_network_hangup (MMIfaceModemVoice *self);
gboolean mm_iface_modem_voice_received_dtmf (MMIfaceModemVoice *self,
gchar *dtmf);
/* Look for a new valid multipart reference */
guint8 mm_iface_modem_voice_get_local_multipart_reference (MMIfaceModemVoice *self,