From 6aaba1066fe89f324d4bae67497f4035fe997d5f Mon Sep 17 00:00:00 2001 From: Yuta Doi Date: Mon, 11 Dec 2017 11:38:01 +0900 Subject: Add APIs which can get information of display and area getDisplayInfo() can get the display information as follows: - width[pixel] - height[pixel] - width[mm] - height[mm] NOTE: It uses wl_output::geometry() for getting physical width[mm] and height[mm] of the display, but the value is different with measured value. value from wl_output::geometry(): width:320 height:520 measured value : width:193 height:343 getAreaInfo() can get the information of area drawn by the application as follows: - x-coordinate - y-coordinate - width - height The details are described in doc/ApplicationGuide.md. Change-Id: I41eec6251527862ef25d1b84cd37d736d3f9c8aa Signed-off-by: Yuta Doi --- src/main.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) mode change 100755 => 100644 src/main.cpp (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp old mode 100755 new mode 100644 index c615d3a..395fa62 --- a/src/main.cpp +++ b/src/main.cpp @@ -170,12 +170,21 @@ void binding_api::send_event(char const *evname, char const *label) { } } -void binding_api::send_event(char const *evname, char const *label, char const *area) { - HMI_DEBUG("wm", "%s: %s(%s, %s)", __func__, evname, label, area); +void binding_api::send_event(char const *evname, char const *label, char const *area, + int x, int y, int w, int h) { + HMI_DEBUG("wm", "%s: %s(%s, %s) x:%d y:%d w:%d h:%d", + __func__, evname, label, area, x, y, w, h); + + json_object *j_rect = json_object_new_object(); + json_object_object_add(j_rect, kKeyX, json_object_new_int(x)); + json_object_object_add(j_rect, kKeyY, json_object_new_int(y)); + json_object_object_add(j_rect, kKeyWidth, json_object_new_int(w)); + json_object_object_add(j_rect, kKeyHeight, json_object_new_int(h)); 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)); + json_object_object_add(j, kKeyDrawingRect, j_rect); int ret = afb_event_push(g_afb_instance->app.map_afb_event[evname], j); if (ret != 0) { -- cgit 1.2.3-korg