diff options
author | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2017-11-01 11:00:08 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@automotivelinux.org> | 2017-11-01 11:00:08 +0000 |
commit | c0f383d989821c61872aaa38932fa7719dc97120 (patch) | |
tree | a0a812ed805803cddb3c4c47abc711134f208130 /src/main.cpp | |
parent | 022def7c34eff5814ef9b5ba3bba7c7d8b869297 (diff) | |
parent | eb7fc4eb593d723f1ac2ed4e5b523afd34e992ac (diff) |
Merge "Add drawing_area parameter to API"
Diffstat (limited to 'src/main.cpp')
-rwxr-xr-x | src/main.cpp | 20 |
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"); } |