summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Porter <mporter@konsulko.com>2017-05-19 14:55:36 -0400
committerMatt Porter <mporter@konsulko.com>2017-05-19 15:02:30 -0400
commit3a208ed9a418f02b4938f447af04666593cda410 (patch)
tree72a3d3ec5345175c538370b4bf09a45c9e997635
parent53f6222d2ca009c86f301a630e4bf81d25c86feb (diff)
Add support for answering calls to the telephony binding and UI
Adds an answer verb and associated incoming call lifecycle management to the telephony binding. Leverages the binding answer support to activate the call answer button when the binding reports that we are in an incoming call state. Once the incoming call is answered, the ring tone is deactivated. AGL-Bug: SPEC-600 Change-Id: I4f2db2d248cfd0f4945fc17d450e9b691061cc9e Signed-off-by: Matt Porter <mporter@konsulko.com>
-rw-r--r--app/Dialer.qml12
-rw-r--r--app/api/Telephony.qml5
-rw-r--r--telephony-binding/gdbus/ofono_voicecall.c7
-rw-r--r--telephony-binding/gdbus/ofono_voicecall.h1
-rw-r--r--telephony-binding/telephony-binding.c16
5 files changed, 38 insertions, 3 deletions
diff --git a/app/Dialer.qml b/app/Dialer.qml
index 5dc800a..99610fd 100644
--- a/app/Dialer.qml
+++ b/app/Dialer.qml
@@ -143,11 +143,12 @@ Item {
Layout.alignment: Qt.AlignHCenter
onImage: './images/HMI_Phone_Hangup.svg'
offImage: './images/HMI_Phone_Call.svg'
- opacity: number.text.length > 0 ? 1 : 0.25
+ property var active: (number.text.length > 0) || (telephony.callStatus == "incoming")
+ opacity: active ? 1 : 0.25
onCheckedChanged: {
if (checked) {
- if (number.text.length === 0) {
+ if (!active) {
callButton.checked = false
return
}
@@ -156,7 +157,12 @@ Item {
if (contact.name === '')
contact.name = 'Unknown'
history.insert(0, contact)
- telephony.dial(number.text)
+ if (telephony.callStatus == "incoming") {
+ telephony.answer()
+ ringtone.active = false;
+ } else {
+ telephony.dial(number.text)
+ }
} else {
name.text = ''
number.text = ''
diff --git a/app/api/Telephony.qml b/app/api/Telephony.qml
index 721a51a..b42af4f 100644
--- a/app/api/Telephony.qml
+++ b/app/api/Telephony.qml
@@ -92,6 +92,11 @@ WebSocket {
sendSocketMesage("dial", parameterJson)
}
+ function answer() {
+ var parameterJson = 'None'
+ sendSocketMesage("answer", parameterJson)
+ }
+
function hangup() {
var parameterJson = 'None'
sendSocketMesage("hangup", parameterJson)
diff --git a/telephony-binding/gdbus/ofono_voicecall.c b/telephony-binding/gdbus/ofono_voicecall.c
index b602c89..de6db2f 100644
--- a/telephony-binding/gdbus/ofono_voicecall.c
+++ b/telephony-binding/gdbus/ofono_voicecall.c
@@ -34,3 +34,10 @@ void ofono_voicecall_hangup(OrgOfonoVoiceCall *voice_call)
org_ofono_voice_call_call_hangup_sync(voice_call, NULL, &error);
}
+
+void ofono_voicecall_answer(OrgOfonoVoiceCall *voice_call)
+{
+ GError *error = NULL;
+
+ org_ofono_voice_call_call_answer_sync(voice_call, NULL, &error);
+}
diff --git a/telephony-binding/gdbus/ofono_voicecall.h b/telephony-binding/gdbus/ofono_voicecall.h
index 0e33dd5..6405d1b 100644
--- a/telephony-binding/gdbus/ofono_voicecall.h
+++ b/telephony-binding/gdbus/ofono_voicecall.h
@@ -20,4 +20,5 @@
OrgOfonoVoiceCall *ofono_voicecall_new(gchar *);
void ofono_voicecall_free(OrgOfonoVoiceCall *);
+void ofono_voicecall_answer(OrgOfonoVoiceCall *);
void ofono_voicecall_hangup(OrgOfonoVoiceCall *);
diff --git a/telephony-binding/telephony-binding.c b/telephony-binding/telephony-binding.c
index 134432c..00115d2 100644
--- a/telephony-binding/telephony-binding.c
+++ b/telephony-binding/telephony-binding.c
@@ -70,6 +70,16 @@ static void hangup(struct afb_req request)
}
}
+static void answer(struct afb_req request)
+{
+ if (incoming_call) {
+ DEBUG(interface, "Answer voice call\n");
+ voice_call = incoming_call;
+ ofono_voicecall_answer(voice_call);
+ } else {
+ ERROR(interface, "Answer: no incoming call");
+ }
+}
static void incoming_call_cb(OrgOfonoVoiceCallManager *manager, gchar *op, gchar *clip)
{
@@ -147,6 +157,12 @@ static const struct afb_verb_desc_v1 verbs[]= {
.callback = hangup,
.info = "Hangup phone"
},
+ {
+ .name = "answer",
+ .session = AFB_SESSION_NONE,
+ .callback = answer,
+ .info = "Answer phone"
+ },
{NULL}
};