summaryrefslogtreecommitdiffstats
path: root/telephony-binding/telephony-binding.c
diff options
context:
space:
mode:
authorMatt Porter <mporter@konsulko.com>2017-05-18 22:43:27 -0400
committerMatt Porter <mporter@konsulko.com>2017-05-19 10:01:02 -0400
commit91520f0839b47641162b2f4ba5e788f6a602b4e4 (patch)
tree47864b1e5d5c3ff1e5145a34bb4dbd4206af75f2 /telephony-binding/telephony-binding.c
parented2a6d1359b7967d56172c0a37660181722a2019 (diff)
Add telephony binding event support and UI call status notification
Add supports for incoming call, dialing call, and terminated call events in the telephony binding. The phone UI is enhanced to make use of these telephony binding events to display a notifications of phone call status. These include generate a ring tone and displaying incoming phone number information, outgoing phone number being dialed, and halt of the ring tone and clearing of the notification space when a call is terminated. AGL-Bug: SPEC-598 Change-Id: Ied610b70c2e6edb1f631decd417cdbd39746a558 Signed-off-by: Matt Porter <mporter@konsulko.com>
Diffstat (limited to 'telephony-binding/telephony-binding.c')
-rw-r--r--telephony-binding/telephony-binding.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/telephony-binding/telephony-binding.c b/telephony-binding/telephony-binding.c
index 6edecd3..bf618ce 100644
--- a/telephony-binding/telephony-binding.c
+++ b/telephony-binding/telephony-binding.c
@@ -78,11 +78,35 @@ static void hangup(struct afb_req request)
}
-static void incoming_call_cb(OrgOfonoVoiceCallManager *manager, gchar *op, gchar *clip) {
- WARNING(interface, "Incoming call from %s\n", clip);
+static void incoming_call_cb(OrgOfonoVoiceCallManager *manager, gchar *op, gchar *clip)
+{
+ struct json_object *call_info;
+
+ call_info = json_object_new_object();
+ json_object_object_add(call_info, "clip", json_object_new_string(clip));
+ afb_daemon_broadcast_event(interface->daemon, "incomingCall", call_info);
incoming_call = strdup(op);
}
+static void dialing_call_cb(OrgOfonoVoiceCallManager *manager, gchar *op, gchar *colp)
+{
+ struct json_object *call_info;
+
+ call_info = json_object_new_object();
+ json_object_object_add(call_info, "colp", json_object_new_string(colp));
+ afb_daemon_broadcast_event(interface->daemon, "dialingCall", call_info);
+}
+
+static void terminated_call_cb(OrgOfonoVoiceCallManager *manager, gchar *op)
+{
+ if (incoming_call) {
+ free(incoming_call);
+ incoming_call = NULL;
+ }
+
+ afb_daemon_broadcast_event(interface->daemon, "terminatedCall", NULL);
+}
+
static void *main_loop_thread(void *unused)
{
GMainLoop *loop = g_main_loop_new(NULL, FALSE);
@@ -101,7 +125,10 @@ static int ofono_init(void)
ofono_manager_init(interface);
const gchar *modem_path = ofono_manager_get_default_modem_path();
DEBUG(interface, "modem_path: %s\n", modem_path);
- vcm = ofono_voicecallmanager_init(interface, modem_path, incoming_call_cb);
+ vcm = ofono_voicecallmanager_init(interface, modem_path,
+ incoming_call_cb,
+ dialing_call_cb,
+ terminated_call_cb);
if (!vcm) {
ERROR(interface, "Failed to initialize voice call manager\n");
ret = -1;