From 58aa4fbd91ca721994b6efe176ea94ccaee324ca Mon Sep 17 00:00:00 2001 From: saman Date: Wed, 16 Dec 2020 14:21:03 +0330 Subject: Adding new verb as send_tones When talking is in progress and someone is talking with the operator, for connecting to special part, the operator says that press 1 or somthings like that. for supporting this property in device side and send that command through the bluetooth, we should use SendTones method on VoiceCallManager interface. Bug-AGL: SPEC-3026 Signed-off-by: saman Change-Id: I875816c1eaca6621d4be9ab5297321ff52571ec5 --- binding/gdbus/ofono_voicecallmanager.c | 12 ++++++++++++ binding/gdbus/ofono_voicecallmanager.h | 1 + binding/telephony-binding.c | 21 +++++++++++++++++++++ 3 files changed, 34 insertions(+) (limited to 'binding') diff --git a/binding/gdbus/ofono_voicecallmanager.c b/binding/gdbus/ofono_voicecallmanager.c index 462ce08..7e8f407 100644 --- a/binding/gdbus/ofono_voicecallmanager.c +++ b/binding/gdbus/ofono_voicecallmanager.c @@ -163,6 +163,18 @@ int ofono_voicecallmanager_last_dial(OrgOfonoVoiceCallManager *manager) return -1; } +int ofono_voicecallmanager_send_tones(OrgOfonoVoiceCallManager *manager, const gchar *number) +{ + if (!manager) { + AFB_ERROR("Ofono VoiceCallmanager uninitialized\n"); + return -1; + } + + if (org_ofono_voice_call_manager_call_send_tones_sync(manager, number, NULL, NULL)) + return 0; + return -1; +} + void ofono_voicecallmanager_hangup_all(OrgOfonoVoiceCallManager *manager) { GError *error = NULL; diff --git a/binding/gdbus/ofono_voicecallmanager.h b/binding/gdbus/ofono_voicecallmanager.h index 1a14111..c878cfc 100644 --- a/binding/gdbus/ofono_voicecallmanager.h +++ b/binding/gdbus/ofono_voicecallmanager.h @@ -26,4 +26,5 @@ OrgOfonoVoiceCallManager void ofono_voicecallmanager_free(OrgOfonoVoiceCallManager *); gchar *ofono_voicecallmanager_dial(OrgOfonoVoiceCallManager *, gchar *, gchar *); int ofono_voicecallmanager_last_dial(OrgOfonoVoiceCallManager *manager); +gboolean ofono_voicecallmanager_send_tones(OrgOfonoVoiceCallManager *manager, const char *call_path); void ofono_hangup_all(OrgOfonoVoiceCallManager *); diff --git a/binding/telephony-binding.c b/binding/telephony-binding.c index dce0ef9..2f96338 100644 --- a/binding/telephony-binding.c +++ b/binding/telephony-binding.c @@ -79,6 +79,23 @@ static void last_dial(afb_req_t request) } } +static void send_tones(afb_req_t request) +{ + const char *value = afb_req_value(request, "value"); + + if (!voice_call) { + AFB_ERROR("send_tones: cannot send tone without active call"); + afb_req_fail(request, "there is no active call", NULL); + } else { + if (!ofono_voicecallmanager_send_tones(vcm, value)) { + afb_req_success(request, NULL, NULL); + } else { + AFB_ERROR("send_tones: failed to send tone\n"); + afb_req_fail(request, "failed send tone", NULL); + } + } +} + static void hangup(afb_req_t request) { if (voice_call) { @@ -363,6 +380,10 @@ static const afb_verb_t verbs[]= { .verb = "last_dial", .callback = last_dial, }, + { + .verb = "send_tones", + .callback = send_tones, + }, { .verb = "hangup", .callback = hangup, -- cgit 1.2.3-korg