diff options
author | saman <mahmoudi.saman1@gmail.com> | 2021-02-07 15:01:20 +0330 |
---|---|---|
committer | Saman Mahmoodi <mahmoudi.saman1@gmail.com> | 2021-03-13 15:00:29 +0330 |
commit | 8987ae42114a8b15522734e40d117fd061e7bf3b (patch) | |
tree | 78ceae43519a246d5f5f559572116fc9da833271 /binding/gdbus/ofono_voicecallmanager.c | |
parent | 4739f747c8fbdeda94a400122651862cfdb522b7 (diff) |
Add call waiting/hold featureslamprey_11.91.0lamprey/11.91.011.91.0
I have developed most features that needed for handling waiting call
response and hold call response.
Also I have changed hangup verb due to have multiple active call. The
changes are including getting argument for hangup specific call.
For correctly working this feature you should subscribe waitingCall event as in README.md.
Signed-off-by: saman <mahmoudi.saman1@gmail.com>
Change-Id: I84c601ddd6f27d8d8e7b6d8c338ea04a48240447
Diffstat (limited to 'binding/gdbus/ofono_voicecallmanager.c')
-rw-r--r-- | binding/gdbus/ofono_voicecallmanager.c | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/binding/gdbus/ofono_voicecallmanager.c b/binding/gdbus/ofono_voicecallmanager.c index 2a361a1..78924dc 100644 --- a/binding/gdbus/ofono_voicecallmanager.c +++ b/binding/gdbus/ofono_voicecallmanager.c @@ -45,6 +45,8 @@ static void call_added(OrgOfonoVoiceCallManager *manager, g_signal_emit_by_name(manager, "incoming-call", op, cl ? cl : ""); } else if (!strcmp(state, "dialing")) { g_signal_emit_by_name(manager, "dialing-call", op, cl ? cl : ""); + } else if (!strcmp(state, "waiting")) { + g_signal_emit_by_name(manager, "waiting-call", op, cl ? cl : ""); } } @@ -59,6 +61,7 @@ const OrgOfonoVoiceCallManager *ofono_voicecallmanager_init(const gchar *op, void (*incoming_call)(OrgOfonoVoiceCallManager *manager,gchar *,gchar *), void (*dialing_call)(OrgOfonoVoiceCallManager *manager,gchar *,gchar *), + void (*waiting_call)(OrgOfonoVoiceCallManager *manager,gchar *,gchar *), void (*terminated_call)(OrgOfonoVoiceCallManager *manager,gchar *)) { OrgOfonoVoiceCallManager *manager = org_ofono_voice_call_manager_proxy_new_for_bus_sync( @@ -89,6 +92,18 @@ const OrgOfonoVoiceCallManager G_TYPE_STRING, G_TYPE_STRING); + g_signal_new("waiting-call", + G_TYPE_OBJECT, + G_SIGNAL_RUN_LAST, + 0, + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 2, + G_TYPE_STRING, + G_TYPE_STRING); + g_signal_new("terminated-call", G_TYPE_OBJECT, G_SIGNAL_RUN_LAST, @@ -108,6 +123,10 @@ const OrgOfonoVoiceCallManager AFB_ERROR("Failed to connect to signal dialing-call\n"); } + if (g_signal_connect(G_OBJECT(manager), "waiting-call", G_CALLBACK(waiting_call), NULL) <= 0) { + AFB_ERROR("Failed to connect to signal waiting-call\n"); + } + if (g_signal_connect(G_OBJECT(manager), "terminated-call", G_CALLBACK(terminated_call), NULL) <= 0) { AFB_ERROR("Failed to connect to signal terminated-call\n"); } @@ -188,3 +207,72 @@ void ofono_voicecallmanager_hangup_all(OrgOfonoVoiceCallManager *manager) org_ofono_voice_call_manager_call_hangup_all_sync(manager, NULL, &error); } + +gchar **ofono_voicecallmanager_create_multiparty(OrgOfonoVoiceCallManager *manager) +{ + gchar **out = NULL; + GError *error = NULL; + if (!manager) { + AFB_ERROR("Ofono VoiceCallmanager uninitialized\n"); + return NULL; + } + + org_ofono_voice_call_manager_call_create_multiparty_sync(manager, &out, NULL, &error); + if (error != NULL) + return NULL; + return out; +} + +gboolean ofono_voicecallmanager_hangup_multiparty(OrgOfonoVoiceCallManager *manager) +{ + GError *error = NULL; + gboolean res; + if (!manager) { + AFB_ERROR("Ofono VoiceCallmanager uninitialized\n"); + return FALSE; + } + + res = org_ofono_voice_call_manager_call_hangup_multiparty_sync(manager, NULL, &error); + + return (res && error == NULL); +} + +gboolean ofono_voicecallmanager_hold_and_answer(OrgOfonoVoiceCallManager *manager) +{ + GError *error = NULL; + gboolean res; + if (!manager) { + AFB_ERROR("Ofono VoiceCallmanager uninitialized\n"); + return FALSE; + } + + res = org_ofono_voice_call_manager_call_hold_and_answer_sync(manager, NULL, &error); + + return (res && error == NULL); +} + +gboolean ofono_voicecallmanager_release_and_answer(OrgOfonoVoiceCallManager *manager) +{ + GError *error = NULL; + if (!manager) { + AFB_ERROR("Ofono VoiceCallmanager uninitialized\n"); + return FALSE; + } + AFB_ERROR("release and answer"); + org_ofono_voice_call_manager_call_release_and_answer_sync(manager, NULL, &error); + + return (error == NULL); +} + +gboolean ofono_voicecallmanager_swap_calls(OrgOfonoVoiceCallManager *manager) +{ + GError *error = NULL; + if (!manager) { + AFB_ERROR("Ofono VoiceCallmanager uninitialized\n"); + return FALSE; + } + + org_ofono_voice_call_manager_call_swap_calls_sync(manager, NULL, &error); + + return (error == NULL); +} |