diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2019-07-02 10:56:18 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2019-07-11 23:21:00 +0200 |
commit | 55e37a6836a358e60a67b0aff3dfea77c1c78f30 (patch) | |
tree | 66638e1f1a156cc1e3d4f3ea961b1781aeec82c1 /src/mm-broadband-modem.c | |
parent | 86aeb84f950c3b3e3be63c8920e63877a9c622f2 (diff) |
iface-modem-voice: allow reporting state updates of any single call
Instead of providing a method to exclusively provide incoming call
updates, make it more generic so that we allow plugins to provide
state updates for any kind of call, not just incoming ones.
The logic to match the call info provided by URCs is updated so that
it can be reused also by the single call reports, in addition to the
full call list reports.
Diffstat (limited to 'src/mm-broadband-modem.c')
-rw-r--r-- | src/mm-broadband-modem.c | 65 |
1 files changed, 44 insertions, 21 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index 15194f42..696f31a0 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -7331,53 +7331,76 @@ modem_voice_setup_cleanup_unsolicited_events_finish (MMIfaceModemVoice *self, } static void -ccwa_received (MMPortSerialAt *port, - GMatchInfo *info, +ccwa_received (MMPortSerialAt *port, + GMatchInfo *info, MMBroadbandModem *self) { - gchar *str; + MMCallInfo call_info; - str = mm_get_string_unquoted_from_match_info (info, 1); - mm_dbg ("Call waiting (%s)", str); - mm_iface_modem_voice_report_incoming_call (MM_IFACE_MODEM_VOICE (self), str, MM_CALL_STATE_WAITING); - g_free (str); + call_info.index = 0; + call_info.direction = MM_CALL_DIRECTION_INCOMING; + call_info.state = MM_CALL_STATE_WAITING; + call_info.number = mm_get_string_unquoted_from_match_info (info, 1); + + mm_dbg ("Call waiting (%s)", call_info.number); + mm_iface_modem_voice_report_call (MM_IFACE_MODEM_VOICE (self), &call_info); + + g_free (call_info.number); } static void -ring_received (MMPortSerialAt *port, - GMatchInfo *info, +ring_received (MMPortSerialAt *port, + GMatchInfo *info, MMBroadbandModem *self) { + MMCallInfo call_info; + + call_info.index = 0; + call_info.direction = MM_CALL_DIRECTION_INCOMING; + call_info.state = MM_CALL_STATE_RINGING_IN; + call_info.number = NULL; + mm_dbg ("Ringing"); - mm_iface_modem_voice_report_incoming_call (MM_IFACE_MODEM_VOICE (self), NULL, MM_CALL_STATE_RINGING_IN); + mm_iface_modem_voice_report_call (MM_IFACE_MODEM_VOICE (self), &call_info); } static void -cring_received (MMPortSerialAt *port, - GMatchInfo *info, +cring_received (MMPortSerialAt *port, + GMatchInfo *info, MMBroadbandModem *self) { - gchar *str; + MMCallInfo call_info; + gchar *str; /* We could have "VOICE" or "DATA". Now consider only "VOICE" */ - str = mm_get_string_unquoted_from_match_info (info, 1); mm_dbg ("Ringing (%s)", str); g_free (str); - mm_iface_modem_voice_report_incoming_call (MM_IFACE_MODEM_VOICE (self), NULL, MM_CALL_STATE_RINGING_IN); + call_info.index = 0; + call_info.direction = MM_CALL_DIRECTION_INCOMING; + call_info.state = MM_CALL_STATE_RINGING_IN; + call_info.number = NULL; + + mm_iface_modem_voice_report_call (MM_IFACE_MODEM_VOICE (self), &call_info); } static void -clip_received (MMPortSerialAt *port, - GMatchInfo *info, +clip_received (MMPortSerialAt *port, + GMatchInfo *info, MMBroadbandModem *self) { - gchar *str; + MMCallInfo call_info; - str = mm_get_string_unquoted_from_match_info (info, 1); - mm_iface_modem_voice_report_incoming_call (MM_IFACE_MODEM_VOICE (self), str, MM_CALL_STATE_RINGING_IN); - g_free (str); + call_info.index = 0; + call_info.direction = MM_CALL_DIRECTION_INCOMING; + call_info.state = MM_CALL_STATE_RINGING_IN; + call_info.number = mm_get_string_unquoted_from_match_info (info, 1); + + mm_dbg ("Ringing (%s)", call_info.number); + mm_iface_modem_voice_report_call (MM_IFACE_MODEM_VOICE (self), &call_info); + + g_free (call_info.number); } static void |