From 55ae2c7f2f5729346e28425f84a28b810b33efed Mon Sep 17 00:00:00 2001 From: Marco Bascetta Date: Wed, 6 May 2015 16:21:17 +0200 Subject: huawei: handle voice call state changes --- src/mm-iface-modem-voice.c | 62 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 10 deletions(-) (limited to 'src/mm-iface-modem-voice.c') diff --git a/src/mm-iface-modem-voice.c b/src/mm-iface-modem-voice.c index 6b896dbde..36cb82f79 100644 --- a/src/mm-iface-modem-voice.c +++ b/src/mm-iface-modem-voice.c @@ -118,7 +118,7 @@ gboolean mm_iface_modem_voice_update_incoming_call_number (MMIfaceModemVoice *se return updated; } -gboolean mm_iface_modem_voice_network_hangup (MMIfaceModemVoice *self) +gboolean mm_iface_modem_voice_call_dialing_to_ringing(MMIfaceModemVoice *self) { gboolean updated = FALSE; MMBaseCall *call = NULL; @@ -130,19 +130,61 @@ gboolean mm_iface_modem_voice_network_hangup (MMIfaceModemVoice *self) if( list ) { - call = mm_call_list_get_first_non_terminated_call(list); + call = mm_call_list_get_first_outgoing_dialing_call(list); if( call ) { - //BASCETTA:TODO: Hang this call! - g_object_set (call, - "state", MM_CALL_STATE_TERMINATED, - "state-reason", MM_CALL_STATE_REASON_TERMINATED, - NULL); - mm_gdbus_call_set_state(MM_GDBUS_CALL (call), MM_CALL_STATE_TERMINATED); - mm_gdbus_call_set_state_reason(MM_GDBUS_CALL (call), MM_CALL_STATE_REASON_TERMINATED); + mm_base_call_change_state(call, MM_CALL_STATE_RINGING_OUT, MM_CALL_STATE_REASON_OUTGOING_STARTED); + updated = TRUE; + } else { + mm_dbg("[%s:%d] Incoming call does not exist yet", __func__, __LINE__); + } + } - //BASCETTA:TODO: I have to signal state change... + 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_call(list); + if( call ) { + mm_base_call_change_state(call, MM_CALL_STATE_ACTIVE, MM_CALL_STATE_REASON_ACCEPTED); + + updated = TRUE; + } else { + mm_dbg("[%s:%d] Incoming call does not exist yet", __func__, __LINE__); + } + } + + 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("[%s:%d] Incoming call does not exist yet", __func__, __LINE__); } -- cgit v1.2.1