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 | |
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')
-rw-r--r-- | src/mm-base-call.c | 6 | ||||
-rw-r--r-- | src/mm-base-call.h | 4 | ||||
-rw-r--r-- | src/mm-broadband-modem.c | 6 | ||||
-rw-r--r-- | src/mm-iface-modem-voice.c | 30 | ||||
-rw-r--r-- | src/mm-iface-modem-voice.h | 4 |
5 files changed, 26 insertions, 24 deletions
diff --git a/src/mm-base-call.c b/src/mm-base-call.c index b3c6aeb5..ae84afa6 100644 --- a/src/mm-base-call.c +++ b/src/mm-base-call.c @@ -932,10 +932,14 @@ call_send_dtmf (MMBaseCall *self, /*****************************************************************************/ MMBaseCall * -mm_base_call_new (MMBaseModem *modem) +mm_base_call_new (MMBaseModem *modem, + MMCallDirection direction, + const gchar *number) { return MM_BASE_CALL (g_object_new (MM_TYPE_BASE_CALL, MM_BASE_CALL_MODEM, modem, + "direction", direction, + "number", number, NULL)); } diff --git a/src/mm-base-call.h b/src/mm-base-call.h index 9ae021ad..0ef3ffcf 100644 --- a/src/mm-base-call.h +++ b/src/mm-base-call.h @@ -92,7 +92,9 @@ struct _MMBaseCallClass { GType mm_base_call_get_type (void); /* This one can be overriden by plugins */ -MMBaseCall *mm_base_call_new (MMBaseModem *modem); +MMBaseCall *mm_base_call_new (MMBaseModem *modem, + MMCallDirection direction, + const gchar *number); void mm_base_call_export (MMBaseCall *self); void mm_base_call_unexport (MMBaseCall *self); diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index 93a3a3e0..ddbb8205 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -7115,9 +7115,11 @@ modem_voice_enable_unsolicited_events (MMIfaceModemVoice *self, /* Create CALL (Voice interface) */ static MMBaseCall * -modem_voice_create_call (MMIfaceModemVoice *self) +modem_voice_create_call (MMIfaceModemVoice *self, + MMCallDirection direction, + const gchar *number) { - return mm_base_call_new (MM_BASE_MODEM (self)); + return mm_base_call_new (MM_BASE_MODEM (self), direction, number); } /*****************************************************************************/ 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); diff --git a/src/mm-iface-modem-voice.h b/src/mm-iface-modem-voice.h index 1c16a42b..df3d399f 100644 --- a/src/mm-iface-modem-voice.h +++ b/src/mm-iface-modem-voice.h @@ -78,7 +78,9 @@ struct _MMIfaceModemVoice { GError **error); /* Create CALL objects */ - MMBaseCall * (* create_call) (MMIfaceModemVoice *self); + MMBaseCall * (* create_call) (MMIfaceModemVoice *self, + MMCallDirection direction, + const gchar *number); }; GType mm_iface_modem_voice_get_type (void); |