diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2018-07-03 14:56:52 +0200 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2018-10-16 17:09:21 +0000 |
commit | 887376fe4467da7a18b8e008537493512adb9fcb (patch) | |
tree | ae24ad69557b1556c3fe76656e27fb50153f1a66 /src/mm-iface-modem-voice.c | |
parent | 44413308b295bd52c1b24eba69bc8e9eed6b4fb5 (diff) |
mm-iface-mode: provide direction and number when creating calls
Calls created from property bundles are always outgoing, while calls
created as input events from URCs during runtime are always incoming.
This change makes it mandatory to provide at least direction of the
call when the object is created, leaving the number as an optional
property that may or may not be known in advance (e.g. it would be
optional only for incoming calls).
Diffstat (limited to 'src/mm-iface-modem-voice.c')
-rw-r--r-- | src/mm-iface-modem-voice.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/src/mm-iface-modem-voice.c b/src/mm-iface-modem-voice.c index 9c15323d..286e96d9 100644 --- a/src/mm-iface-modem-voice.c +++ b/src/mm-iface-modem-voice.c @@ -39,19 +39,19 @@ mm_iface_modem_voice_bind_simple_status (MMIfaceModemVoice *self, /*****************************************************************************/ static MMBaseCall * -create_call (MMIfaceModemVoice *self) +create_incoming_call (MMIfaceModemVoice *self, + const gchar *number) { g_assert (MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->create_call != NULL); - return MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->create_call (self); + return MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->create_call (self, MM_CALL_DIRECTION_INCOMING, number); } static MMBaseCall * -create_call_from_properties (MMIfaceModemVoice *self, - MMCallProperties *properties, - GError **error) +create_outgoing_call_from_properties (MMIfaceModemVoice *self, + MMCallProperties *properties, + GError **error) { - MMBaseCall *call; const gchar *number; /* Don't create CALL from properties if either number is missing */ @@ -66,14 +66,7 @@ create_call_from_properties (MMIfaceModemVoice *self, /* Create a call object as defined by the interface */ g_assert (MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->create_call != NULL); - call = MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->create_call (self); - g_object_set (call, - "state", mm_call_properties_get_state (properties), - "state-reason", mm_call_properties_get_state_reason (properties), - "direction", mm_call_properties_get_direction (properties), - "number", number, - NULL); - return call; + return MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->create_call (self, MM_CALL_DIRECTION_OUTGOING, number); } /*****************************************************************************/ @@ -103,11 +96,10 @@ mm_iface_modem_voice_incoming_call (MMIfaceModemVoice *self) } mm_dbg ("Creating new incoming call..."); - call = create_call (self); + call = create_incoming_call (self, NULL); g_object_set (call, - "state", MM_CALL_STATE_RINGING_IN, - "state-reason", MM_CALL_STATE_REASON_INCOMING_NEW, - "direction", MM_CALL_DIRECTION_INCOMING, + "state", MM_CALL_STATE_RINGING_IN, + "state-reason", MM_CALL_STATE_REASON_INCOMING_NEW, NULL); /* Start its validity timeout */ @@ -302,7 +294,7 @@ handle_create_auth_ready (MMBaseModem *self, return; } - call = create_call_from_properties (MM_IFACE_MODEM_VOICE (self), properties, &error); + call = create_outgoing_call_from_properties (MM_IFACE_MODEM_VOICE (self), properties, &error); if (!call) { g_object_unref (properties); g_dbus_method_invocation_take_error (ctx->invocation, error); |