summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>2017-11-01 11:00:08 +0000
committerGerrit Code Review <gerrit@automotivelinux.org>2017-11-01 11:00:08 +0000
commitc0f383d989821c61872aaa38932fa7719dc97120 (patch)
treea0a812ed805803cddb3c4c47abc711134f208130 /src/main.cpp
parent022def7c34eff5814ef9b5ba3bba7c7d8b869297 (diff)
parenteb7fc4eb593d723f1ac2ed4e5b523afd34e992ac (diff)
Merge "Add drawing_area parameter to API"
Diffstat (limited to 'src/main.cpp')
-rwxr-xr-xsrc/main.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index a1e3db8..f33b20e 100755
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -160,11 +160,27 @@ int binding_init() noexcept {
#include "afb_binding_glue.inl"
-// XXX implement send_event right here...
namespace wm {
void binding_api::send_event(char const *evname, char const *label) {
logdebug("%s: %s(%s)", __func__, evname, label);
- int ret = afb_daemon_broadcast_event(evname, json_object_new_string(label));
+
+ json_object *j = json_object_new_object();
+ json_object_object_add(j, kKeyDrawingName, json_object_new_string(label));
+
+ int ret = afb_daemon_broadcast_event(evname, j);
+ if (ret != 0) {
+ logdebug("afb_event_broadcast failed: %m");
+ }
+}
+
+void binding_api::send_event(char const *evname, char const *label, char const *area) {
+ logdebug("%s: %s(%s, %s)", __func__, evname, label, area);
+
+ json_object *j = json_object_new_object();
+ json_object_object_add(j, kKeyDrawingName, json_object_new_string(label));
+ json_object_object_add(j, kKeyDrawingArea, json_object_new_string(area));
+
+ int ret = afb_daemon_broadcast_event(evname, j);
if (ret != 0) {
logdebug("afb_event_broadcast failed: %m");
}