From 31ff5ce755d00cf12ea2ffc96c33ed9acd36358f Mon Sep 17 00:00:00 2001 From: wang_zhiqiang Date: Wed, 21 Nov 2018 16:32:29 +0800 Subject: [PATCH] update doc add new sequence and update doxygen files. Change-Id: I6737939eb2628577d58b2d1d65086e46e7cb14a4 Signed-off-by: wang_zhiqiang --- doc/ApplicationGuide.md | 271 ++++- doc/api-ref/.keep | 0 doc/api-ref/html/annotated.html | 58 +- doc/api-ref/html/arrowdown.png | Bin 0 -> 246 bytes doc/api-ref/html/arrowright.png | Bin 0 -> 229 bytes doc/api-ref/html/classes.html | 67 +- doc/api-ref/html/d0/d1e/homescreen_8c.html | 832 ------------- doc/api-ref/html/d0/d1e/homescreen_8c_source.html | 108 -- .../html/d0/d53/struct_h_s___client_ctxt.html | 161 +++ doc/api-ref/html/d0/d8a/libhomescreen_8cpp.html | 131 +- .../html/d0/d8a/libhomescreen_8cpp_source.html | 117 +- doc/api-ref/html/d2/d66/include_2hmi-debug_8h.html | 490 ++++++++ .../html/d2/d66/include_2hmi-debug_8h_source.html | 109 ++ .../html/d2/d8e/class_h_s___client_manager.html | 670 +++++++++++ doc/api-ref/html/d3/d3d/hs-helper_8h.html | 407 +++++-- doc/api-ref/html/d3/d3d/hs-helper_8h_source.html | 79 +- doc/api-ref/html/d4/d10/structdisplay-members.html | 110 ++ .../html/d5/d0d/class_h_s___client-members.html | 114 ++ doc/api-ref/html/d5/d20/class_h_s___client.html | 653 ++++++++++ .../d5/d56/struct_h_s___client_ctxt-members.html | 101 ++ doc/api-ref/html/d6/dda/homescreen_8cpp.html | 841 +++++++++++++ .../html/d6/dda/homescreen_8cpp_source.html | 138 +++ doc/api-ref/html/d6/de3/structwindow.html | 381 ++++++ doc/api-ref/html/d6/df5/structdisplay.html | 285 +++++ doc/api-ref/html/d6/dff/src_2hmi-debug_8h.html | 490 ++++++++ .../html/d6/dff/src_2hmi-debug_8h_source.html | 109 ++ .../html/d7/df4/class_lib_home_screen-members.html | 81 +- doc/api-ref/html/d8/d55/hs-client_8cpp.html | 255 ++++ doc/api-ref/html/d8/d55/hs-client_8cpp_source.html | 129 ++ doc/api-ref/html/da/dd3/hs-client_8h.html | 112 ++ doc/api-ref/html/da/dd3/hs-client_8h_source.html | 115 ++ .../dcb/structgeometry-members.html} | 57 +- doc/api-ref/html/dd/d1d/hs-helper_8c.html | 361 ------ doc/api-ref/html/dd/d1d/hs-helper_8c_source.html | 91 -- doc/api-ref/html/dd/d30/hs-clientmanager_8cpp.html | 170 +++ .../html/dd/d30/hs-clientmanager_8cpp_source.html | 133 +++ .../dd/dc9/class_h_s___client_manager-members.html | 118 ++ doc/api-ref/html/dd/ddc/structgeometry.html | 142 +++ doc/api-ref/html/de/da4/simple-egl_8cpp.html | 1253 ++++++++++++++++++++ .../html/de/da4/simple-egl_8cpp_source.html | 179 +++ doc/api-ref/html/de/dca/hs-clientmanager_8h.html | 136 +++ .../html/de/dca/hs-clientmanager_8h_source.html | 117 ++ doc/api-ref/html/de/dd0/class_lib_home_screen.html | 595 +++++++--- doc/api-ref/html/df/d37/structwindow-members.html | 116 ++ doc/api-ref/html/df/d43/libhomescreen_8hpp.html | 49 +- .../html/df/d43/libhomescreen_8hpp_source.html | 111 +- doc/api-ref/html/df/d66/hs-helper_8cpp.html | 449 +++++++ doc/api-ref/html/df/d66/hs-helper_8cpp_source.html | 113 ++ doc/api-ref/html/df/d76/hmi-debug_8h.html | 435 ------- doc/api-ref/html/df/d76/hmi-debug_8h_source.html | 87 -- doc/api-ref/html/df/d7d/structevent.html | 123 -- doc/api-ref/html/df/dac/test_8cpp.html | 334 ------ doc/api-ref/html/df/dac/test_8cpp_source.html | 95 -- .../html/dir_0f70dc74e67ded1ed6ea12b5a24cac83.html | 83 -- .../html/dir_65f76d62445e9e84c0450b12bf77c3bc.html | 50 +- .../html/dir_68267d1309a1af8e8297ef4c3efbcdba.html | 62 +- .../html/dir_a01af9eb3c502936dfd53c3f8e45721d.html | 87 -- .../html/dir_d44c64559bbebec7f509842c48db8b23.html | 50 +- doc/api-ref/html/doxygen.css | 139 +-- doc/api-ref/html/files.html | 63 +- doc/api-ref/html/functions.html | 364 +++++- doc/api-ref/html/functions_enum.html | 59 +- doc/api-ref/html/functions_eval.html | 74 +- doc/api-ref/html/functions_func.html | 188 ++- doc/api-ref/html/functions_type.html | 59 +- doc/api-ref/html/functions_vars.html | 254 +++- doc/api-ref/html/globals.html | 431 +++++-- doc/api-ref/html/globals_defs.html | 103 +- doc/api-ref/html/globals_enum.html | 61 +- doc/api-ref/html/globals_eval.html | 73 +- doc/api-ref/html/globals_func.html | 232 +++- doc/api-ref/html/globals_type.html | 71 +- doc/api-ref/html/globals_vars.html | 247 +++- doc/api-ref/html/index.html | 42 +- doc/api-ref/html/jquery.js | 35 +- doc/api-ref/html/menu.js | 26 - doc/api-ref/html/menudata.js | 51 - doc/api-ref/html/search/all_0.html | 2 +- doc/api-ref/html/search/all_0.js | 26 +- doc/api-ref/html/search/all_1.html | 2 +- doc/api-ref/html/search/all_1.js | 13 +- doc/api-ref/html/search/all_10.html | 2 +- doc/api-ref/html/search/all_10.js | 11 +- doc/api-ref/html/search/all_11.html | 2 +- doc/api-ref/html/search/all_11.js | 5 +- doc/api-ref/html/search/all_12.html | 2 +- doc/api-ref/html/search/all_12.js | 2 +- .../html/search/{defines_4.html => all_13.html} | 4 +- doc/api-ref/html/search/all_13.js | 5 + doc/api-ref/html/search/all_14.html | 26 + doc/api-ref/html/search/all_14.js | 7 + doc/api-ref/html/search/all_15.html | 26 + doc/api-ref/html/search/all_15.js | 6 + doc/api-ref/html/search/all_2.html | 2 +- doc/api-ref/html/search/all_2.js | 5 +- doc/api-ref/html/search/all_3.html | 2 +- doc/api-ref/html/search/all_3.js | 24 +- doc/api-ref/html/search/all_4.html | 2 +- doc/api-ref/html/search/all_4.js | 6 +- doc/api-ref/html/search/all_5.html | 2 +- doc/api-ref/html/search/all_5.js | 34 +- doc/api-ref/html/search/all_6.html | 2 +- doc/api-ref/html/search/all_6.js | 6 +- doc/api-ref/html/search/all_7.html | 2 +- doc/api-ref/html/search/all_7.js | 18 +- doc/api-ref/html/search/all_8.html | 2 +- doc/api-ref/html/search/all_8.js | 27 +- doc/api-ref/html/search/all_9.html | 2 +- doc/api-ref/html/search/all_9.js | 16 +- doc/api-ref/html/search/all_a.html | 2 +- doc/api-ref/html/search/all_a.js | 25 +- doc/api-ref/html/search/all_b.html | 2 +- doc/api-ref/html/search/all_b.js | 4 +- doc/api-ref/html/search/all_c.html | 2 +- doc/api-ref/html/search/all_c.js | 7 +- doc/api-ref/html/search/all_d.html | 2 +- doc/api-ref/html/search/all_d.js | 15 +- doc/api-ref/html/search/all_e.html | 2 +- doc/api-ref/html/search/all_e.js | 7 +- doc/api-ref/html/search/all_f.html | 2 +- doc/api-ref/html/search/all_f.js | 16 +- doc/api-ref/html/search/classes_0.html | 2 +- doc/api-ref/html/search/classes_0.js | 2 +- doc/api-ref/html/search/classes_1.html | 2 +- doc/api-ref/html/search/classes_1.js | 2 +- doc/api-ref/html/search/classes_2.html | 26 + doc/api-ref/html/search/classes_2.js | 6 + doc/api-ref/html/search/classes_3.html | 26 + doc/api-ref/html/search/classes_3.js | 4 + doc/api-ref/html/search/classes_4.html | 26 + doc/api-ref/html/search/classes_4.js | 4 + doc/api-ref/html/search/defines_0.html | 2 +- doc/api-ref/html/search/defines_0.js | 3 +- doc/api-ref/html/search/defines_1.html | 2 +- doc/api-ref/html/search/defines_1.js | 7 +- doc/api-ref/html/search/defines_2.html | 2 +- doc/api-ref/html/search/defines_2.js | 4 +- doc/api-ref/html/search/defines_3.html | 2 +- doc/api-ref/html/search/defines_3.js | 6 +- doc/api-ref/html/search/defines_4.js | 8 - doc/api-ref/html/search/enums_0.html | 2 +- doc/api-ref/html/search/enums_1.html | 2 +- doc/api-ref/html/search/enums_1.js | 2 +- doc/api-ref/html/search/enums_2.html | 2 +- doc/api-ref/html/search/enumvalues_0.html | 2 +- doc/api-ref/html/search/enumvalues_0.js | 5 + doc/api-ref/html/search/enumvalues_1.html | 2 +- doc/api-ref/html/search/enumvalues_1.js | 14 +- doc/api-ref/html/search/enumvalues_2.html | 2 +- doc/api-ref/html/search/enumvalues_3.html | 2 +- doc/api-ref/html/search/enumvalues_4.html | 2 +- doc/api-ref/html/search/files_0.html | 2 +- doc/api-ref/html/search/files_0.js | 11 +- doc/api-ref/html/search/files_1.html | 2 +- doc/api-ref/html/search/files_2.html | 2 +- doc/api-ref/html/search/files_2.js | 2 +- doc/api-ref/html/search/functions_0.html | 2 +- doc/api-ref/html/search/functions_0.js | 2 +- doc/api-ref/html/search/functions_1.html | 2 +- doc/api-ref/html/search/functions_1.js | 5 +- doc/api-ref/html/search/functions_10.html | 26 + doc/api-ref/html/search/functions_10.js | 6 + doc/api-ref/html/search/functions_2.html | 2 +- doc/api-ref/html/search/functions_2.js | 2 +- doc/api-ref/html/search/functions_3.html | 2 +- doc/api-ref/html/search/functions_3.js | 4 +- doc/api-ref/html/search/functions_4.html | 2 +- doc/api-ref/html/search/functions_4.js | 6 +- doc/api-ref/html/search/functions_5.html | 2 +- doc/api-ref/html/search/functions_5.js | 4 +- doc/api-ref/html/search/functions_6.html | 2 +- doc/api-ref/html/search/functions_6.js | 10 +- doc/api-ref/html/search/functions_7.html | 2 +- doc/api-ref/html/search/functions_7.js | 7 +- doc/api-ref/html/search/functions_8.html | 2 +- doc/api-ref/html/search/functions_8.js | 13 +- doc/api-ref/html/search/functions_9.html | 2 +- doc/api-ref/html/search/functions_9.js | 3 +- doc/api-ref/html/search/functions_a.html | 2 +- doc/api-ref/html/search/functions_a.js | 11 +- doc/api-ref/html/search/functions_b.html | 2 +- doc/api-ref/html/search/functions_b.js | 5 +- doc/api-ref/html/search/functions_c.html | 2 +- doc/api-ref/html/search/functions_c.js | 8 +- doc/api-ref/html/search/functions_d.html | 2 +- doc/api-ref/html/search/functions_d.js | 8 +- doc/api-ref/html/search/functions_e.html | 2 +- doc/api-ref/html/search/functions_e.js | 3 +- doc/api-ref/html/search/functions_f.html | 26 + doc/api-ref/html/search/functions_f.js | 4 + doc/api-ref/html/search/search.css | 12 +- doc/api-ref/html/search/searchdata.js | 14 +- doc/api-ref/html/search/typedefs_0.html | 2 +- doc/api-ref/html/search/typedefs_0.js | 3 +- doc/api-ref/html/search/typedefs_1.html | 2 +- doc/api-ref/html/search/typedefs_1.js | 2 +- doc/api-ref/html/search/typedefs_2.html | 26 + doc/api-ref/html/search/typedefs_2.js | 5 + doc/api-ref/html/search/typedefs_3.html | 26 + doc/api-ref/html/search/typedefs_3.js | 4 + doc/api-ref/html/search/variables_0.html | 2 +- doc/api-ref/html/search/variables_0.js | 21 +- doc/api-ref/html/search/variables_1.html | 2 +- doc/api-ref/html/search/variables_1.js | 6 +- doc/api-ref/html/search/variables_10.html | 26 + doc/api-ref/html/search/variables_10.js | 6 + doc/api-ref/html/search/variables_11.html | 26 + doc/api-ref/html/search/variables_11.js | 5 + doc/api-ref/html/search/variables_12.html | 26 + doc/api-ref/html/search/variables_12.js | 5 + doc/api-ref/html/search/variables_13.html | 26 + doc/api-ref/html/search/variables_13.js | 7 + doc/api-ref/html/search/variables_2.html | 2 +- doc/api-ref/html/search/variables_2.js | 10 +- doc/api-ref/html/search/variables_3.html | 2 +- doc/api-ref/html/search/variables_3.js | 6 +- doc/api-ref/html/search/variables_4.html | 2 +- doc/api-ref/html/search/variables_4.js | 3 +- doc/api-ref/html/search/variables_5.html | 2 +- doc/api-ref/html/search/variables_5.js | 6 +- doc/api-ref/html/search/variables_6.html | 26 + doc/api-ref/html/search/variables_6.js | 7 + doc/api-ref/html/search/variables_7.html | 26 + doc/api-ref/html/search/variables_7.js | 6 + doc/api-ref/html/search/variables_8.html | 26 + doc/api-ref/html/search/variables_8.js | 5 + doc/api-ref/html/search/variables_9.html | 26 + doc/api-ref/html/search/variables_9.js | 11 + doc/api-ref/html/search/variables_a.html | 26 + doc/api-ref/html/search/variables_a.js | 4 + doc/api-ref/html/search/variables_b.html | 26 + doc/api-ref/html/search/variables_b.js | 4 + doc/api-ref/html/search/variables_c.html | 26 + doc/api-ref/html/search/variables_c.js | 4 + doc/api-ref/html/search/variables_d.html | 26 + doc/api-ref/html/search/variables_d.js | 4 + doc/api-ref/html/search/variables_e.html | 26 + doc/api-ref/html/search/variables_e.js | 5 + doc/api-ref/html/search/variables_f.html | 26 + doc/api-ref/html/search/variables_f.js | 7 + doc/api-ref/html/tabs.css | 61 +- doc/api-ref/latex/Makefile | 21 + doc/api-ref/latex/annotated.tex | 9 +- doc/api-ref/latex/d0/d1e/homescreen_8c.tex | 599 ---------- .../latex/d0/d53/struct_h_s___client_ctxt.tex | 58 + doc/api-ref/latex/d0/d8a/libhomescreen_8cpp.tex | 162 ++- doc/api-ref/latex/d2/d66/include_2hmi-debug_8h.tex | 242 ++++ .../latex/d2/d8e/class_h_s___client_manager.tex | 657 ++++++++++ doc/api-ref/latex/d3/d3d/hs-helper_8h.tex | 578 +++++---- doc/api-ref/latex/d5/d20/class_h_s___client.tex | 579 +++++++++ doc/api-ref/latex/d6/dda/homescreen_8cpp.tex | 672 +++++++++++ doc/api-ref/latex/d6/de3/structwindow.tex | 170 +++ doc/api-ref/latex/d6/df5/structdisplay.tex | 116 ++ doc/api-ref/latex/d6/dff/src_2hmi-debug_8h.tex | 242 ++++ doc/api-ref/latex/d8/d55/hs-client_8cpp.tex | 65 + doc/api-ref/latex/da/dd3/hs-client_8h.tex | 10 + doc/api-ref/latex/dd/d1d/hs-helper_8c.tex | 238 ---- doc/api-ref/latex/dd/d30/hs-clientmanager_8cpp.tex | 45 + doc/api-ref/latex/dd/ddc/structgeometry.tex | 38 + doc/api-ref/latex/de/da4/simple-egl_8cpp.tex | 1068 +++++++++++++++++ doc/api-ref/latex/de/dca/hs-clientmanager_8h.tex | 26 + doc/api-ref/latex/de/dd0/class_lib_home_screen.tex | 1045 ++++++++++------ doc/api-ref/latex/df/d43/libhomescreen_8hpp.tex | 17 +- doc/api-ref/latex/df/d66/hs-helper_8cpp.tex | 374 ++++++ doc/api-ref/latex/df/d76/hmi-debug_8h.tex | 202 ---- doc/api-ref/latex/df/d7d/structevent.tex | 44 - doc/api-ref/latex/df/dac/test_8cpp.tex | 275 ----- .../latex/dir_0f70dc74e67ded1ed6ea12b5a24cac83.tex | 7 - .../latex/dir_65f76d62445e9e84c0450b12bf77c3bc.tex | 2 +- .../latex/dir_68267d1309a1af8e8297ef4c3efbcdba.tex | 14 +- .../latex/dir_a01af9eb3c502936dfd53c3f8e45721d.tex | 11 - .../latex/dir_d44c64559bbebec7f509842c48db8b23.tex | 2 +- doc/api-ref/latex/doxygen.sty | 28 +- doc/api-ref/latex/files.tex | 19 +- doc/api-ref/latex/refman.tex | 25 +- doc/parts/initialize-registercallback.svg | 29 - doc/parts/initialize-set-event-handler.svg | 25 +- doc/parts/initialize.svg | 34 - doc/parts/showInformation.svg | 30 + doc/parts/showNotification.svg | 34 + doc/parts/showOnScreen.svg | 72 ++ doc/parts/showWindow.svg | 34 + 282 files changed, 18658 insertions(+), 6261 deletions(-) delete mode 100644 doc/api-ref/.keep create mode 100644 doc/api-ref/html/arrowdown.png create mode 100644 doc/api-ref/html/arrowright.png delete mode 100644 doc/api-ref/html/d0/d1e/homescreen_8c.html delete mode 100644 doc/api-ref/html/d0/d1e/homescreen_8c_source.html create mode 100644 doc/api-ref/html/d0/d53/struct_h_s___client_ctxt.html create mode 100644 doc/api-ref/html/d2/d66/include_2hmi-debug_8h.html create mode 100644 doc/api-ref/html/d2/d66/include_2hmi-debug_8h_source.html create mode 100644 doc/api-ref/html/d2/d8e/class_h_s___client_manager.html create mode 100644 doc/api-ref/html/d4/d10/structdisplay-members.html create mode 100644 doc/api-ref/html/d5/d0d/class_h_s___client-members.html create mode 100644 doc/api-ref/html/d5/d20/class_h_s___client.html create mode 100644 doc/api-ref/html/d5/d56/struct_h_s___client_ctxt-members.html create mode 100644 doc/api-ref/html/d6/dda/homescreen_8cpp.html create mode 100644 doc/api-ref/html/d6/dda/homescreen_8cpp_source.html create mode 100644 doc/api-ref/html/d6/de3/structwindow.html create mode 100644 doc/api-ref/html/d6/df5/structdisplay.html create mode 100644 doc/api-ref/html/d6/dff/src_2hmi-debug_8h.html create mode 100644 doc/api-ref/html/d6/dff/src_2hmi-debug_8h_source.html create mode 100644 doc/api-ref/html/d8/d55/hs-client_8cpp.html create mode 100644 doc/api-ref/html/d8/d55/hs-client_8cpp_source.html create mode 100644 doc/api-ref/html/da/dd3/hs-client_8h.html create mode 100644 doc/api-ref/html/da/dd3/hs-client_8h_source.html rename doc/api-ref/html/{dd/d86/structevent-members.html => db/dcb/structgeometry-members.html} (52%) delete mode 100644 doc/api-ref/html/dd/d1d/hs-helper_8c.html delete mode 100644 doc/api-ref/html/dd/d1d/hs-helper_8c_source.html create mode 100644 doc/api-ref/html/dd/d30/hs-clientmanager_8cpp.html create mode 100644 doc/api-ref/html/dd/d30/hs-clientmanager_8cpp_source.html create mode 100644 doc/api-ref/html/dd/dc9/class_h_s___client_manager-members.html create mode 100644 doc/api-ref/html/dd/ddc/structgeometry.html create mode 100644 doc/api-ref/html/de/da4/simple-egl_8cpp.html create mode 100644 doc/api-ref/html/de/da4/simple-egl_8cpp_source.html create mode 100644 doc/api-ref/html/de/dca/hs-clientmanager_8h.html create mode 100644 doc/api-ref/html/de/dca/hs-clientmanager_8h_source.html create mode 100644 doc/api-ref/html/df/d37/structwindow-members.html create mode 100644 doc/api-ref/html/df/d66/hs-helper_8cpp.html create mode 100644 doc/api-ref/html/df/d66/hs-helper_8cpp_source.html delete mode 100644 doc/api-ref/html/df/d76/hmi-debug_8h.html delete mode 100644 doc/api-ref/html/df/d76/hmi-debug_8h_source.html delete mode 100644 doc/api-ref/html/df/d7d/structevent.html delete mode 100644 doc/api-ref/html/df/dac/test_8cpp.html delete mode 100644 doc/api-ref/html/df/dac/test_8cpp_source.html delete mode 100644 doc/api-ref/html/dir_0f70dc74e67ded1ed6ea12b5a24cac83.html delete mode 100644 doc/api-ref/html/dir_a01af9eb3c502936dfd53c3f8e45721d.html delete mode 100644 doc/api-ref/html/menu.js delete mode 100644 doc/api-ref/html/menudata.js rename doc/api-ref/html/search/{defines_4.html => all_13.html} (89%) create mode 100644 doc/api-ref/html/search/all_13.js create mode 100644 doc/api-ref/html/search/all_14.html create mode 100644 doc/api-ref/html/search/all_14.js create mode 100644 doc/api-ref/html/search/all_15.html create mode 100644 doc/api-ref/html/search/all_15.js create mode 100644 doc/api-ref/html/search/classes_2.html create mode 100644 doc/api-ref/html/search/classes_2.js create mode 100644 doc/api-ref/html/search/classes_3.html create mode 100644 doc/api-ref/html/search/classes_3.js create mode 100644 doc/api-ref/html/search/classes_4.html create mode 100644 doc/api-ref/html/search/classes_4.js delete mode 100644 doc/api-ref/html/search/defines_4.js create mode 100644 doc/api-ref/html/search/functions_10.html create mode 100644 doc/api-ref/html/search/functions_10.js create mode 100644 doc/api-ref/html/search/functions_f.html create mode 100644 doc/api-ref/html/search/functions_f.js create mode 100644 doc/api-ref/html/search/typedefs_2.html create mode 100644 doc/api-ref/html/search/typedefs_2.js create mode 100644 doc/api-ref/html/search/typedefs_3.html create mode 100644 doc/api-ref/html/search/typedefs_3.js create mode 100644 doc/api-ref/html/search/variables_10.html create mode 100644 doc/api-ref/html/search/variables_10.js create mode 100644 doc/api-ref/html/search/variables_11.html create mode 100644 doc/api-ref/html/search/variables_11.js create mode 100644 doc/api-ref/html/search/variables_12.html create mode 100644 doc/api-ref/html/search/variables_12.js create mode 100644 doc/api-ref/html/search/variables_13.html create mode 100644 doc/api-ref/html/search/variables_13.js create mode 100644 doc/api-ref/html/search/variables_6.html create mode 100644 doc/api-ref/html/search/variables_6.js create mode 100644 doc/api-ref/html/search/variables_7.html create mode 100644 doc/api-ref/html/search/variables_7.js create mode 100644 doc/api-ref/html/search/variables_8.html create mode 100644 doc/api-ref/html/search/variables_8.js create mode 100644 doc/api-ref/html/search/variables_9.html create mode 100644 doc/api-ref/html/search/variables_9.js create mode 100644 doc/api-ref/html/search/variables_a.html create mode 100644 doc/api-ref/html/search/variables_a.js create mode 100644 doc/api-ref/html/search/variables_b.html create mode 100644 doc/api-ref/html/search/variables_b.js create mode 100644 doc/api-ref/html/search/variables_c.html create mode 100644 doc/api-ref/html/search/variables_c.js create mode 100644 doc/api-ref/html/search/variables_d.html create mode 100644 doc/api-ref/html/search/variables_d.js create mode 100644 doc/api-ref/html/search/variables_e.html create mode 100644 doc/api-ref/html/search/variables_e.js create mode 100644 doc/api-ref/html/search/variables_f.html create mode 100644 doc/api-ref/html/search/variables_f.js create mode 100644 doc/api-ref/latex/Makefile delete mode 100644 doc/api-ref/latex/d0/d1e/homescreen_8c.tex create mode 100644 doc/api-ref/latex/d0/d53/struct_h_s___client_ctxt.tex create mode 100644 doc/api-ref/latex/d2/d66/include_2hmi-debug_8h.tex create mode 100644 doc/api-ref/latex/d2/d8e/class_h_s___client_manager.tex create mode 100644 doc/api-ref/latex/d5/d20/class_h_s___client.tex create mode 100644 doc/api-ref/latex/d6/dda/homescreen_8cpp.tex create mode 100644 doc/api-ref/latex/d6/de3/structwindow.tex create mode 100644 doc/api-ref/latex/d6/df5/structdisplay.tex create mode 100644 doc/api-ref/latex/d6/dff/src_2hmi-debug_8h.tex create mode 100644 doc/api-ref/latex/d8/d55/hs-client_8cpp.tex create mode 100644 doc/api-ref/latex/da/dd3/hs-client_8h.tex delete mode 100644 doc/api-ref/latex/dd/d1d/hs-helper_8c.tex create mode 100644 doc/api-ref/latex/dd/d30/hs-clientmanager_8cpp.tex create mode 100644 doc/api-ref/latex/dd/ddc/structgeometry.tex create mode 100644 doc/api-ref/latex/de/da4/simple-egl_8cpp.tex create mode 100644 doc/api-ref/latex/de/dca/hs-clientmanager_8h.tex create mode 100644 doc/api-ref/latex/df/d66/hs-helper_8cpp.tex delete mode 100644 doc/api-ref/latex/df/d76/hmi-debug_8h.tex delete mode 100644 doc/api-ref/latex/df/d7d/structevent.tex delete mode 100644 doc/api-ref/latex/df/dac/test_8cpp.tex delete mode 100644 doc/api-ref/latex/dir_0f70dc74e67ded1ed6ea12b5a24cac83.tex delete mode 100644 doc/api-ref/latex/dir_a01af9eb3c502936dfd53c3f8e45721d.tex delete mode 100644 doc/parts/initialize-registercallback.svg delete mode 100644 doc/parts/initialize.svg create mode 100644 doc/parts/showInformation.svg create mode 100644 doc/parts/showNotification.svg create mode 100644 doc/parts/showOnScreen.svg create mode 100644 doc/parts/showWindow.svg diff --git a/doc/ApplicationGuide.md b/doc/ApplicationGuide.md index dd3f1f0..9c5c409 100644 --- a/doc/ApplicationGuide.md +++ b/doc/ApplicationGuide.md @@ -3,7 +3,7 @@
Revision: 0.1
TOYOTA MOTOR CORPORATION
Advanced Driver Information Technology
-
26th/Sep/2017
+
21th/Nov/2018
* * * @@ -21,12 +21,17 @@ - [Software Architecture](#Software\ Architecture) - [API reference](#API\ reference) - [Sequence](#Sequence) - - [Initialize](#InitializeSequence) - - [Tap Shortcut](#TapShortcutSequence) - - [On Screen Message / Reply Sequence](#OnScreenMessageSequence) + - [Initialize](###Initialize\ Sequence) + - [Tap Shortcut(deprecated)](###Tap\ Shortcut\ Sequence) + - [ShowWindow](###ShowWindow\ Sequence) + - [On Screen Message / Reply Sequence(deprecated)](###On\ Screen\ Message\ /\ Reply\ Sequence) + - [ShowOnscreen](###ShowOnscreen\ Sequence) + - [ShowNotification](###ShowNotification\ Sequence) + - [ShowInformation](###ShowInformation\ Sequence) - [Sample code](#Sample\ code) - [Limitation](#Limitation) - [Next Plan](#Next\ Plan) +- [Appendix](#Appendix) * * * @@ -45,12 +50,16 @@ HomeScreen can start/switch applications run in AGL, also displays information s You can find these projects in AGL gerrit. -homescreen-2017(HomeScreenGUI): - https://gerrit.automotivelinux.org/gerrit/#/admin/projects/staging/homescreen-2017 -agl-service-homescreen-2017(HomeScreenBinder's binding library): - https://gerrit.automotivelinux.org/gerrit/#/admin/projects/apps/agl-service-homescreen-2017 +homescreen(HomeScreenGUI): + https://gerrit.automotivelinux.org/gerrit/#/admin/projects/apps/homescreen +launcher(LauncherGUI) + https://gerrit.automotivelinux.org/gerrit/#/admin/projects/apps/launcher +agl-service-homescreen(HomeScreenBinder's binding library): + https://gerrit.automotivelinux.org/gerrit/#/admin/projects/apps/agl-service-homescreen libhomescreen(library for application to communication with HomeScreenBinder): https://gerrit.automotivelinux.org/gerrit/#/admin/projects/src/libhomescreen +libqthomescreen(library for qt application to communication with HomeScreenBinder based on libhomescreen) + https://gerrit.automotivelinux.org/gerrit/#/admin/projects/src/libqthomescreen Also HomeScreenGUI is using libwindowmanager. @@ -84,12 +93,16 @@ $ repo sync Then you can find the following recipes. -* `meta-agl-devel/meta-hmi-framework/homescreen-2017` +* `meta-agl-demo/recipes-demo-hmi/homescreen` -* `meta-agl-devel/meta-hmi-framework/agl-service-homescreen-2017` +* `meta-agl-devel/meta-hmi-framework/recipes-demo-hmi/launcher` + +* `meta-agl-demo/recipes-demo-hmi/agl-service-homescreen` * `meta-agl-demo/recipes-demo-hmi/libhomescreen` +* `meta-agl-devel/meta-hmi-framework/recipes-demo-hmi/qlibhomescreen` + **Bitbake** @@ -109,6 +122,7 @@ To use HomeScreen API, an application shall paste the following configuration de ``` + ``` @@ -119,7 +133,7 @@ To use HomeScreen API, an application shall paste the following configuration de ### How to call HomeScreen APIs from your Application? HomeScreen provides a library which is called "libhomescreen". This library treats "json format" as API calling. -For example, if an application wants to call "tap_shortcut()" API, the you should implement as below. +For example, if an application wants to call "showWIndow()" API, the you should implement as below. At first the application should create the instance of libhomescreen. @@ -131,16 +145,16 @@ libhs->init(port, token); The port and token is provided by Application Framework -Execute the "tapShortcut()" function. +Execute the "showWindow()" function. ``` -libhs->tapShortcut("application_id"); +libhs->showWindow("application_id", "display_area"); ``` -Regarding the detail of tap_shortcut() API, please refer [this](#HomeScreen\ API) section. -The first parameter is the name of API, so in this case "tap_shortcut" is proper string. -And the second parameter corresponds to arguments of "connect()" API. - +Regarding the detail of showWindow() API, please refer [this](#HomeScreen\ API) section. +The first parameter is the appid of application which want to display,liked "dashboard". +And the second parameter corresponds to display_area which defined by windowmanager,usually "normal", +so in this case "showWindow" the two parameters are proper string. See also our [Sample code](#Sample\ code). @@ -152,15 +166,29 @@ See also our [Sample code](#Sample\ code).
## Supported usecase -1. HomeScreenGUI sending ShortCut Icon tapped event to applications - - Applications using libhomescreen to subscribe the tapShortcut event, - HomeScreenGUI will send ShortCut Icon tapped event to applications. -2. Display OnScreen messages +1. HomeScreenGUI sending showWindow event to applications + - Applications using libhomescreen to subscribe the showWindow event, + HomeScreenGUI will send showWindow event to applications. +2. Display OnScreen messages(deprecated) - Applications sending OnScreen messages to homescreen-service, and OnScreenAPP will get these message and display. -3. Get OnSreen Reply event +3. Get OnSreen Reply event(deprecated) - When OnScreen messages is displaying, OnScreenAPP will send a reply event to applications. - +4. Display OnScreen by showWindow + - When application who want to show OnScreen,it can call "showWindow",then OnScreenApp will + display request OnScreen. +5. Hide OnScreen by hideWindow + - When application who want to hide OnScreen which is displaying,it can call "hideWindow",then OnScreenApp + will hide OnScreen. +6. Send OnScreen Reply by replyShowWindow + - When user touch the button of OnScreen, OnScreenApp can call "relplyShowWindow" to send reply information + back to application. +7. Show Notification on HomeScreenGUI + - When application who want to display a notification,it can call "showNotification",then HomeScreenGUI will + display the notification contents on the screen top area. +8. Show Information on HomeScreenGUI + - When application who want to display a information,it can call "showInformation",then HomeScreenGUI will + display the information contents on the screen bottom area. * * *
@@ -182,7 +210,7 @@ The communication protocols between libhomescreen and upper binder, upper binder
## API reference -"libhomescreen" and "agl-service-homescreen-2017" provides several kinds of APIs. +"libhomescreen" and "agl-service-homescreen" provides several kinds of APIs.
@@ -190,7 +218,7 @@ The communication protocols between libhomescreen and upper binder, upper binder - [LibHomeScreen ()](api-ref/html/de/dd0/class_lib_home_screen.html#a724bd949c4154fad041f96a15ef0f5dc) - [init (const int port, const std::string &token)](api-ref/html/de/dd0/class_lib_home_screen.html#a6a57b573cc767725762ba9beab032220) -- [tapShortcut(const char *application_id)](api-ref/html/de/dd0/class_lib_home_screen.html#afb571c9577087b47065eb23e7fdbc903) +- [tapShortcut(const char *application_id)](api-ref/html/de/dd0/class_lib_home_screen.html#a6ca8ff4a2aa019a735afaff713e0ef44) - [onScreenMessage(const char *display_message)](api-ref/html/de/dd0/class_lib_home_screen.html#ac336482036a72b51a822725f1929523c) - [onScreenReply(const char *reply_message)](api-ref/html/de/dd0/class_lib_home_screen.html#a6c065f41f2c5d1f58d2763bfb4da9c37) - [registerCallback (void(*event_cb)(const std::string &event, struct json_object *event_contents), void(*reply_cb)(struct json_object *reply_contents), void(*hangup_cb)(void)=nullptr)](api-ref/html/de/dd0/class_lib_home_screen.html#a2789e8a5372202cc36f48e71dbb9b7cf) @@ -199,6 +227,12 @@ The communication protocols between libhomescreen and upper binder, upper binder - [call (const char* verb, struct json_object* arg)](api-ref/html/de/dd0/class_lib_home_screen.html#ab5e8e8ab7d53e0f114e9e907fcbb7643) - [subscribe (const string& event_name)](api-ref/html/de/dd0/class_lib_home_screen.html#aa4c189807b75d070f567967f0d690738) - [unsubscribe (const string& event_name)](api-ref/html/de/dd0/class_lib_home_screen.html#aac03a45cbd453ba69ddb00c1016930a6) +- [showWindow (const char* application_id, json_object* json)](api-ref/html/de/dd0/class_lib_home_screen.html#a69fc770cb3f94d30a10c2c8c81eb892f) +- [hideWindow (const char* application_id)](api-ref/html/de/dd0/class_lib_home_screen.html#a4dbaea6c7b310e8ce7207155ff11b32a) +- [replyShowWindow (const char* application_id, json_object* json)](api-ref/html/de/dd0/class_lib_home_screen.html#a6310b129fc85ef0623e2e2063950cc4b) +- [showNotification (json_object* json)](api-ref/html/de/dd0/class_lib_home_screen.html#a93ad567ed597a80a344ba82457c2bd7f) +- [showInformation (json_object* json)](api-ref/html/de/dd0/class_lib_home_screen.html#ada999aeb0444c964428bdf1ee236727f) + * * * @@ -209,7 +243,6 @@ The communication protocols between libhomescreen and upper binder, upper binder
### Initialize Sequence -![initialize-registercallback.svg](parts/initialize-registercallback.svg) * deprecated ![initialize-set-event-handler](parts/initialize-set-event-handler.svg)
@@ -217,11 +250,31 @@ The communication protocols between libhomescreen and upper binder, upper binder ### Tap Shortcut Sequence ![tap_shortcut.svg](parts/tap_shortcut.svg) +
+ +### ShowWindow Sequence +![showWindow.svg](parts/showWindow.svg) +
### On Screen Message / Reply Sequence ![on_screen_message.svg](parts/on_screen_message.svg) +
+ +### ShowOnScreen Sequence +![showOnScreen.svg](parts/showOnScreen.svg) + +
+ +### ShowNotification Sequence +![showNotification.svg](parts/showNotification.svg) + +
+ +### ShowInformation Sequence +![showInformation.svg](parts/showInformation.svg) +
@@ -232,43 +285,31 @@ You can find sample implementation of HomeScreen as below. * `libhomescreen/sample/template` -### Appendix +# Limitation +Now OnScreenApp is developing,approximately it will finished at GG. -``` -@startuml -title Application initialization phase (ex. registerCallback) -entity App -entity HomeScreenBinder -entity HomeScreenGUI -App->HomeScreenBinder: init(port, token) -App->HomeScreenBinder: subscribe() +# Next Plan +None. -note over HomeScreenBinder - Register the event the App wishes to receive - ・tap_shortcut - ・on_screen_message - ・on_screen_reply -end note - -App->HomeScreenBinder: registerCallback() - -@enduml -``` +# Appendix ``` @startuml -title Application initialization phase (ex. set_event_handler) + +title Application initialization phase + entity App entity HomeScreenBinder entity HomeScreenGUI + App->HomeScreenBinder: init(port, token) App->HomeScreenBinder: set_event_handler() note over HomeScreenBinder setup event handler the App wishes to receive - ・LibHomeScreen::Event_TapShortcut - ・LibHomeScreen::Event_OnScreenMessage - ・LibHomeScreen::Event_OnScreenReply + ・LibHomeScreen::Event_ShowWindow + ・LibHomeScreen::Event_HideWindow + ・LibHomeScreen::Event_ReplyShowWindow end note @enduml @@ -291,6 +332,30 @@ HomeScreenBinder->App: event_handler(application_id) @enduml ``` +``` +@startuml + +title Application callback event showWindow phase + +actor user +entity "homescreen-service" as hss +entity launcher +entity App +entity windowmanager as wm + +user-->launcher: tap app's icon +launcher->hss: showWindow() +note over hss,App +{"application_id":"tapped application id", "parameter":{"area":"display area", ...}} +end note +hss->App: push showWindow event +App->wm: activateWindow("application_name","display area") +wm-->App: push syncDraw event +App->App: display + +@enduml +``` + ``` @startuml title Application Callback Event On Screen Message / Reply phase @@ -317,3 +382,109 @@ HomeScreenGUI->HomeScreenBinder: onScreenReply(reply_message) HomeScreenBinder->App: event_handler(reply_message) @enduml ``` + +``` +@startuml + +title show/hide onscreen phase + +actor user +entity "homescreen-service" as hss +entity App +entity onscreenapp +entity windowmanager as wm + +== show onscreen == +user->App: the operation request onscreen +App->hss: showWindow() +note over App,hss +{"application_id":"onscreenapp", +"parameter":{"area":"display area", "file":"qml file path", +"data":{"the datas to onscreen qml"}}} +end note + +hss->onscreenapp: push showWindow event +note over hss,onscreenapp +{"application_id":"onscreenapp", +"parameter":{"area":"display area", "file":"qml file path", +"data":{"the datas to onscreen qml"}, +"replyto":"caller application id" +}} +end note + +onscreenapp->onscreenapp: get and save parameters +onscreenapp->wm: activateWindow("onscreeapp", "display area") +alt can show +wm-->onscreenapp: push syncDraw event +onscreenapp->wm: endDraw("onscreeapp") +onscreenapp->onscreenapp: load and display qml file +else can't show +note over onscreenapp,wm +do nothing +end note +end + +== hide onscreen == + +user->onscreenapp: tap onscreen's button +onscreenapp->hss: replyShowWindow() +note over onscreenapp,hss +{"application_id":"the application id who called onscreenapp", +"parameter": {"buttonName": "VOLUME_UP", "buttonPressMode": "shortPress", "buttonPressState": "release"}} +end note +hss->App: push replyShowWindow event +App->App: call reply function +App->hss: hideWindow("onscreenapp") +hss->onscreenapp: push hideWindow event +note over hss,onscreenapp +{"application_id":"request hideWindow application id"} +end note +onscreenapp->wm: deactivateWindow("onscreenapp"); +onscreenapp->onscreenapp: hide window + +@enduml +``` + +``` +@startuml + +title show notification on HomeScreen top area + +entity "homescreen-service" as hss +entity homescreen +entity App + +App->hss: showNotification() +note over App,hss +{"icon":"display icon", "text":"display text"} +end note +hss-> homescreen: push showNotification event +note over hss,homescreen +{"application_id":"request application id", +"parameter":{"icon":"display icon", "text":"display text"}} +end note + +homescreen->homescreen: display notification message 3s + +@enduml +``` + +``` +@startuml + +title show information on HomeScreen bottom area + +entity "homescreen-service" as hss +entity homescreen +entity App + +App->hss: showInformation() +note over hss +{"info":"display information"} +end note +hss-> homescreen: push showInformation event + +homescreen->homescreen: display information message 3s + +@enduml +``` \ No newline at end of file diff --git a/doc/api-ref/.keep b/doc/api-ref/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/doc/api-ref/html/annotated.html b/doc/api-ref/html/annotated.html index 8e5887a..2a2bb7e 100644 --- a/doc/api-ref/html/annotated.html +++ b/doc/api-ref/html/annotated.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: Class List @@ -12,6 +11,9 @@ + @@ -29,19 +31,40 @@ - + - - - - + +
Here are the classes, structs, unions and interfaces with brief descriptions:
@@ -73,7 +101,7 @@ $(function() { diff --git a/doc/api-ref/html/arrowdown.png b/doc/api-ref/html/arrowdown.png new file mode 100644 index 0000000000000000000000000000000000000000..0b63f6d38c4b9ec907b820192ebe9724ed6eca22 GIT binary patch literal 246 zcmVkw!R34#Lv2LOS^S2tZA31X++9RY}n zChwn@Z)Wz*WWHH{)HDtJnq&A2hk$b-y(>?@z0iHr41EKCGp#T5?07*qoM6N<$f(V3Pvj6}9 literal 0 HcmV?d00001 diff --git a/doc/api-ref/html/arrowright.png b/doc/api-ref/html/arrowright.png new file mode 100644 index 0000000000000000000000000000000000000000..c6ee22f937a07d1dbfc27c669d11f8ed13e2f152 GIT binary patch literal 229 zcmV^P)R?RzRoKvklcaQ%HF6%rK2&ZgO(-ihJ_C zzrKgp4jgO( fd_(yg|3PpEQb#9`a?Pz_00000NkvXXu0mjftR`5K literal 0 HcmV?d00001 diff --git a/doc/api-ref/html/classes.html b/doc/api-ref/html/classes.html index 1d0c8c0..b0d4141 100644 --- a/doc/api-ref/html/classes.html +++ b/doc/api-ref/html/classes.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: Class Index @@ -12,6 +11,9 @@ + @@ -29,19 +31,40 @@ - + - - - - + +
Class Index
-
e | l
+
D | G | H | L | W
- + + + - - + +
  e  
-
  l  
+
  H  
+
HS_ClientManager   
  d  
+
  w  
+
  L  
+
HS_Client   display   window   
HS_ClientCtxt   LibHomeScreen   
  g  
event   LibHomeScreen   
geometry   
-
e | l
+
D | G | H | L | W
diff --git a/doc/api-ref/html/d0/d1e/homescreen_8c.html b/doc/api-ref/html/d0/d1e/homescreen_8c.html deleted file mode 100644 index 2ea52e3..0000000 --- a/doc/api-ref/html/d0/d1e/homescreen_8c.html +++ /dev/null @@ -1,832 +0,0 @@ - - - - - - - -HomeScreenBinding: src/homescreen.c File Reference - - - - - - - - - -
-
- - - - - - -
-
HomeScreenBinding -
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
- -
-
homescreen.c File Reference
-
-
-
#include <afb/afb-binding.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <unistd.h>
-#include <json-c/json.h>
-#include <glib.h>
-#include <pthread.h>
-#include "hs-helper.h"
-
-

Go to the source code of this file.

- - - - -

-Classes

struct  event
 
- - - - - - - - - -

-Macros

#define _GNU_SOURCE
 
#define AFB_BINDING_VERSION   2
 
#define COMMAND_EVENT_NUM   4
 
#define EVENT_SUBSCRIBE_ERROR_CODE   100
 
- - - - - - - - - - - - - - - - - - - -

-Functions

static void pingSample (struct afb_req request)
 
static void tap_shortcut (struct afb_req request)
 
static void on_screen_message (struct afb_req request)
 
static void on_screen_reply (struct afb_req request)
 
static void subscribe (struct afb_req request)
 
static void unsubscribe (struct afb_req request)
 
static int preinit ()
 
static int init ()
 
static void onevent (const char *event, struct json_object *object)
 
- - - - - - - - - - - - - - - - - - - - - - - -

-Variables

static struct event event_list [COMMAND_EVENT_NUM]
 
static struct afb_event ev_tap_shortcut
 
static struct afb_event ev_on_screen_message
 
static struct afb_event ev_on_screen_reply
 
static struct afb_event ev_reserved
 
static const char _error [] = "error"
 
static const char _application_name [] = "application_name"
 
static const char _display_message [] = "display_message"
 
static const char _reply_message [] = "reply_message"
 
static const struct afb_verb_v2 verbs []
 
const struct afb_binding_v2 afbBindingV2
 
-

Macro Definition Documentation

- -

◆ _GNU_SOURCE

- -
-
- - - - -
#define _GNU_SOURCE
-
- -

Definition at line 17 of file homescreen.c.

- -
-
- -

◆ AFB_BINDING_VERSION

- -
-
- - - - -
#define AFB_BINDING_VERSION   2
-
- -

Definition at line 18 of file homescreen.c.

- -
-
- -

◆ COMMAND_EVENT_NUM

- -
-
- - - - -
#define COMMAND_EVENT_NUM   4
-
- -

Definition at line 31 of file homescreen.c.

- -
-
- -

◆ EVENT_SUBSCRIBE_ERROR_CODE

- -
-
- - - - -
#define EVENT_SUBSCRIBE_ERROR_CODE   100
-
- -

Definition at line 32 of file homescreen.c.

- -
-
-

Function Documentation

- -

◆ init()

- -
-
- - - - - -
- - - - - - - -
static int init ()
-
-static
-
- -

Definition at line 277 of file homescreen.c.

-
278 {
279  HMI_NOTICE("homescreen-service","binding init");
280 
281  ev_tap_shortcut = afb_daemon_make_event(evlist[0]);
282  ev_on_screen_message = afb_daemon_make_event(evlist[1]);
283  ev_on_screen_reply = afb_daemon_make_event(evlist[2]);
284  ev_reserved = afb_daemon_make_event(evlist[3]);
285 
286  event_list[0].name = evlist[0];
288 
289  event_list[1].name = evlist[1];
291 
292  event_list[2].name = evlist[2];
294 
295  event_list[3].name = evlist[3];
297 
298  return 0;
299 }
struct afb_event * event
Definition: homescreen.c:37
-
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:20
-
static struct afb_event ev_reserved
Definition: homescreen.c:45
-
static const char * evlist[]
Definition: hs-helper.h:34
-
const char * name
Definition: homescreen.c:36
-
static struct afb_event ev_on_screen_reply
Definition: homescreen.c:44
-
static struct afb_event ev_on_screen_message
Definition: homescreen.c:43
-
static struct event event_list[COMMAND_EVENT_NUM]
Definition: homescreen.c:40
-
static struct afb_event ev_tap_shortcut
Definition: homescreen.c:42
-
-
-
- -

◆ on_screen_message()

- -
-
- - - - - -
- - - - - - - - -
static void on_screen_message (struct afb_req request)
-
-static
-
-

HomeScreen OnScreen message

-

Parameters

-

Request key

    -
  • display_message : message for display
  • -
-

Return

-

Nothing

- -

Definition at line 114 of file homescreen.c.

-
115 {
116  HMI_NOTICE("homescreen-service","is called.");
117 
118  int ret = 0;
119  const char* value = afb_req_value(request, _display_message);
120  if (value) {
121 
122  HMI_NOTICE("homescreen-service","request params = %s.", value);
123 
124  struct json_object* push_obj = json_object_new_object();
126  _display_message, value);
127  afb_event_push(ev_on_screen_message, push_obj);
128  } else {
129  afb_req_fail_f(request, "failed", "called %s, Unknown palameter", __FUNCTION__);
130  return;
131  }
132 
133  // response to HomeScreen
134  struct json_object *res = json_object_new_object();
135  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
136  _error, ret);
137  afb_req_success(request, res, "afb_event_push event [on_screen_message]");
138 }
void hs_add_object_to_json_object_str(struct json_object *j_obj, int count,...)
Definition: hs-helper.c:110
-
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:20
-
static const char _error[]
Definition: homescreen.c:47
-
static struct afb_event ev_on_screen_message
Definition: homescreen.c:43
-
static const char _display_message[]
Definition: homescreen.c:50
-
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: hs-helper.c:125
-
-
-
- -

◆ on_screen_reply()

- -
-
- - - - - -
- - - - - - - - -
static void on_screen_reply (struct afb_req request)
-
-static
-
-

HomeScreen OnScreen Reply

-

Parameters

-

Request key

    -
  • reply_message : message for reply
  • -
-

Return

-

Nothing

- -

Definition at line 151 of file homescreen.c.

-
152 {
153  HMI_NOTICE("homescreen-service","is called.");
154 
155  int ret = 0;
156  const char* value = afb_req_value(request, _reply_message);
157  if (value) {
158 
159  HMI_NOTICE("homescreen-service","request params = %s.", value);
160 
161  struct json_object* push_obj = json_object_new_object();
163  _reply_message, value);
164  afb_event_push(ev_on_screen_reply, push_obj);
165  } else {
166  afb_req_fail_f(request, "failed", "called %s, Unknown palameter", __FUNCTION__);
167  return;
168  }
169 
170  // response to HomeScreen
171  struct json_object *res = json_object_new_object();
172  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
173  _error, ret);
174  afb_req_success(request, res, "afb_event_push event [on_screen_reply]");
175 }
void hs_add_object_to_json_object_str(struct json_object *j_obj, int count,...)
Definition: hs-helper.c:110
-
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:20
-
static const char _error[]
Definition: homescreen.c:47
-
static struct afb_event ev_on_screen_reply
Definition: homescreen.c:44
-
static const char _reply_message[]
Definition: homescreen.c:51
-
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: hs-helper.c:125
-
-
-
- -

◆ onevent()

- -
-
- - - - - -
- - - - - - - - - - - - - - - - - - -
static void onevent (const char * event,
struct json_object * object 
)
-
-static
-
- -

Definition at line 301 of file homescreen.c.

-
302 {
303  HMI_NOTICE("homescreen-service","on_event %s", event);
304 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:20
- -
-
-
- -

◆ pingSample()

- -
-
- - - - - -
- - - - - - - - -
static void pingSample (struct afb_req request)
-
-static
-
- -

Definition at line 57 of file homescreen.c.

-
58 {
59  static int pingcount = 0;
60  afb_req_success_f(request, json_object_new_int(pingcount), "Ping count = %d", pingcount);
61  HMI_NOTICE("homescreen-service","Verbosity macro at level notice invoked at ping invocation count = %d", pingcount);
62  pingcount++;
63 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:20
-
-
-
- -

◆ preinit()

- -
-
- - - - - -
- - - - - - - -
static int preinit ()
-
-static
-
- -

Definition at line 271 of file homescreen.c.

-
272 {
273  HMI_NOTICE("homescreen-service","binding preinit (was register)");
274  return 0;
275 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:20
-
-
-
- -

◆ subscribe()

- -
-
- - - - - -
- - - - - - - - -
static void subscribe (struct afb_req request)
-
-static
-
-

Subscribe event

-

Parameters

- -

Return

-

Nothing

-

Note

- -

Definition at line 189 of file homescreen.c.

-
190 {
191  const char *value = afb_req_value(request, "event");
192  HMI_NOTICE("homescreen-service","value is %s", value);
193  int ret = 0;
194  if(value) {
195  int index = hs_search_event_name_index(value);
196  if(index < 0)
197  {
198  HMI_NOTICE("homescreen-service","dedicated event doesn't exist");
200  }
201  else
202  {
203  afb_req_subscribe(request, *event_list[index].event);
204  }
205  }
206  else{
207  HMI_NOTICE("homescreen-service","Please input event name");
209  }
210  /*create response json object*/
211  struct json_object *res = json_object_new_object();
212  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
213  _error, ret);
214  afb_req_success_f(request, res, "homescreen binder subscribe event name [%s]", value);
215 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:20
-
static const char _error[]
Definition: homescreen.c:47
- -
int hs_search_event_name_index(const char *value)
Definition: hs-helper.c:142
-
static struct event event_list[COMMAND_EVENT_NUM]
Definition: homescreen.c:40
-
#define EVENT_SUBSCRIBE_ERROR_CODE
Definition: homescreen.c:32
-
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: hs-helper.c:125
-
-
-
- -

◆ tap_shortcut()

- -
-
- - - - - -
- - - - - - - - -
static void tap_shortcut (struct afb_req request)
-
-static
-
-

tap_shortcut notify for homescreen When Shortcut area is tapped, notify these applciations

-

Parameters

-

Request key

    -
  • application_name : application name
  • -
-

Return

-

Nothing

- -

Definition at line 77 of file homescreen.c.

-
78 {
79  HMI_NOTICE("homescreen-service","is called.");
80 
81  int ret = 0;
82  const char* value = afb_req_value(request, _application_name);
83  if (value) {
84 
85  HMI_NOTICE("homescreen-service","request params = %s.", value);
86 
87  struct json_object* push_obj = json_object_new_object();
89  _application_name, value);
90  afb_event_push(ev_tap_shortcut, push_obj);
91  } else {
92  afb_req_fail_f(request, "failed", "called %s, Unknown palameter", __FUNCTION__);
93  return;
94  }
95 
96  // response to HomeScreen
97  struct json_object *res = json_object_new_object();
98  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
99  _error, ret);
100  afb_req_success(request, res, "afb_event_push event [tap_shortcut]");
101 }
void hs_add_object_to_json_object_str(struct json_object *j_obj, int count,...)
Definition: hs-helper.c:110
-
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:20
-
static const char _application_name[]
Definition: homescreen.c:49
-
static const char _error[]
Definition: homescreen.c:47
-
static struct afb_event ev_tap_shortcut
Definition: homescreen.c:42
-
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: hs-helper.c:125
-
-
-
- -

◆ unsubscribe()

- -
-
- - - - - -
- - - - - - - - -
static void unsubscribe (struct afb_req request)
-
-static
-
-

Unsubscribe event

-

Parameters

- -

Return

-

Nothing

-

Note

- -

Definition at line 229 of file homescreen.c.

-
230 {
231  const char *value = afb_req_value(request, "event");
232  HMI_NOTICE("homescreen-service","value is %s", value);
233  int ret = 0;
234  if(value) {
235  int index = hs_search_event_name_index(value);
236  if(index < 0)
237  {
238  HMI_NOTICE("homescreen-service","dedicated event doesn't exist");
240  }
241  else
242  {
243  afb_req_unsubscribe(request, *event_list[index].event);
244  }
245  }
246  else{
247  HMI_NOTICE("homescreen-service","Please input event name");
249  }
250  /*create response json object*/
251  struct json_object *res = json_object_new_object();
252  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
253  _error, ret);
254  afb_req_success_f(request, res, "homescreen binder unsubscribe event name [%s]", value);
255 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:20
-
static const char _error[]
Definition: homescreen.c:47
- -
int hs_search_event_name_index(const char *value)
Definition: hs-helper.c:142
-
static struct event event_list[COMMAND_EVENT_NUM]
Definition: homescreen.c:40
-
#define EVENT_SUBSCRIBE_ERROR_CODE
Definition: homescreen.c:32
-
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: hs-helper.c:125
-
-
-
-

Variable Documentation

- -

◆ _application_name

- -
-
- - - - - -
- - - - -
const char _application_name[] = "application_name"
-
-static
-
- -

Definition at line 49 of file homescreen.c.

- -
-
- -

◆ _display_message

- -
-
- - - - - -
- - - - -
const char _display_message[] = "display_message"
-
-static
-
- -

Definition at line 50 of file homescreen.c.

- -
-
- -

◆ _error

- -
-
- - - - - -
- - - - -
const char _error[] = "error"
-
-static
-
- -

Definition at line 47 of file homescreen.c.

- -
-
- -

◆ _reply_message

- -
-
- - - - - -
- - - - -
const char _reply_message[] = "reply_message"
-
-static
-
- -

Definition at line 51 of file homescreen.c.

- -
-
- -

◆ afbBindingV2

- -
-
- - - - -
const struct afb_binding_v2 afbBindingV2
-
-Initial value:
= {
.api = "homescreen",
.specification = NULL,
.verbs = verbs,
.preinit = preinit,
.init = init,
.onevent = onevent
}
static int preinit()
Definition: homescreen.c:271
-
static void onevent(const char *event, struct json_object *object)
Definition: homescreen.c:301
-
static int init()
Definition: homescreen.c:277
-
static const struct afb_verb_v2 verbs[]
Definition: homescreen.c:260
-
-

Definition at line 306 of file homescreen.c.

- -
-
- -

◆ ev_on_screen_message

- -
-
- - - - - -
- - - - -
struct afb_event ev_on_screen_message
-
-static
-
- -

Definition at line 43 of file homescreen.c.

- -
-
- -

◆ ev_on_screen_reply

- -
-
- - - - - -
- - - - -
struct afb_event ev_on_screen_reply
-
-static
-
- -

Definition at line 44 of file homescreen.c.

- -
-
- -

◆ ev_reserved

- -
-
- - - - - -
- - - - -
struct afb_event ev_reserved
-
-static
-
- -

Definition at line 45 of file homescreen.c.

- -
-
- -

◆ ev_tap_shortcut

- -
-
- - - - - -
- - - - -
struct afb_event ev_tap_shortcut
-
-static
-
- -

Definition at line 42 of file homescreen.c.

- -
-
- -

◆ event_list

- -
-
- - - - - -
- - - - -
struct event event_list[COMMAND_EVENT_NUM]
-
-static
-
- -

Definition at line 40 of file homescreen.c.

- -
-
- -

◆ verbs

- -
-
- - - - - -
- - - - -
const struct afb_verb_v2 verbs[]
-
-static
-
-Initial value:
= {
{ .verb = "ping", .session = AFB_SESSION_NONE, .callback = pingSample, .auth = NULL },
{ .verb = "tap_shortcut", .session = AFB_SESSION_NONE, .callback = tap_shortcut, .auth = NULL },
{ .verb = "on_screen_message", .session = AFB_SESSION_NONE, .callback = on_screen_message, .auth = NULL },
{ .verb = "on_screen_reply", .session = AFB_SESSION_NONE, .callback = on_screen_reply, .auth = NULL },
{ .verb = "subscribe", .session = AFB_SESSION_NONE, .callback = subscribe, .auth = NULL },
{ .verb = "unsubscribe", .session = AFB_SESSION_NONE, .callback = unsubscribe, .auth = NULL },
{NULL }
}
static void tap_shortcut(struct afb_req request)
Definition: homescreen.c:77
-
static void pingSample(struct afb_req request)
Definition: homescreen.c:57
-
static void on_screen_reply(struct afb_req request)
Definition: homescreen.c:151
-
static void unsubscribe(struct afb_req request)
Definition: homescreen.c:229
-
static void on_screen_message(struct afb_req request)
Definition: homescreen.c:114
-
static void subscribe(struct afb_req request)
Definition: homescreen.c:189
-
-

Definition at line 260 of file homescreen.c.

- -
-
-
- - - - diff --git a/doc/api-ref/html/d0/d1e/homescreen_8c_source.html b/doc/api-ref/html/d0/d1e/homescreen_8c_source.html deleted file mode 100644 index 6a4f516..0000000 --- a/doc/api-ref/html/d0/d1e/homescreen_8c_source.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - -HomeScreenBinding: src/homescreen.c Source File - - - - - - - - - -
-
- - - - - - -
-
HomeScreenBinding -
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
-
-
homescreen.c
-
-
-Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #define _GNU_SOURCE
18 #define AFB_BINDING_VERSION 2
19 #include <afb/afb-binding.h>
20 
21 #include <stdio.h>
22 #include <string.h>
23 #include <stdlib.h>
24 #include <stdint.h>
25 #include <unistd.h>
26 #include <json-c/json.h>
27 #include <glib.h>
28 #include <pthread.h>
29 #include "hs-helper.h"
30 
31 #define COMMAND_EVENT_NUM 4
32 #define EVENT_SUBSCRIBE_ERROR_CODE 100
33 
34 /* To Do hash table is better */
35 struct event{
36  const char* name;
37  struct afb_event* event;
38  };
39 
41 
42 static struct afb_event ev_tap_shortcut;
43 static struct afb_event ev_on_screen_message;
44 static struct afb_event ev_on_screen_reply;
45 static struct afb_event ev_reserved;
46 
47 static const char _error[] = "error";
48 
49 static const char _application_name[] = "application_name";
50 static const char _display_message[] = "display_message";
51 static const char _reply_message[] = "reply_message";
52 
53 /*
54 ********** Method of HomeScreen Service (API) **********
55 */
56 
57 static void pingSample(struct afb_req request)
58 {
59  static int pingcount = 0;
60  afb_req_success_f(request, json_object_new_int(pingcount), "Ping count = %d", pingcount);
61  HMI_NOTICE("homescreen-service","Verbosity macro at level notice invoked at ping invocation count = %d", pingcount);
62  pingcount++;
63 }
64 
77 static void tap_shortcut (struct afb_req request)
78 {
79  HMI_NOTICE("homescreen-service","is called.");
80 
81  int ret = 0;
82  const char* value = afb_req_value(request, _application_name);
83  if (value) {
84 
85  HMI_NOTICE("homescreen-service","request params = %s.", value);
86 
87  struct json_object* push_obj = json_object_new_object();
89  _application_name, value);
90  afb_event_push(ev_tap_shortcut, push_obj);
91  } else {
92  afb_req_fail_f(request, "failed", "called %s, Unknown palameter", __FUNCTION__);
93  return;
94  }
95 
96  // response to HomeScreen
97  struct json_object *res = json_object_new_object();
98  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
99  _error, ret);
100  afb_req_success(request, res, "afb_event_push event [tap_shortcut]");
101 }
102 
114 static void on_screen_message (struct afb_req request)
115 {
116  HMI_NOTICE("homescreen-service","is called.");
117 
118  int ret = 0;
119  const char* value = afb_req_value(request, _display_message);
120  if (value) {
121 
122  HMI_NOTICE("homescreen-service","request params = %s.", value);
123 
124  struct json_object* push_obj = json_object_new_object();
126  _display_message, value);
127  afb_event_push(ev_on_screen_message, push_obj);
128  } else {
129  afb_req_fail_f(request, "failed", "called %s, Unknown palameter", __FUNCTION__);
130  return;
131  }
132 
133  // response to HomeScreen
134  struct json_object *res = json_object_new_object();
135  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
136  _error, ret);
137  afb_req_success(request, res, "afb_event_push event [on_screen_message]");
138 }
139 
151 static void on_screen_reply (struct afb_req request)
152 {
153  HMI_NOTICE("homescreen-service","is called.");
154 
155  int ret = 0;
156  const char* value = afb_req_value(request, _reply_message);
157  if (value) {
158 
159  HMI_NOTICE("homescreen-service","request params = %s.", value);
160 
161  struct json_object* push_obj = json_object_new_object();
163  _reply_message, value);
164  afb_event_push(ev_on_screen_reply, push_obj);
165  } else {
166  afb_req_fail_f(request, "failed", "called %s, Unknown palameter", __FUNCTION__);
167  return;
168  }
169 
170  // response to HomeScreen
171  struct json_object *res = json_object_new_object();
172  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
173  _error, ret);
174  afb_req_success(request, res, "afb_event_push event [on_screen_reply]");
175 }
176 
189 static void subscribe(struct afb_req request)
190 {
191  const char *value = afb_req_value(request, "event");
192  HMI_NOTICE("homescreen-service","value is %s", value);
193  int ret = 0;
194  if(value) {
195  int index = hs_search_event_name_index(value);
196  if(index < 0)
197  {
198  HMI_NOTICE("homescreen-service","dedicated event doesn't exist");
200  }
201  else
202  {
203  afb_req_subscribe(request, *event_list[index].event);
204  }
205  }
206  else{
207  HMI_NOTICE("homescreen-service","Please input event name");
209  }
210  /*create response json object*/
211  struct json_object *res = json_object_new_object();
212  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
213  _error, ret);
214  afb_req_success_f(request, res, "homescreen binder subscribe event name [%s]", value);
215 }
216 
229 static void unsubscribe(struct afb_req request)
230 {
231  const char *value = afb_req_value(request, "event");
232  HMI_NOTICE("homescreen-service","value is %s", value);
233  int ret = 0;
234  if(value) {
235  int index = hs_search_event_name_index(value);
236  if(index < 0)
237  {
238  HMI_NOTICE("homescreen-service","dedicated event doesn't exist");
240  }
241  else
242  {
243  afb_req_unsubscribe(request, *event_list[index].event);
244  }
245  }
246  else{
247  HMI_NOTICE("homescreen-service","Please input event name");
249  }
250  /*create response json object*/
251  struct json_object *res = json_object_new_object();
252  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
253  _error, ret);
254  afb_req_success_f(request, res, "homescreen binder unsubscribe event name [%s]", value);
255 }
256 
257 /*
258  * array of the verbs exported to afb-daemon
259  */
260 static const struct afb_verb_v2 verbs[]= {
261  /* VERB'S NAME SESSION MANAGEMENT FUNCTION TO CALL */
262  { .verb = "ping", .session = AFB_SESSION_NONE, .callback = pingSample, .auth = NULL },
263  { .verb = "tap_shortcut", .session = AFB_SESSION_NONE, .callback = tap_shortcut, .auth = NULL },
264  { .verb = "on_screen_message", .session = AFB_SESSION_NONE, .callback = on_screen_message, .auth = NULL },
265  { .verb = "on_screen_reply", .session = AFB_SESSION_NONE, .callback = on_screen_reply, .auth = NULL },
266  { .verb = "subscribe", .session = AFB_SESSION_NONE, .callback = subscribe, .auth = NULL },
267  { .verb = "unsubscribe", .session = AFB_SESSION_NONE, .callback = unsubscribe, .auth = NULL },
268  {NULL } /* marker for end of the array */
269 };
270 
271 static int preinit()
272 {
273  HMI_NOTICE("homescreen-service","binding preinit (was register)");
274  return 0;
275 }
276 
277 static int init()
278 {
279  HMI_NOTICE("homescreen-service","binding init");
280 
281  ev_tap_shortcut = afb_daemon_make_event(evlist[0]);
282  ev_on_screen_message = afb_daemon_make_event(evlist[1]);
283  ev_on_screen_reply = afb_daemon_make_event(evlist[2]);
284  ev_reserved = afb_daemon_make_event(evlist[3]);
285 
286  event_list[0].name = evlist[0];
288 
289  event_list[1].name = evlist[1];
291 
292  event_list[2].name = evlist[2];
294 
295  event_list[3].name = evlist[3];
297 
298  return 0;
299 }
300 
301 static void onevent(const char *event, struct json_object *object)
302 {
303  HMI_NOTICE("homescreen-service","on_event %s", event);
304 }
305 
306 const struct afb_binding_v2 afbBindingV2 = {
307  .api = "homescreen",
308  .specification = NULL,
309  .verbs = verbs,
310  .preinit = preinit,
311  .init = init,
312  .onevent = onevent
313 };
void hs_add_object_to_json_object_str(struct json_object *j_obj, int count,...)
Definition: hs-helper.c:110
-
struct afb_event * event
Definition: homescreen.c:37
-
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:20
-
static int preinit()
Definition: homescreen.c:271
-
static void tap_shortcut(struct afb_req request)
Definition: homescreen.c:77
-
static const char _application_name[]
Definition: homescreen.c:49
-
static struct afb_event ev_reserved
Definition: homescreen.c:45
-
static const char _error[]
Definition: homescreen.c:47
-
static void pingSample(struct afb_req request)
Definition: homescreen.c:57
-
static void onevent(const char *event, struct json_object *object)
Definition: homescreen.c:301
- - -
static void on_screen_reply(struct afb_req request)
Definition: homescreen.c:151
-
static int init()
Definition: homescreen.c:277
-
static const char * evlist[]
Definition: hs-helper.h:34
-
const char * name
Definition: homescreen.c:36
-
static void unsubscribe(struct afb_req request)
Definition: homescreen.c:229
-
int hs_search_event_name_index(const char *value)
Definition: hs-helper.c:142
-
static struct afb_event ev_on_screen_reply
Definition: homescreen.c:44
-
static struct afb_event ev_on_screen_message
Definition: homescreen.c:43
-
#define COMMAND_EVENT_NUM
Definition: homescreen.c:31
-
static void on_screen_message(struct afb_req request)
Definition: homescreen.c:114
-
static const struct afb_verb_v2 verbs[]
Definition: homescreen.c:260
-
static struct event event_list[COMMAND_EVENT_NUM]
Definition: homescreen.c:40
-
static const char _display_message[]
Definition: homescreen.c:50
-
static void subscribe(struct afb_req request)
Definition: homescreen.c:189
-
#define EVENT_SUBSCRIBE_ERROR_CODE
Definition: homescreen.c:32
-
static struct afb_event ev_tap_shortcut
Definition: homescreen.c:42
-
static const char _reply_message[]
Definition: homescreen.c:51
-
const struct afb_binding_v2 afbBindingV2
Definition: homescreen.c:306
-
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: hs-helper.c:125
-
- - - - diff --git a/doc/api-ref/html/d0/d53/struct_h_s___client_ctxt.html b/doc/api-ref/html/d0/d53/struct_h_s___client_ctxt.html new file mode 100644 index 0000000..b02f624 --- /dev/null +++ b/doc/api-ref/html/d0/d53/struct_h_s___client_ctxt.html @@ -0,0 +1,161 @@ + + + + + + +HomeScreenBinding: HS_ClientCtxt Struct Reference + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ +
+
+ +
+
HS_ClientCtxt Struct Reference
+
+
+ +

#include <hs-clientmanager.h>

+ + + + +

+Public Member Functions

 HS_ClientCtxt (const char *appid)
 
+ + + +

+Public Attributes

std::string id
 
+

Detailed Description

+
+

Definition at line 27 of file hs-clientmanager.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + +
+ + + + + + + + +
HS_ClientCtxt::HS_ClientCtxt (const char * appid)
+
+inline
+
+ +

Definition at line 30 of file hs-clientmanager.h.

+
31  {
32  id = appid;
33  }
+
+
+

Member Data Documentation

+ +
+
+ + + + +
std::string HS_ClientCtxt::id
+
+ +

Definition at line 29 of file hs-clientmanager.h.

+ +
+
+
The documentation for this struct was generated from the following file: +
+ + + + diff --git a/doc/api-ref/html/d0/d8a/libhomescreen_8cpp.html b/doc/api-ref/html/d0/d8a/libhomescreen_8cpp.html index 1aec416..bed43cb 100644 --- a/doc/api-ref/html/d0/d8a/libhomescreen_8cpp.html +++ b/doc/api-ref/html/d0/d8a/libhomescreen_8cpp.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: libhomescreen/libhomescreen.cpp File Reference @@ -12,6 +11,9 @@ + @@ -29,19 +31,39 @@ - + - - - - + +
#include <sys/socket.h>
#include <iostream>
#include <algorithm>
-#include <thread>
#include <errno.h>
#include <cassert>
#include <cctype>
@@ -82,7 +103,7 @@ $(function() { #include <cstdlib>
#include <cstring>
#include <libhomescreen.hpp>
-#include "hmi-debug.h"
+#include "hmi-debug.h"

Go to the source code of this file.

@@ -94,22 +115,20 @@ Functions - + - -
 
static void _on_call_static (void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg)
 
static void _on_event_static (void *closure, const char *event, struct afb_wsj1_msg *msg)
static void _on_event_static (void *closure, const char *event, struct afb_wsj1_msg *msg)
 
static void _on_reply_static (void *closure, struct afb_wsj1_msg *msg)
 
static void * event_loop_run (void *args)
 
+ +

Variables

static const char API [] = "homescreen"
 
static const char ApplicationId [] = "application_id"
 

Function Documentation

- -

◆ _on_call_static()

- +
@@ -153,13 +172,11 @@ Variables
-

Definition at line 64 of file libhomescreen.cpp.

-
65 {
66  /* LibHomeScreen is not called from other process */
67 }
+

Definition at line 74 of file libhomescreen.cpp.

+
75 {
76  /* LibHomeScreen is not called from other process */
77 }
- -

◆ _on_event_static()

- +
@@ -197,15 +214,12 @@ Variables
-

Definition at line 69 of file libhomescreen.cpp.

-
70 {
71  static_cast<LibHomeScreen*>(closure)->on_event(NULL,event,msg);
72 }
- +

Definition at line 79 of file libhomescreen.cpp.

+
80 {
81  static_cast<LibHomeScreen*>(closure)->on_event(NULL,event,msg);
82 }
- -

◆ _on_hangup_static()

- +
@@ -238,14 +252,12 @@ Variables

websocket

-

Definition at line 59 of file libhomescreen.cpp.

-
60 {
61  static_cast<LibHomeScreen*>(closure)->on_hangup(NULL,wsj);
62 }
+

Definition at line 69 of file libhomescreen.cpp.

+
70 {
71  static_cast<LibHomeScreen*>(closure)->on_hangup(NULL,wsj);
72 }
- -

◆ _on_reply_static()

- +
@@ -277,14 +289,12 @@ Variables
-

Definition at line 74 of file libhomescreen.cpp.

-
75 {
76  static_cast<LibHomeScreen*>(closure)->on_reply(NULL,msg);
77 }
+

Definition at line 84 of file libhomescreen.cpp.

+
85 {
86  static_cast<LibHomeScreen*>(closure)->on_reply(NULL,msg);
87 }
- -

◆ event_loop_run()

- +
@@ -292,10 +302,10 @@ Variables
- + - - + +
static void* event_loop_run static bool has_verb (void * args)const string & verb)
@@ -306,14 +316,14 @@ Variables
-

Definition at line 201 of file libhomescreen.cpp.

-
202 {
203  struct sd_event* loop = (struct sd_event*)(args);
204  HMI_DEBUG("libhomescreen","start eventloop");
205  for(;;)
206  sd_event_run(loop, 30000000);
207 }
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:22
+

Definition at line 705 of file libhomescreen.cpp.

+
706 {
707  HMI_DEBUG("libhomescreen","verb is %s", verb.c_str());
708  if(find(LibHomeScreen::api_list.begin(), LibHomeScreen::api_list.end(), verb) != LibHomeScreen::api_list.end())
709  return true;
710  else
711  return false;
712 }
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:42
+
static const std::vector< std::string > api_list
- -

◆ has_verb()

- +

Variable Documentation

+
@@ -321,11 +331,7 @@ Variables @@ -335,16 +341,11 @@ Variables
- - - - - +
static bool has_verb (const string & verb)const char API[] = "homescreen"
-

Definition at line 518 of file libhomescreen.cpp.

-
519 {
520  HMI_DEBUG("libhomescreen","verb is %s", verb.c_str());
521  if(find(LibHomeScreen::api_list.begin(), LibHomeScreen::api_list.end(), verb) != LibHomeScreen::api_list.end())
522  return true;
523  else
524  return false;
525 }
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:22
-
static const std::vector< std::string > api_list
-
+

Definition at line 35 of file libhomescreen.cpp.

+
-

Variable Documentation

- -

◆ API

- +
@@ -352,7 +353,7 @@ Variables @@ -362,7 +363,7 @@ Variables
- +
const char API[] = "homescreen"const char ApplicationId[] = "application_id"
-

Definition at line 36 of file libhomescreen.cpp.

+

Definition at line 36 of file libhomescreen.cpp.

@@ -371,7 +372,7 @@ Variables diff --git a/doc/api-ref/html/d0/d8a/libhomescreen_8cpp_source.html b/doc/api-ref/html/d0/d8a/libhomescreen_8cpp_source.html index 621f8d4..fadfb12 100644 --- a/doc/api-ref/html/d0/d8a/libhomescreen_8cpp_source.html +++ b/doc/api-ref/html/d0/d8a/libhomescreen_8cpp_source.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: libhomescreen/libhomescreen.cpp Source File @@ -12,6 +11,9 @@ + @@ -29,19 +31,39 @@
- + - - - - + +
libhomescreen.cpp
-Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <stdarg.h>
18 #include <sys/socket.h>
19 #include <iostream>
20 #include <algorithm>
21 #include <thread>
22 #include <errno.h>
23 #include <cassert>
24 #include <cctype>
25 #include <cerrno>
26 #include <cstdio>
27 #include <cstdlib>
28 #include <cstring>
29 
30 #include <libhomescreen.hpp>
31 #include "hmi-debug.h"
32 
33 using namespace std;
34 
35 static bool has_verb(const string& verb);
36 static const char API[] = "homescreen";
37 
38 const std::vector<std::string> LibHomeScreen::api_list {
39  std::string("ping"), // debug do not use
40  std::string("tap_shortcut"), // HomeScreen Application only
41  std::string("on_screen_message"),
42  std::string("on_screen_reply"),
43  std::string("subscribe"),
44  std::string("unsubscribe")
45 };
46 
47 const std::vector<std::string> LibHomeScreen::event_list {
48  std::string("tap_shortcut"),
49  std::string("on_screen_message"),
50  std::string("on_screen_reply"),
51  std::string("none")
52 };
53 
54 
59 static void _on_hangup_static(void *closure, struct afb_wsj1 *wsj)
60 {
61  static_cast<LibHomeScreen*>(closure)->on_hangup(NULL,wsj);
62 }
63 
64 static void _on_call_static(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg)
65 {
66  /* LibHomeScreen is not called from other process */
67 }
68 
69 static void _on_event_static(void* closure, const char* event, struct afb_wsj1_msg *msg)
70 {
71  static_cast<LibHomeScreen*>(closure)->on_event(NULL,event,msg);
72 }
73 
74 static void _on_reply_static(void *closure, struct afb_wsj1_msg *msg)
75 {
76  static_cast<LibHomeScreen*>(closure)->on_reply(NULL,msg);
77 }
78 
79 
84 {
85 }
86 
91 {
92  if(mploop)
93  {
94  sd_event_unref(mploop);
95  }
96  if(sp_websock != NULL)
97  {
98  afb_wsj1_unref(sp_websock);
99  }
100 }
101 
116 int LibHomeScreen::init(const int port, const string& token)
117 {
118  int ret = 0;
119  if(port > 0 && token.size() > 0)
120  {
121  mport = port;
122  mtoken = token;
123  }
124  else
125  {
126  HMI_ERROR("libhomescreen","port and token should be > 0, Initial port and token uses.");
127  }
128 
129  ret = initialize_websocket();
130  if(ret != 0 )
131  {
132  HMI_ERROR("libhomescreen","Failed to initialize websocket");
133  }
134  else{
135  HMI_DEBUG("libhomescreen","Initialized");
136  }
137 
138  return ret;
139 }
140 
156  void (*event_cb)(const std::string& event, struct json_object* event_contents),
157  void (*reply_cb)(struct json_object* reply_contents),
158  void (*hangup_cb)(void))
159 {
160  onEvent = event_cb;
161  onReply = reply_cb;
162  onHangup = hangup_cb;
163 }
164 
165 int LibHomeScreen::initialize_websocket()
166 {
167  mploop = NULL;
168  onEvent = nullptr;
169  onReply = nullptr;
170  int ret = sd_event_default(&mploop);
171  if(ret < 0)
172  {
173  HMI_ERROR("libhomescreen","Failed to create event loop");
174  goto END;
175  }
176 
177  /* Initialize interface from websocket */
178  minterface.on_hangup = _on_hangup_static;
179  minterface.on_call = _on_call_static; /* Is this necessary? */
180  minterface.on_event = _on_event_static;
181  muri += "ws://localhost:" + to_string(mport) + "/api?token=" + mtoken; /*To be modified*/
182  sp_websock = afb_ws_client_connect_wsj1(mploop, muri.c_str(), &minterface, this);
183  if(sp_websock == NULL)
184  {
185  HMI_ERROR("libhomescreen","Failed to create websocket connection");
186  goto END;
187  }
188 
189  /* creates the evsrc */
190  //ret = sd_event_add_io(mploop,&mevent_src, sp_websock->fd, EPOLLIN, event_callback, NULL);
191 
192  return 0;
193 END:
194  if(mploop)
195  {
196  sd_event_unref(mploop);
197  }
198  return -1;
199 }
200 
201 static void *event_loop_run(void *args)
202 {
203  struct sd_event* loop = (struct sd_event*)(args);
204  HMI_DEBUG("libhomescreen","start eventloop");
205  for(;;)
206  sd_event_run(loop, 30000000);
207 }
208 
220 int LibHomeScreen::tapShortcut(const char* application_name)
221 {
222  if(!sp_websock)
223  {
224  return -1;
225  }
226 
227  struct json_object* j_obj = json_object_new_object();
228  struct json_object* val = json_object_new_string(application_name);
229  json_object_object_add(j_obj, "application_name", val);
230  return this->call("tap_shortcut", j_obj);
231 }
232 
244 int LibHomeScreen::onScreenMessage(const char* display_message)
245 {
246  if(!sp_websock)
247  {
248  return -1;
249  }
250 
251  struct json_object* j_obj = json_object_new_object();
252  struct json_object* val = json_object_new_string(display_message);
253  json_object_object_add(j_obj, "display_message", val);
254  return this->call("on_screen_message", j_obj);
255 }
256 
268 int LibHomeScreen::onScreenReply(const char* reply_message)
269 {
270  if(!sp_websock)
271  {
272  return -1;
273  }
274 
275  struct json_object* j_obj = json_object_new_object();
276  struct json_object* val = json_object_new_string(reply_message);
277  json_object_object_add(j_obj, "reply_message", val);
278  return this->call("on_screen_reply", j_obj);
279 }
280 
294 {
295  if (et >= 1 && et <= 3) {
296  switch (et) {
297  case Event_TapShortcut:
299  break;
300  case Event_OnScreenMessage:
302  break;
303  case Event_OnScreenReply:
305  break;
306  }
307 
308  this->handlers[et] = std::move(f);
309  }
310 }
311 
326 int LibHomeScreen::call(const string& verb, struct json_object* arg)
327 {
328  int ret;
329  if(!sp_websock)
330  {
331  return -1;
332  }
333  if (!has_verb(verb))
334  {
335  HMI_ERROR("libhomescreen","verb doesn't exit");
336  return -1;
337  }
338  ret = afb_wsj1_call_j(sp_websock, API, verb.c_str(), arg, _on_reply_static, this);
339  if (ret < 0) {
340  HMI_ERROR("libhomescreen","Failed to call verb:%s",verb.c_str());
341  }
342  return ret;
343 }
344 
360 int LibHomeScreen::call(const char* verb, struct json_object* arg)
361 {
362  int ret;
363  if(!sp_websock)
364  {
365  return -1;
366  }
367  if (!has_verb(string(verb)))
368  {
369  HMI_ERROR("libhomescreen","verb doesn't exit");
370  return -1;
371  }
372  ret = afb_wsj1_call_j(sp_websock, API, verb, arg, _on_reply_static, this);
373  if (ret < 0) {
374  HMI_ERROR("libhomescreen","Failed to call verb:%s",verb);
375  }
376  return ret;
377 }
378 
392 int LibHomeScreen::subscribe(const string& event_name)
393 {
394  if(!sp_websock)
395  {
396  return -1;
397  }
398  struct json_object* j_obj = json_object_new_object();
399  json_object_object_add(j_obj, "event", json_object_new_string(event_name.c_str()));
400 
401  int ret = afb_wsj1_call_j(sp_websock, API, "subscribe", j_obj, _on_reply_static, this);
402  if (ret < 0) {
403  HMI_ERROR("libhomescreen","Failed to call verb:%s",__FUNCTION__);
404  }
405  return ret;
406 }
407 
421 int LibHomeScreen::unsubscribe(const string& event_name)
422 {
423  if(!sp_websock)
424  {
425  return -1;
426  }
427  struct json_object* j_obj = json_object_new_object();
428  json_object_object_add(j_obj, "event", json_object_new_string(event_name.c_str()));
429 
430  int ret = afb_wsj1_call_j(sp_websock, API, "unsubscribe", j_obj, _on_reply_static, this);
431  if (ret < 0) {
432  HMI_ERROR("libhomescreen","Failed to call verb:%s",__FUNCTION__);
433  }
434  return ret;
435 }
436 
437 /************* Callback Function *************/
438 
439 void LibHomeScreen::on_hangup(void *closure, struct afb_wsj1 *wsj)
440 {
441  HMI_DEBUG("libhomescreen","%s called", __FUNCTION__);
442  if(onHangup != nullptr)
443  {
444  onHangup();
445  }
446 }
447 
448 void LibHomeScreen::on_call(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg)
449 {
450 }
451 
452 /*
453 * event is like "homescreen/tap_shortcut"
454 * msg is like {"event":"homescreen\/tap_shortcut","data":{"application_name":"hoge"},"jtype":"afb-event"}
455 * so you can get
456  event name : struct json_object obj = json_object_object_get(msg,"event")
457 */
458 void LibHomeScreen::on_event(void *closure, const char *event, struct afb_wsj1_msg *msg)
459 {
460  HMI_DEBUG("libhomescreen","event: (%s) msg: (%s).", event, afb_wsj1_msg_object_s(msg));
461 
462  if (strstr(event, API) == NULL) {
463  return;
464  }
465 
466  struct json_object* ev_contents = afb_wsj1_msg_object_j(msg);
467  struct json_object *json_data = json_object_object_get(ev_contents, "data");
468 
469  if(onEvent != nullptr)
470  {
471  const string ev(event);
472  onEvent(ev, ev_contents);
473  }
474 
475  const char* event_only = strchr(event, '/');
476  if (event_only != nullptr) {
477  event_only = event_only + 1;
478  }
479 
480  if (strcasecmp(event_only, LibHomeScreen::event_list[0].c_str()) == 0) {
481  auto i = this->handlers.find(Event_TapShortcut);
482  if ( i != this->handlers.end() ) {
483  i->second(json_data);
484  }
485  }
486  else if (strcasecmp(event_only, LibHomeScreen::event_list[1].c_str()) == 0) {
487  auto i = this->handlers.find(Event_OnScreenMessage);
488  if ( i != this->handlers.end() ) {
489  i->second(json_data);
490  }
491  }
492  else if (strcasecmp(event_only, LibHomeScreen::event_list[2].c_str()) == 0) {
493  auto i = this->handlers.find(Event_OnScreenReply);
494  if ( i != this->handlers.end() ) {
495  i->second(json_data);
496  }
497  }
498 
499  json_object_put(ev_contents);
500 }
501 
506 void LibHomeScreen::on_reply(void *closure, struct afb_wsj1_msg *msg)
507 {
508  HMI_DEBUG("libhomescreen","msg: (%s)", afb_wsj1_msg_object_s(msg));
509  if(onReply != nullptr)
510  {
511  struct json_object* reply = afb_wsj1_msg_object_j(msg);
512  onReply(reply);
513 
514  json_object_put(reply);
515  }
516 }
517 
518 static bool has_verb(const string& verb)
519 {
520  HMI_DEBUG("libhomescreen","verb is %s", verb.c_str());
521  if(find(LibHomeScreen::api_list.begin(), LibHomeScreen::api_list.end(), verb) != LibHomeScreen::api_list.end())
522  return true;
523  else
524  return false;
525 }
void on_event(void *closure, const char *event, struct afb_wsj1_msg *msg)
-
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:18
-
static void _on_hangup_static(void *closure, struct afb_wsj1 *wsj)
-
void on_reply(void *closure, struct afb_wsj1_msg *msg)
-
int onScreenReply(const char *reply_message)
-
std::function< void(json_object *)> handler_func
-
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:22
-
void on_call(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg)
- +Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <stdarg.h>
18 #include <sys/socket.h>
19 #include <iostream>
20 #include <algorithm>
21 #include <errno.h>
22 #include <cassert>
23 #include <cctype>
24 #include <cerrno>
25 #include <cstdio>
26 #include <cstdlib>
27 #include <cstring>
28 
29 #include <libhomescreen.hpp>
30 #include "hmi-debug.h"
31 
32 using namespace std;
33 
34 static bool has_verb(const string& verb);
35 static const char API[] = "homescreen";
36 static const char ApplicationId[] = "application_id";
37 
38 const std::vector<std::string> LibHomeScreen::api_list {
39  std::string("ping"), // debug do not use
40  std::string("tap_shortcut"), // HomeScreen Application only
41  std::string("on_screen_message"),
42  std::string("on_screen_reply"),
43  std::string("subscribe"),
44  std::string("unsubscribe"),
45  std::string("showWindow"),
46  std::string("hideWindow"),
47  std::string("replyShowWindow"),
48  std::string("showNotification"),
49  std::string("showInformation")
50 };
51 
52 const std::vector<std::string> LibHomeScreen::event_list {
53 // std::string("tap_shortcut"),
54  std::string("showWindow"),
55  std::string("on_screen_message"),
56  std::string("on_screen_reply"),
57  std::string("hideWindow"),
58  std::string("replyShowWindow"),
59  std::string("showNotification"),
60  std::string("showInformation"),
61  std::string("none")
62 };
63 
64 
69 static void _on_hangup_static(void *closure, struct afb_wsj1 *wsj)
70 {
71  static_cast<LibHomeScreen*>(closure)->on_hangup(NULL,wsj);
72 }
73 
74 static void _on_call_static(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg)
75 {
76  /* LibHomeScreen is not called from other process */
77 }
78 
79 static void _on_event_static(void* closure, const char* event, struct afb_wsj1_msg *msg)
80 {
81  static_cast<LibHomeScreen*>(closure)->on_event(NULL,event,msg);
82 }
83 
84 static void _on_reply_static(void *closure, struct afb_wsj1_msg *msg)
85 {
86  static_cast<LibHomeScreen*>(closure)->on_reply(NULL,msg);
87 }
88 
89 
94 {
95 }
96 
101 {
102  if(mploop)
103  {
104  sd_event_unref(mploop);
105  }
106  if(sp_websock != NULL)
107  {
108  afb_wsj1_unref(sp_websock);
109  }
110 }
111 
126 int LibHomeScreen::init(const int port, const string& token)
127 {
128  int ret = 0;
129  if(port > 0 && token.size() > 0)
130  {
131  mport = port;
132  mtoken = token;
133  }
134  else
135  {
136  HMI_ERROR("libhomescreen","port and token should be > 0, Initial port and token uses.");
137  }
138 
139  ret = initialize_websocket();
140  if(ret != 0 )
141  {
142  HMI_ERROR("libhomescreen","Failed to initialize websocket");
143  }
144  else{
145  HMI_DEBUG("libhomescreen","Initialized");
146  }
147 
148  return ret;
149 }
150 
166  void (*event_cb)(const std::string& event, struct json_object* event_contents),
167  void (*reply_cb)(struct json_object* reply_contents),
168  void (*hangup_cb)(void))
169 {
170  onEvent = event_cb;
171  onReply = reply_cb;
172  onHangup = hangup_cb;
173 }
174 
175 int LibHomeScreen::initialize_websocket()
176 {
177  mploop = NULL;
178  onEvent = nullptr;
179  onReply = nullptr;
180  int ret = sd_event_default(&mploop);
181  if(ret < 0)
182  {
183  HMI_ERROR("libhomescreen","Failed to create event loop");
184  goto END;
185  }
186 
187  /* Initialize interface from websocket */
188  minterface.on_hangup = _on_hangup_static;
189  minterface.on_call = _on_call_static;
190  minterface.on_event = _on_event_static;
191  muri += "ws://localhost:" + to_string(mport) + "/api?token=" + mtoken; /*To be modified*/
192  sp_websock = afb_ws_client_connect_wsj1(mploop, muri.c_str(), &minterface, this);
193  if(sp_websock == NULL)
194  {
195  HMI_ERROR("libhomescreen","Failed to create websocket connection");
196  goto END;
197  }
198 
199  /* creates the evsrc */
200  //ret = sd_event_add_io(mploop,&mevent_src, sp_websock->fd, EPOLLIN, event_callback, NULL);
201 
202  return 0;
203 END:
204  if(mploop)
205  {
206  sd_event_unref(mploop);
207  }
208  return -1;
209 }
210 
222 int LibHomeScreen::tapShortcut(const char* application_id)
223 {
224  struct json_object* obj = json_object_new_object();
225  struct json_object* val = json_object_new_string("normal");
226  json_object_object_add(obj, "area", val);
227 
228  return showWindow(application_id, obj);
229 }
230 
242 int LibHomeScreen::onScreenMessage(const char* display_message)
243 {
244  if(!sp_websock)
245  {
246  return -1;
247  }
248 
249  struct json_object* j_obj = json_object_new_object();
250  struct json_object* val = json_object_new_string(display_message);
251  json_object_object_add(j_obj, "display_message", val);
252  return this->call("on_screen_message", j_obj);
253 }
254 
266 int LibHomeScreen::onScreenReply(const char* reply_message)
267 {
268  if(!sp_websock)
269  {
270  return -1;
271  }
272 
273  struct json_object* j_obj = json_object_new_object();
274  struct json_object* val = json_object_new_string(reply_message);
275  json_object_object_add(j_obj, "reply_message", val);
276  return this->call("on_screen_reply", j_obj);
277 }
278 
296 {
297  if (et >= 1 && et <= 7) {
298  switch (et) {
299 /* case Event_TapShortcut:
300  this->subscribe(LibHomeScreen::event_list[0]);
301  break;*/
302  case Event_ShowWindow:
304  break;
305  case Event_OnScreenMessage:
307  break;
308  case Event_OnScreenReply:
310  break;
311  case Event_HideWindow:
313  break;
314  case Event_ReplyShowWindow:
316  break;
317  case Event_ShowNotification:
319  break;
320  case Event_ShowInformation:
322  break;
323  }
324 
325  this->handlers[et] = std::move(f);
326  }
327 }
328 
343 int LibHomeScreen::call(const string& verb, struct json_object* arg)
344 {
345  int ret;
346  if(!sp_websock)
347  {
348  return -1;
349  }
350  if (!has_verb(verb))
351  {
352  HMI_ERROR("libhomescreen","verb doesn't exit");
353  return -1;
354  }
355  ret = afb_wsj1_call_j(sp_websock, API, verb.c_str(), arg, _on_reply_static, this);
356  if (ret < 0) {
357  HMI_ERROR("libhomescreen","Failed to call verb:%s",verb.c_str());
358  }
359  return ret;
360 }
361 
377 int LibHomeScreen::call(const char* verb, struct json_object* arg)
378 {
379  int ret;
380  if(!sp_websock)
381  {
382  return -1;
383  }
384  if (!has_verb(string(verb)))
385  {
386  HMI_ERROR("libhomescreen","verb doesn't exit");
387  return -1;
388  }
389  ret = afb_wsj1_call_j(sp_websock, API, verb, arg, _on_reply_static, this);
390  if (ret < 0) {
391  HMI_ERROR("libhomescreen","Failed to call verb:%s",verb);
392  }
393  return ret;
394 }
395 
409 int LibHomeScreen::subscribe(const string& event_name)
410 {
411  if(!sp_websock)
412  {
413  return -1;
414  }
415  struct json_object* j_obj = json_object_new_object();
416  json_object_object_add(j_obj, "event", json_object_new_string(event_name.c_str()));
417 
418  int ret = afb_wsj1_call_j(sp_websock, API, "subscribe", j_obj, _on_reply_static, this);
419  if (ret < 0) {
420  HMI_ERROR("libhomescreen","Failed to call verb");
421  }
422  return ret;
423 }
424 
438 int LibHomeScreen::unsubscribe(const string& event_name)
439 {
440  if(!sp_websock)
441  {
442  return -1;
443  }
444  struct json_object* j_obj = json_object_new_object();
445  json_object_object_add(j_obj, "event", json_object_new_string(event_name.c_str()));
446 
447  int ret = afb_wsj1_call_j(sp_websock, API, "unsubscribe", j_obj, _on_reply_static, this);
448  if (ret < 0) {
449  HMI_ERROR("libhomescreen","Failed to call verb");
450  }
451  return ret;
452 }
453 
467 int LibHomeScreen::showWindow(const char* application_id, json_object* json)
468 {
469  if(!sp_websock)
470  {
471  return -1;
472  }
473 
474  struct json_object* j_obj = json_object_new_object();
475  struct json_object* val = json_object_new_string(application_id);
476  json_object_object_add(j_obj, ApplicationId, val);
477 
478  if (json == nullptr) {
479  struct json_object* j_json = json_object_new_object();
480  struct json_object* value = json_object_new_string("normal");
481  json_object_object_add(j_json, "area", value);
482  json_object_object_add(j_obj, "parameter", j_json);
483  }
484  else {
485  json_object_object_add(j_obj, "parameter", json);
486  }
487 
488  return this->call("showWindow", j_obj);
489 }
490 
503 int LibHomeScreen::hideWindow(const char* application_id)
504 {
505  if(!sp_websock)
506  {
507  return -1;
508  }
509 
510  struct json_object* j_obj = json_object_new_object();
511  struct json_object* val = json_object_new_string(application_id);
512  json_object_object_add(j_obj, ApplicationId, val);
513 
514  return this->call("hideWindow", j_obj);
515 }
516 
530 int LibHomeScreen::replyShowWindow(const char* application_id, json_object* json)
531 {
532  if(!sp_websock)
533  {
534  return -1;
535  }
536 
537  if (json == nullptr) {
538  HMI_WARNING("libhomescreen", "replyShowWindow`s parameter is null");
539  return -1;
540  }
541 
542  struct json_object* j_obj = json_object_new_object();
543  struct json_object* val = json_object_new_string(application_id);
544  json_object_object_add(j_obj, ApplicationId, val);
545  json_object_object_add(j_obj, "parameter", json);
546 
547  return this->call("replyShowWindow", j_obj);
548 }
549 
562 int LibHomeScreen::showNotification(json_object* json)
563 {
564  if(!sp_websock)
565  {
566  return -1;
567  }
568 
569  return this->call("showNotification", json);
570 }
571 
584 int LibHomeScreen::showInformation(json_object* json)
585 {
586  if(!sp_websock)
587  {
588  return -1;
589  }
590 
591  return this->call("showInformation", json);
592 }
593 
594 
595 /************* Callback Function *************/
596 
597 void LibHomeScreen::on_hangup(void *closure, struct afb_wsj1 *wsj)
598 {
599  HMI_DEBUG("libhomescreen","called");
600  if(onHangup != nullptr)
601  {
602  onHangup();
603  }
604 }
605 
606 void LibHomeScreen::on_call(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg)
607 {
608 }
609 
610 /*
611 * event is like "homescreen/hvac"
612 * msg is like {"event":"homescreen\/hvac","data":{"type":"tap_shortcut"},"jtype":"afb-event"}
613 * so you can get
614  event name : struct json_object obj = json_object_object_get(msg,"event")
615 */
616 void LibHomeScreen::on_event(void *closure, const char *event, struct afb_wsj1_msg *msg)
617 {
618  HMI_DEBUG("libhomescreen","event: (%s) msg: (%s).", event, afb_wsj1_msg_object_s(msg));
619 
620  if (strstr(event, API) == NULL) {
621  return;
622  }
623 
624  struct json_object* ev_contents = afb_wsj1_msg_object_j(msg);
625  struct json_object *json_data;
626  if(!json_object_object_get_ex(ev_contents, "data", &json_data)) {
627  HMI_ERROR("libhomescreen", "got ev_contents error.");
628  return;
629  }
630 
631  if(onEvent != nullptr)
632  {
633  const string ev(event);
634  onEvent(ev, ev_contents);
635  }
636 
637  const char* event_type = nullptr;
638  struct json_object *json_event_type;
639  if(json_object_object_get_ex(json_data, "type", &json_event_type)) {
640  event_type = json_object_get_string(json_event_type);
641  }
642  else {
643  HMI_WARNING("libhomescreen","event_type is null.");
644  return;
645  }
646 
647  if (strcasecmp(event_type, LibHomeScreen::event_list[0].c_str()) == 0) {
648  auto i = this->handlers.find(Event_ShowWindow);
649  if ( i != this->handlers.end() ) {
650  i->second(json_data);
651  }
652  }
653  else if (strcasecmp(event_type, LibHomeScreen::event_list[1].c_str()) == 0) {
654  auto i = this->handlers.find(Event_OnScreenMessage);
655  if ( i != this->handlers.end() ) {
656  i->second(json_data);
657  }
658  }
659  else if (strcasecmp(event_type, LibHomeScreen::event_list[2].c_str()) == 0) {
660  auto i = this->handlers.find(Event_OnScreenReply);
661  if ( i != this->handlers.end() ) {
662  i->second(json_data);
663  }
664  }
665  else if (strcasecmp(event_type, LibHomeScreen::event_list[3].c_str()) == 0) {
666  auto i = this->handlers.find(Event_HideWindow);
667  if ( i != this->handlers.end() ) {
668  i->second(json_data);
669  }
670  }
671  else if (strcasecmp(event_type, LibHomeScreen::event_list[4].c_str()) == 0) {
672  auto i = this->handlers.find(Event_ReplyShowWindow);
673  if ( i != this->handlers.end() ) {
674  i->second(json_data);
675  }
676  }
677  else if (strcasecmp(event_type, LibHomeScreen::event_list[5].c_str()) == 0) {
678  auto i = this->handlers.find(Event_ShowNotification);
679  if ( i != this->handlers.end() ) {
680  i->second(json_data);
681  }
682  }
683  else if (strcasecmp(event_type, LibHomeScreen::event_list[6].c_str()) == 0) {
684  auto i = this->handlers.find(Event_ShowInformation);
685  if ( i != this->handlers.end() ) {
686  i->second(json_data);
687  }
688  }
689 }
690 
695 void LibHomeScreen::on_reply(void *closure, struct afb_wsj1_msg *msg)
696 {
697  HMI_DEBUG("libhomescreen","msg: (%s)", afb_wsj1_msg_object_s(msg));
698  if(onReply != nullptr)
699  {
700  struct json_object* reply = afb_wsj1_msg_object_j(msg);
701  onReply(reply);
702  }
703 }
704 
705 static bool has_verb(const string& verb)
706 {
707  HMI_DEBUG("libhomescreen","verb is %s", verb.c_str());
708  if(find(LibHomeScreen::api_list.begin(), LibHomeScreen::api_list.end(), verb) != LibHomeScreen::api_list.end())
709  return true;
710  else
711  return false;
712 }
void on_event(void *closure, const char *event, struct afb_wsj1_msg *msg)
+
static void _on_hangup_static(void *closure, struct afb_wsj1 *wsj)
+
void on_reply(void *closure, struct afb_wsj1_msg *msg)
+
static void showWindow(afb_req_t request)
Definition: homescreen.cpp:194
+
int onScreenReply(const char *reply_message)
+
std::function< void(json_object *)> handler_func
+
void on_call(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg)
+
static void subscribe(afb_req_t request)
Definition: homescreen.cpp:140
+
int tapShortcut(const char *application_id)
-
static void _on_call_static(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg)
-
static const char API[]
+
static void _on_call_static(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg)
+
static const char API[]
+
int hideWindow(const char *application_id)
+
int showWindow(const char *application_id, json_object *json)
+
static const char ApplicationId[]
+
int replyShowWindow(const char *application_id, json_object *json)
+
string token
Definition: simple-egl.cpp:61
int call(const std::string &verb, struct json_object *arg)
-
static void * event_loop_run(void *args)
-
void on_hangup(void *closure, struct afb_wsj1 *wsj)
-
int tapShortcut(const char *application_name)
-
int subscribe(const std::string &event_name)
- - -
static const std::vector< std::string > event_list
-
static void subscribe(struct afb_req request)
Definition: homescreen.c:189
- -
int init(const int port, const std::string &token)
-
static bool has_verb(const string &verb)
-
static void _on_event_static(void *closure, const char *event, struct afb_wsj1_msg *msg)
-
int onScreenMessage(const char *display_message)
- - -
static const std::vector< std::string > api_list
-
int unsubscribe(const std::string &event_name)
-
void set_event_handler(enum EventType et, handler_func f)
-
void registerCallback(void(*event_cb)(const std::string &event, struct json_object *event_contents), void(*reply_cb)(struct json_object *reply_contents), void(*hangup_cb)(void)=nullptr)
-
static void _on_reply_static(void *closure, struct afb_wsj1_msg *msg)
+
int showInformation(json_object *json)
+
void on_hangup(void *closure, struct afb_wsj1 *wsj)
+
int subscribe(const std::string &event_name)
+
#define HMI_WARNING(prefix, args,...)
Definition: hmi-debug.h:39
+ + +
long port
Definition: simple-egl.cpp:60
+
static const std::vector< std::string > event_list
+
int init(const int port, const std::string &token)
+
static bool has_verb(const string &verb)
+
static void _on_event_static(void *closure, const char *event, struct afb_wsj1_msg *msg)
+
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:38
+
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:42
+
int onScreenMessage(const char *display_message)
+ + +
static const std::vector< std::string > api_list
+
int unsubscribe(const std::string &event_name)
+
void set_event_handler(enum EventType et, handler_func f)
+
void registerCallback(void(*event_cb)(const std::string &event, struct json_object *event_contents), void(*reply_cb)(struct json_object *reply_contents), void(*hangup_cb)(void)=nullptr)
+
int showNotification(json_object *json)
+
static void _on_reply_static(void *closure, struct afb_wsj1_msg *msg)
diff --git a/doc/api-ref/html/d2/d66/include_2hmi-debug_8h.html b/doc/api-ref/html/d2/d66/include_2hmi-debug_8h.html new file mode 100644 index 0000000..10e01be --- /dev/null +++ b/doc/api-ref/html/d2/d66/include_2hmi-debug_8h.html @@ -0,0 +1,490 @@ + + + + + + +HomeScreenBinding: include/hmi-debug.h File Reference + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ + +
+
+ +
+
hmi-debug.h File Reference
+
+
+
#include <time.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + + +

+Macros

#define __FILENAME__   (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
 
#define HMI_ERROR(prefix, args, ...)   _HMI_LOG(LOG_LEVEL_ERROR, __FILENAME__, __FUNCTION__, __LINE__, prefix, args, ##__VA_ARGS__)
 
#define HMI_WARNING(prefix, args, ...)   _HMI_LOG(LOG_LEVEL_WARNING, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
 
#define HMI_NOTICE(prefix, args, ...)   _HMI_LOG(LOG_LEVEL_NOTICE, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
 
#define HMI_INFO(prefix, args, ...)   _HMI_LOG(LOG_LEVEL_INFO, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
 
#define HMI_DEBUG(prefix, args, ...)   _HMI_LOG(LOG_LEVEL_DEBUG, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
 
+ + + +

+Enumerations

enum  LOG_LEVEL {
+  LOG_LEVEL_NONE = 0, +LOG_LEVEL_ERROR, +LOG_LEVEL_WARNING, +LOG_LEVEL_NOTICE, +
+  LOG_LEVEL_INFO, +LOG_LEVEL_DEBUG, +LOG_LEVEL_MAX = LOG_LEVEL_DEBUG, +LOG_LEVEL_NONE = 0, +
+  LOG_LEVEL_ERROR, +LOG_LEVEL_WARNING, +LOG_LEVEL_NOTICE, +LOG_LEVEL_INFO, +
+  LOG_LEVEL_DEBUG, +LOG_LEVEL_MAX = LOG_LEVEL_DEBUG +
+ }
 
+ + + +

+Functions

static void _HMI_LOG (enum LOG_LEVEL level, const char *file, const char *func, const int line, const char *prefix, const char *log,...)
 
+ + + +

+Variables

static char ERROR_FLAG [6][20] = {"NONE", "ERROR", "WARNING", "NOTICE", "INFO", "DEBUG"}
 
+

Macro Definition Documentation

+ +
+
+ + + + +
#define __FILENAME__   (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
+
+ +

Definition at line 36 of file hmi-debug.h.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
#define HMI_DEBUG( prefix,
 args,
 ... 
)   _HMI_LOG(LOG_LEVEL_DEBUG, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
+
+ +

Definition at line 42 of file hmi-debug.h.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
#define HMI_ERROR( prefix,
 args,
 ... 
)   _HMI_LOG(LOG_LEVEL_ERROR, __FILENAME__, __FUNCTION__, __LINE__, prefix, args, ##__VA_ARGS__)
+
+ +

Definition at line 38 of file hmi-debug.h.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
#define HMI_INFO( prefix,
 args,
 ... 
)   _HMI_LOG(LOG_LEVEL_INFO, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
+
+ +

Definition at line 41 of file hmi-debug.h.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
#define HMI_NOTICE( prefix,
 args,
 ... 
)   _HMI_LOG(LOG_LEVEL_NOTICE, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
+
+ +

Definition at line 40 of file hmi-debug.h.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
#define HMI_WARNING( prefix,
 args,
 ... 
)   _HMI_LOG(LOG_LEVEL_WARNING, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
+
+ +

Definition at line 39 of file hmi-debug.h.

+ +
+
+

Enumeration Type Documentation

+ +
+
+ + + + +
enum LOG_LEVEL
+
+ + + + + + + + + + + + + + + +
Enumerator
LOG_LEVEL_NONE  +
LOG_LEVEL_ERROR  +
LOG_LEVEL_WARNING  +
LOG_LEVEL_NOTICE  +
LOG_LEVEL_INFO  +
LOG_LEVEL_DEBUG  +
LOG_LEVEL_MAX  +
LOG_LEVEL_NONE  +
LOG_LEVEL_ERROR  +
LOG_LEVEL_WARNING  +
LOG_LEVEL_NOTICE  +
LOG_LEVEL_INFO  +
LOG_LEVEL_DEBUG  +
LOG_LEVEL_MAX  +
+ +

Definition at line 26 of file hmi-debug.h.

+ +
+
+

Function Documentation

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static void _HMI_LOG (enum LOG_LEVEL level,
const char * file,
const char * func,
const int line,
const char * prefix,
const char * log,
 ... 
)
+
+static
+
+ +

Definition at line 46 of file hmi-debug.h.

+
47 {
48  const int log_level = (getenv("USE_HMI_DEBUG") == NULL)?LOG_LEVEL_ERROR:atoi(getenv("USE_HMI_DEBUG"));
49  if(log_level < level)
50  {
51  return;
52  }
53 
54  char *message;
55  struct timespec tp;
56  unsigned int time;
57 
58  clock_gettime(CLOCK_REALTIME, &tp);
59  time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
60 
61  va_list args;
62  va_start(args, log);
63  if (log == NULL || vasprintf(&message, log, args) < 0)
64  message = NULL;
65  fprintf(stderr, "[%10.3f] [%s %s] [%s, %s(), Line:%d] >>> %s \n", time / 1000.0, prefix, ERROR_FLAG[level], file, func, line, message);
66  va_end(args);
67  free(message);
68 }
+
static char ERROR_FLAG[6][20]
Definition: hmi-debug.h:44
+
+
+
+

Variable Documentation

+ +
+
+ + + + + +
+ + + + +
char ERROR_FLAG[6][20] = {"NONE", "ERROR", "WARNING", "NOTICE", "INFO", "DEBUG"}
+
+static
+
+ +

Definition at line 44 of file hmi-debug.h.

+ +
+
+
+ + + + diff --git a/doc/api-ref/html/d2/d66/include_2hmi-debug_8h_source.html b/doc/api-ref/html/d2/d66/include_2hmi-debug_8h_source.html new file mode 100644 index 0000000..54a369f --- /dev/null +++ b/doc/api-ref/html/d2/d66/include_2hmi-debug_8h_source.html @@ -0,0 +1,109 @@ + + + + + + +HomeScreenBinding: include/hmi-debug.h Source File + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ + +
+
+
+
hmi-debug.h
+
+
+Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __HMI_DEBUG_H__
18 #define __HMI_DEBUG_H__
19 
20 #include <time.h>
21 #include <stdio.h>
22 #include <stdarg.h>
23 #include <string.h>
24 #include <stdlib.h>
25 
26 enum LOG_LEVEL{
34 };
35 
36 #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
37 
38 #define HMI_ERROR(prefix, args,...) _HMI_LOG(LOG_LEVEL_ERROR, __FILENAME__, __FUNCTION__, __LINE__, prefix, args, ##__VA_ARGS__)
39 #define HMI_WARNING(prefix, args,...) _HMI_LOG(LOG_LEVEL_WARNING, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
40 #define HMI_NOTICE(prefix, args,...) _HMI_LOG(LOG_LEVEL_NOTICE, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
41 #define HMI_INFO(prefix, args,...) _HMI_LOG(LOG_LEVEL_INFO, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
42 #define HMI_DEBUG(prefix, args,...) _HMI_LOG(LOG_LEVEL_DEBUG, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
43 
44 static char ERROR_FLAG[6][20] = {"NONE", "ERROR", "WARNING", "NOTICE", "INFO", "DEBUG"};
45 
46 static void _HMI_LOG(enum LOG_LEVEL level, const char* file, const char* func, const int line, const char* prefix, const char* log, ...)
47 {
48  const int log_level = (getenv("USE_HMI_DEBUG") == NULL)?LOG_LEVEL_ERROR:atoi(getenv("USE_HMI_DEBUG"));
49  if(log_level < level)
50  {
51  return;
52  }
53 
54  char *message;
55  struct timespec tp;
56  unsigned int time;
57 
58  clock_gettime(CLOCK_REALTIME, &tp);
59  time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
60 
61  va_list args;
62  va_start(args, log);
63  if (log == NULL || vasprintf(&message, log, args) < 0)
64  message = NULL;
65  fprintf(stderr, "[%10.3f] [%s %s] [%s, %s(), Line:%d] >>> %s \n", time / 1000.0, prefix, ERROR_FLAG[level], file, func, line, message);
66  va_end(args);
67  free(message);
68 }
69 
70 #endif //__HMI_DEBUG_H__
+
LOG_LEVEL
Definition: hmi-debug.h:26
+
static void _HMI_LOG(enum LOG_LEVEL level, const char *file, const char *func, const int line, const char *prefix, const char *log,...)
Definition: hmi-debug.h:46
+ + + + + +
static char ERROR_FLAG[6][20]
Definition: hmi-debug.h:44
+ +
+ + + + diff --git a/doc/api-ref/html/d2/d8e/class_h_s___client_manager.html b/doc/api-ref/html/d2/d8e/class_h_s___client_manager.html new file mode 100644 index 0000000..da86b35 --- /dev/null +++ b/doc/api-ref/html/d2/d8e/class_h_s___client_manager.html @@ -0,0 +1,670 @@ + + + + + + +HomeScreenBinding: HS_ClientManager Class Reference + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ +
+
+ +
+
HS_ClientManager Class Reference
+
+
+ +

#include <hs-clientmanager.h>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 HS_ClientManager ()
 
 ~HS_ClientManager ()=default
 
 HS_ClientManager (HS_ClientManager const &)=delete
 
HS_ClientManageroperator= (HS_ClientManager const &)=delete
 
 HS_ClientManager (HS_ClientManager &&)=delete
 
HS_ClientManageroperator= (HS_ClientManager &&)=delete
 
int init (void)
 
void removeClientCtxt (void *data)
 
int tap_shortcut (afb_req_t request)
 
int showWindow (afb_req_t request)
 
int hideWindow (afb_req_t request)
 
int replyShowWindow (afb_req_t request)
 
int on_screen_message (afb_req_t request)
 
int on_screen_reply (afb_req_t request)
 
int subscribe (afb_req_t request)
 
int unsubscribe (afb_req_t request)
 
int showNotification (afb_req_t request)
 
int showInformation (afb_req_t request)
 
+ + + +

+Static Public Member Functions

static HS_ClientManagerinstance (void)
 
+

Detailed Description

+
+

Definition at line 37 of file hs-clientmanager.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
HS_ClientManager::HS_ClientManager ()
+
+

HS_ClientManager construction function

+

Parameters

+
    +
  • Nothing
  • +
+

Return

+

None

+ +

Definition at line 39 of file hs-clientmanager.cpp.

+
40 {
41 }
+
+
+ +
+
+ + + + + +
+ + + + + + + +
HS_ClientManager::~HS_ClientManager ()
+
+default
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
HS_ClientManager::HS_ClientManager (HS_ClientManager const & )
+
+delete
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
HS_ClientManager::HS_ClientManager (HS_ClientManager && )
+
+delete
+
+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
int HS_ClientManager::hideWindow (afb_req_t request)
+
+

hideWindow event

+

Parameters

+
    +
  • request : the request
  • +
+

Return

+

0 : success others : fail

+ +

Definition at line 356 of file hs-clientmanager.cpp.

+
357 {
358  int ret = 0;
359  const char* value = afb_req_value(request, _application_id);
360  if (value) {
361  HMI_NOTICE("homescreen-service","request params = %s.", value);
362  std::lock_guard<std::mutex> lock(this->mtx);
363  auto ip = client_list.find(std::string(value));
364  if(ip != client_list.end()) {
365  ret = ip->second->hideWindow(request);
366  }
367  }
368  else {
369  HMI_NOTICE("homescreen-service","Please input application_id");
370  ret = AFB_EVENT_BAD_REQUEST;
371  }
372  return ret;
373 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
const char _application_id[]
Definition: homescreen.cpp:28
+
#define AFB_EVENT_BAD_REQUEST
Definition: hs-helper.h:23
+
+
+
+ +
+
+ + + + + + + + +
int HS_ClientManager::init (void )
+
+

HS_ClientManager init function

+

Parameters

+
    +
  • Nothing
  • +
+

Return

+

init result

+ +

Definition at line 71 of file hs-clientmanager.cpp.

+
72 {
73  HMI_NOTICE("homescreen-service","called.");
74 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + +
HS_ClientManager * HS_ClientManager::instance (void )
+
+static
+
+

get instance

+

Parameters

+
    +
  • Nothing
  • +
+

Return

+

HS_ClientManager instance pointer

+ +

Definition at line 53 of file hs-clientmanager.cpp.

+
54 {
55  if(me == nullptr)
56  me = new HS_ClientManager();
57 
58  return me;
59 }
+
+
+
+ +
+
+ + + + + + + + +
int HS_ClientManager::on_screen_message (afb_req_t request)
+
+

on_screen_message

+

Parameters

+
    +
  • request: the request to bindings
  • +
+

Return

+

result

+ +

Definition at line 195 of file hs-clientmanager.cpp.

+
196 {
197  int ret = 0;
198  const char* value = afb_req_value(request, _display_message);
199  if (value) {
200  HMI_NOTICE("homescreen-service","request params = %s.", value);
201  std::lock_guard<std::mutex> lock(this->mtx);
202  for(auto m : client_list) {
203  m.second->on_screen_message(request, value);
204  }
205  }
206  else {
207  HMI_NOTICE("homescreen-service","Please input display_message");
208  ret = AFB_EVENT_BAD_REQUEST;
209  }
210  return ret;
211 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
const char _display_message[]
Definition: homescreen.cpp:29
+
#define AFB_EVENT_BAD_REQUEST
Definition: hs-helper.h:23
+
+
+
+ +
+
+ + + + + + + + +
int HS_ClientManager::on_screen_reply (afb_req_t request)
+
+

on_screen_reply

+

Parameters

+
    +
  • request: the request to bindings
  • +
+

Return

+

result

+ +

Definition at line 223 of file hs-clientmanager.cpp.

+
224 {
225  int ret = 0;
226  const char* value = afb_req_value(request, _reply_message);
227  if (value) {
228  HMI_NOTICE("homescreen-service","request params = %s.", value);
229  std::lock_guard<std::mutex> lock(this->mtx);
230  for(auto m : client_list) {
231  m.second->on_screen_reply(request, value);
232  }
233  }
234  else {
235  HMI_NOTICE("homescreen-service","Please input reply_message");
236  ret = AFB_EVENT_BAD_REQUEST;
237  }
238  return ret;
239 }
const char _reply_message[]
Definition: homescreen.cpp:30
+
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
#define AFB_EVENT_BAD_REQUEST
Definition: hs-helper.h:23
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + +
HS_ClientManager& HS_ClientManager::operator= (HS_ClientManager const & )
+
+delete
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
HS_ClientManager& HS_ClientManager::operator= (HS_ClientManager && )
+
+delete
+
+ +
+
+ +
+
+ + + + + + + + +
void HS_ClientManager::removeClientCtxt (void * data)
+
+

remove Client from list

+

Parameters

+ +

Return

+

None

+ +

Definition at line 140 of file hs-clientmanager.cpp.

+
141 {
142  HS_ClientCtxt *ctxt = (HS_ClientCtxt *)data;
143  if(ctxt == nullptr)
144  {
145  HMI_ERROR("homescreen-service", "data is nullptr");
146  return;
147  }
148 
149  HMI_NOTICE("homescreen-service", "remove app %s", ctxt->id.c_str());
150  std::lock_guard<std::mutex> lock(this->mtx);
151  removeClient(ctxt->id);
152  delete appid2ctxt[ctxt->id];
153  appid2ctxt.erase(ctxt->id);
154 }
+
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
std::string id
+
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:38
+
+
+
+ +
+
+ + + + + + + + +
int HS_ClientManager::replyShowWindow (afb_req_t request)
+
+

replyShowWindow event

+

Parameters

+
    +
  • request : the request
  • +
+

Return

+

0 : success others : fail

+ +

Definition at line 386 of file hs-clientmanager.cpp.

+
387 {
388  int ret = 0;
389  const char* value = afb_req_value(request, _application_id);
390  if (value) {
391  HMI_NOTICE("homescreen-service","request params = %s.", value);
392  std::lock_guard<std::mutex> lock(this->mtx);
393  auto ip = client_list.find(std::string(value));
394  if(ip != client_list.end()) {
395  ret = ip->second->replyShowWindow(request, value);
396  }
397  }
398  else {
399  HMI_NOTICE("homescreen-service","Please input application_id");
400  ret = AFB_EVENT_BAD_REQUEST;
401  }
402  return ret;
403 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
const char _application_id[]
Definition: homescreen.cpp:28
+
#define AFB_EVENT_BAD_REQUEST
Definition: hs-helper.h:23
+
+
+
+ +
+
+ + + + + + + + +
int HS_ClientManager::showInformation (afb_req_t request)
+
+

showInformation event

+

Parameters

+
    +
  • request : the request
  • +
+

Return

+

0 : success others : fail

+ +

Definition at line 443 of file hs-clientmanager.cpp.

+
444 {
445  int ret = 0;
446  std::lock_guard<std::mutex> lock(this->mtx);
447  auto ip = client_list.find(_homescreen);
448  if(ip != client_list.end()) {
449  ret = ip->second->showInformation(request);
450  }
451  else {
452  HMI_NOTICE("homescreen-service","not exist sessiion with homescreen");
454  }
455 
456  return ret;
457 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
static const char _homescreen[]
+
#define AFB_REQ_SHOWINFORMATION_ERROR
Definition: hs-helper.h:27
+
+
+
+ +
+
+ + + + + + + + +
int HS_ClientManager::showNotification (afb_req_t request)
+
+

showNotification event

+

Parameters

+
    +
  • request : the request
  • +
+

Return

+

0 : success others : fail

+ +

Definition at line 416 of file hs-clientmanager.cpp.

+
417 {
418  int ret = 0;
419  std::lock_guard<std::mutex> lock(this->mtx);
420  auto ip = client_list.find(_homescreen);
421  if(ip != client_list.end()) {
422  ret = ip->second->showNotification(request);
423  }
424  else {
425  HMI_NOTICE("homescreen-service","not exist sessiion with homescreen");
427  }
428 
429  return ret;
430 }
#define AFB_REQ_SHOWNOTIFICATION_ERROR
Definition: hs-helper.h:26
+
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
static const char _homescreen[]
+
+
+
+ +
+
+ + + + + + + + +
int HS_ClientManager::showWindow (afb_req_t request)
+
+

showWindow event

+

Parameters

+
    +
  • request : the request
  • +
+

Return

+

0 : success others : fail

+ +

Definition at line 326 of file hs-clientmanager.cpp.

+
327 {
328  int ret = 0;
329  const char* value = afb_req_value(request, _application_id);
330  if (value) {
331  HMI_NOTICE("homescreen-service","request params = %s.", value);
332  std::lock_guard<std::mutex> lock(this->mtx);
333  auto ip = client_list.find(std::string(value));
334  if(ip != client_list.end()) {
335  ret = ip->second->showWindow(request, value);
336  }
337  }
338  else {
339  HMI_NOTICE("homescreen-service","Please input application_id");
340  ret = AFB_EVENT_BAD_REQUEST;
341  }
342  return ret;
343 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
const char _application_id[]
Definition: homescreen.cpp:28
+
#define AFB_EVENT_BAD_REQUEST
Definition: hs-helper.h:23
+
+
+
+ +
+
+ + + + + + + + +
int HS_ClientManager::subscribe (afb_req_t request)
+
+

subscribe

+

Parameters

+
    +
  • request: the request to bindings
  • +
+

Return

+

result

+ +

Definition at line 251 of file hs-clientmanager.cpp.

+
252 {
253  int ret = 0;
254  const char *value = afb_req_value(request, "event");
255  HMI_NOTICE("homescreen-service","value is %s", value);
256  if(value) {
257  std::string appid(afb_req_get_application_id(request));
258  std::lock_guard<std::mutex> lock(this->mtx);
259 
260  HS_Client* client = nullptr;
261  auto ip = client_list.find(appid);
262  if(ip != client_list.end()) {
263  client = client_list[appid];
264  }
265  else {
266  appid2ctxt[appid] = createClientCtxt(request, appid);
267  client = addClient(request, appid);
268  }
269 
270  if(client->subscribe(request, value) != 0) {
271  HMI_NOTICE("homescreen-service","subscribe failed");
273  }
274  }
275  else {
276  HMI_NOTICE("homescreen-service","Please input event name");
277  ret = AFB_EVENT_BAD_REQUEST;
278  }
279  return ret;
280 }
int subscribe(afb_req_t request, const char *event)
Definition: hs-client.cpp:139
+ +
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
#define AFB_EVENT_BAD_REQUEST
Definition: hs-helper.h:23
+
#define AFB_REQ_SUBSCRIBE_ERROR
Definition: hs-helper.h:24
+
+
+
+ +
+
+ + + + + + + + +
int HS_ClientManager::tap_shortcut (afb_req_t request)
+
+

tap_shortcut

+

Parameters

+
    +
  • request: the request to bindings
  • +
+

Return

+

result

+ +

Definition at line 166 of file hs-clientmanager.cpp.

+
167 {
168  int ret = 0;
169  const char* value = afb_req_value(request, _application_id);
170  if (value) {
171  HMI_NOTICE("homescreen-service","request params = %s.", value);
172  std::lock_guard<std::mutex> lock(this->mtx);
173  auto ip = client_list.find(std::string(value));
174  if(ip != client_list.end()) {
175  ip->second->tap_shortcut(value);
176  }
177  }
178  else {
179  HMI_NOTICE("homescreen-service","Please input application_id");
180  ret = AFB_EVENT_BAD_REQUEST;
181  }
182  return ret;
183 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
const char _application_id[]
Definition: homescreen.cpp:28
+
#define AFB_EVENT_BAD_REQUEST
Definition: hs-helper.h:23
+
+
+
+ +
+
+ + + + + + + + +
int HS_ClientManager::unsubscribe (afb_req_t request)
+
+

unsubscribe

+

Parameters

+
    +
  • request: the request to bindings
  • +
+

Return

+

result

+ +

Definition at line 292 of file hs-clientmanager.cpp.

+
293 {
294  const char *value = afb_req_value(request, "event");
295  HMI_NOTICE("homescreen-service","value is %s", value);
296  int ret = 0;
297  if(value) {
298  std::string appid(afb_req_get_application_id(request));
299  std::lock_guard<std::mutex> lock(this->mtx);
300 
301  auto ip = client_list.find(appid);
302  if(ip != client_list.end()
303  && ip->second->unsubscribe(request, value) != 0) {
304  HMI_NOTICE("homescreen-service","unsubscribe failed");
306  }
307  }
308  else {
309  HMI_NOTICE("homescreen-service","Please input event name");
310  ret = AFB_EVENT_BAD_REQUEST;
311  }
312  return ret;
313 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
#define AFB_REQ_UNSUBSCRIBE_ERROR
Definition: hs-helper.h:25
+
#define AFB_EVENT_BAD_REQUEST
Definition: hs-helper.h:23
+
+
+
+
The documentation for this class was generated from the following files: +
+ + + + diff --git a/doc/api-ref/html/d3/d3d/hs-helper_8h.html b/doc/api-ref/html/d3/d3d/hs-helper_8h.html index 5ee78fe..edf1de4 100644 --- a/doc/api-ref/html/d3/d3d/hs-helper_8h.html +++ b/doc/api-ref/html/d3/d3d/hs-helper_8h.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: src/hs-helper.h File Reference @@ -12,6 +11,9 @@ + @@ -29,19 +31,39 @@
- + - - - - + +
#include <afb/afb-binding.h>
-#include <stdint.h>
-#include <glib.h>
-#include <errno.h>
-#include "hmi-debug.h"
+#include <json-c/json.h>

Go to the source code of this file.

- + + + + + + + + + + +

Macros

#define AFB_BINDING_VERSION   2
#define AFB_BINDING_VERSION   3
 
#define AFB_EVENT_BAD_REQUEST   100
 
#define AFB_REQ_SUBSCRIBE_ERROR   101
 
#define AFB_REQ_UNSUBSCRIBE_ERROR   102
 
#define AFB_REQ_SHOWNOTIFICATION_ERROR   103
 
#define AFB_REQ_SHOWINFORMATION_ERROR   104
 
@@ -101,12 +130,12 @@ Enumerations

Typedefs

- - - - - - + + + + + + @@ -118,30 +147,104 @@ Functions

Functions

REQ_ERROR get_value_uint16 (const struct afb_req request, const char *source, uint16_t *out_id)
 
REQ_ERROR get_value_int16 (const struct afb_req request, const char *source, int16_t *out_id)
 
REQ_ERROR get_value_int32 (const struct afb_req request, const char *source, int32_t *out_id)
 
REQ_ERROR get_value_uint16 (const afb_req_t request, const char *source, uint16_t *out_id)
 
REQ_ERROR get_value_int16 (const afb_req_t request, const char *source, int16_t *out_id)
 
REQ_ERROR get_value_int32 (const afb_req_t request, const char *source, int32_t *out_id)
 
void hs_add_object_to_json_object (struct json_object *j_obj, int count,...)
 
void hs_add_object_to_json_object_str (struct json_object *j_obj, int count,...)
- + + + + + + + + +

Variables

static const char * evlist []
const char * evlist []
 
const char _error []
 
const char _application_id []
 
const char _display_message []
 
const char _reply_message []
 

Macro Definition Documentation

- -

◆ AFB_BINDING_VERSION

+ +
+
+ + + + +
#define AFB_BINDING_VERSION   3
+
+ +

Definition at line 19 of file hs-helper.h.

+
+
+
- +
#define AFB_BINDING_VERSION   2#define AFB_EVENT_BAD_REQUEST   100
-

Definition at line 19 of file hs-helper.h.

+

Definition at line 23 of file hs-helper.h.

-

Typedef Documentation

- -

◆ REQ_ERROR

+ +
+
+ + + + +
#define AFB_REQ_SHOWINFORMATION_ERROR   104
+
+ +

Definition at line 27 of file hs-helper.h.

+ +
+
+ +
+
+ + + + +
#define AFB_REQ_SHOWNOTIFICATION_ERROR   103
+
+

Definition at line 26 of file hs-helper.h.

+ +
+
+ +
+
+ + + + +
#define AFB_REQ_SUBSCRIBE_ERROR   101
+
+ +

Definition at line 24 of file hs-helper.h.

+ +
+
+ +
+
+ + + + +
#define AFB_REQ_UNSUBSCRIBE_ERROR   102
+
+ +

Definition at line 25 of file hs-helper.h.

+ +
+
+

Typedef Documentation

+
@@ -154,9 +257,7 @@ Variables

Enumeration Type Documentation

- -

◆ REQ_ERROR

- +
@@ -166,32 +267,34 @@ Variables
- - - - + + + +
Enumerator
REQ_FAIL 
REQ_OK 
NOT_NUMBER 
OUT_RANGE 
Enumerator
REQ_FAIL  +
REQ_OK  +
NOT_NUMBER  +
OUT_RANGE  +
-

Definition at line 26 of file hs-helper.h.

-
27 {
28  REQ_FAIL = -1,
29  REQ_OK=0,
30  NOT_NUMBER,
31  OUT_RANGE
32 }REQ_ERROR;
- - - -
REQ_ERROR
Definition: hs-helper.h:26
+

Definition at line 29 of file hs-helper.h.

+
30 {
31  REQ_FAIL = -1,
32  REQ_OK=0,
33  NOT_NUMBER,
34  OUT_RANGE
35 }REQ_ERROR;
+ + + +
REQ_ERROR
Definition: hs-helper.h:29

Function Documentation

- -

◆ get_value_int16()

- +
- + @@ -213,25 +316,32 @@ Variables
REQ_ERROR get_value_int16 (const struct afb_req const afb_req_t  request,
+

get int16 value from source

+

Parameters

+
    +
  • request : Describes the request by bindings from afb-daemon
  • +
  • source : input source
  • +
  • out_id : output int16 value
  • +
+

Return

+

error code

-

Definition at line 48 of file hs-helper.c.

-
49 {
50  char* endptr;
51  const char* tmp = afb_req_value (request, source);
52  if(!tmp)
53  {
54  return REQ_FAIL;
55  }
56  long tmp_id = strtol(tmp,&endptr,10);
57 
58  /* error check of range */
59  if( (tmp_id > INT16_MAX) || (tmp_id < INT16_MIN) )
60  {
61  return OUT_RANGE;
62  }
63  if(*endptr != '\0')
64  {
65  return NOT_NUMBER;
66  }
67 
68  *out_id = (int16_t)tmp_id;
69  return REQ_OK;
70 }
- - - +

Definition at line 82 of file hs-helper.cpp.

+
83 {
84  char* endptr;
85  const char* tmp = afb_req_value (request, source);
86  if(!tmp)
87  {
88  return REQ_FAIL;
89  }
90  long tmp_id = strtol(tmp,&endptr,10);
91 
92  /* error check of range */
93  if( (tmp_id > INT16_MAX) || (tmp_id < INT16_MIN) )
94  {
95  return OUT_RANGE;
96  }
97  if(*endptr != '\0')
98  {
99  return NOT_NUMBER;
100  }
101 
102  *out_id = (int16_t)tmp_id;
103  return REQ_OK;
104 }
+ + +
- -

◆ get_value_int32()

- +
- + @@ -253,25 +363,32 @@ Variables
REQ_ERROR get_value_int32 (const struct afb_req const afb_req_t  request,
+

get int32 value from source

+

Parameters

+
    +
  • request : Describes the request by bindings from afb-daemon
  • +
  • source : input source
  • +
  • out_id : output int32 value
  • +
+

Return

+

error code

-

Definition at line 72 of file hs-helper.c.

-
73 {
74  char* endptr;
75  const char* tmp = afb_req_value (request, source);
76  if(!tmp)
77  {
78  return REQ_FAIL;
79  }
80  long tmp_id = strtol(tmp,&endptr,10);
81 
82  /* error check of range */
83  if( (tmp_id > INT32_MAX) || (tmp_id < INT32_MIN) )
84  {
85  return OUT_RANGE;
86  }
87  if(*endptr != '\0')
88  {
89  return NOT_NUMBER;
90  }
91 
92  *out_id = (int32_t)tmp_id;
93  return REQ_OK;
94 }
- - - +

Definition at line 118 of file hs-helper.cpp.

+
119 {
120  char* endptr;
121  const char* tmp = afb_req_value (request, source);
122  if(!tmp)
123  {
124  return REQ_FAIL;
125  }
126  long tmp_id = strtol(tmp,&endptr,10);
127 
128  /* error check of range */
129  if( (tmp_id > INT32_MAX) || (tmp_id < INT32_MIN) )
130  {
131  return OUT_RANGE;
132  }
133  if(*endptr != '\0')
134  {
135  return NOT_NUMBER;
136  }
137 
138  *out_id = (int32_t)tmp_id;
139  return REQ_OK;
140 }
+ + +
- -

◆ get_value_uint16()

- +
- + @@ -293,18 +410,25 @@ Variables
REQ_ERROR get_value_uint16 (const struct afb_req const afb_req_t  request,
+

get uint16 value from source

+

Parameters

+
    +
  • request : Describes the request by bindings from afb-daemon
  • +
  • source : input source
  • +
  • out_id : output uint16 value
  • +
+

Return

+

error code

-

Definition at line 24 of file hs-helper.c.

-
25 {
26  char* endptr;
27  const char* tmp = afb_req_value (request, source);
28  if(!tmp)
29  {
30  return REQ_FAIL;
31  }
32  long tmp_id = strtol(tmp,&endptr,10);
33 
34  /* error check of range */
35  if( (tmp_id > UINT16_MAX) || (tmp_id < 0) )
36  {
37  return OUT_RANGE;
38  }
39  if(*endptr != '\0')
40  {
41  return NOT_NUMBER;
42  }
43 
44  *out_id = (uint16_t)tmp_id;
45  return REQ_OK;
46 }
- - - +

Definition at line 46 of file hs-helper.cpp.

+
47 {
48  char* endptr;
49  const char* tmp = afb_req_value (request, source);
50  if(!tmp)
51  {
52  return REQ_FAIL;
53  }
54  long tmp_id = strtol(tmp,&endptr,10);
55 
56  /* error check of range */
57  if( (tmp_id > UINT16_MAX) || (tmp_id < 0) )
58  {
59  return OUT_RANGE;
60  }
61  if(*endptr != '\0')
62  {
63  return NOT_NUMBER;
64  }
65 
66  *out_id = (uint16_t)tmp_id;
67  return REQ_OK;
68 }
+ + +
- -

◆ hs_add_object_to_json_object()

- +
@@ -333,14 +457,21 @@ Variables
+

add int object to json object

+

Parameters

+
    +
  • j_obj : the json object will join in int json object
  • +
  • count : input parameter number
  • +
  • ... : parameter list
  • +
+

Return

+

None

-

Definition at line 96 of file hs-helper.c.

-
97 {
98  va_list args;
99  va_start(args, count);
100  for(int i = 0; i < count; ++i )
101  {
102  char *key = va_arg(args, char*);
103  int value = va_arg(args, int);
104  json_object_object_add(j_obj, key, json_object_new_int((int32_t)value));
105  ++i;
106  }
107  va_end(args);
108 }
+

Definition at line 154 of file hs-helper.cpp.

+
155 {
156  va_list args;
157  va_start(args, count);
158  for(int i = 0; i < count; ++i )
159  {
160  char *key = va_arg(args, char*);
161  int value = va_arg(args, int);
162  json_object_object_add(j_obj, key, json_object_new_int((int32_t)value));
163  ++i;
164  }
165  va_end(args);
166 }
- -

◆ hs_add_object_to_json_object_func()

- +
@@ -375,14 +506,22 @@ Variables
+

add new json object to json object

+

Parameters

+
    +
  • j_obj : the json object will join in new json object
  • +
  • verb_name : new json object's verb value
  • +
  • count : input parameter number
  • +
  • ... : parameter list
  • +
+

Return

+

None

-

Definition at line 125 of file hs-helper.c.

-
126 {
127  va_list args;
128  va_start(args, count);
129 
130  json_object_object_add(j_obj,"verb", json_object_new_string(verb_name));
131 
132  for(int i = 0; i < count; ++i )
133  {
134  char *key = va_arg(args, char*);
135  int value = va_arg(args, int);
136  json_object_object_add(j_obj, key, json_object_new_int((int32_t)value));
137  ++i;
138  }
139  va_end(args);
140 }
+

Definition at line 207 of file hs-helper.cpp.

+
208 {
209  va_list args;
210  va_start(args, count);
211 
212  json_object_object_add(j_obj,"verb", json_object_new_string(verb_name));
213 
214  for(int i = 0; i < count; ++i )
215  {
216  char *key = va_arg(args, char*);
217  int value = va_arg(args, int);
218  json_object_object_add(j_obj, key, json_object_new_int((int32_t)value));
219  ++i;
220  }
221  va_end(args);
222 }
- -

◆ hs_add_object_to_json_object_str()

- +
@@ -411,14 +550,21 @@ Variables
+

add string object to json object

+

Parameters

+
    +
  • j_obj : the json object will join in string json object
  • +
  • count : input parameter number
  • +
  • ... : parameter list
  • +
+

Return

+

None

-

Definition at line 110 of file hs-helper.c.

-
111 {
112  va_list args;
113  va_start(args, count);
114  for(int i = 0; i < count; ++i )
115  {
116  char *key = va_arg(args, char*);
117  char *value = va_arg(args, char*);
118  json_object_object_add(j_obj, key, json_object_new_string(value));
119  ++i;
120  }
121  va_end(args);
122 }
+

Definition at line 180 of file hs-helper.cpp.

+
181 {
182  va_list args;
183  va_start(args, count);
184  for(int i = 0; i < count; ++i )
185  {
186  char *key = va_arg(args, char*);
187  char *value = va_arg(args, char*);
188  json_object_object_add(j_obj, key, json_object_new_string(value));
189  ++i;
190  }
191  va_end(args);
192 }
- -

◆ hs_search_event_name_index()

- +
@@ -431,34 +577,87 @@ Variables
+

search event position in event list

+

Parameters

+
    +
  • value : searched event name
  • +
+

Return

+

event's index in event list

-

Definition at line 142 of file hs-helper.c.

-
143 {
144  size_t buf_size = 50;
145  size_t size = sizeof evlist / sizeof *evlist;
146  int ret = -1;
147  for(size_t i = 0 ; i < size ; ++i)
148  {
149  if(!strncmp(value, evlist[i], buf_size))
150  {
151  ret = i;
152  break;
153  }
154  }
155  return ret;
156 }
static const char * evlist[]
Definition: hs-helper.h:34
+

Definition at line 234 of file hs-helper.cpp.

+
235 {
236  size_t buf_size = 50;
237  size_t size = sizeof evlist / sizeof *evlist;
238  int ret = -1;
239  for(size_t i = 0 ; i < size ; ++i)
240  {
241  if(!strncmp(value, evlist[i], buf_size))
242  {
243  ret = i;
244  break;
245  }
246  }
247  return ret;
248 }
const char * evlist[]
Definition: hs-helper.cpp:22

Variable Documentation

- -

◆ evlist

+ +
+
+ + + + +
const char _application_id[]
+
+ +

Definition at line 28 of file homescreen.cpp.

+
+
+ +
+
+ + + + +
const char _display_message[]
+
+ +

Definition at line 29 of file homescreen.cpp.

+ +
+
+ +
+
+ + + + +
const char _error[]
+
+ +

Definition at line 27 of file homescreen.cpp.

+ +
+
+ +
+
+ + + + +
const char _reply_message[]
+
+ +

Definition at line 30 of file homescreen.cpp.

+ +
+
+
- - - - - -
const char* evlist[]
-
-static
-Initial value:
= {
"tap_shortcut",
"on_screen_message",
"on_screen_reply",
"reserved"
}
-

Definition at line 34 of file hs-helper.h.

+ +

Definition at line 22 of file hs-helper.cpp.

@@ -467,7 +666,7 @@ Variables diff --git a/doc/api-ref/html/d3/d3d/hs-helper_8h_source.html b/doc/api-ref/html/d3/d3d/hs-helper_8h_source.html index f0a581a..3406ab2 100644 --- a/doc/api-ref/html/d3/d3d/hs-helper_8h_source.html +++ b/doc/api-ref/html/d3/d3d/hs-helper_8h_source.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: src/hs-helper.h Source File @@ -12,6 +11,9 @@ + @@ -29,19 +31,39 @@
- + - - - - + +
hs-helper.h
-Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef HOMESCREEN_HELPER_H
18 #define HOMESCREEN_HELPER_H
19 #define AFB_BINDING_VERSION 2
20 #include <afb/afb-binding.h>
21 #include <stdint.h>
22 #include <glib.h>
23 #include <errno.h>
24 #include "hmi-debug.h"
25 
26 typedef enum REQ_ERROR
27 {
28  REQ_FAIL = -1,
29  REQ_OK=0,
32 }REQ_ERROR;
33 
34 static const char* evlist[] = {
35  "tap_shortcut",
36  "on_screen_message",
37  "on_screen_reply",
38  "reserved"
39  };
40 
41 REQ_ERROR get_value_uint16(const struct afb_req request, const char *source, uint16_t *out_id);
42 REQ_ERROR get_value_int16(const struct afb_req request, const char *source, int16_t *out_id);
43 REQ_ERROR get_value_int32(const struct afb_req request, const char *source, int32_t *out_id);
44 void hs_add_object_to_json_object(struct json_object* j_obj, int count, ...);
45 void hs_add_object_to_json_object_str(struct json_object* j_obj, int count, ...);
46 void hs_add_object_to_json_object_func(struct json_object* j_obj, const char* verb_name, int count, ...);
47 int hs_search_event_name_index(const char* value);
48 
49 #endif /*HOMESCREEN_HELPER_H*/
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: hs-helper.c:125
-
REQ_ERROR get_value_uint16(const struct afb_req request, const char *source, uint16_t *out_id)
Definition: hs-helper.c:24
-
void hs_add_object_to_json_object(struct json_object *j_obj, int count,...)
Definition: hs-helper.c:96
-
REQ_ERROR get_value_int32(const struct afb_req request, const char *source, int32_t *out_id)
Definition: hs-helper.c:72
-
REQ_ERROR get_value_int16(const struct afb_req request, const char *source, int16_t *out_id)
Definition: hs-helper.c:48
-
int hs_search_event_name_index(const char *value)
Definition: hs-helper.c:142
-
static const char * evlist[]
Definition: hs-helper.h:34
- - - - -
REQ_ERROR
Definition: hs-helper.h:26
- -
void hs_add_object_to_json_object_str(struct json_object *j_obj, int count,...)
Definition: hs-helper.c:110
+Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef HOMESCREEN_HELPER_H
18 #define HOMESCREEN_HELPER_H
19 #define AFB_BINDING_VERSION 3
20 #include <afb/afb-binding.h>
21 #include <json-c/json.h>
22 
23 #define AFB_EVENT_BAD_REQUEST 100
24 #define AFB_REQ_SUBSCRIBE_ERROR 101
25 #define AFB_REQ_UNSUBSCRIBE_ERROR 102
26 #define AFB_REQ_SHOWNOTIFICATION_ERROR 103
27 #define AFB_REQ_SHOWINFORMATION_ERROR 104
28 
29 typedef enum REQ_ERROR
30 {
31  REQ_FAIL = -1,
32  REQ_OK=0,
35 }REQ_ERROR;
36 
37 extern const char* evlist[];
38 extern const char _error[];
39 extern const char _application_id[];
40 extern const char _display_message[];
41 extern const char _reply_message[];
42 
43 REQ_ERROR get_value_uint16(const afb_req_t request, const char *source, uint16_t *out_id);
44 REQ_ERROR get_value_int16(const afb_req_t request, const char *source, int16_t *out_id);
45 REQ_ERROR get_value_int32(const afb_req_t request, const char *source, int32_t *out_id);
46 void hs_add_object_to_json_object(struct json_object* j_obj, int count, ...);
47 void hs_add_object_to_json_object_str(struct json_object* j_obj, int count, ...);
48 void hs_add_object_to_json_object_func(struct json_object* j_obj, const char* verb_name, int count, ...);
49 int hs_search_event_name_index(const char* value);
50 
51 #endif /*HOMESCREEN_HELPER_H*/
const char _application_id[]
Definition: homescreen.cpp:28
+
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: hs-helper.cpp:207
+
const char _reply_message[]
Definition: homescreen.cpp:30
+
const char _display_message[]
Definition: homescreen.cpp:29
+
REQ_ERROR get_value_int32(const afb_req_t request, const char *source, int32_t *out_id)
Definition: hs-helper.cpp:118
+
void hs_add_object_to_json_object(struct json_object *j_obj, int count,...)
Definition: hs-helper.cpp:154
+
const char _error[]
Definition: homescreen.cpp:27
+
int hs_search_event_name_index(const char *value)
Definition: hs-helper.cpp:234
+
const char * evlist[]
Definition: hs-helper.cpp:22
+ + +
REQ_ERROR get_value_uint16(const afb_req_t request, const char *source, uint16_t *out_id)
Definition: hs-helper.cpp:46
+ + +
REQ_ERROR
Definition: hs-helper.h:29
+
void hs_add_object_to_json_object_str(struct json_object *j_obj, int count,...)
Definition: hs-helper.cpp:180
+
REQ_ERROR get_value_int16(const afb_req_t request, const char *source, int16_t *out_id)
Definition: hs-helper.cpp:82
diff --git a/doc/api-ref/html/d4/d10/structdisplay-members.html b/doc/api-ref/html/d4/d10/structdisplay-members.html new file mode 100644 index 0000000..a98b168 --- /dev/null +++ b/doc/api-ref/html/d4/d10/structdisplay-members.html @@ -0,0 +1,110 @@ + + + + + + +HomeScreenBinding: Member List + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ +
+
+
+
display Member List
+
+ + + + + diff --git a/doc/api-ref/html/d5/d0d/class_h_s___client-members.html b/doc/api-ref/html/d5/d0d/class_h_s___client-members.html new file mode 100644 index 0000000..ea1b866 --- /dev/null +++ b/doc/api-ref/html/d5/d0d/class_h_s___client-members.html @@ -0,0 +1,114 @@ + + + + + + +HomeScreenBinding: Member List + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ +
+
+
+
HS_Client Member List
+
+
+ +

This is the complete list of members for HS_Client, including all inherited members.

+ + + + + + + + + + + + + + + + +
hideWindow(afb_req_t request)HS_Client
HS_Client(afb_req_t request, const char *id)HS_Clientinline
HS_Client(afb_req_t request, std::string id)HS_Client
HS_Client(HS_Client &)=deleteHS_Client
on_screen_message(afb_req_t request, const char *message)HS_Client
on_screen_reply(afb_req_t request, const char *message)HS_Client
operator=(HS_Client &)=deleteHS_Client
replyShowWindow(afb_req_t request, const char *appid)HS_Client
showInformation(afb_req_t request)HS_Client
showNotification(afb_req_t request)HS_Client
showWindow(afb_req_t request, const char *appid)HS_Client
subscribe(afb_req_t request, const char *event)HS_Client
tap_shortcut(const char *appid)HS_Client
unsubscribe(afb_req_t request, const char *event)HS_Client
~HS_Client()HS_Client
+ + + + diff --git a/doc/api-ref/html/d5/d20/class_h_s___client.html b/doc/api-ref/html/d5/d20/class_h_s___client.html new file mode 100644 index 0000000..e9d7ff8 --- /dev/null +++ b/doc/api-ref/html/d5/d20/class_h_s___client.html @@ -0,0 +1,653 @@ + + + + + + +HomeScreenBinding: HS_Client Class Reference + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ +
+
+ +
+
HS_Client Class Reference
+
+
+ +

#include <hs-client.h>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 HS_Client (afb_req_t request, const char *id)
 
 HS_Client (afb_req_t request, std::string id)
 
 HS_Client (HS_Client &)=delete
 
HS_Clientoperator= (HS_Client &)=delete
 
 ~HS_Client ()
 
int tap_shortcut (const char *appid)
 
int showWindow (afb_req_t request, const char *appid)
 
int hideWindow (afb_req_t request)
 
int replyShowWindow (afb_req_t request, const char *appid)
 
int on_screen_message (afb_req_t request, const char *message)
 
int on_screen_reply (afb_req_t request, const char *message)
 
int subscribe (afb_req_t request, const char *event)
 
int unsubscribe (afb_req_t request, const char *event)
 
int showNotification (afb_req_t request)
 
int showInformation (afb_req_t request)
 
+

Detailed Description

+
+

Definition at line 25 of file hs-client.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
HS_Client::HS_Client (afb_req_t request,
const char * id 
)
+
+inline
+
+ +

Definition at line 27 of file hs-client.h.

+
27 : HS_Client(request, std::string(id)){}
HS_Client(afb_req_t request, const char *id)
Definition: hs-client.h:27
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
HS_Client::HS_Client (afb_req_t request,
std::string id 
)
+
+

HS_Client construction function

+

Parameters

+
    +
  • id: app's id
  • +
+

Return

+

None

+ +

Definition at line 38 of file hs-client.cpp.

+
38  : my_id(id)
39 {
40  HMI_NOTICE("homescreen-service","called.");
41  my_event = afb_api_make_event(request->api, id.c_str());
42 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + +
HS_Client::HS_Client (HS_Client)
+
+delete
+
+ +
+
+ +
+
+ + + + + + + +
HS_Client::~HS_Client ()
+
+

HS_Client destruction function

+

Parameters

+
    +
  • null
  • +
+

Return

+

None

+ +

Definition at line 54 of file hs-client.cpp.

+
55 {
56  HMI_NOTICE("homescreen-service","called.");
57  afb_event_unref(my_event);
58 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
+
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
int HS_Client::hideWindow (afb_req_t request)
+
+

hideWindow event

+

input contents : {"application_id":"the appid that want to hide"}

+

Parameters

+
    +
  • request : the request
  • +
+

Return

+

0 : success others : fail

+ +

Definition at line 245 of file hs-client.cpp.

+
246 {
247  if(!checkEvent(__FUNCTION__))
248  return 0;
249 
250  HMI_NOTICE("homescreen-service","%s application_id = %s.", __FUNCTION__);
251  const char* req_appid = afb_req_get_application_id(request);
252  struct json_object* push_obj = json_object_new_object();
253  hs_add_object_to_json_object_str( push_obj, 4, _application_id, req_appid,
254  _type, __FUNCTION__);
255  afb_event_push(my_event, push_obj);
256  return 0;
257 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
static const char _type[]
Definition: hs-client.cpp:21
+
void hs_add_object_to_json_object_str(struct json_object *j_obj, int count,...)
Definition: hs-helper.cpp:180
+
const char _application_id[]
Definition: homescreen.cpp:28
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
int HS_Client::on_screen_message (afb_req_t request,
const char * message 
)
+
+

push on_screen_message event

+

Parameters

+
    +
  • message: post message.
  • +
+

Return

+

result

+ +

Definition at line 93 of file hs-client.cpp.

+
94 {
95  if(!checkEvent(__FUNCTION__))
96  return 0;
97 
98  HMI_NOTICE("homescreen-service","push %s event message [%s].", __FUNCTION__, message);
99  struct json_object* push_obj = json_object_new_object();
100  hs_add_object_to_json_object_str( push_obj, 4, _display_message, message,
101  _type, __FUNCTION__);
102  afb_event_push(my_event, push_obj);
103  return 0;
104 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
static const char _type[]
Definition: hs-client.cpp:21
+
void hs_add_object_to_json_object_str(struct json_object *j_obj, int count,...)
Definition: hs-helper.cpp:180
+
const char _display_message[]
Definition: homescreen.cpp:29
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
int HS_Client::on_screen_reply (afb_req_t request,
const char * message 
)
+
+

push on_screen_reply event

+

Parameters

+
    +
  • message: reply message.
  • +
+

Return

+

result

+ +

Definition at line 116 of file hs-client.cpp.

+
117 {
118  if(!checkEvent(__FUNCTION__))
119  return 0;
120 
121  HMI_NOTICE("homescreen-service","push %s event message [%s].", __FUNCTION__, message);
122  struct json_object* push_obj = json_object_new_object();
123  hs_add_object_to_json_object_str( push_obj, 4, _reply_message, message,
124  _type, __FUNCTION__);
125  afb_event_push(my_event, push_obj);
126  return 0;
127 }
const char _reply_message[]
Definition: homescreen.cpp:30
+
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
static const char _type[]
Definition: hs-client.cpp:21
+
void hs_add_object_to_json_object_str(struct json_object *j_obj, int count,...)
Definition: hs-helper.cpp:180
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + +
HS_Client& HS_Client::operator= (HS_Client)
+
+delete
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
int HS_Client::replyShowWindow (afb_req_t request,
const char * appid 
)
+
+

replyShowWindow event

+

input contens : {"application_id": "the appid that want to reply", "parameter": {...}}

+

Parameters

+
    +
  • request : the request
  • +
  • appid : the appid that want to reply
  • +
+

Return

+

0 : success others : fail

+ +

Definition at line 273 of file hs-client.cpp.

+
274 {
275  if(!checkEvent(__FUNCTION__))
276  return 0;
277 
278  HMI_NOTICE("homescreen-service","%s application_id = %s.", __FUNCTION__, appid);
279  struct json_object* push_obj = json_object_new_object();
280  hs_add_object_to_json_object_str( push_obj, 4, _application_id, appid, _type, __FUNCTION__);
281  const char* param = afb_req_value(request, _parameter);
282  if(param) {
283  json_object_object_add(push_obj, _parameter, json_tokener_parse(param));
284  }
285  else {
286  HMI_ERROR("homescreen-service","please input correct parameter.");
287  return AFB_EVENT_BAD_REQUEST;
288  }
289 
290  afb_event_push(my_event, push_obj);
291  return 0;
292 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
static const char _parameter[]
Definition: hs-client.cpp:25
+
static const char _type[]
Definition: hs-client.cpp:21
+
void hs_add_object_to_json_object_str(struct json_object *j_obj, int count,...)
Definition: hs-helper.cpp:180
+
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:38
+
const char _application_id[]
Definition: homescreen.cpp:28
+
#define AFB_EVENT_BAD_REQUEST
Definition: hs-helper.h:23
+
+
+
+ +
+
+ + + + + + + + +
int HS_Client::showInformation (afb_req_t request)
+
+

showInformation event

+

input contents : {"info": "information contents"}

+

Parameters

+
    +
  • request : the request
  • +
+

Return

+

0 : success others : fail

+ +

Definition at line 350 of file hs-client.cpp.

+
351 {
352  int ret = 0;
353  const char *value = afb_req_value(request, _info);
354  if(value) {
355  HMI_NOTICE("homescreen-service","info is %s", value);
356  const char* appid = afb_req_get_application_id(request);
357  struct json_object* param_obj = json_object_new_object();
358  json_object_object_add(param_obj, _info, json_object_new_string(value));
359  struct json_object* push_obj = json_object_new_object();
360  hs_add_object_to_json_object_str( push_obj, 4, _application_id, appid, _type, __FUNCTION__);
361  json_object_object_add(push_obj, _parameter, param_obj);
362  afb_event_push(my_event, push_obj);
363  }
364  else {
365  HMI_NOTICE("homescreen-service","please input information.");
367  }
368 
369  return ret;
370 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
static const char _parameter[]
Definition: hs-client.cpp:25
+
static const char _type[]
Definition: hs-client.cpp:21
+
void hs_add_object_to_json_object_str(struct json_object *j_obj, int count,...)
Definition: hs-helper.cpp:180
+
static const char _info[]
Definition: hs-client.cpp:23
+
const char _application_id[]
Definition: homescreen.cpp:28
+
#define AFB_REQ_SHOWINFORMATION_ERROR
Definition: hs-helper.h:27
+
+
+
+ +
+
+ + + + + + + + +
int HS_Client::showNotification (afb_req_t request)
+
+

showNotification event

+

input contents : {"icon": "icon path", "text": "message contents"}

+

Parameters

+
    +
  • request : the request
  • +
+

Return

+

0 : success others : fail

+ +

Definition at line 307 of file hs-client.cpp.

+
308 {
309  int ret = 0;
310  const char *value = afb_req_value(request, _text);
311  if(value) {
312  HMI_NOTICE("homescreen-service","text is %s", value);
313  const char* appid = afb_req_get_application_id(request);
314  struct json_object* param_obj = json_object_new_object();
315  const char *icon = afb_req_value(request, _icon);
316  if(icon) {
317  json_object_object_add(param_obj, _icon, json_object_new_string(icon));
318  json_object_object_add(param_obj, _text, json_object_new_string(value));
319  struct json_object* push_obj = json_object_new_object();
320  hs_add_object_to_json_object_str( push_obj, 4, _application_id, appid, _type, __FUNCTION__);
321  json_object_object_add(push_obj, _parameter, param_obj);
322  afb_event_push(my_event, push_obj);
323  }
324  else {
325  HMI_NOTICE("homescreen-service","please input icon.");
327  }
328  }
329  else {
330  HMI_NOTICE("homescreen-service","please input text.");
332  }
333 
334  return ret;
335 }
static const char _text[]
Definition: hs-client.cpp:22
+
#define AFB_REQ_SHOWNOTIFICATION_ERROR
Definition: hs-helper.h:26
+
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
static const char _parameter[]
Definition: hs-client.cpp:25
+
static const char _type[]
Definition: hs-client.cpp:21
+
void hs_add_object_to_json_object_str(struct json_object *j_obj, int count,...)
Definition: hs-helper.cpp:180
+
static const char _icon[]
Definition: hs-client.cpp:24
+
const char _application_id[]
Definition: homescreen.cpp:28
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
int HS_Client::showWindow (afb_req_t request,
const char * appid 
)
+
+

showWindow event

+

input contents : {"application_id":"the appid that want to display", "parameter":{"area": "display area", ...}}

+

Parameters

+
    +
  • request : the request
  • +
  • appid : the appid that want to display
  • +
+

Return

+

0 : success others : fail

+ +

Definition at line 209 of file hs-client.cpp.

+
210 {
211  if(!checkEvent(__FUNCTION__))
212  return 0;
213 
214  HMI_NOTICE("homescreen-service","%s application_id = %s.", __FUNCTION__, appid);
215  struct json_object* push_obj = json_object_new_object();
216  hs_add_object_to_json_object_str( push_obj, 4, _application_id, appid, _type, __FUNCTION__);
217  const char* param = afb_req_value(request, _parameter);
218  if(param) {
219  const char* req_appid = afb_req_get_application_id(request);
220  struct json_object* param_obj = json_tokener_parse(param);
221  json_object_object_add(param_obj, _replyto, json_object_new_string(req_appid));
222  json_object_object_add(push_obj, _parameter, param_obj);
223  }
224  else {
225  HMI_ERROR("homescreen-service","please input correct parameter.");
226  return AFB_EVENT_BAD_REQUEST;
227  }
228  afb_event_push(my_event, push_obj);
229  return 0;
230 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
static const char _parameter[]
Definition: hs-client.cpp:25
+
static const char _type[]
Definition: hs-client.cpp:21
+
void hs_add_object_to_json_object_str(struct json_object *j_obj, int count,...)
Definition: hs-helper.cpp:180
+
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:38
+
static const char _replyto[]
Definition: hs-client.cpp:26
+
const char _application_id[]
Definition: homescreen.cpp:28
+
#define AFB_EVENT_BAD_REQUEST
Definition: hs-helper.h:23
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
int HS_Client::subscribe (afb_req_t request,
const char * event 
)
+
+

subscribe event

+

Parameters

+
    +
  • event: homescreen event, tap_shortcut etc.
  • +
+

Return

+

result

+ +

Definition at line 139 of file hs-client.cpp.

+
140 {
141  int ret = 0;
142  auto ip = event_list.find(std::string(event));
143  if(ip == event_list.end()) {
144  event_list[std::string(event)] = 0;
145  }
146  if(!subscription) {
147  ret = afb_req_subscribe(request, my_event);
148  if(ret == 0) {
149  subscription = true;
150  }
151  }
152  return ret;
153 }
+
+
+ +
+
+ + + + + + + + +
int HS_Client::tap_shortcut (const char * appid)
+
+

push tap_shortcut event

+

Parameters

+
    +
  • appid: app's id.
  • +
+

Return

+

result

+ +

Definition at line 70 of file hs-client.cpp.

+
71 {
72  if(!checkEvent(__FUNCTION__))
73  return 0;
74 
75  HMI_NOTICE("homescreen-service","%s application_id = %s.", __FUNCTION__, appid);
76  struct json_object* push_obj = json_object_new_object();
78  _type, __FUNCTION__);
79  afb_event_push(my_event, push_obj);
80  return 0;
81 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
static const char _type[]
Definition: hs-client.cpp:21
+
void hs_add_object_to_json_object_str(struct json_object *j_obj, int count,...)
Definition: hs-helper.cpp:180
+
const char _application_id[]
Definition: homescreen.cpp:28
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
int HS_Client::unsubscribe (afb_req_t request,
const char * event 
)
+
+

unsubscribe event

+

Parameters

+
    +
  • event: homescreen event, tap_shortcut etc.
  • +
+

Return

+

result

+ +

Definition at line 165 of file hs-client.cpp.

+
166 {
167  int ret = 0;
168  event_list.erase(std::string(event));
169  if(event_list.empty()) {
170  ret = afb_req_unsubscribe(request, my_event);
171  }
172  return ret;
173 }
+
+
+
The documentation for this class was generated from the following files: +
+ + + + diff --git a/doc/api-ref/html/d5/d56/struct_h_s___client_ctxt-members.html b/doc/api-ref/html/d5/d56/struct_h_s___client_ctxt-members.html new file mode 100644 index 0000000..1cdc63f --- /dev/null +++ b/doc/api-ref/html/d5/d56/struct_h_s___client_ctxt-members.html @@ -0,0 +1,101 @@ + + + + + + +HomeScreenBinding: Member List + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ +
+
+
+
HS_ClientCtxt Member List
+
+
+ +

This is the complete list of members for HS_ClientCtxt, including all inherited members.

+ + + +
HS_ClientCtxt(const char *appid)HS_ClientCtxtinline
idHS_ClientCtxt
+ + + + diff --git a/doc/api-ref/html/d6/dda/homescreen_8cpp.html b/doc/api-ref/html/d6/dda/homescreen_8cpp.html new file mode 100644 index 0000000..c9edaec --- /dev/null +++ b/doc/api-ref/html/d6/dda/homescreen_8cpp.html @@ -0,0 +1,841 @@ + + + + + + +HomeScreenBinding: src/homescreen.cpp File Reference + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ + +
+
+ +
+
homescreen.cpp File Reference
+
+
+
#include <memory>
+#include <algorithm>
+#include "hs-helper.h"
+#include "hmi-debug.h"
+#include "hs-clientmanager.h"
+
+

Go to the source code of this file.

+ + + + +

+Macros

#define _GNU_SOURCE
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

static void pingSample (afb_req_t request)
 
static void tap_shortcut (afb_req_t request)
 
static void on_screen_message (afb_req_t request)
 
static void on_screen_reply (afb_req_t request)
 
static void subscribe (afb_req_t request)
 
static void unsubscribe (afb_req_t request)
 
static void showWindow (afb_req_t request)
 
static void hideWindow (afb_req_t request)
 
static void replyShowWindow (afb_req_t request)
 
static void showNotification (afb_req_t request)
 
static void showInformation (afb_req_t request)
 
static int preinit (afb_api_t api)
 
static int init (afb_api_t api)
 
static void onevent (afb_api_t api, const char *event, struct json_object *object)
 
+ + + + + + + + + + + + + + + +

+Variables

const char _error [] = "error"
 
const char _application_id [] = "application_id"
 
const char _display_message [] = "display_message"
 
const char _reply_message [] = "reply_message"
 
static HS_ClientManagerg_client_manager = HS_ClientManager::instance()
 
static const afb_verb_t verbs []
 
const afb_binding_t afbBindingExport
 
+

Macro Definition Documentation

+ +
+
+ + + + +
#define _GNU_SOURCE
+
+ +

Definition at line 18 of file homescreen.cpp.

+ +
+
+

Function Documentation

+ +
+
+ + + + + +
+ + + + + + + + +
static void hideWindow (afb_req_t request)
+
+static
+
+

hideWindow event

+

Parameters

+
    +
  • request : the request
  • +
+

Return

+

None

+ +

Definition at line 221 of file homescreen.cpp.

+
222 {
223  HMI_NOTICE("homescreen-service","called.");
224 
225  int ret = g_client_manager->hideWindow(request);
226  if (ret != 0) {
227  afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
228  return;
229  }
230 
231  // response to HomeScreen
232  struct json_object *res = json_object_new_object();
233  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
234  _error, ret);
235  afb_req_success(request, res, "afb_event_push event [hideWindow]");
236 }
int hideWindow(afb_req_t request)
+
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
const char _error[]
Definition: homescreen.cpp:27
+
static HS_ClientManager * g_client_manager
Definition: homescreen.cpp:32
+
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: hs-helper.cpp:207
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + +
static int init (afb_api_t api)
+
+static
+
+

homescreen binding init function

+

Parameters

+
    +
  • api : the api serving the request
  • +
+

Return

+

None

+ +

Definition at line 368 of file homescreen.cpp.

+
369 {
370  HMI_NOTICE("homescreen-service","binding init");
371 
373 
374  return 0;
375 }
+
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
static HS_ClientManager * g_client_manager
Definition: homescreen.cpp:32
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + +
static void on_screen_message (afb_req_t request)
+
+static
+
+

HomeScreen OnScreen message

+

Parameters

+

Request key

    +
  • display_message : message for display
  • +
+

Return

+

None

+ +

Definition at line 85 of file homescreen.cpp.

+
86 {
87  HMI_NOTICE("homescreen-service","called.");
88 
89  int ret = g_client_manager->on_screen_message(request);
90  if (ret != 0) {
91  afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
92  return;
93  }
94 
95  // response to HomeScreen
96  struct json_object *res = json_object_new_object();
97  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
98  _error, ret);
99  afb_req_success(request, res, "afb_event_push event [on_screen_message]");
100 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
const char _error[]
Definition: homescreen.cpp:27
+
static HS_ClientManager * g_client_manager
Definition: homescreen.cpp:32
+
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: hs-helper.cpp:207
+
int on_screen_message(afb_req_t request)
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + +
static void on_screen_reply (afb_req_t request)
+
+static
+
+

HomeScreen OnScreen Reply

+

Parameters

+

Request key

    +
  • reply_message : message for reply
  • +
+

Return

+

None

+ +

Definition at line 113 of file homescreen.cpp.

+
114 {
115  HMI_NOTICE("homescreen-service","called.");
116 
117  int ret = g_client_manager->on_screen_reply(request);
118  if (ret != 0) {
119  afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
120  return;
121  }
122 
123  // response to HomeScreen
124  struct json_object *res = json_object_new_object();
125  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
126  _error, ret);
127  afb_req_success(request, res, "afb_event_push event [on_screen_reply]");
128 }
int on_screen_reply(afb_req_t request)
+
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
const char _error[]
Definition: homescreen.cpp:27
+
static HS_ClientManager * g_client_manager
Definition: homescreen.cpp:32
+
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: hs-helper.cpp:207
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static void onevent (afb_api_t api,
const char * event,
struct json_object * object 
)
+
+static
+
+

homescreen binding event function

+

Parameters

+
    +
  • api : the api serving the request
  • +
  • event : event name
  • +
  • object : event json object
  • +
+

Return

+

None

+ +

Definition at line 389 of file homescreen.cpp.

+
390 {
391  HMI_NOTICE("homescreen-service","on_event %s", event);
392 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + +
static void pingSample (afb_req_t request)
+
+static
+
+ +

Definition at line 38 of file homescreen.cpp.

+
39 {
40  static int pingcount = 0;
41  afb_req_success_f(request, json_object_new_int(pingcount), "Ping count = %d", pingcount);
42  HMI_NOTICE("homescreen-service","Verbosity macro at level notice invoked at ping invocation count = %d", pingcount);
43  pingcount++;
44 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + +
static int preinit (afb_api_t api)
+
+static
+
+

homescreen binding preinit function

+

Parameters

+
    +
  • api : the api serving the request
  • +
+

Return

+

None

+ +

Definition at line 352 of file homescreen.cpp.

+
353 {
354  HMI_NOTICE("homescreen-service","binding preinit (was register)");
355  return 0;
356 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + +
static void replyShowWindow (afb_req_t request)
+
+static
+
+

replyShowWindow event

+

Parameters

+
    +
  • request : the request
  • +
+

Return

+

None

+ +

Definition at line 248 of file homescreen.cpp.

+
249 {
250  HMI_NOTICE("homescreen-service","called.");
251 
252  int ret = g_client_manager->replyShowWindow(request);
253  if (ret != 0) {
254  afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
255  return;
256  }
257 
258  // response to HomeScreen
259  struct json_object *res = json_object_new_object();
260  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
261  _error, ret);
262  afb_req_success(request, res, "afb_event_push event [replyShowWindow]");
263 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
const char _error[]
Definition: homescreen.cpp:27
+
int replyShowWindow(afb_req_t request)
+
static HS_ClientManager * g_client_manager
Definition: homescreen.cpp:32
+
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: hs-helper.cpp:207
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + +
static void showInformation (afb_req_t request)
+
+static
+
+

showInformation event

+

the contents to homescreen which display at bottom area.

+

Parameters

+
    +
  • request : the request
  • +
+

Return

+

None

+ +

Definition at line 306 of file homescreen.cpp.

+
307 {
308  HMI_NOTICE("homescreen-service","called.");
309 
310  int ret = g_client_manager->showInformation(request);
311  if (ret != 0) {
312  afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
313  return;
314  }
315 
316  // response to Application
317  struct json_object *res = json_object_new_object();
318  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
319  _error, ret);
320  afb_req_success(request, res, "afb_event_push event [showInformation]");
321 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
const char _error[]
Definition: homescreen.cpp:27
+
static HS_ClientManager * g_client_manager
Definition: homescreen.cpp:32
+
int showInformation(afb_req_t request)
+
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: hs-helper.cpp:207
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + +
static void showNotification (afb_req_t request)
+
+static
+
+

showNotification event

+

the contents to homescreen which display at top area.

+

Parameters

+
    +
  • request : the request
  • +
+

Return

+

None

+ +

Definition at line 277 of file homescreen.cpp.

+
278 {
279  HMI_NOTICE("homescreen-service","called.");
280 
281  int ret = g_client_manager->showNotification(request);
282  if (ret != 0) {
283  afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
284  return;
285  }
286 
287  // response to Application
288  struct json_object *res = json_object_new_object();
289  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
290  _error, ret);
291  afb_req_success(request, res, "afb_event_push event [showNotification]");
292 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
const char _error[]
Definition: homescreen.cpp:27
+
static HS_ClientManager * g_client_manager
Definition: homescreen.cpp:32
+
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: hs-helper.cpp:207
+
int showNotification(afb_req_t request)
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + +
static void showWindow (afb_req_t request)
+
+static
+
+

showWindow event

+

Parameters

+
    +
  • request : the request
  • +
+

Return

+

None

+ +

Definition at line 194 of file homescreen.cpp.

+
195 {
196  HMI_NOTICE("homescreen-service","called.");
197 
198  int ret = g_client_manager->showWindow(request);
199  if (ret != 0) {
200  afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
201  return;
202  }
203 
204  // response to HomeScreen
205  struct json_object *res = json_object_new_object();
206  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
207  _error, ret);
208  afb_req_success(request, res, "afb_event_push event [showWindow]");
209 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
int showWindow(afb_req_t request)
+
const char _error[]
Definition: homescreen.cpp:27
+
static HS_ClientManager * g_client_manager
Definition: homescreen.cpp:32
+
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: hs-helper.cpp:207
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + +
static void subscribe (afb_req_t request)
+
+static
+
+

Subscribe event

+

Parameters

+ +

Return

+

None

+ +

Definition at line 140 of file homescreen.cpp.

+
141 {
142  HMI_NOTICE("homescreen-service","called.");
143 
144  int ret = g_client_manager->subscribe(request);
145  if(ret) {
146  afb_req_fail_f(request, "afb_req_subscribe failed", "called %s.", __FUNCTION__);
147  return;
148  }
149 
150  /*create response json object*/
151  struct json_object *res = json_object_new_object();
152  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
153  _error, ret);
154  afb_req_success_f(request, res, "homescreen binder subscribe.");
155 }
int subscribe(afb_req_t request)
+
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
const char _error[]
Definition: homescreen.cpp:27
+
static HS_ClientManager * g_client_manager
Definition: homescreen.cpp:32
+
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: hs-helper.cpp:207
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + +
static void tap_shortcut (afb_req_t request)
+
+static
+
+

tap_shortcut notify for homescreen When Shortcut area is tapped, notify these applciations

+

Parameters

+

Request key

    +
  • application_id : application id
  • +
+

Return

+

None

+ +

Definition at line 58 of file homescreen.cpp.

+
59 {
60  HMI_NOTICE("homescreen-service","called.");
61  int ret = g_client_manager->tap_shortcut(request);
62  if (ret != 0) {
63  afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
64  return;
65  }
66 
67  // response to HomeScreen
68  struct json_object *res = json_object_new_object();
69  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
70  _error, ret);
71  afb_req_success(request, res, "afb_event_push event [tap_shortcut]");
72 }
int tap_shortcut(afb_req_t request)
+
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
const char _error[]
Definition: homescreen.cpp:27
+
static HS_ClientManager * g_client_manager
Definition: homescreen.cpp:32
+
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: hs-helper.cpp:207
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + +
static void unsubscribe (afb_req_t request)
+
+static
+
+

Unsubscribe event

+

Parameters

+ +

Return

+

None

+ +

Definition at line 167 of file homescreen.cpp.

+
168 {
169  HMI_NOTICE("homescreen-service","called.");
170 
171  int ret = g_client_manager->unsubscribe(request);
172  if(ret) {
173  afb_req_fail_f(request, "afb_req_unsubscribe failed", "called %s.", __FUNCTION__);
174  return;
175  }
176 
177  /*create response json object*/
178  struct json_object *res = json_object_new_object();
179  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
180  _error, ret);
181  afb_req_success_f(request, res, "homescreen binder unsubscribe success.");
182 }
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
int unsubscribe(afb_req_t request)
+
const char _error[]
Definition: homescreen.cpp:27
+
static HS_ClientManager * g_client_manager
Definition: homescreen.cpp:32
+
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: hs-helper.cpp:207
+
+
+
+

Variable Documentation

+ +
+
+ + + + +
const char _application_id[] = "application_id"
+
+ +

Definition at line 28 of file homescreen.cpp.

+ +
+
+ +
+
+ + + + +
const char _display_message[] = "display_message"
+
+ +

Definition at line 29 of file homescreen.cpp.

+ +
+
+ +
+
+ + + + +
const char _error[] = "error"
+
+ +

Definition at line 27 of file homescreen.cpp.

+ +
+
+ +
+
+ + + + +
const char _reply_message[] = "reply_message"
+
+ +

Definition at line 30 of file homescreen.cpp.

+ +
+
+ +
+
+ + + + +
const afb_binding_t afbBindingExport
+
+Initial value:
= {
.api = "homescreen",
.specification = NULL,
.info = NULL,
.verbs = verbs,
.preinit = preinit,
.init = init,
.onevent = onevent
}
static const afb_verb_t verbs[]
Definition: homescreen.cpp:326
+
static void onevent(afb_api_t api, const char *event, struct json_object *object)
Definition: homescreen.cpp:389
+
static int preinit(afb_api_t api)
Definition: homescreen.cpp:352
+
static int init(afb_api_t api)
Definition: homescreen.cpp:368
+
+

Definition at line 394 of file homescreen.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
HS_ClientManager* g_client_manager = HS_ClientManager::instance()
+
+static
+
+ +

Definition at line 32 of file homescreen.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const afb_verb_t verbs[]
+
+static
+
+Initial value:
= {
{ .verb="ping", .callback=pingSample },
{ .verb="tap_shortcut", .callback=tap_shortcut },
{ .verb="showWindow", .callback=showWindow },
{ .verb="hideWindow", .callback=hideWindow },
{ .verb="replyShowWindow", .callback=replyShowWindow },
{ .verb="on_screen_message", .callback=on_screen_message },
{ .verb="on_screen_reply", .callback=on_screen_reply },
{ .verb="subscribe", .callback=subscribe },
{ .verb="unsubscribe", .callback=unsubscribe },
{ .verb="showNotification", .callback=showNotification },
{ .verb="showInformation", .callback=showInformation },
{NULL }
}
static void showWindow(afb_req_t request)
Definition: homescreen.cpp:194
+
static void on_screen_reply(afb_req_t request)
Definition: homescreen.cpp:113
+
static void on_screen_message(afb_req_t request)
Definition: homescreen.cpp:85
+
static void subscribe(afb_req_t request)
Definition: homescreen.cpp:140
+
static void unsubscribe(afb_req_t request)
Definition: homescreen.cpp:167
+
static void showInformation(afb_req_t request)
Definition: homescreen.cpp:306
+
static void pingSample(afb_req_t request)
Definition: homescreen.cpp:38
+
static void hideWindow(afb_req_t request)
Definition: homescreen.cpp:221
+
static void replyShowWindow(afb_req_t request)
Definition: homescreen.cpp:248
+
static void showNotification(afb_req_t request)
Definition: homescreen.cpp:277
+
static void tap_shortcut(afb_req_t request)
Definition: homescreen.cpp:58
+
+

Definition at line 326 of file homescreen.cpp.

+ +
+
+
+ + + + diff --git a/doc/api-ref/html/d6/dda/homescreen_8cpp_source.html b/doc/api-ref/html/d6/dda/homescreen_8cpp_source.html new file mode 100644 index 0000000..31aadbc --- /dev/null +++ b/doc/api-ref/html/d6/dda/homescreen_8cpp_source.html @@ -0,0 +1,138 @@ + + + + + + +HomeScreenBinding: src/homescreen.cpp Source File + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ + +
+
+
+
homescreen.cpp
+
+
+Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef _GNU_SOURCE
18 #define _GNU_SOURCE
19 #endif
20 #include <memory>
21 #include <algorithm>
22 #include "hs-helper.h"
23 #include "hmi-debug.h"
24 #include "hs-clientmanager.h"
25 
26 
27 const char _error[] = "error";
28 const char _application_id[] = "application_id";
29 const char _display_message[] = "display_message";
30 const char _reply_message[] = "reply_message";
31 
33 
34 /*
35 ********** Method of HomeScreen Service (API) **********
36 */
37 
38 static void pingSample(afb_req_t request)
39 {
40  static int pingcount = 0;
41  afb_req_success_f(request, json_object_new_int(pingcount), "Ping count = %d", pingcount);
42  HMI_NOTICE("homescreen-service","Verbosity macro at level notice invoked at ping invocation count = %d", pingcount);
43  pingcount++;
44 }
45 
58 static void tap_shortcut (afb_req_t request)
59 {
60  HMI_NOTICE("homescreen-service","called.");
61  int ret = g_client_manager->tap_shortcut(request);
62  if (ret != 0) {
63  afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
64  return;
65  }
66 
67  // response to HomeScreen
68  struct json_object *res = json_object_new_object();
69  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
70  _error, ret);
71  afb_req_success(request, res, "afb_event_push event [tap_shortcut]");
72 }
73 
85 static void on_screen_message (afb_req_t request)
86 {
87  HMI_NOTICE("homescreen-service","called.");
88 
89  int ret = g_client_manager->on_screen_message(request);
90  if (ret != 0) {
91  afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
92  return;
93  }
94 
95  // response to HomeScreen
96  struct json_object *res = json_object_new_object();
97  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
98  _error, ret);
99  afb_req_success(request, res, "afb_event_push event [on_screen_message]");
100 }
101 
113 static void on_screen_reply (afb_req_t request)
114 {
115  HMI_NOTICE("homescreen-service","called.");
116 
117  int ret = g_client_manager->on_screen_reply(request);
118  if (ret != 0) {
119  afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
120  return;
121  }
122 
123  // response to HomeScreen
124  struct json_object *res = json_object_new_object();
125  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
126  _error, ret);
127  afb_req_success(request, res, "afb_event_push event [on_screen_reply]");
128 }
129 
140 static void subscribe(afb_req_t request)
141 {
142  HMI_NOTICE("homescreen-service","called.");
143 
144  int ret = g_client_manager->subscribe(request);
145  if(ret) {
146  afb_req_fail_f(request, "afb_req_subscribe failed", "called %s.", __FUNCTION__);
147  return;
148  }
149 
150  /*create response json object*/
151  struct json_object *res = json_object_new_object();
152  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
153  _error, ret);
154  afb_req_success_f(request, res, "homescreen binder subscribe.");
155 }
156 
167 static void unsubscribe(afb_req_t request)
168 {
169  HMI_NOTICE("homescreen-service","called.");
170 
171  int ret = g_client_manager->unsubscribe(request);
172  if(ret) {
173  afb_req_fail_f(request, "afb_req_unsubscribe failed", "called %s.", __FUNCTION__);
174  return;
175  }
176 
177  /*create response json object*/
178  struct json_object *res = json_object_new_object();
179  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
180  _error, ret);
181  afb_req_success_f(request, res, "homescreen binder unsubscribe success.");
182 }
183 
194 static void showWindow(afb_req_t request)
195 {
196  HMI_NOTICE("homescreen-service","called.");
197 
198  int ret = g_client_manager->showWindow(request);
199  if (ret != 0) {
200  afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
201  return;
202  }
203 
204  // response to HomeScreen
205  struct json_object *res = json_object_new_object();
206  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
207  _error, ret);
208  afb_req_success(request, res, "afb_event_push event [showWindow]");
209 }
210 
221 static void hideWindow(afb_req_t request)
222 {
223  HMI_NOTICE("homescreen-service","called.");
224 
225  int ret = g_client_manager->hideWindow(request);
226  if (ret != 0) {
227  afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
228  return;
229  }
230 
231  // response to HomeScreen
232  struct json_object *res = json_object_new_object();
233  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
234  _error, ret);
235  afb_req_success(request, res, "afb_event_push event [hideWindow]");
236 }
237 
248 static void replyShowWindow(afb_req_t request)
249 {
250  HMI_NOTICE("homescreen-service","called.");
251 
252  int ret = g_client_manager->replyShowWindow(request);
253  if (ret != 0) {
254  afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
255  return;
256  }
257 
258  // response to HomeScreen
259  struct json_object *res = json_object_new_object();
260  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
261  _error, ret);
262  afb_req_success(request, res, "afb_event_push event [replyShowWindow]");
263 }
264 
277 static void showNotification(afb_req_t request)
278 {
279  HMI_NOTICE("homescreen-service","called.");
280 
281  int ret = g_client_manager->showNotification(request);
282  if (ret != 0) {
283  afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
284  return;
285  }
286 
287  // response to Application
288  struct json_object *res = json_object_new_object();
289  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
290  _error, ret);
291  afb_req_success(request, res, "afb_event_push event [showNotification]");
292 }
293 
306 static void showInformation(afb_req_t request)
307 {
308  HMI_NOTICE("homescreen-service","called.");
309 
310  int ret = g_client_manager->showInformation(request);
311  if (ret != 0) {
312  afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
313  return;
314  }
315 
316  // response to Application
317  struct json_object *res = json_object_new_object();
318  hs_add_object_to_json_object_func(res, __FUNCTION__, 2,
319  _error, ret);
320  afb_req_success(request, res, "afb_event_push event [showInformation]");
321 }
322 
323 /*
324  * array of the verbs exported to afb-daemon
325  */
326 static const afb_verb_t verbs[]= {
327  /* VERB'S NAME FUNCTION TO CALL */
328  { .verb="ping", .callback=pingSample },
329  { .verb="tap_shortcut", .callback=tap_shortcut },
330  { .verb="showWindow", .callback=showWindow },
331  { .verb="hideWindow", .callback=hideWindow },
332  { .verb="replyShowWindow", .callback=replyShowWindow },
333  { .verb="on_screen_message", .callback=on_screen_message },
334  { .verb="on_screen_reply", .callback=on_screen_reply },
335  { .verb="subscribe", .callback=subscribe },
336  { .verb="unsubscribe", .callback=unsubscribe },
337  { .verb="showNotification", .callback=showNotification },
338  { .verb="showInformation", .callback=showInformation },
339  {NULL } /* marker for end of the array */
340 };
341 
352 static int preinit(afb_api_t api)
353 {
354  HMI_NOTICE("homescreen-service","binding preinit (was register)");
355  return 0;
356 }
357 
368 static int init(afb_api_t api)
369 {
370  HMI_NOTICE("homescreen-service","binding init");
371 
372  g_client_manager->init();
373 
374  return 0;
375 }
376 
389 static void onevent(afb_api_t api, const char *event, struct json_object *object)
390 {
391  HMI_NOTICE("homescreen-service","on_event %s", event);
392 }
393 
394 const afb_binding_t afbBindingExport = {
395  .api = "homescreen",
396  .specification = NULL,
397  .info = NULL,
398  .verbs = verbs,
399  .preinit = preinit,
400  .init = init,
401  .onevent = onevent
402 };
+
int hideWindow(afb_req_t request)
+ +
static void showWindow(afb_req_t request)
Definition: homescreen.cpp:194
+
static void on_screen_reply(afb_req_t request)
Definition: homescreen.cpp:113
+
int subscribe(afb_req_t request)
+
int tap_shortcut(afb_req_t request)
+
static void on_screen_message(afb_req_t request)
Definition: homescreen.cpp:85
+
const afb_binding_t afbBindingExport
Definition: homescreen.cpp:394
+
static void subscribe(afb_req_t request)
Definition: homescreen.cpp:140
+ +
const char _reply_message[]
Definition: homescreen.cpp:30
+
static void unsubscribe(afb_req_t request)
Definition: homescreen.cpp:167
+
int on_screen_reply(afb_req_t request)
+
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
static const afb_verb_t verbs[]
Definition: homescreen.cpp:326
+
int showWindow(afb_req_t request)
+
static void showInformation(afb_req_t request)
Definition: homescreen.cpp:306
+
static void pingSample(afb_req_t request)
Definition: homescreen.cpp:38
+
static void onevent(afb_api_t api, const char *event, struct json_object *object)
Definition: homescreen.cpp:389
+
int unsubscribe(afb_req_t request)
+
const char _error[]
Definition: homescreen.cpp:27
+
int replyShowWindow(afb_req_t request)
+ +
static void hideWindow(afb_req_t request)
Definition: homescreen.cpp:221
+
static HS_ClientManager * g_client_manager
Definition: homescreen.cpp:32
+
const char _display_message[]
Definition: homescreen.cpp:29
+
static HS_ClientManager * instance(void)
+ +
int showInformation(afb_req_t request)
+
static void replyShowWindow(afb_req_t request)
Definition: homescreen.cpp:248
+
static void showNotification(afb_req_t request)
Definition: homescreen.cpp:277
+
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: hs-helper.cpp:207
+
static int preinit(afb_api_t api)
Definition: homescreen.cpp:352
+
int on_screen_message(afb_req_t request)
+
const char _application_id[]
Definition: homescreen.cpp:28
+
int showNotification(afb_req_t request)
+
static void tap_shortcut(afb_req_t request)
Definition: homescreen.cpp:58
+
static int init(afb_api_t api)
Definition: homescreen.cpp:368
+
+ + + + diff --git a/doc/api-ref/html/d6/de3/structwindow.html b/doc/api-ref/html/d6/de3/structwindow.html new file mode 100644 index 0000000..76f755f --- /dev/null +++ b/doc/api-ref/html/d6/de3/structwindow.html @@ -0,0 +1,381 @@ + + + + + + +HomeScreenBinding: window Struct Reference + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ +
+
+ +
+
window Struct Reference
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Attributes

struct displaydisplay
 
struct geometry geometry window_size
 
struct {
   GLuint   rotation_uniform
 
   GLuint   pos
 
   GLuint   col
 
gl
 
uint32_t benchmark_time
 
uint32_t frames
 
struct wl_egl_window * native
 
struct wl_surface * surface
 
struct ivi_surface * ivi_surface
 
EGLSurface egl_surface
 
struct wl_callback * callback
 
int fullscreen
 
int opaque
 
int buffer_size
 
int frame_sync
 
+

Detailed Description

+
+

Definition at line 136 of file simple-egl.cpp.

+

Member Data Documentation

+ +
+
+ + + + +
uint32_t window::benchmark_time
+
+ +

Definition at line 145 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
int window::buffer_size
+
+ +

Definition at line 151 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
struct wl_callback* window::callback
+
+ +

Definition at line 150 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
GLuint window::col
+
+ +

Definition at line 142 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
struct display* window::display
+
+ +

Definition at line 137 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
EGLSurface window::egl_surface
+
+ +

Definition at line 149 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
int window::frame_sync
+
+ +

Definition at line 151 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
uint32_t window::frames
+
+ +

Definition at line 145 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
int window::fullscreen
+
+ +

Definition at line 151 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
struct { ... } window::gl
+
+ +
+
+ +
+
+ + + + +
struct ivi_surface* window::ivi_surface
+
+ +

Definition at line 148 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
struct wl_egl_window* window::native
+
+ +

Definition at line 146 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
int window::opaque
+
+ +

Definition at line 151 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
GLuint window::pos
+
+ +

Definition at line 141 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
GLuint window::rotation_uniform
+
+ +

Definition at line 140 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
struct wl_surface* window::surface
+
+ +

Definition at line 147 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
struct geometry geometry window::window_size
+
+ +

Definition at line 138 of file simple-egl.cpp.

+ +
+
+
The documentation for this struct was generated from the following file: +
+ + + + diff --git a/doc/api-ref/html/d6/df5/structdisplay.html b/doc/api-ref/html/d6/df5/structdisplay.html new file mode 100644 index 0000000..3fee795 --- /dev/null +++ b/doc/api-ref/html/d6/df5/structdisplay.html @@ -0,0 +1,285 @@ + + + + + + +HomeScreenBinding: display Struct Reference + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ +
+
+ +
+
display Struct Reference
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Attributes

struct wl_display * display
 
struct wl_registry * registry
 
struct wl_compositor * compositor
 
struct wl_seat * seat
 
struct {
   EGLDisplay   dpy
 
   EGLContext   ctx
 
   EGLConfig   conf
 
egl
 
struct windowwindow
 
struct ivi_application * ivi_application
 
PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC swap_buffers_with_damage
 
+

Detailed Description

+
+

Definition at line 116 of file simple-egl.cpp.

+

Member Data Documentation

+ +
+
+ + + + +
struct wl_compositor* display::compositor
+
+ +

Definition at line 119 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
EGLConfig display::conf
+
+ +

Definition at line 124 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
EGLContext display::ctx
+
+ +

Definition at line 123 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
struct wl_display* display::display
+
+ +

Definition at line 117 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
EGLDisplay display::dpy
+
+ +

Definition at line 122 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
struct { ... } display::egl
+
+ +
+
+ +
+
+ + + + +
struct ivi_application* display::ivi_application
+
+ +

Definition at line 127 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
struct wl_registry* display::registry
+
+ +

Definition at line 118 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
struct wl_seat* display::seat
+
+ +

Definition at line 120 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC display::swap_buffers_with_damage
+
+ +

Definition at line 129 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
struct window* display::window
+
+ +

Definition at line 126 of file simple-egl.cpp.

+ +
+
+
The documentation for this struct was generated from the following file: +
+ + + + diff --git a/doc/api-ref/html/d6/dff/src_2hmi-debug_8h.html b/doc/api-ref/html/d6/dff/src_2hmi-debug_8h.html new file mode 100644 index 0000000..a229503 --- /dev/null +++ b/doc/api-ref/html/d6/dff/src_2hmi-debug_8h.html @@ -0,0 +1,490 @@ + + + + + + +HomeScreenBinding: src/hmi-debug.h File Reference + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ + +
+
+ +
+
hmi-debug.h File Reference
+
+
+
#include <time.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + + +

+Macros

#define __FILENAME__   (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
 
#define HMI_ERROR(prefix, args, ...)   _HMI_LOG(LOG_LEVEL_ERROR, __FILENAME__, __FUNCTION__, __LINE__, prefix, args, ##__VA_ARGS__)
 
#define HMI_WARNING(prefix, args, ...)   _HMI_LOG(LOG_LEVEL_WARNING, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
 
#define HMI_NOTICE(prefix, args, ...)   _HMI_LOG(LOG_LEVEL_NOTICE, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
 
#define HMI_INFO(prefix, args, ...)   _HMI_LOG(LOG_LEVEL_INFO, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
 
#define HMI_DEBUG(prefix, args, ...)   _HMI_LOG(LOG_LEVEL_DEBUG, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
 
+ + + +

+Enumerations

enum  LOG_LEVEL {
+  LOG_LEVEL_NONE = 0, +LOG_LEVEL_ERROR, +LOG_LEVEL_WARNING, +LOG_LEVEL_NOTICE, +
+  LOG_LEVEL_INFO, +LOG_LEVEL_DEBUG, +LOG_LEVEL_MAX = LOG_LEVEL_DEBUG, +LOG_LEVEL_NONE = 0, +
+  LOG_LEVEL_ERROR, +LOG_LEVEL_WARNING, +LOG_LEVEL_NOTICE, +LOG_LEVEL_INFO, +
+  LOG_LEVEL_DEBUG, +LOG_LEVEL_MAX = LOG_LEVEL_DEBUG +
+ }
 
+ + + +

+Functions

static void _HMI_LOG (enum LOG_LEVEL level, const char *file, const char *func, const int line, const char *prefix, const char *log,...)
 
+ + + +

+Variables

static char ERROR_FLAG [6][20] = {"NONE", "ERROR", "WARNING", "NOTICE", "INFO", "DEBUG"}
 
+

Macro Definition Documentation

+ +
+
+ + + + +
#define __FILENAME__   (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
+
+ +

Definition at line 40 of file hmi-debug.h.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
#define HMI_DEBUG( prefix,
 args,
 ... 
)   _HMI_LOG(LOG_LEVEL_DEBUG, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
+
+ +

Definition at line 46 of file hmi-debug.h.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
#define HMI_ERROR( prefix,
 args,
 ... 
)   _HMI_LOG(LOG_LEVEL_ERROR, __FILENAME__, __FUNCTION__, __LINE__, prefix, args, ##__VA_ARGS__)
+
+ +

Definition at line 42 of file hmi-debug.h.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
#define HMI_INFO( prefix,
 args,
 ... 
)   _HMI_LOG(LOG_LEVEL_INFO, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
+
+ +

Definition at line 45 of file hmi-debug.h.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
#define HMI_NOTICE( prefix,
 args,
 ... 
)   _HMI_LOG(LOG_LEVEL_NOTICE, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
+
+ +

Definition at line 44 of file hmi-debug.h.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
#define HMI_WARNING( prefix,
 args,
 ... 
)   _HMI_LOG(LOG_LEVEL_WARNING, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
+
+ +

Definition at line 43 of file hmi-debug.h.

+ +
+
+

Enumeration Type Documentation

+ +
+
+ + + + +
enum LOG_LEVEL
+
+ + + + + + + + + + + + + + + +
Enumerator
LOG_LEVEL_NONE  +
LOG_LEVEL_ERROR  +
LOG_LEVEL_WARNING  +
LOG_LEVEL_NOTICE  +
LOG_LEVEL_INFO  +
LOG_LEVEL_DEBUG  +
LOG_LEVEL_MAX  +
LOG_LEVEL_NONE  +
LOG_LEVEL_ERROR  +
LOG_LEVEL_WARNING  +
LOG_LEVEL_NOTICE  +
LOG_LEVEL_INFO  +
LOG_LEVEL_DEBUG  +
LOG_LEVEL_MAX  +
+ +

Definition at line 30 of file hmi-debug.h.

+ +
+
+

Function Documentation

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static void _HMI_LOG (enum LOG_LEVEL level,
const char * file,
const char * func,
const int line,
const char * prefix,
const char * log,
 ... 
)
+
+static
+
+ +

Definition at line 50 of file hmi-debug.h.

+
51 {
52  const int log_level = (getenv("USE_HMI_DEBUG") == NULL)?LOG_LEVEL_ERROR:atoi(getenv("USE_HMI_DEBUG"));
53  if(log_level < level)
54  {
55  return;
56  }
57 
58  char *message;
59  struct timespec tp;
60  unsigned int time;
61 
62  clock_gettime(CLOCK_REALTIME, &tp);
63  time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
64 
65  va_list args;
66  va_start(args, log);
67  if (log == NULL || vasprintf(&message, log, args) < 0)
68  message = NULL;
69  fprintf(stderr, "[%10.3f] [%s %s] [%s, %s(), Line:%d] >>> %s \n", time / 1000.0, prefix, ERROR_FLAG[level], file, func, line, message);
70  va_end(args);
71  free(message);
72 }
static char ERROR_FLAG[6][20]
Definition: hmi-debug.h:48
+ +
+
+
+

Variable Documentation

+ +
+
+ + + + + +
+ + + + +
char ERROR_FLAG[6][20] = {"NONE", "ERROR", "WARNING", "NOTICE", "INFO", "DEBUG"}
+
+static
+
+ +

Definition at line 48 of file hmi-debug.h.

+ +
+
+
+ + + + diff --git a/doc/api-ref/html/d6/dff/src_2hmi-debug_8h_source.html b/doc/api-ref/html/d6/dff/src_2hmi-debug_8h_source.html new file mode 100644 index 0000000..d4cd670 --- /dev/null +++ b/doc/api-ref/html/d6/dff/src_2hmi-debug_8h_source.html @@ -0,0 +1,109 @@ + + + + + + +HomeScreenBinding: src/hmi-debug.h Source File + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ + +
+
+
+
hmi-debug.h
+
+
+Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __HMI_DEBUG_H__
18 #define __HMI_DEBUG_H__
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 #include <time.h>
25 #include <stdio.h>
26 #include <stdarg.h>
27 #include <string.h>
28 #include <stdlib.h>
29 
30 enum LOG_LEVEL{
38 };
39 
40 #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
41 
42 #define HMI_ERROR(prefix, args,...) _HMI_LOG(LOG_LEVEL_ERROR, __FILENAME__, __FUNCTION__, __LINE__, prefix, args, ##__VA_ARGS__)
43 #define HMI_WARNING(prefix, args,...) _HMI_LOG(LOG_LEVEL_WARNING, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
44 #define HMI_NOTICE(prefix, args,...) _HMI_LOG(LOG_LEVEL_NOTICE, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
45 #define HMI_INFO(prefix, args,...) _HMI_LOG(LOG_LEVEL_INFO, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
46 #define HMI_DEBUG(prefix, args,...) _HMI_LOG(LOG_LEVEL_DEBUG, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
47 
48 static char ERROR_FLAG[6][20] = {"NONE", "ERROR", "WARNING", "NOTICE", "INFO", "DEBUG"};
49 
50 static void _HMI_LOG(enum LOG_LEVEL level, const char* file, const char* func, const int line, const char* prefix, const char* log, ...)
51 {
52  const int log_level = (getenv("USE_HMI_DEBUG") == NULL)?LOG_LEVEL_ERROR:atoi(getenv("USE_HMI_DEBUG"));
53  if(log_level < level)
54  {
55  return;
56  }
57 
58  char *message;
59  struct timespec tp;
60  unsigned int time;
61 
62  clock_gettime(CLOCK_REALTIME, &tp);
63  time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
64 
65  va_list args;
66  va_start(args, log);
67  if (log == NULL || vasprintf(&message, log, args) < 0)
68  message = NULL;
69  fprintf(stderr, "[%10.3f] [%s %s] [%s, %s(), Line:%d] >>> %s \n", time / 1000.0, prefix, ERROR_FLAG[level], file, func, line, message);
70  va_end(args);
71  free(message);
72 }
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 #endif //__HMI_DEBUG_H__
+
static void _HMI_LOG(enum LOG_LEVEL level, const char *file, const char *func, const int line, const char *prefix, const char *log,...)
Definition: hmi-debug.h:50
+
LOG_LEVEL
Definition: hmi-debug.h:26
+
static char ERROR_FLAG[6][20]
Definition: hmi-debug.h:48
+ + + + + + +
+ + + + diff --git a/doc/api-ref/html/d7/df4/class_lib_home_screen-members.html b/doc/api-ref/html/d7/df4/class_lib_home_screen-members.html index 6171ad9..047f900 100644 --- a/doc/api-ref/html/d7/df4/class_lib_home_screen-members.html +++ b/doc/api-ref/html/d7/df4/class_lib_home_screen-members.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: Member List @@ -12,6 +11,9 @@ + @@ -29,19 +31,40 @@
- + - - - - + +
This is the complete list of members for LibHomeScreen, including all inherited members.

+ + + + + + - - - - - - + + + + + + + + + + + + @@ -85,9 +120,13 @@ $(function() { - + + + + + - +
_areaFullScreenLibHomeScreen
_areaNormalLibHomeScreen
_areaSplitMainLibHomeScreen
_areaSplitSubLibHomeScreen
_keyAreaLibHomeScreen
_keyParameterLibHomeScreen
api_listLibHomeScreenstatic
call(const std::string &verb, struct json_object *arg)LibHomeScreen
call(const char *verb, struct json_object *arg)LibHomeScreen
event_listLibHomeScreenstatic
Event_OnScreenMessage enum valueLibHomeScreen
Event_OnScreenReply enum valueLibHomeScreen
Event_TapShortcut enum valueLibHomeScreen
EventType enum nameLibHomeScreen
handler_func typedefLibHomeScreen
Event_HideWindow enum valueLibHomeScreen
event_listLibHomeScreenstatic
Event_OnScreenMessage enum valueLibHomeScreen
Event_OnScreenReply enum valueLibHomeScreen
Event_ReplyShowWindow enum valueLibHomeScreen
Event_ShowInformation enum valueLibHomeScreen
Event_ShowNotification enum valueLibHomeScreen
Event_ShowWindow enum valueLibHomeScreen
Event_TapShortcut enum valueLibHomeScreen
EventType enum nameLibHomeScreen
handler_func typedefLibHomeScreen
hideWindow(const char *application_id)LibHomeScreen
init(const int port, const std::string &token)LibHomeScreen
LibHomeScreen()LibHomeScreen
LibHomeScreen(const LibHomeScreen &)=deleteLibHomeScreen
onScreenReply(const char *reply_message)LibHomeScreen
operator=(const LibHomeScreen &)=deleteLibHomeScreen
registerCallback(void(*event_cb)(const std::string &event, struct json_object *event_contents), void(*reply_cb)(struct json_object *reply_contents), void(*hangup_cb)(void)=nullptr)LibHomeScreen
set_event_handler(enum EventType et, handler_func f)LibHomeScreen
replyShowWindow(const char *application_id, json_object *json)LibHomeScreen
set_event_handler(enum EventType et, handler_func f)LibHomeScreen
showInformation(json_object *json)LibHomeScreen
showNotification(json_object *json)LibHomeScreen
showWindow(const char *application_id, json_object *json)LibHomeScreen
subscribe(const std::string &event_name)LibHomeScreen
tapShortcut(const char *application_name)LibHomeScreen
tapShortcut(const char *application_id)LibHomeScreen
unsubscribe(const std::string &event_name)LibHomeScreen
~LibHomeScreen()LibHomeScreen
@@ -95,7 +134,7 @@ $(function() { diff --git a/doc/api-ref/html/d8/d55/hs-client_8cpp.html b/doc/api-ref/html/d8/d55/hs-client_8cpp.html new file mode 100644 index 0000000..1c0887c --- /dev/null +++ b/doc/api-ref/html/d8/d55/hs-client_8cpp.html @@ -0,0 +1,255 @@ + + + + + + +HomeScreenBinding: src/hs-client.cpp File Reference + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ + +
+
+ +
+
hs-client.cpp File Reference
+
+
+
#include "hs-client.h"
+#include "hs-helper.h"
+#include "hmi-debug.h"
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + + +

+Variables

static const char _type [] = "type"
 
static const char _text [] = "text"
 
static const char _info [] = "info"
 
static const char _icon [] = "icon"
 
static const char _parameter [] = "parameter"
 
static const char _replyto [] = "replyto"
 
+

Variable Documentation

+ +
+
+ + + + + +
+ + + + +
const char _icon[] = "icon"
+
+static
+
+ +

Definition at line 24 of file hs-client.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const char _info[] = "info"
+
+static
+
+ +

Definition at line 23 of file hs-client.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const char _parameter[] = "parameter"
+
+static
+
+ +

Definition at line 25 of file hs-client.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const char _replyto[] = "replyto"
+
+static
+
+ +

Definition at line 26 of file hs-client.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const char _text[] = "text"
+
+static
+
+ +

Definition at line 22 of file hs-client.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const char _type[] = "type"
+
+static
+
+ +

Definition at line 21 of file hs-client.cpp.

+ +
+
+
+ + + + diff --git a/doc/api-ref/html/d8/d55/hs-client_8cpp_source.html b/doc/api-ref/html/d8/d55/hs-client_8cpp_source.html new file mode 100644 index 0000000..8243a1d --- /dev/null +++ b/doc/api-ref/html/d8/d55/hs-client_8cpp_source.html @@ -0,0 +1,129 @@ + + + + + + +HomeScreenBinding: src/hs-client.cpp Source File + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ + +
+
+
+
hs-client.cpp
+
+
+Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 TOYOTA MOTOR CORPORATION
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "hs-client.h"
18 #include "hs-helper.h"
19 #include "hmi-debug.h"
20 
21 static const char _type[] = "type";
22 static const char _text[] = "text";
23 static const char _info[] = "info";
24 static const char _icon[] = "icon";
25 static const char _parameter[] = "parameter";
26 static const char _replyto[] = "replyto";
27 
38 HS_Client::HS_Client(afb_req_t request, std::string id) : my_id(id)
39 {
40  HMI_NOTICE("homescreen-service","called.");
41  my_event = afb_api_make_event(request->api, id.c_str());
42 }
43 
55 {
56  HMI_NOTICE("homescreen-service","called.");
57  afb_event_unref(my_event);
58 }
59 
70 int HS_Client::tap_shortcut(const char* appid)
71 {
72  if(!checkEvent(__FUNCTION__))
73  return 0;
74 
75  HMI_NOTICE("homescreen-service","%s application_id = %s.", __FUNCTION__, appid);
76  struct json_object* push_obj = json_object_new_object();
78  _type, __FUNCTION__);
79  afb_event_push(my_event, push_obj);
80  return 0;
81 }
82 
93 int HS_Client::on_screen_message(afb_req_t request, const char* message)
94 {
95  if(!checkEvent(__FUNCTION__))
96  return 0;
97 
98  HMI_NOTICE("homescreen-service","push %s event message [%s].", __FUNCTION__, message);
99  struct json_object* push_obj = json_object_new_object();
100  hs_add_object_to_json_object_str( push_obj, 4, _display_message, message,
101  _type, __FUNCTION__);
102  afb_event_push(my_event, push_obj);
103  return 0;
104 }
105 
116 int HS_Client::on_screen_reply(afb_req_t request, const char* message)
117 {
118  if(!checkEvent(__FUNCTION__))
119  return 0;
120 
121  HMI_NOTICE("homescreen-service","push %s event message [%s].", __FUNCTION__, message);
122  struct json_object* push_obj = json_object_new_object();
123  hs_add_object_to_json_object_str( push_obj, 4, _reply_message, message,
124  _type, __FUNCTION__);
125  afb_event_push(my_event, push_obj);
126  return 0;
127 }
128 
139 int HS_Client::subscribe(afb_req_t request, const char* event)
140 {
141  int ret = 0;
142  auto ip = event_list.find(std::string(event));
143  if(ip == event_list.end()) {
144  event_list[std::string(event)] = 0;
145  }
146  if(!subscription) {
147  ret = afb_req_subscribe(request, my_event);
148  if(ret == 0) {
149  subscription = true;
150  }
151  }
152  return ret;
153 }
154 
165 int HS_Client::unsubscribe(afb_req_t request, const char* event)
166 {
167  int ret = 0;
168  event_list.erase(std::string(event));
169  if(event_list.empty()) {
170  ret = afb_req_unsubscribe(request, my_event);
171  }
172  return ret;
173 }
174 
186 bool HS_Client::checkEvent(const char* event)
187 {
188  auto ip = event_list.find(std::string(event));
189  if(ip == event_list.end())
190  return false;
191  else
192  return true;
193 }
194 
209 int HS_Client::showWindow(afb_req_t request, const char* appid)
210 {
211  if(!checkEvent(__FUNCTION__))
212  return 0;
213 
214  HMI_NOTICE("homescreen-service","%s application_id = %s.", __FUNCTION__, appid);
215  struct json_object* push_obj = json_object_new_object();
216  hs_add_object_to_json_object_str( push_obj, 4, _application_id, appid, _type, __FUNCTION__);
217  const char* param = afb_req_value(request, _parameter);
218  if(param) {
219  const char* req_appid = afb_req_get_application_id(request);
220  struct json_object* param_obj = json_tokener_parse(param);
221  json_object_object_add(param_obj, _replyto, json_object_new_string(req_appid));
222  json_object_object_add(push_obj, _parameter, param_obj);
223  }
224  else {
225  HMI_ERROR("homescreen-service","please input correct parameter.");
226  return AFB_EVENT_BAD_REQUEST;
227  }
228  afb_event_push(my_event, push_obj);
229  return 0;
230 }
231 
245 int HS_Client::hideWindow(afb_req_t request)
246 {
247  if(!checkEvent(__FUNCTION__))
248  return 0;
249 
250  HMI_NOTICE("homescreen-service","%s application_id = %s.", __FUNCTION__);
251  const char* req_appid = afb_req_get_application_id(request);
252  struct json_object* push_obj = json_object_new_object();
253  hs_add_object_to_json_object_str( push_obj, 4, _application_id, req_appid,
254  _type, __FUNCTION__);
255  afb_event_push(my_event, push_obj);
256  return 0;
257 }
258 
273 int HS_Client::replyShowWindow(afb_req_t request, const char* appid)
274 {
275  if(!checkEvent(__FUNCTION__))
276  return 0;
277 
278  HMI_NOTICE("homescreen-service","%s application_id = %s.", __FUNCTION__, appid);
279  struct json_object* push_obj = json_object_new_object();
280  hs_add_object_to_json_object_str( push_obj, 4, _application_id, appid, _type, __FUNCTION__);
281  const char* param = afb_req_value(request, _parameter);
282  if(param) {
283  json_object_object_add(push_obj, _parameter, json_tokener_parse(param));
284  }
285  else {
286  HMI_ERROR("homescreen-service","please input correct parameter.");
287  return AFB_EVENT_BAD_REQUEST;
288  }
289 
290  afb_event_push(my_event, push_obj);
291  return 0;
292 }
293 
307 int HS_Client::showNotification(afb_req_t request)
308 {
309  int ret = 0;
310  const char *value = afb_req_value(request, _text);
311  if(value) {
312  HMI_NOTICE("homescreen-service","text is %s", value);
313  const char* appid = afb_req_get_application_id(request);
314  struct json_object* param_obj = json_object_new_object();
315  const char *icon = afb_req_value(request, _icon);
316  if(icon) {
317  json_object_object_add(param_obj, _icon, json_object_new_string(icon));
318  json_object_object_add(param_obj, _text, json_object_new_string(value));
319  struct json_object* push_obj = json_object_new_object();
320  hs_add_object_to_json_object_str( push_obj, 4, _application_id, appid, _type, __FUNCTION__);
321  json_object_object_add(push_obj, _parameter, param_obj);
322  afb_event_push(my_event, push_obj);
323  }
324  else {
325  HMI_NOTICE("homescreen-service","please input icon.");
327  }
328  }
329  else {
330  HMI_NOTICE("homescreen-service","please input text.");
332  }
333 
334  return ret;
335 }
336 
350 int HS_Client::showInformation(afb_req_t request)
351 {
352  int ret = 0;
353  const char *value = afb_req_value(request, _info);
354  if(value) {
355  HMI_NOTICE("homescreen-service","info is %s", value);
356  const char* appid = afb_req_get_application_id(request);
357  struct json_object* param_obj = json_object_new_object();
358  json_object_object_add(param_obj, _info, json_object_new_string(value));
359  struct json_object* push_obj = json_object_new_object();
360  hs_add_object_to_json_object_str( push_obj, 4, _application_id, appid, _type, __FUNCTION__);
361  json_object_object_add(push_obj, _parameter, param_obj);
362  afb_event_push(my_event, push_obj);
363  }
364  else {
365  HMI_NOTICE("homescreen-service","please input information.");
367  }
368 
369  return ret;
370 }
int subscribe(afb_req_t request, const char *event)
Definition: hs-client.cpp:139
+
static const char _text[]
Definition: hs-client.cpp:22
+
#define AFB_REQ_SHOWNOTIFICATION_ERROR
Definition: hs-helper.h:26
+
HS_Client(afb_req_t request, const char *id)
Definition: hs-client.h:27
+ +
const char _reply_message[]
Definition: homescreen.cpp:30
+
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
int replyShowWindow(afb_req_t request, const char *appid)
Definition: hs-client.cpp:273
+
int on_screen_message(afb_req_t request, const char *message)
Definition: hs-client.cpp:93
+
int showInformation(afb_req_t request)
Definition: hs-client.cpp:350
+
static const char _parameter[]
Definition: hs-client.cpp:25
+
int on_screen_reply(afb_req_t request, const char *message)
Definition: hs-client.cpp:116
+ +
int unsubscribe(afb_req_t request, const char *event)
Definition: hs-client.cpp:165
+
static const char _type[]
Definition: hs-client.cpp:21
+
int showNotification(afb_req_t request)
Definition: hs-client.cpp:307
+ +
void hs_add_object_to_json_object_str(struct json_object *j_obj, int count,...)
Definition: hs-helper.cpp:180
+
const char _display_message[]
Definition: homescreen.cpp:29
+
static const char _icon[]
Definition: hs-client.cpp:24
+
int showWindow(afb_req_t request, const char *appid)
Definition: hs-client.cpp:209
+
int hideWindow(afb_req_t request)
Definition: hs-client.cpp:245
+ +
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:38
+
static const char _replyto[]
Definition: hs-client.cpp:26
+
static const char _info[]
Definition: hs-client.cpp:23
+
const char _application_id[]
Definition: homescreen.cpp:28
+
#define AFB_EVENT_BAD_REQUEST
Definition: hs-helper.h:23
+
int tap_shortcut(const char *appid)
Definition: hs-client.cpp:70
+
#define AFB_REQ_SHOWINFORMATION_ERROR
Definition: hs-helper.h:27
+
+ + + + diff --git a/doc/api-ref/html/da/dd3/hs-client_8h.html b/doc/api-ref/html/da/dd3/hs-client_8h.html new file mode 100644 index 0000000..3759dbb --- /dev/null +++ b/doc/api-ref/html/da/dd3/hs-client_8h.html @@ -0,0 +1,112 @@ + + + + + + +HomeScreenBinding: src/hs-client.h File Reference + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ + +
+
+ +
+
hs-client.h File Reference
+
+
+
#include <string>
+#include <unordered_map>
+#include "hs-helper.h"
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  HS_Client
 
+
+ + + + diff --git a/doc/api-ref/html/da/dd3/hs-client_8h_source.html b/doc/api-ref/html/da/dd3/hs-client_8h_source.html new file mode 100644 index 0000000..84f0d3e --- /dev/null +++ b/doc/api-ref/html/da/dd3/hs-client_8h_source.html @@ -0,0 +1,115 @@ + + + + + + +HomeScreenBinding: src/hs-client.h Source File + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ + +
+
+
+
hs-client.h
+
+
+Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 TOYOTA MOTOR CORPORATION
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef HOMESCREEN_CLIENT_H
18 #define HOMESCREEN_CLIENT_H
19 
20 #include <string>
21 #include <unordered_map>
22 #include "hs-helper.h"
23 
24 
25 class HS_Client {
26 public:
27  HS_Client(afb_req_t request, const char* id) : HS_Client(request, std::string(id)){}
28  HS_Client(afb_req_t request, std::string id);
29  HS_Client(HS_Client&) = delete;
30  HS_Client &operator=(HS_Client&) = delete;
31  ~HS_Client();
32 
33  int tap_shortcut(const char* appid);
34  int showWindow(afb_req_t request, const char* appid);
35  int hideWindow(afb_req_t request);
36  int replyShowWindow(afb_req_t request, const char* appid);
37  int on_screen_message (afb_req_t request, const char* message);
38  int on_screen_reply (afb_req_t request, const char* message);
39  int subscribe(afb_req_t request, const char* event);
40  int unsubscribe(afb_req_t request, const char* event);
41  int showNotification(afb_req_t request);
42  int showInformation(afb_req_t request);
43 
44 private:
45  bool checkEvent(const char* event);
46 
47 private:
48  std::string my_id;
49  afb_event_t my_event;
50  bool subscription = false;
51  std::unordered_map<std::string, int> event_list;
52 
53 };
54 
55 #endif // HOMESCREEN_CLIENT_H
int subscribe(afb_req_t request, const char *event)
Definition: hs-client.cpp:139
+
HS_Client & operator=(HS_Client &)=delete
+
HS_Client(afb_req_t request, const char *id)
Definition: hs-client.h:27
+ + + +
int replyShowWindow(afb_req_t request, const char *appid)
Definition: hs-client.cpp:273
+
int on_screen_message(afb_req_t request, const char *message)
Definition: hs-client.cpp:93
+
int showInformation(afb_req_t request)
Definition: hs-client.cpp:350
+
int on_screen_reply(afb_req_t request, const char *message)
Definition: hs-client.cpp:116
+
int unsubscribe(afb_req_t request, const char *event)
Definition: hs-client.cpp:165
+
int showNotification(afb_req_t request)
Definition: hs-client.cpp:307
+ +
int showWindow(afb_req_t request, const char *appid)
Definition: hs-client.cpp:209
+
int hideWindow(afb_req_t request)
Definition: hs-client.cpp:245
+
int tap_shortcut(const char *appid)
Definition: hs-client.cpp:70
+
+ + + + diff --git a/doc/api-ref/html/dd/d86/structevent-members.html b/doc/api-ref/html/db/dcb/structgeometry-members.html similarity index 52% rename from doc/api-ref/html/dd/d86/structevent-members.html rename to doc/api-ref/html/db/dcb/structgeometry-members.html index 8f15215..b5fb3cc 100644 --- a/doc/api-ref/html/dd/d86/structevent-members.html +++ b/doc/api-ref/html/db/dcb/structgeometry-members.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: Member List @@ -12,6 +11,9 @@ + @@ -29,19 +31,40 @@
- + - - - - + +
-
event Member List
+
geometry Member List
-

This is the complete list of members for event, including all inherited members.

+

This is the complete list of members for geometry, including all inherited members.

- - + +
eventevent
nameevent
heightgeometry
widthgeometry
diff --git a/doc/api-ref/html/dd/d1d/hs-helper_8c.html b/doc/api-ref/html/dd/d1d/hs-helper_8c.html deleted file mode 100644 index ce8d1bd..0000000 --- a/doc/api-ref/html/dd/d1d/hs-helper_8c.html +++ /dev/null @@ -1,361 +0,0 @@ - - - - - - - -HomeScreenBinding: src/hs-helper.c File Reference - - - - - - - - - -
-
- - - - - - -
-
HomeScreenBinding -
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
- -
-
hs-helper.c File Reference
-
-
-
#include "hs-helper.h"
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <json-c/json.h>
-#include <stdarg.h>
-
-

Go to the source code of this file.

- - - - - - - - - - - - - - - - -

-Functions

REQ_ERROR get_value_uint16 (const struct afb_req request, const char *source, uint16_t *out_id)
 
REQ_ERROR get_value_int16 (const struct afb_req request, const char *source, int16_t *out_id)
 
REQ_ERROR get_value_int32 (const struct afb_req request, const char *source, int32_t *out_id)
 
void hs_add_object_to_json_object (struct json_object *j_obj, int count,...)
 
void hs_add_object_to_json_object_str (struct json_object *j_obj, int count,...)
 
void hs_add_object_to_json_object_func (struct json_object *j_obj, const char *verb_name, int count,...)
 
int hs_search_event_name_index (const char *value)
 
-

Function Documentation

- -

◆ get_value_int16()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
REQ_ERROR get_value_int16 (const struct afb_req request,
const char * source,
int16_t * out_id 
)
-
- -

Definition at line 48 of file hs-helper.c.

-
49 {
50  char* endptr;
51  const char* tmp = afb_req_value (request, source);
52  if(!tmp)
53  {
54  return REQ_FAIL;
55  }
56  long tmp_id = strtol(tmp,&endptr,10);
57 
58  /* error check of range */
59  if( (tmp_id > INT16_MAX) || (tmp_id < INT16_MIN) )
60  {
61  return OUT_RANGE;
62  }
63  if(*endptr != '\0')
64  {
65  return NOT_NUMBER;
66  }
67 
68  *out_id = (int16_t)tmp_id;
69  return REQ_OK;
70 }
- - - -
-
-
- -

◆ get_value_int32()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
REQ_ERROR get_value_int32 (const struct afb_req request,
const char * source,
int32_t * out_id 
)
-
- -

Definition at line 72 of file hs-helper.c.

-
73 {
74  char* endptr;
75  const char* tmp = afb_req_value (request, source);
76  if(!tmp)
77  {
78  return REQ_FAIL;
79  }
80  long tmp_id = strtol(tmp,&endptr,10);
81 
82  /* error check of range */
83  if( (tmp_id > INT32_MAX) || (tmp_id < INT32_MIN) )
84  {
85  return OUT_RANGE;
86  }
87  if(*endptr != '\0')
88  {
89  return NOT_NUMBER;
90  }
91 
92  *out_id = (int32_t)tmp_id;
93  return REQ_OK;
94 }
- - - -
-
-
- -

◆ get_value_uint16()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
REQ_ERROR get_value_uint16 (const struct afb_req request,
const char * source,
uint16_t * out_id 
)
-
- -

Definition at line 24 of file hs-helper.c.

-
25 {
26  char* endptr;
27  const char* tmp = afb_req_value (request, source);
28  if(!tmp)
29  {
30  return REQ_FAIL;
31  }
32  long tmp_id = strtol(tmp,&endptr,10);
33 
34  /* error check of range */
35  if( (tmp_id > UINT16_MAX) || (tmp_id < 0) )
36  {
37  return OUT_RANGE;
38  }
39  if(*endptr != '\0')
40  {
41  return NOT_NUMBER;
42  }
43 
44  *out_id = (uint16_t)tmp_id;
45  return REQ_OK;
46 }
- - - -
-
-
- -

◆ hs_add_object_to_json_object()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
void hs_add_object_to_json_object (struct json_object * j_obj,
int count,
 ... 
)
-
- -

Definition at line 96 of file hs-helper.c.

-
97 {
98  va_list args;
99  va_start(args, count);
100  for(int i = 0; i < count; ++i )
101  {
102  char *key = va_arg(args, char*);
103  int value = va_arg(args, int);
104  json_object_object_add(j_obj, key, json_object_new_int((int32_t)value));
105  ++i;
106  }
107  va_end(args);
108 }
-
-
- -

◆ hs_add_object_to_json_object_func()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void hs_add_object_to_json_object_func (struct json_object * j_obj,
const char * verb_name,
int count,
 ... 
)
-
- -

Definition at line 125 of file hs-helper.c.

-
126 {
127  va_list args;
128  va_start(args, count);
129 
130  json_object_object_add(j_obj,"verb", json_object_new_string(verb_name));
131 
132  for(int i = 0; i < count; ++i )
133  {
134  char *key = va_arg(args, char*);
135  int value = va_arg(args, int);
136  json_object_object_add(j_obj, key, json_object_new_int((int32_t)value));
137  ++i;
138  }
139  va_end(args);
140 }
-
-
- -

◆ hs_add_object_to_json_object_str()

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
void hs_add_object_to_json_object_str (struct json_object * j_obj,
int count,
 ... 
)
-
- -

Definition at line 110 of file hs-helper.c.

-
111 {
112  va_list args;
113  va_start(args, count);
114  for(int i = 0; i < count; ++i )
115  {
116  char *key = va_arg(args, char*);
117  char *value = va_arg(args, char*);
118  json_object_object_add(j_obj, key, json_object_new_string(value));
119  ++i;
120  }
121  va_end(args);
122 }
-
-
- -

◆ hs_search_event_name_index()

- -
-
- - - - - - - - -
int hs_search_event_name_index (const char * value)
-
- -

Definition at line 142 of file hs-helper.c.

-
143 {
144  size_t buf_size = 50;
145  size_t size = sizeof evlist / sizeof *evlist;
146  int ret = -1;
147  for(size_t i = 0 ; i < size ; ++i)
148  {
149  if(!strncmp(value, evlist[i], buf_size))
150  {
151  ret = i;
152  break;
153  }
154  }
155  return ret;
156 }
static const char * evlist[]
Definition: hs-helper.h:34
-
-
-
-
- - - - diff --git a/doc/api-ref/html/dd/d1d/hs-helper_8c_source.html b/doc/api-ref/html/dd/d1d/hs-helper_8c_source.html deleted file mode 100644 index 792ec9d..0000000 --- a/doc/api-ref/html/dd/d1d/hs-helper_8c_source.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - -HomeScreenBinding: src/hs-helper.c Source File - - - - - - - - - -
-
- - - - - - -
-
HomeScreenBinding -
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
-
-
hs-helper.c
-
-
-Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "hs-helper.h"
18 #include <stdlib.h>
19 #include <string.h>
20 #include <limits.h>
21 #include <json-c/json.h>
22 #include <stdarg.h>
23 
24 REQ_ERROR get_value_uint16(const struct afb_req request, const char *source, uint16_t *out_id)
25 {
26  char* endptr;
27  const char* tmp = afb_req_value (request, source);
28  if(!tmp)
29  {
30  return REQ_FAIL;
31  }
32  long tmp_id = strtol(tmp,&endptr,10);
33 
34  /* error check of range */
35  if( (tmp_id > UINT16_MAX) || (tmp_id < 0) )
36  {
37  return OUT_RANGE;
38  }
39  if(*endptr != '\0')
40  {
41  return NOT_NUMBER;
42  }
43 
44  *out_id = (uint16_t)tmp_id;
45  return REQ_OK;
46 }
47 
48 REQ_ERROR get_value_int16(const struct afb_req request, const char *source, int16_t *out_id)
49 {
50  char* endptr;
51  const char* tmp = afb_req_value (request, source);
52  if(!tmp)
53  {
54  return REQ_FAIL;
55  }
56  long tmp_id = strtol(tmp,&endptr,10);
57 
58  /* error check of range */
59  if( (tmp_id > INT16_MAX) || (tmp_id < INT16_MIN) )
60  {
61  return OUT_RANGE;
62  }
63  if(*endptr != '\0')
64  {
65  return NOT_NUMBER;
66  }
67 
68  *out_id = (int16_t)tmp_id;
69  return REQ_OK;
70 }
71 
72 REQ_ERROR get_value_int32(const struct afb_req request, const char *source, int32_t *out_id)
73 {
74  char* endptr;
75  const char* tmp = afb_req_value (request, source);
76  if(!tmp)
77  {
78  return REQ_FAIL;
79  }
80  long tmp_id = strtol(tmp,&endptr,10);
81 
82  /* error check of range */
83  if( (tmp_id > INT32_MAX) || (tmp_id < INT32_MIN) )
84  {
85  return OUT_RANGE;
86  }
87  if(*endptr != '\0')
88  {
89  return NOT_NUMBER;
90  }
91 
92  *out_id = (int32_t)tmp_id;
93  return REQ_OK;
94 }
95 
96 void hs_add_object_to_json_object(struct json_object* j_obj, int count,...)
97 {
98  va_list args;
99  va_start(args, count);
100  for(int i = 0; i < count; ++i )
101  {
102  char *key = va_arg(args, char*);
103  int value = va_arg(args, int);
104  json_object_object_add(j_obj, key, json_object_new_int((int32_t)value));
105  ++i;
106  }
107  va_end(args);
108 }
109 
110 void hs_add_object_to_json_object_str(struct json_object* j_obj, int count,...)
111 {
112  va_list args;
113  va_start(args, count);
114  for(int i = 0; i < count; ++i )
115  {
116  char *key = va_arg(args, char*);
117  char *value = va_arg(args, char*);
118  json_object_object_add(j_obj, key, json_object_new_string(value));
119  ++i;
120  }
121  va_end(args);
122 }
123 
124 
125 void hs_add_object_to_json_object_func(struct json_object* j_obj, const char* verb_name, int count, ...)
126 {
127  va_list args;
128  va_start(args, count);
129 
130  json_object_object_add(j_obj,"verb", json_object_new_string(verb_name));
131 
132  for(int i = 0; i < count; ++i )
133  {
134  char *key = va_arg(args, char*);
135  int value = va_arg(args, int);
136  json_object_object_add(j_obj, key, json_object_new_int((int32_t)value));
137  ++i;
138  }
139  va_end(args);
140 }
141 
142 int hs_search_event_name_index(const char* value)
143 {
144  size_t buf_size = 50;
145  size_t size = sizeof evlist / sizeof *evlist;
146  int ret = -1;
147  for(size_t i = 0 ; i < size ; ++i)
148  {
149  if(!strncmp(value, evlist[i], buf_size))
150  {
151  ret = i;
152  break;
153  }
154  }
155  return ret;
156 }
void hs_add_object_to_json_object_str(struct json_object *j_obj, int count,...)
Definition: hs-helper.c:110
- -
REQ_ERROR get_value_uint16(const struct afb_req request, const char *source, uint16_t *out_id)
Definition: hs-helper.c:24
-
static const char * evlist[]
Definition: hs-helper.h:34
- -
int hs_search_event_name_index(const char *value)
Definition: hs-helper.c:142
-
REQ_ERROR get_value_int16(const struct afb_req request, const char *source, int16_t *out_id)
Definition: hs-helper.c:48
- -
REQ_ERROR get_value_int32(const struct afb_req request, const char *source, int32_t *out_id)
Definition: hs-helper.c:72
- - -
REQ_ERROR
Definition: hs-helper.h:26
-
void hs_add_object_to_json_object(struct json_object *j_obj, int count,...)
Definition: hs-helper.c:96
-
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: hs-helper.c:125
-
- - - - diff --git a/doc/api-ref/html/dd/d30/hs-clientmanager_8cpp.html b/doc/api-ref/html/dd/d30/hs-clientmanager_8cpp.html new file mode 100644 index 0000000..2207299 --- /dev/null +++ b/doc/api-ref/html/dd/d30/hs-clientmanager_8cpp.html @@ -0,0 +1,170 @@ + + + + + + +HomeScreenBinding: src/hs-clientmanager.cpp File Reference + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ + +
+
+ +
+
hs-clientmanager.cpp File Reference
+
+
+
#include <algorithm>
+#include "hs-clientmanager.h"
+#include "hmi-debug.h"
+
+

Go to the source code of this file.

+ + + + +

+Functions

static void cbRemoveClientCtxt (void *data)
 
+ + + +

+Variables

static const char _homescreen [] = "homescreen"
 
+

Function Documentation

+ +
+
+ + + + + +
+ + + + + + + + +
static void cbRemoveClientCtxt (void * data)
+
+static
+
+ +

Definition at line 24 of file hs-clientmanager.cpp.

+
25 {
27 }
void removeClientCtxt(void *data)
+
static HS_ClientManager * instance(void)
+
+
+
+

Variable Documentation

+ +
+
+ + + + + +
+ + + + +
const char _homescreen[] = "homescreen"
+
+static
+
+ +

Definition at line 20 of file hs-clientmanager.cpp.

+ +
+
+
+ + + + diff --git a/doc/api-ref/html/dd/d30/hs-clientmanager_8cpp_source.html b/doc/api-ref/html/dd/d30/hs-clientmanager_8cpp_source.html new file mode 100644 index 0000000..9fd56e9 --- /dev/null +++ b/doc/api-ref/html/dd/d30/hs-clientmanager_8cpp_source.html @@ -0,0 +1,133 @@ + + + + + + +HomeScreenBinding: src/hs-clientmanager.cpp Source File + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ + +
+
+
+
hs-clientmanager.cpp
+
+
+Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 TOYOTA MOTOR CORPORATION
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #include <algorithm>
17 #include "hs-clientmanager.h"
18 #include "hmi-debug.h"
19 
20 static const char _homescreen[] = "homescreen";
21 
22 HS_ClientManager* HS_ClientManager::me = nullptr;
23 
24 static void cbRemoveClientCtxt(void *data)
25 {
27 }
28 
40 {
41 }
42 
54 {
55  if(me == nullptr)
56  me = new HS_ClientManager();
57 
58  return me;
59 }
60 
72 {
73  HMI_NOTICE("homescreen-service","called.");
74 }
75 
86 HS_ClientCtxt* HS_ClientManager::createClientCtxt(afb_req_t req, std::string appid)
87 {
88  HS_ClientCtxt *ctxt = (HS_ClientCtxt *)afb_req_context_get(req);
89  if (!ctxt)
90  {
91  HMI_NOTICE("homescreen-service", "create new session for %s", appid.c_str());
92  HS_ClientCtxt *ctxt = new HS_ClientCtxt(appid.c_str());
93  afb_req_session_set_LOA(req, 1);
94  afb_req_context_set(req, ctxt, cbRemoveClientCtxt);
95  }
96  return ctxt;
97 }
98 
109 HS_Client* HS_ClientManager::addClient(afb_req_t req, std::string appid)
110 {
111  return (client_list[appid] = new HS_Client(req, appid));
112 }
113 
124 void HS_ClientManager::removeClient(std::string appid)
125 {
126  delete client_list[appid];
127  client_list.erase(appid);
128 }
129 
141 {
142  HS_ClientCtxt *ctxt = (HS_ClientCtxt *)data;
143  if(ctxt == nullptr)
144  {
145  HMI_ERROR("homescreen-service", "data is nullptr");
146  return;
147  }
148 
149  HMI_NOTICE("homescreen-service", "remove app %s", ctxt->id.c_str());
150  std::lock_guard<std::mutex> lock(this->mtx);
151  removeClient(ctxt->id);
152  delete appid2ctxt[ctxt->id];
153  appid2ctxt.erase(ctxt->id);
154 }
155 
166 int HS_ClientManager::tap_shortcut(afb_req_t request)
167 {
168  int ret = 0;
169  const char* value = afb_req_value(request, _application_id);
170  if (value) {
171  HMI_NOTICE("homescreen-service","request params = %s.", value);
172  std::lock_guard<std::mutex> lock(this->mtx);
173  auto ip = client_list.find(std::string(value));
174  if(ip != client_list.end()) {
175  ip->second->tap_shortcut(value);
176  }
177  }
178  else {
179  HMI_NOTICE("homescreen-service","Please input application_id");
180  ret = AFB_EVENT_BAD_REQUEST;
181  }
182  return ret;
183 }
184 
196 {
197  int ret = 0;
198  const char* value = afb_req_value(request, _display_message);
199  if (value) {
200  HMI_NOTICE("homescreen-service","request params = %s.", value);
201  std::lock_guard<std::mutex> lock(this->mtx);
202  for(auto m : client_list) {
203  m.second->on_screen_message(request, value);
204  }
205  }
206  else {
207  HMI_NOTICE("homescreen-service","Please input display_message");
208  ret = AFB_EVENT_BAD_REQUEST;
209  }
210  return ret;
211 }
212 
223 int HS_ClientManager::on_screen_reply(afb_req_t request)
224 {
225  int ret = 0;
226  const char* value = afb_req_value(request, _reply_message);
227  if (value) {
228  HMI_NOTICE("homescreen-service","request params = %s.", value);
229  std::lock_guard<std::mutex> lock(this->mtx);
230  for(auto m : client_list) {
231  m.second->on_screen_reply(request, value);
232  }
233  }
234  else {
235  HMI_NOTICE("homescreen-service","Please input reply_message");
236  ret = AFB_EVENT_BAD_REQUEST;
237  }
238  return ret;
239 }
240 
251 int HS_ClientManager::subscribe(afb_req_t request)
252 {
253  int ret = 0;
254  const char *value = afb_req_value(request, "event");
255  HMI_NOTICE("homescreen-service","value is %s", value);
256  if(value) {
257  std::string appid(afb_req_get_application_id(request));
258  std::lock_guard<std::mutex> lock(this->mtx);
259 
260  HS_Client* client = nullptr;
261  auto ip = client_list.find(appid);
262  if(ip != client_list.end()) {
263  client = client_list[appid];
264  }
265  else {
266  appid2ctxt[appid] = createClientCtxt(request, appid);
267  client = addClient(request, appid);
268  }
269 
270  if(client->subscribe(request, value) != 0) {
271  HMI_NOTICE("homescreen-service","subscribe failed");
273  }
274  }
275  else {
276  HMI_NOTICE("homescreen-service","Please input event name");
277  ret = AFB_EVENT_BAD_REQUEST;
278  }
279  return ret;
280 }
281 
292 int HS_ClientManager::unsubscribe(afb_req_t request)
293 {
294  const char *value = afb_req_value(request, "event");
295  HMI_NOTICE("homescreen-service","value is %s", value);
296  int ret = 0;
297  if(value) {
298  std::string appid(afb_req_get_application_id(request));
299  std::lock_guard<std::mutex> lock(this->mtx);
300 
301  auto ip = client_list.find(appid);
302  if(ip != client_list.end()
303  && ip->second->unsubscribe(request, value) != 0) {
304  HMI_NOTICE("homescreen-service","unsubscribe failed");
306  }
307  }
308  else {
309  HMI_NOTICE("homescreen-service","Please input event name");
310  ret = AFB_EVENT_BAD_REQUEST;
311  }
312  return ret;
313 }
314 
326 int HS_ClientManager::showWindow(afb_req_t request)
327 {
328  int ret = 0;
329  const char* value = afb_req_value(request, _application_id);
330  if (value) {
331  HMI_NOTICE("homescreen-service","request params = %s.", value);
332  std::lock_guard<std::mutex> lock(this->mtx);
333  auto ip = client_list.find(std::string(value));
334  if(ip != client_list.end()) {
335  ret = ip->second->showWindow(request, value);
336  }
337  }
338  else {
339  HMI_NOTICE("homescreen-service","Please input application_id");
340  ret = AFB_EVENT_BAD_REQUEST;
341  }
342  return ret;
343 }
344 
356 int HS_ClientManager::hideWindow(afb_req_t request)
357 {
358  int ret = 0;
359  const char* value = afb_req_value(request, _application_id);
360  if (value) {
361  HMI_NOTICE("homescreen-service","request params = %s.", value);
362  std::lock_guard<std::mutex> lock(this->mtx);
363  auto ip = client_list.find(std::string(value));
364  if(ip != client_list.end()) {
365  ret = ip->second->hideWindow(request);
366  }
367  }
368  else {
369  HMI_NOTICE("homescreen-service","Please input application_id");
370  ret = AFB_EVENT_BAD_REQUEST;
371  }
372  return ret;
373 }
374 
386 int HS_ClientManager::replyShowWindow(afb_req_t request)
387 {
388  int ret = 0;
389  const char* value = afb_req_value(request, _application_id);
390  if (value) {
391  HMI_NOTICE("homescreen-service","request params = %s.", value);
392  std::lock_guard<std::mutex> lock(this->mtx);
393  auto ip = client_list.find(std::string(value));
394  if(ip != client_list.end()) {
395  ret = ip->second->replyShowWindow(request, value);
396  }
397  }
398  else {
399  HMI_NOTICE("homescreen-service","Please input application_id");
400  ret = AFB_EVENT_BAD_REQUEST;
401  }
402  return ret;
403 }
404 
417 {
418  int ret = 0;
419  std::lock_guard<std::mutex> lock(this->mtx);
420  auto ip = client_list.find(_homescreen);
421  if(ip != client_list.end()) {
422  ret = ip->second->showNotification(request);
423  }
424  else {
425  HMI_NOTICE("homescreen-service","not exist sessiion with homescreen");
427  }
428 
429  return ret;
430 }
431 
443 int HS_ClientManager::showInformation(afb_req_t request)
444 {
445  int ret = 0;
446  std::lock_guard<std::mutex> lock(this->mtx);
447  auto ip = client_list.find(_homescreen);
448  if(ip != client_list.end()) {
449  ret = ip->second->showInformation(request);
450  }
451  else {
452  HMI_NOTICE("homescreen-service","not exist sessiion with homescreen");
454  }
455 
456  return ret;
457 }
int subscribe(afb_req_t request, const char *event)
Definition: hs-client.cpp:139
+ +
int hideWindow(afb_req_t request)
+ +
int subscribe(afb_req_t request)
+
int tap_shortcut(afb_req_t request)
+
#define AFB_REQ_SHOWNOTIFICATION_ERROR
Definition: hs-helper.h:26
+ +
const char _reply_message[]
Definition: homescreen.cpp:30
+ +
int on_screen_reply(afb_req_t request)
+
#define HMI_NOTICE(prefix, args,...)
Definition: hmi-debug.h:40
+
int showWindow(afb_req_t request)
+
struct HS_ClientCtxt HS_ClientCtxt
+
int unsubscribe(afb_req_t request)
+ +
static const char _homescreen[]
+
int replyShowWindow(afb_req_t request)
+ +
const char _display_message[]
Definition: homescreen.cpp:29
+
void removeClientCtxt(void *data)
+
static HS_ClientManager * instance(void)
+
static void cbRemoveClientCtxt(void *data)
+
std::string id
+ +
#define AFB_REQ_UNSUBSCRIBE_ERROR
Definition: hs-helper.h:25
+
int showInformation(afb_req_t request)
+
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:38
+
int on_screen_message(afb_req_t request)
+
const char _application_id[]
Definition: homescreen.cpp:28
+
#define AFB_EVENT_BAD_REQUEST
Definition: hs-helper.h:23
+
int showNotification(afb_req_t request)
+
#define AFB_REQ_SUBSCRIBE_ERROR
Definition: hs-helper.h:24
+
#define AFB_REQ_SHOWINFORMATION_ERROR
Definition: hs-helper.h:27
+
+ + + + diff --git a/doc/api-ref/html/dd/dc9/class_h_s___client_manager-members.html b/doc/api-ref/html/dd/dc9/class_h_s___client_manager-members.html new file mode 100644 index 0000000..fd18777 --- /dev/null +++ b/doc/api-ref/html/dd/dc9/class_h_s___client_manager-members.html @@ -0,0 +1,118 @@ + + + + + + +HomeScreenBinding: Member List + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ +
+
+
+
HS_ClientManager Member List
+
+
+ +

This is the complete list of members for HS_ClientManager, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + +
hideWindow(afb_req_t request)HS_ClientManager
HS_ClientManager()HS_ClientManager
HS_ClientManager(HS_ClientManager const &)=deleteHS_ClientManager
HS_ClientManager(HS_ClientManager &&)=deleteHS_ClientManager
init(void)HS_ClientManager
instance(void)HS_ClientManagerstatic
on_screen_message(afb_req_t request)HS_ClientManager
on_screen_reply(afb_req_t request)HS_ClientManager
operator=(HS_ClientManager const &)=deleteHS_ClientManager
operator=(HS_ClientManager &&)=deleteHS_ClientManager
removeClientCtxt(void *data)HS_ClientManager
replyShowWindow(afb_req_t request)HS_ClientManager
showInformation(afb_req_t request)HS_ClientManager
showNotification(afb_req_t request)HS_ClientManager
showWindow(afb_req_t request)HS_ClientManager
subscribe(afb_req_t request)HS_ClientManager
tap_shortcut(afb_req_t request)HS_ClientManager
unsubscribe(afb_req_t request)HS_ClientManager
~HS_ClientManager()=defaultHS_ClientManager
+ + + + diff --git a/doc/api-ref/html/dd/ddc/structgeometry.html b/doc/api-ref/html/dd/ddc/structgeometry.html new file mode 100644 index 0000000..ed8d0ff --- /dev/null +++ b/doc/api-ref/html/dd/ddc/structgeometry.html @@ -0,0 +1,142 @@ + + + + + + +HomeScreenBinding: geometry Struct Reference + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ +
+
+ +
+
geometry Struct Reference
+
+
+ + + + + + +

+Public Attributes

int width
 
int height
 
+

Detailed Description

+
+

Definition at line 132 of file simple-egl.cpp.

+

Member Data Documentation

+ +
+
+ + + + +
int geometry::height
+
+ +

Definition at line 133 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
int geometry::width
+
+ +

Definition at line 133 of file simple-egl.cpp.

+ +
+
+
The documentation for this struct was generated from the following file: +
+ + + + diff --git a/doc/api-ref/html/de/da4/simple-egl_8cpp.html b/doc/api-ref/html/de/da4/simple-egl_8cpp.html new file mode 100644 index 0000000..30fe5cc --- /dev/null +++ b/doc/api-ref/html/de/da4/simple-egl_8cpp.html @@ -0,0 +1,1253 @@ + + + + + + +HomeScreenBinding: libhomescreen/simple-egl.cpp File Reference + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ + +
+
+ +
+
simple-egl.cpp File Reference
+
+
+
#include <mutex>
+#include <chrono>
+#include <iostream>
+#include <string>
+#include <stdarg.h>
+#include <sys/types.h>
+#include <thread>
+#include <exception>
+#include <vector>
+#include <sstream>
+#include <assert.h>
+#include <signal.h>
+#include <wayland-client.h>
+#include <wayland-egl.h>
+#include <GLES2/gl2.h>
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <unistd.h>
+#include <time.h>
+#include <libwindowmanager.h>
+#include <libhomescreen.hpp>
+#include <ilm/ivi-application-client-protocol.h>
+#include "hmi-debug.h"
+#include "platform.h"
+
+

Go to the source code of this file.

+ + + + + + + + +

+Classes

struct  display
 
struct  geometry
 
struct  window
 
+ + + + + + + +

+Macros

#define EGL_EXT_swap_buffers_with_damage   1
 
#define EGL_EXT_buffer_age   1
 
#define EGL_BUFFER_AGE_EXT   0x313D
 
+ + + + + + + +

+Typedefs

typedef EGLSurface surface
 
typedef EGLSurface EGLint * rects
 
typedef EGLSurface EGLint EGLint n_rects
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC)(EGLDisplay dpy
 
static void init_egl (struct display *display, struct window *window)
 
static void fini_egl (struct display *display)
 
static GLuint create_shader (struct window *window, const char *source, GLenum shader_type)
 
static void init_gl (struct window *window)
 
static void create_ivi_surface (struct window *window, struct display *display)
 
static void create_surface (struct window *window)
 
static void destroy_surface (struct window *window)
 
static void redraw (void *data, struct wl_callback *callback, uint32_t time)
 
static void registry_handle_global (void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version)
 
static void registry_handle_global_remove (void *data, struct wl_registry *registry, uint32_t name)
 
static void signal_int (int signum)
 
int init_wm (LibWindowmanager *wm, struct window *window)
 
int init_hs (LibHomeScreen *hs)
 
int main (int argc, char **argv)
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Variables

const char * log_prefix = "simple-egl"
 
uint32_t g_id_ivisurf = 9009
 
long port = 1700
 
string token = string("wm")
 
string app_name = string("Navigation")
 
const char * main_role = "navigation"
 
LibHomeScreenhs
 
LibWindowmanager * wm
 
static const struct wl_interface * types []
 
static const struct wl_message ivi_surface_requests []
 
static const struct wl_message ivi_surface_events []
 
const struct wl_interface ivi_surface_interface
 
static const struct wl_message ivi_application_requests []
 
const struct wl_interface ivi_application_interface
 
static const char * vert_shader_text
 
static const char * frag_shader_text
 
static int running = 1
 
static const struct wl_registry_listener registry_listener
 
+

Macro Definition Documentation

+ +
+
+ + + + +
#define EGL_BUFFER_AGE_EXT   0x313D
+
+ +

Definition at line 110 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
#define EGL_EXT_buffer_age   1
+
+ +

Definition at line 109 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
#define EGL_EXT_swap_buffers_with_damage   1
+
+ +

Definition at line 104 of file simple-egl.cpp.

+ +
+
+

Typedef Documentation

+ +
+
+ + + + +
typedef EGLSurface EGLint EGLint n_rects
+
+ +

Definition at line 105 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
typedef EGLSurface EGLint* rects
+
+ +

Definition at line 105 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
typedef EGLSurface surface
+
+ +

Definition at line 105 of file simple-egl.cpp.

+ +
+
+

Function Documentation

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
static void create_ivi_surface (struct windowwindow,
struct displaydisplay 
)
+
+static
+
+ +

Definition at line 322 of file simple-egl.cpp.

+
323 {
324  uint32_t id_ivisurf = g_id_ivisurf;
325  window->ivi_surface =
326  ivi_application_surface_create(display->ivi_application,
327  id_ivisurf, window->surface);
328 
329  if (window->ivi_surface == NULL) {
330  HMI_ERROR(log_prefix,"Failed to create ivi_client_surface");
331  abort();
332  }
333 
334 }
uint32_t g_id_ivisurf
Definition: simple-egl.cpp:59
+
struct wl_surface * surface
Definition: simple-egl.cpp:147
+
struct ivi_application * ivi_application
Definition: simple-egl.cpp:127
+
struct ivi_surface * ivi_surface
Definition: simple-egl.cpp:148
+
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:38
+
const char * log_prefix
Definition: simple-egl.cpp:58
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static GLuint create_shader (struct windowwindow,
const char * source,
GLenum shader_type 
)
+
+static
+
+ +

Definition at line 259 of file simple-egl.cpp.

+
260 {
261  GLuint shader;
262  GLint status;
263 
264  shader = glCreateShader(shader_type);
265  assert(shader != 0);
266 
267  glShaderSource(shader, 1, (const char **) &source, NULL);
268  glCompileShader(shader);
269 
270  glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
271  if (!status) {
272  char log[1000];
273  GLsizei len;
274  glGetShaderInfoLog(shader, 1000, &len, log);
275  HMI_ERROR(log_prefix,"Error: compiling %s: %*s",
276  shader_type == GL_VERTEX_SHADER ? "vertex" : "fragment",
277  len, log);
278  exit(1);
279  }
280 
281  return shader;
282 }
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:38
+
const char * log_prefix
Definition: simple-egl.cpp:58
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + +
static void create_surface (struct windowwindow)
+
+static
+
+ +

Definition at line 337 of file simple-egl.cpp.

+
338 {
339  struct display *display = window->display;
340  EGLBoolean ret;
341 
342  window->surface = wl_compositor_create_surface(display->compositor);
343 
344  window->native =
345  wl_egl_window_create(window->surface,
346  window->geometry.width,
347  window->geometry.height);
348  window->egl_surface =
349  weston_platform_create_egl_surface(display->egl.dpy,
350  display->egl.conf,
351  window->native, NULL);
352 
353 
354  if (display->ivi_application ) {
355  create_ivi_surface(window, display);
356  } else {
357  assert(0);
358  }
359 
360  ret = eglMakeCurrent(window->display->egl.dpy, window->egl_surface,
361  window->egl_surface, window->display->egl.ctx);
362  assert(ret == EGL_TRUE);
363 
364  if (!window->frame_sync)
365  eglSwapInterval(display->egl.dpy, 0);
366 
367 }
+
typedef EGLBoolean(EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC)(EGLDisplay dpy
+
EGLDisplay dpy
Definition: simple-egl.cpp:122
+
EGLSurface egl_surface
Definition: simple-egl.cpp:149
+
EGLConfig conf
Definition: simple-egl.cpp:124
+
struct wl_egl_window * native
Definition: simple-egl.cpp:146
+
struct wl_surface * surface
Definition: simple-egl.cpp:147
+
struct ivi_application * ivi_application
Definition: simple-egl.cpp:127
+
struct display::@0 egl
+
struct display * display
Definition: simple-egl.cpp:137
+
EGLContext ctx
Definition: simple-egl.cpp:123
+
static void create_ivi_surface(struct window *window, struct display *display)
Definition: simple-egl.cpp:322
+
int frame_sync
Definition: simple-egl.cpp:151
+
struct wl_compositor * compositor
Definition: simple-egl.cpp:119
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + +
static void destroy_surface (struct windowwindow)
+
+static
+
+ +

Definition at line 370 of file simple-egl.cpp.

+
371 {
372  /* Required, otherwise segfault in egl_dri2.c: dri2_make_current()
373  * on eglReleaseThread(). */
374  eglMakeCurrent(window->display->egl.dpy, EGL_NO_SURFACE, EGL_NO_SURFACE,
375  EGL_NO_CONTEXT);
376 
377  eglDestroySurface(window->display->egl.dpy, window->egl_surface);
378  wl_egl_window_destroy(window->native);
379 
380  if (window->display->ivi_application)
381  ivi_surface_destroy(window->ivi_surface);
382  wl_surface_destroy(window->surface);
383 
384  if (window->callback)
385  wl_callback_destroy(window->callback);
386 }
EGLDisplay dpy
Definition: simple-egl.cpp:122
+
EGLSurface egl_surface
Definition: simple-egl.cpp:149
+
struct wl_egl_window * native
Definition: simple-egl.cpp:146
+
struct wl_surface * surface
Definition: simple-egl.cpp:147
+
struct ivi_application * ivi_application
Definition: simple-egl.cpp:127
+
struct display::@0 egl
+
struct wl_callback * callback
Definition: simple-egl.cpp:150
+
struct display * display
Definition: simple-egl.cpp:137
+
struct ivi_surface * ivi_surface
Definition: simple-egl.cpp:148
+
+
+
+ +
+
+ + + + + + + + +
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC)
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
static void fini_egl (struct displaydisplay)
+
+static
+
+ +

Definition at line 252 of file simple-egl.cpp.

+
253 {
254  eglTerminate(display->egl.dpy);
255  eglReleaseThread();
256 }
EGLDisplay dpy
Definition: simple-egl.cpp:122
+
struct display::@0 egl
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
static void init_egl (struct displaydisplay,
struct windowwindow 
)
+
+static
+
+ +

Definition at line 174 of file simple-egl.cpp.

+
175 {
176  static const EGLint context_attribs[] = {
177  EGL_CONTEXT_CLIENT_VERSION, 2,
178  EGL_NONE
179  };
180  const char *extensions;
181 
182  EGLint config_attribs[] = {
183  EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
184  EGL_RED_SIZE, 1,
185  EGL_GREEN_SIZE, 1,
186  EGL_BLUE_SIZE, 1,
187  EGL_ALPHA_SIZE, 1,
188  EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
189  EGL_NONE
190  };
191 
192  EGLint major, minor, n, count, i, size;
193  EGLConfig *configs;
194  EGLBoolean ret;
195 
196  if (window->opaque || window->buffer_size == 16)
197  config_attribs[9] = 0;
198 
199  display->egl.dpy = weston_platform_get_egl_display(EGL_PLATFORM_WAYLAND_KHR, display->display, NULL);
200  assert(display->egl.dpy);
201 
202  ret = eglInitialize(display->egl.dpy, &major, &minor);
203  assert(ret == EGL_TRUE);
204  ret = eglBindAPI(EGL_OPENGL_ES_API);
205  assert(ret == EGL_TRUE);
206 
207  if (!eglGetConfigs(display->egl.dpy, NULL, 0, &count) || count < 1)
208  assert(0);
209 
210  configs = calloc(count, sizeof *configs);
211  assert(configs);
212 
213  ret = eglChooseConfig(display->egl.dpy, config_attribs,
214  configs, count, &n);
215  assert(ret && n >= 1);
216 
217  for (i = 0; i < n; i++) {
218  eglGetConfigAttrib(display->egl.dpy,
219  configs[i], EGL_BUFFER_SIZE, &size);
220  if (window->buffer_size == size) {
221  display->egl.conf = configs[i];
222  break;
223  }
224  }
225  free(configs);
226  if (display->egl.conf == NULL) {
227  HMI_ERROR(log_prefix,"did not find config with buffer size %d",
228  window->buffer_size);
229  exit(EXIT_FAILURE);
230  }
231 
232  display->egl.ctx = eglCreateContext(display->egl.dpy,
233  display->egl.conf,
234  EGL_NO_CONTEXT, context_attribs);
235  assert(display->egl.ctx);
236 
237  display->swap_buffers_with_damage = NULL;
238  extensions = eglQueryString(display->egl.dpy, EGL_EXTENSIONS);
239  if (extensions &&
240  strstr(extensions, "EGL_EXT_swap_buffers_with_damage") &&
241  strstr(extensions, "EGL_EXT_buffer_age"))
242  display->swap_buffers_with_damage =
243  (PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC)
244  eglGetProcAddress("eglSwapBuffersWithDamageEXT");
245 
246  if (display->swap_buffers_with_damage)
247  HMI_DEBUG(log_prefix,"has EGL_EXT_buffer_age and EGL_EXT_swap_buffers_with_damage");
248 
249 }
int opaque
Definition: simple-egl.cpp:151
+
typedef EGLBoolean(EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC)(EGLDisplay dpy
+
EGLDisplay dpy
Definition: simple-egl.cpp:122
+
EGLConfig conf
Definition: simple-egl.cpp:124
+
struct display::@0 egl
+
PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC swap_buffers_with_damage
Definition: simple-egl.cpp:129
+
EGLContext ctx
Definition: simple-egl.cpp:123
+
struct wl_display * display
Definition: simple-egl.cpp:117
+
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:38
+
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:42
+
int buffer_size
Definition: simple-egl.cpp:151
+
const char * log_prefix
Definition: simple-egl.cpp:58
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + +
static void init_gl (struct windowwindow)
+
+static
+
+ +

Definition at line 285 of file simple-egl.cpp.

+
286 {
287  GLuint frag, vert;
288  GLuint program;
289  GLint status;
290 
291  frag = create_shader(window, frag_shader_text, GL_FRAGMENT_SHADER);
292  vert = create_shader(window, vert_shader_text, GL_VERTEX_SHADER);
293 
294  program = glCreateProgram();
295  glAttachShader(program, frag);
296  glAttachShader(program, vert);
297  glLinkProgram(program);
298 
299  glGetProgramiv(program, GL_LINK_STATUS, &status);
300  if (!status) {
301  char log[1000];
302  GLsizei len;
303  glGetProgramInfoLog(program, 1000, &len, log);
304  HMI_ERROR(log_prefix,"Error: linking:%*s", len, log);
305  exit(1);
306  }
307 
308  glUseProgram(program);
309 
310  window->gl.pos = 0;
311  window->gl.col = 1;
312 
313  glBindAttribLocation(program, window->gl.pos, "pos");
314  glBindAttribLocation(program, window->gl.col, "color");
315  glLinkProgram(program);
316 
317  window->gl.rotation_uniform =
318  glGetUniformLocation(program, "rotation");
319 }
GLuint rotation_uniform
Definition: simple-egl.cpp:140
+
struct window::@1 gl
+
static GLuint create_shader(struct window *window, const char *source, GLenum shader_type)
Definition: simple-egl.cpp:259
+
GLuint pos
Definition: simple-egl.cpp:141
+
static const char * frag_shader_text
Definition: simple-egl.cpp:164
+
static const char * vert_shader_text
Definition: simple-egl.cpp:154
+
GLuint col
Definition: simple-egl.cpp:142
+
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:38
+
const char * log_prefix
Definition: simple-egl.cpp:58
+
+
+
+ +
+
+ + + + + + + + +
int init_hs (LibHomeScreenhs)
+
+ +

Definition at line 565 of file simple-egl.cpp.

+
565  {
566  if(hs->init(port, token)!=0)
567  {
568  HMI_ERROR(log_prefix,"homescreen init failed. ");
569  return -1;
570  }
571 
572  hs->set_event_handler(LibHomeScreen::Event_ShowWindow, [hs](json_object *object){
573  HMI_DEBUG("simple-egl","try to activeWindow %s ", app_name.c_str());
574 
575  struct json_object *param_obj = json_object_object_get(object, hs->_keyParameter);
576  const char *area = json_object_get_string(
577  json_object_object_get(param_obj, hs->_keyArea));
578  // Application should call LibWindowmanager::activateWindow() in showWindow handler
579  if(area == nullptr)
580  wm->activateWindow(main_role, hs->_areaNormal);
581  else
582  wm->activateWindow(main_role, area);
583  });
584 
585  return 0;
586 }
LibWindowmanager * wm
Definition: simple-egl.cpp:67
+
const char * main_role
Definition: simple-egl.cpp:64
+
const char * _keyParameter
+
string app_name
Definition: simple-egl.cpp:63
+ +
string token
Definition: simple-egl.cpp:61
+
const char * _keyArea
+
long port
Definition: simple-egl.cpp:60
+
int init(const int port, const std::string &token)
+
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:38
+
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:42
+
const char * _areaNormal
+
const char * log_prefix
Definition: simple-egl.cpp:58
+
void set_event_handler(enum EventType et, handler_func f)
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
int init_wm (LibWindowmanager * wm,
struct windowwindow 
)
+
+ +

Definition at line 527 of file simple-egl.cpp.

+
528 {
529  HMI_DEBUG(log_prefix,"called");
530 
531  if (wm->init(port, token) != 0) {
532  HMI_ERROR(log_prefix,"wm init failed. ");
533  return -1;
534  }
535 
536  g_id_ivisurf = wm->requestSurface(main_role);
537  if (g_id_ivisurf < 0) {
538  HMI_ERROR(log_prefix,"wm request surface failed ");
539  return -1;
540  }
541  HMI_DEBUG(log_prefix,"IVI_SURFACE_ID: %d ", g_id_ivisurf);
542 
543  WMHandler wmh;
544  wmh.on_visible = [](const char* role, bool visible){
545  // Sample code if user uses visible event
546  HMI_DEBUG(log_prefix, "role: %s, visible: %s", role, visible ? "true" : "false");
547  };
548  wmh.on_sync_draw = [wm, window](const char* role, const char* area, Rect rect) {
549 
550  HMI_DEBUG(log_prefix,"Surface %s got syncDraw! Area: %s. w:%d, h:%d", role, area, rect.width(), rect.height());
551 
552  wl_egl_window_resize(window->native, rect.width(), rect.height(), 0, 0);
553  window->geometry.width = rect.width();
554  window->geometry.height = rect.height();
555 
556  wm->endDraw(role);
557  };
558 
559  wm->setEventHandler(wmh);
560 
561  return 0;
562 }
LibWindowmanager * wm
Definition: simple-egl.cpp:67
+
uint32_t g_id_ivisurf
Definition: simple-egl.cpp:59
+
const char * main_role
Definition: simple-egl.cpp:64
+
struct wl_egl_window * native
Definition: simple-egl.cpp:146
+
string token
Definition: simple-egl.cpp:61
+
long port
Definition: simple-egl.cpp:60
+
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:38
+
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:42
+
const char * log_prefix
Definition: simple-egl.cpp:58
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
int main (int argc,
char ** argv 
)
+
+ +

Definition at line 589 of file simple-egl.cpp.

+
590 {
591  struct sigaction sigint;
592  struct window window = { 0 };
593  struct display display = { 0 };
594 
595  window.display = &display;
596  display.window = &window;
597  window.geometry.width = 1080;
598  window.geometry.height = 1488;
599  window.window_size = window.geometry;
600  window.buffer_size = 32;
601  window.frame_sync = 1;
602 
603  if(argc > 2){
604  port = strtol(argv[1], NULL, 10);
605  token = argv[2];
606  }
607 
608  HMI_DEBUG(log_prefix,"main_role: %s, port: %d, token: %s. ", main_role, port, token.c_str());
609 
610  display.display = wl_display_connect(NULL);
611  assert(display.display);
612 
613  display.registry = wl_display_get_registry(display.display);
614  wl_registry_add_listener(display.registry,
615  &registry_listener, &display);
616 
617  wl_display_roundtrip(display.display);
618 
619  init_egl(&display, &window);
620 
621  wm = new LibWindowmanager();
622  if(init_wm(wm, &window)!=0){
623  fini_egl(&display);
624  if (display.ivi_application)
625  ivi_application_destroy(display.ivi_application);
626  if (display.compositor)
627  wl_compositor_destroy(display.compositor);
628  wl_registry_destroy(display.registry);
629  wl_display_flush(display.display);
630  return -1;
631  }
632 
633  hs = new LibHomeScreen();
634  if(init_hs(hs)!=0){
635  fini_egl(&display);
636  if (display.ivi_application)
637  ivi_application_destroy(display.ivi_application);
638  if (display.compositor)
639  wl_compositor_destroy(display.compositor);
640  wl_registry_destroy(display.registry);
641  wl_display_flush(display.display);
642  return -1;
643  }
644 
645  create_surface(&window);
646  init_gl(&window);
647 
648  //Ctrl+C
649  sigint.sa_handler = signal_int;
650  sigemptyset(&sigint.sa_mask);
651  sigint.sa_flags = SA_RESETHAND;
652  sigaction(SIGINT, &sigint, NULL);
653 
654  eglSwapBuffers(window.display->egl.dpy, window.egl_surface);
655 
656  wm->activateWindow(main_role);
657 
658  /* The mainloop here is a little subtle. Redrawing will cause
659  * EGL to read events so we can just call
660  * wl_display_dispatch_pending() to handle any events that got
661  * queued up as a side effect. */
662  while (running) {
663  wl_display_dispatch_pending(display.display);
664  redraw(&window, NULL, 0);
665  }
666 
667  HMI_DEBUG(log_prefix,"simple-egl exiting! ");
668 
669  destroy_surface(&window);
670  fini_egl(&display);
671 
672  if (display.ivi_application)
673  ivi_application_destroy(display.ivi_application);
674 
675  if (display.compositor)
676  wl_compositor_destroy(display.compositor);
677 
678  wl_registry_destroy(display.registry);
679  wl_display_flush(display.display);
680  wl_display_disconnect(display.display);
681 
682  return 0;
683 }
struct window * window
Definition: simple-egl.cpp:126
+ +
LibWindowmanager * wm
Definition: simple-egl.cpp:67
+
static void init_gl(struct window *window)
Definition: simple-egl.cpp:285
+
int init_wm(LibWindowmanager *wm, struct window *window)
Definition: simple-egl.cpp:527
+
const char * main_role
Definition: simple-egl.cpp:64
+
EGLDisplay dpy
Definition: simple-egl.cpp:122
+
EGLSurface egl_surface
Definition: simple-egl.cpp:149
+
static void signal_int(int signum)
Definition: simple-egl.cpp:521
+
static void create_surface(struct window *window)
Definition: simple-egl.cpp:337
+
static void redraw(void *data, struct wl_callback *callback, uint32_t time)
Definition: simple-egl.cpp:389
+
string token
Definition: simple-egl.cpp:61
+
struct ivi_application * ivi_application
Definition: simple-egl.cpp:127
+
LibHomeScreen * hs
Definition: simple-egl.cpp:66
+
struct display::@0 egl
+
struct wl_registry * registry
Definition: simple-egl.cpp:118
+
static int running
Definition: simple-egl.cpp:171
+
struct display * display
Definition: simple-egl.cpp:137
+ +
long port
Definition: simple-egl.cpp:60
+
static const struct wl_registry_listener registry_listener
Definition: simple-egl.cpp:515
+
struct geometry geometry window_size
Definition: simple-egl.cpp:138
+
int frame_sync
Definition: simple-egl.cpp:151
+
struct wl_display * display
Definition: simple-egl.cpp:117
+
static void fini_egl(struct display *display)
Definition: simple-egl.cpp:252
+
static void init_egl(struct display *display, struct window *window)
Definition: simple-egl.cpp:174
+
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:42
+
struct wl_compositor * compositor
Definition: simple-egl.cpp:119
+
int buffer_size
Definition: simple-egl.cpp:151
+
const char * log_prefix
Definition: simple-egl.cpp:58
+ +
static void destroy_surface(struct window *window)
Definition: simple-egl.cpp:370
+
int init_hs(LibHomeScreen *hs)
Definition: simple-egl.cpp:565
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static void redraw (void * data,
struct wl_callback * callback,
uint32_t time 
)
+
+static
+
+ +

Definition at line 389 of file simple-egl.cpp.

+
390 {
391  struct window *window = data;
392  struct display *display = window->display;
393  static const GLfloat verts[3][2] = {
394  { -0.5, -0.5 },
395  { 0.5, -0.5 },
396  { 0, 0.5 }
397  };
398 
399  static const GLfloat colors[3][3] = {
400  { 1, 0, 0 },
401  { 0, 1, 0 },
402  { 0, 0, 1 }
403  };
404 
405  GLfloat angle;
406  GLfloat rotation[4][4] = {
407  { 1, 0, 0, 0 },
408  { 0, 1, 0, 0 },
409  { 0, 0, 1, 0 },
410  { 0, 0, 0, 1 }
411  };
412  static const uint32_t speed_div = 5, benchmark_interval = 5;
413  struct wl_region *region;
414  EGLint rect[4];
415  EGLint buffer_age = 0;
416  struct timeval tv;
417 
418  assert(window->callback == callback);
419  window->callback = NULL;
420 
421  if (callback)
422  wl_callback_destroy(callback);
423 
424  gettimeofday(&tv, NULL);
425  time = tv.tv_sec * 1000 + tv.tv_usec / 1000;
426  if (window->frames == 0)
427  window->benchmark_time = time;
428 
429  if (time - window->benchmark_time > (benchmark_interval * 1000)) {
430  HMI_DEBUG(log_prefix,"%d frames in %d seconds: %f fps",
431  window->frames,
432  benchmark_interval,
433  (float) window->frames / benchmark_interval);
434  window->benchmark_time = time;
435  window->frames = 0;
436  }
437 
438  angle = (time / speed_div) % 360 * M_PI / 180.0;
439  rotation[0][0] = cos(angle);
440  rotation[0][2] = sin(angle);
441  rotation[2][0] = -sin(angle);
442  rotation[2][2] = cos(angle);
443 
444  if (display->swap_buffers_with_damage)
445  eglQuerySurface(display->egl.dpy, window->egl_surface,
446  EGL_BUFFER_AGE_EXT, &buffer_age);
447 
448  glViewport(0, 0, window->geometry.width, window->geometry.height);
449 
450  glUniformMatrix4fv(window->gl.rotation_uniform, 1, GL_FALSE,
451  (GLfloat *) rotation);
452 
453  glClearColor(0.0, 0.0, 0.0, 0.5);
454  glClear(GL_COLOR_BUFFER_BIT);
455 
456  glVertexAttribPointer(window->gl.pos, 2, GL_FLOAT, GL_FALSE, 0, verts);
457  glVertexAttribPointer(window->gl.col, 3, GL_FLOAT, GL_FALSE, 0, colors);
458  glEnableVertexAttribArray(window->gl.pos);
459  glEnableVertexAttribArray(window->gl.col);
460 
461  glDrawArrays(GL_TRIANGLES, 0, 3);
462 
463  glDisableVertexAttribArray(window->gl.pos);
464  glDisableVertexAttribArray(window->gl.col);
465 
466  if (window->opaque || window->fullscreen) {
467  region = wl_compositor_create_region(window->display->compositor);
468  wl_region_add(region, 0, 0,
469  window->geometry.width,
470  window->geometry.height);
471  wl_surface_set_opaque_region(window->surface, region);
472  wl_region_destroy(region);
473  } else {
474  wl_surface_set_opaque_region(window->surface, NULL);
475  }
476 
477  if (display->swap_buffers_with_damage && buffer_age > 0) {
478  rect[0] = window->geometry.width / 4 - 1;
479  rect[1] = window->geometry.height / 4 - 1;
480  rect[2] = window->geometry.width / 2 + 2;
481  rect[3] = window->geometry.height / 2 + 2;
482  display->swap_buffers_with_damage(display->egl.dpy,
483  window->egl_surface,
484  rect, 1);
485  } else {
486  eglSwapBuffers(display->egl.dpy, window->egl_surface);
487  }
488 
489  window->frames++;
490 }
+
GLuint rotation_uniform
Definition: simple-egl.cpp:140
+
struct window::@1 gl
+
uint32_t benchmark_time
Definition: simple-egl.cpp:145
+
int opaque
Definition: simple-egl.cpp:151
+
EGLDisplay dpy
Definition: simple-egl.cpp:122
+
EGLSurface egl_surface
Definition: simple-egl.cpp:149
+
GLuint pos
Definition: simple-egl.cpp:141
+
#define EGL_BUFFER_AGE_EXT
Definition: simple-egl.cpp:110
+
struct wl_surface * surface
Definition: simple-egl.cpp:147
+
struct display::@0 egl
+
GLuint col
Definition: simple-egl.cpp:142
+
struct wl_callback * callback
Definition: simple-egl.cpp:150
+
PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC swap_buffers_with_damage
Definition: simple-egl.cpp:129
+
struct display * display
Definition: simple-egl.cpp:137
+ +
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:42
+
struct wl_compositor * compositor
Definition: simple-egl.cpp:119
+
const char * log_prefix
Definition: simple-egl.cpp:58
+
int fullscreen
Definition: simple-egl.cpp:151
+
uint32_t frames
Definition: simple-egl.cpp:145
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static void registry_handle_global (void * data,
struct wl_registry * registry,
uint32_t name,
const char * interface,
uint32_t version 
)
+
+static
+
+ +

Definition at line 493 of file simple-egl.cpp.

+
495 {
496  struct display *d = data;
497 
498  if (strcmp(interface, "wl_compositor") == 0) {
499  d->compositor =
500  wl_registry_bind(registry, name,
501  &wl_compositor_interface, 1);
502  } else if (strcmp(interface, "ivi_application") == 0) {
503  d->ivi_application =
504  wl_registry_bind(registry, name,
506  }
507 }
+
struct ivi_application * ivi_application
Definition: simple-egl.cpp:127
+
const struct wl_interface ivi_application_interface
Definition: simple-egl.cpp:95
+
struct wl_registry * registry
Definition: simple-egl.cpp:118
+
struct wl_compositor * compositor
Definition: simple-egl.cpp:119
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static void registry_handle_global_remove (void * data,
struct wl_registry * registry,
uint32_t name 
)
+
+static
+
+ +

Definition at line 510 of file simple-egl.cpp.

+
512 {
513 }
+
+
+ +
+
+ + + + + +
+ + + + + + + + +
static void signal_int (int signum)
+
+static
+
+ +

Definition at line 521 of file simple-egl.cpp.

+
522 {
523  running = 0;
524 }
static int running
Definition: simple-egl.cpp:171
+
+
+
+

Variable Documentation

+ +
+
+ + + + +
string app_name = string("Navigation")
+
+ +

Definition at line 63 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const char* frag_shader_text
+
+static
+
+Initial value:
=
"precision mediump float;\n"
"varying vec4 v_color;\n"
"void main() {\n"
" gl_FragColor = v_color;\n"
"}\n"
+

Definition at line 164 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
uint32_t g_id_ivisurf = 9009
+
+ +

Definition at line 59 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
LibHomeScreen* hs
+
+ +

Definition at line 66 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
const struct wl_interface ivi_application_interface
+
+Initial value:
= {
"ivi_application", 1,
0, NULL,
}
static const struct wl_message ivi_application_requests[]
Definition: simple-egl.cpp:91
+
+

Definition at line 95 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const struct wl_message ivi_application_requests[]
+
+static
+
+Initial value:
= {
{ "surface_create", "uon", types + 2 },
}
static const struct wl_interface * types[]
Definition: simple-egl.cpp:69
+
+

Definition at line 91 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const struct wl_message ivi_surface_events[]
+
+static
+
+Initial value:
= {
{ "configure", "ii", types + 0 },
}
static const struct wl_interface * types[]
Definition: simple-egl.cpp:69
+
+

Definition at line 81 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
const struct wl_interface ivi_surface_interface
+
+Initial value:
= {
"ivi_surface", 1,
}
static const struct wl_message ivi_surface_events[]
Definition: simple-egl.cpp:81
+
static const struct wl_message ivi_surface_requests[]
Definition: simple-egl.cpp:77
+
+

Definition at line 85 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const struct wl_message ivi_surface_requests[]
+
+static
+
+Initial value:
= {
{ "destroy", "", types + 0 },
}
static const struct wl_interface * types[]
Definition: simple-egl.cpp:69
+
+

Definition at line 77 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
const char* log_prefix = "simple-egl"
+
+ +

Definition at line 58 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
const char* main_role = "navigation"
+
+ +

Definition at line 64 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
long port = 1700
+
+ +

Definition at line 60 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const struct wl_registry_listener registry_listener
+
+static
+
+Initial value:
= {
}
static void registry_handle_global(void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version)
Definition: simple-egl.cpp:493
+
static void registry_handle_global_remove(void *data, struct wl_registry *registry, uint32_t name)
Definition: simple-egl.cpp:510
+
+

Definition at line 515 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
int running = 1
+
+static
+
+ +

Definition at line 171 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
string token = string("wm")
+
+ +

Definition at line 61 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const struct wl_interface* types[]
+
+static
+
+Initial value:
= {
NULL,
NULL,
NULL,
&wl_surface_interface,
}
const struct wl_interface ivi_surface_interface
Definition: simple-egl.cpp:85
+
+

Definition at line 69 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const char* vert_shader_text
+
+static
+
+Initial value:
=
"uniform mat4 rotation;\n"
"attribute vec4 pos;\n"
"attribute vec4 color;\n"
"varying vec4 v_color;\n"
"void main() {\n"
" gl_Position = rotation * pos;\n"
" v_color = color;\n"
"}\n"
+

Definition at line 154 of file simple-egl.cpp.

+ +
+
+ +
+
+ + + + +
LibWindowmanager* wm
+
+ +

Definition at line 67 of file simple-egl.cpp.

+ +
+
+
+ + + + diff --git a/doc/api-ref/html/de/da4/simple-egl_8cpp_source.html b/doc/api-ref/html/de/da4/simple-egl_8cpp_source.html new file mode 100644 index 0000000..f87e538 --- /dev/null +++ b/doc/api-ref/html/de/da4/simple-egl_8cpp_source.html @@ -0,0 +1,179 @@ + + + + + + +HomeScreenBinding: libhomescreen/simple-egl.cpp Source File + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ + +
+
+
+
simple-egl.cpp
+
+
+Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
3  * Copyright © 2011 Benjamin Franzke
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 
25 #include <mutex>
26 #include <chrono>
27 
28 #include <iostream>
29 #include <string>
30 #include <stdarg.h>
31 #include <sys/types.h>
32 #include <thread>
33 #include <exception>
34 #include <vector>
35 #include <sstream>
36 
37 #include <assert.h>
38 #include <signal.h>
39 
40 #include <wayland-client.h>
41 #include <wayland-egl.h>
42 
43 #include <GLES2/gl2.h>
44 #include <EGL/egl.h>
45 #include <EGL/eglext.h>
46 
47 #include <unistd.h>
48 #include <time.h>
49 
50 #include <libwindowmanager.h>
51 #include <libhomescreen.hpp>
52 
53 #include <ilm/ivi-application-client-protocol.h>
54 #include "hmi-debug.h"
55 
56 using namespace std;
57 
58 const char* log_prefix = "simple-egl";
59 uint32_t g_id_ivisurf = 9009;
60 long port = 1700;
61 string token = string("wm");
62 
63 string app_name = string("Navigation");
64 const char* main_role = "navigation";
65 
67 LibWindowmanager *wm;
68 
69 static const struct wl_interface *types[] = {
70  NULL,
71  NULL,
72  NULL,
73  &wl_surface_interface,
75 };
76 
77 static const struct wl_message ivi_surface_requests[] = {
78  { "destroy", "", types + 0 },
79 };
80 
81 static const struct wl_message ivi_surface_events[] = {
82  { "configure", "ii", types + 0 },
83 };
84 
85 const struct wl_interface ivi_surface_interface = {
86  "ivi_surface", 1,
89 };
90 
91 static const struct wl_message ivi_application_requests[] = {
92  { "surface_create", "uon", types + 2 },
93 };
94 
95 const struct wl_interface ivi_application_interface = {
96  "ivi_application", 1,
98  0, NULL,
99 };
100 
101 #include "platform.h"
102 
103 #ifndef EGL_EXT_swap_buffers_with_damage
104 #define EGL_EXT_swap_buffers_with_damage 1
105 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC)(EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
106 #endif
107 
108 #ifndef EGL_EXT_buffer_age
109 #define EGL_EXT_buffer_age 1
110 #define EGL_BUFFER_AGE_EXT 0x313D
111 #endif
112 
113 struct window;
114 struct seat;
115 
116 struct display {
117  struct wl_display *display;
118  struct wl_registry *registry;
119  struct wl_compositor *compositor;
120  struct wl_seat *seat;
121  struct {
122  EGLDisplay dpy;
123  EGLContext ctx;
124  EGLConfig conf;
125  } egl;
126  struct window *window;
127  struct ivi_application *ivi_application;
128 
129  PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC swap_buffers_with_damage;
130 };
131 
132 struct geometry {
133  int width, height;
134 };
135 
136 struct window {
137  struct display *display;
138  struct geometry geometry, window_size;
139  struct {
141  GLuint pos;
142  GLuint col;
143  } gl;
144 
145  uint32_t benchmark_time, frames;
146  struct wl_egl_window *native;
147  struct wl_surface *surface;
148  struct ivi_surface *ivi_surface;
149  EGLSurface egl_surface;
150  struct wl_callback *callback;
151  int fullscreen, opaque, buffer_size, frame_sync;
152 };
153 
154 static const char *vert_shader_text =
155  "uniform mat4 rotation;\n"
156  "attribute vec4 pos;\n"
157  "attribute vec4 color;\n"
158  "varying vec4 v_color;\n"
159  "void main() {\n"
160  " gl_Position = rotation * pos;\n"
161  " v_color = color;\n"
162  "}\n";
163 
164 static const char *frag_shader_text =
165  "precision mediump float;\n"
166  "varying vec4 v_color;\n"
167  "void main() {\n"
168  " gl_FragColor = v_color;\n"
169  "}\n";
170 
171 static int running = 1;
172 
173 static void
175 {
176  static const EGLint context_attribs[] = {
177  EGL_CONTEXT_CLIENT_VERSION, 2,
178  EGL_NONE
179  };
180  const char *extensions;
181 
182  EGLint config_attribs[] = {
183  EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
184  EGL_RED_SIZE, 1,
185  EGL_GREEN_SIZE, 1,
186  EGL_BLUE_SIZE, 1,
187  EGL_ALPHA_SIZE, 1,
188  EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
189  EGL_NONE
190  };
191 
192  EGLint major, minor, n, count, i, size;
193  EGLConfig *configs;
194  EGLBoolean ret;
195 
196  if (window->opaque || window->buffer_size == 16)
197  config_attribs[9] = 0;
198 
199  display->egl.dpy = weston_platform_get_egl_display(EGL_PLATFORM_WAYLAND_KHR, display->display, NULL);
200  assert(display->egl.dpy);
201 
202  ret = eglInitialize(display->egl.dpy, &major, &minor);
203  assert(ret == EGL_TRUE);
204  ret = eglBindAPI(EGL_OPENGL_ES_API);
205  assert(ret == EGL_TRUE);
206 
207  if (!eglGetConfigs(display->egl.dpy, NULL, 0, &count) || count < 1)
208  assert(0);
209 
210  configs = calloc(count, sizeof *configs);
211  assert(configs);
212 
213  ret = eglChooseConfig(display->egl.dpy, config_attribs,
214  configs, count, &n);
215  assert(ret && n >= 1);
216 
217  for (i = 0; i < n; i++) {
218  eglGetConfigAttrib(display->egl.dpy,
219  configs[i], EGL_BUFFER_SIZE, &size);
220  if (window->buffer_size == size) {
221  display->egl.conf = configs[i];
222  break;
223  }
224  }
225  free(configs);
226  if (display->egl.conf == NULL) {
227  HMI_ERROR(log_prefix,"did not find config with buffer size %d",
228  window->buffer_size);
229  exit(EXIT_FAILURE);
230  }
231 
232  display->egl.ctx = eglCreateContext(display->egl.dpy,
233  display->egl.conf,
234  EGL_NO_CONTEXT, context_attribs);
235  assert(display->egl.ctx);
236 
237  display->swap_buffers_with_damage = NULL;
238  extensions = eglQueryString(display->egl.dpy, EGL_EXTENSIONS);
239  if (extensions &&
240  strstr(extensions, "EGL_EXT_swap_buffers_with_damage") &&
241  strstr(extensions, "EGL_EXT_buffer_age"))
242  display->swap_buffers_with_damage =
243  (PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC)
244  eglGetProcAddress("eglSwapBuffersWithDamageEXT");
245 
246  if (display->swap_buffers_with_damage)
247  HMI_DEBUG(log_prefix,"has EGL_EXT_buffer_age and EGL_EXT_swap_buffers_with_damage");
248 
249 }
250 
251 static void
253 {
254  eglTerminate(display->egl.dpy);
255  eglReleaseThread();
256 }
257 
258 static GLuint
259 create_shader(struct window *window, const char *source, GLenum shader_type)
260 {
261  GLuint shader;
262  GLint status;
263 
264  shader = glCreateShader(shader_type);
265  assert(shader != 0);
266 
267  glShaderSource(shader, 1, (const char **) &source, NULL);
268  glCompileShader(shader);
269 
270  glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
271  if (!status) {
272  char log[1000];
273  GLsizei len;
274  glGetShaderInfoLog(shader, 1000, &len, log);
275  HMI_ERROR(log_prefix,"Error: compiling %s: %*s",
276  shader_type == GL_VERTEX_SHADER ? "vertex" : "fragment",
277  len, log);
278  exit(1);
279  }
280 
281  return shader;
282 }
283 
284 static void
286 {
287  GLuint frag, vert;
288  GLuint program;
289  GLint status;
290 
291  frag = create_shader(window, frag_shader_text, GL_FRAGMENT_SHADER);
292  vert = create_shader(window, vert_shader_text, GL_VERTEX_SHADER);
293 
294  program = glCreateProgram();
295  glAttachShader(program, frag);
296  glAttachShader(program, vert);
297  glLinkProgram(program);
298 
299  glGetProgramiv(program, GL_LINK_STATUS, &status);
300  if (!status) {
301  char log[1000];
302  GLsizei len;
303  glGetProgramInfoLog(program, 1000, &len, log);
304  HMI_ERROR(log_prefix,"Error: linking:%*s", len, log);
305  exit(1);
306  }
307 
308  glUseProgram(program);
309 
310  window->gl.pos = 0;
311  window->gl.col = 1;
312 
313  glBindAttribLocation(program, window->gl.pos, "pos");
314  glBindAttribLocation(program, window->gl.col, "color");
315  glLinkProgram(program);
316 
317  window->gl.rotation_uniform =
318  glGetUniformLocation(program, "rotation");
319 }
320 
321 static void
323 {
324  uint32_t id_ivisurf = g_id_ivisurf;
325  window->ivi_surface =
326  ivi_application_surface_create(display->ivi_application,
327  id_ivisurf, window->surface);
328 
329  if (window->ivi_surface == NULL) {
330  HMI_ERROR(log_prefix,"Failed to create ivi_client_surface");
331  abort();
332  }
333 
334 }
335 
336 static void
338 {
339  struct display *display = window->display;
340  EGLBoolean ret;
341 
342  window->surface = wl_compositor_create_surface(display->compositor);
343 
344  window->native =
345  wl_egl_window_create(window->surface,
346  window->geometry.width,
347  window->geometry.height);
348  window->egl_surface =
349  weston_platform_create_egl_surface(display->egl.dpy,
350  display->egl.conf,
351  window->native, NULL);
352 
353 
354  if (display->ivi_application ) {
355  create_ivi_surface(window, display);
356  } else {
357  assert(0);
358  }
359 
360  ret = eglMakeCurrent(window->display->egl.dpy, window->egl_surface,
361  window->egl_surface, window->display->egl.ctx);
362  assert(ret == EGL_TRUE);
363 
364  if (!window->frame_sync)
365  eglSwapInterval(display->egl.dpy, 0);
366 
367 }
368 
369 static void
371 {
372  /* Required, otherwise segfault in egl_dri2.c: dri2_make_current()
373  * on eglReleaseThread(). */
374  eglMakeCurrent(window->display->egl.dpy, EGL_NO_SURFACE, EGL_NO_SURFACE,
375  EGL_NO_CONTEXT);
376 
377  eglDestroySurface(window->display->egl.dpy, window->egl_surface);
378  wl_egl_window_destroy(window->native);
379 
380  if (window->display->ivi_application)
381  ivi_surface_destroy(window->ivi_surface);
382  wl_surface_destroy(window->surface);
383 
384  if (window->callback)
385  wl_callback_destroy(window->callback);
386 }
387 
388 static void
389 redraw(void *data, struct wl_callback *callback, uint32_t time)
390 {
391  struct window *window = data;
392  struct display *display = window->display;
393  static const GLfloat verts[3][2] = {
394  { -0.5, -0.5 },
395  { 0.5, -0.5 },
396  { 0, 0.5 }
397  };
398 
399  static const GLfloat colors[3][3] = {
400  { 1, 0, 0 },
401  { 0, 1, 0 },
402  { 0, 0, 1 }
403  };
404 
405  GLfloat angle;
406  GLfloat rotation[4][4] = {
407  { 1, 0, 0, 0 },
408  { 0, 1, 0, 0 },
409  { 0, 0, 1, 0 },
410  { 0, 0, 0, 1 }
411  };
412  static const uint32_t speed_div = 5, benchmark_interval = 5;
413  struct wl_region *region;
414  EGLint rect[4];
415  EGLint buffer_age = 0;
416  struct timeval tv;
417 
418  assert(window->callback == callback);
419  window->callback = NULL;
420 
421  if (callback)
422  wl_callback_destroy(callback);
423 
424  gettimeofday(&tv, NULL);
425  time = tv.tv_sec * 1000 + tv.tv_usec / 1000;
426  if (window->frames == 0)
427  window->benchmark_time = time;
428 
429  if (time - window->benchmark_time > (benchmark_interval * 1000)) {
430  HMI_DEBUG(log_prefix,"%d frames in %d seconds: %f fps",
431  window->frames,
432  benchmark_interval,
433  (float) window->frames / benchmark_interval);
434  window->benchmark_time = time;
435  window->frames = 0;
436  }
437 
438  angle = (time / speed_div) % 360 * M_PI / 180.0;
439  rotation[0][0] = cos(angle);
440  rotation[0][2] = sin(angle);
441  rotation[2][0] = -sin(angle);
442  rotation[2][2] = cos(angle);
443 
444  if (display->swap_buffers_with_damage)
445  eglQuerySurface(display->egl.dpy, window->egl_surface,
446  EGL_BUFFER_AGE_EXT, &buffer_age);
447 
448  glViewport(0, 0, window->geometry.width, window->geometry.height);
449 
450  glUniformMatrix4fv(window->gl.rotation_uniform, 1, GL_FALSE,
451  (GLfloat *) rotation);
452 
453  glClearColor(0.0, 0.0, 0.0, 0.5);
454  glClear(GL_COLOR_BUFFER_BIT);
455 
456  glVertexAttribPointer(window->gl.pos, 2, GL_FLOAT, GL_FALSE, 0, verts);
457  glVertexAttribPointer(window->gl.col, 3, GL_FLOAT, GL_FALSE, 0, colors);
458  glEnableVertexAttribArray(window->gl.pos);
459  glEnableVertexAttribArray(window->gl.col);
460 
461  glDrawArrays(GL_TRIANGLES, 0, 3);
462 
463  glDisableVertexAttribArray(window->gl.pos);
464  glDisableVertexAttribArray(window->gl.col);
465 
466  if (window->opaque || window->fullscreen) {
467  region = wl_compositor_create_region(window->display->compositor);
468  wl_region_add(region, 0, 0,
469  window->geometry.width,
470  window->geometry.height);
471  wl_surface_set_opaque_region(window->surface, region);
472  wl_region_destroy(region);
473  } else {
474  wl_surface_set_opaque_region(window->surface, NULL);
475  }
476 
477  if (display->swap_buffers_with_damage && buffer_age > 0) {
478  rect[0] = window->geometry.width / 4 - 1;
479  rect[1] = window->geometry.height / 4 - 1;
480  rect[2] = window->geometry.width / 2 + 2;
481  rect[3] = window->geometry.height / 2 + 2;
482  display->swap_buffers_with_damage(display->egl.dpy,
483  window->egl_surface,
484  rect, 1);
485  } else {
486  eglSwapBuffers(display->egl.dpy, window->egl_surface);
487  }
488 
489  window->frames++;
490 }
491 
492 static void
493 registry_handle_global(void *data, struct wl_registry *registry,
494  uint32_t name, const char *interface, uint32_t version)
495 {
496  struct display *d = data;
497 
498  if (strcmp(interface, "wl_compositor") == 0) {
499  d->compositor =
500  wl_registry_bind(registry, name,
501  &wl_compositor_interface, 1);
502  } else if (strcmp(interface, "ivi_application") == 0) {
503  d->ivi_application =
504  wl_registry_bind(registry, name,
506  }
507 }
508 
509 static void
510 registry_handle_global_remove(void *data, struct wl_registry *registry,
511  uint32_t name)
512 {
513 }
514 
515 static const struct wl_registry_listener registry_listener = {
518 };
519 
520 static void
521 signal_int(int signum)
522 {
523  running = 0;
524 }
525 
526 int
527 init_wm(LibWindowmanager *wm, struct window *window)
528 {
529  HMI_DEBUG(log_prefix,"called");
530 
531  if (wm->init(port, token) != 0) {
532  HMI_ERROR(log_prefix,"wm init failed. ");
533  return -1;
534  }
535 
536  g_id_ivisurf = wm->requestSurface(main_role);
537  if (g_id_ivisurf < 0) {
538  HMI_ERROR(log_prefix,"wm request surface failed ");
539  return -1;
540  }
541  HMI_DEBUG(log_prefix,"IVI_SURFACE_ID: %d ", g_id_ivisurf);
542 
543  WMHandler wmh;
544  wmh.on_visible = [](const char* role, bool visible){
545  // Sample code if user uses visible event
546  HMI_DEBUG(log_prefix, "role: %s, visible: %s", role, visible ? "true" : "false");
547  };
548  wmh.on_sync_draw = [wm, window](const char* role, const char* area, Rect rect) {
549 
550  HMI_DEBUG(log_prefix,"Surface %s got syncDraw! Area: %s. w:%d, h:%d", role, area, rect.width(), rect.height());
551 
552  wl_egl_window_resize(window->native, rect.width(), rect.height(), 0, 0);
553  window->geometry.width = rect.width();
554  window->geometry.height = rect.height();
555 
556  wm->endDraw(role);
557  };
558 
559  wm->setEventHandler(wmh);
560 
561  return 0;
562 }
563 
564 int
566  if(hs->init(port, token)!=0)
567  {
568  HMI_ERROR(log_prefix,"homescreen init failed. ");
569  return -1;
570  }
571 
572  hs->set_event_handler(LibHomeScreen::Event_ShowWindow, [hs](json_object *object){
573  HMI_DEBUG("simple-egl","try to activeWindow %s ", app_name.c_str());
574 
575  struct json_object *param_obj = json_object_object_get(object, hs->_keyParameter);
576  const char *area = json_object_get_string(
577  json_object_object_get(param_obj, hs->_keyArea));
578  // Application should call LibWindowmanager::activateWindow() in showWindow handler
579  if(area == nullptr)
580  wm->activateWindow(main_role, hs->_areaNormal);
581  else
582  wm->activateWindow(main_role, area);
583  });
584 
585  return 0;
586 }
587 
588 int
589 main(int argc, char **argv)
590 {
591  struct sigaction sigint;
592  struct window window = { 0 };
593  struct display display = { 0 };
594 
595  window.display = &display;
596  display.window = &window;
597  window.geometry.width = 1080;
598  window.geometry.height = 1488;
599  window.window_size = window.geometry;
600  window.buffer_size = 32;
601  window.frame_sync = 1;
602 
603  if(argc > 2){
604  port = strtol(argv[1], NULL, 10);
605  token = argv[2];
606  }
607 
608  HMI_DEBUG(log_prefix,"main_role: %s, port: %d, token: %s. ", main_role, port, token.c_str());
609 
610  display.display = wl_display_connect(NULL);
611  assert(display.display);
612 
613  display.registry = wl_display_get_registry(display.display);
614  wl_registry_add_listener(display.registry,
615  &registry_listener, &display);
616 
617  wl_display_roundtrip(display.display);
618 
619  init_egl(&display, &window);
620 
621  wm = new LibWindowmanager();
622  if(init_wm(wm, &window)!=0){
623  fini_egl(&display);
624  if (display.ivi_application)
625  ivi_application_destroy(display.ivi_application);
626  if (display.compositor)
627  wl_compositor_destroy(display.compositor);
628  wl_registry_destroy(display.registry);
629  wl_display_flush(display.display);
630  return -1;
631  }
632 
633  hs = new LibHomeScreen();
634  if(init_hs(hs)!=0){
635  fini_egl(&display);
636  if (display.ivi_application)
637  ivi_application_destroy(display.ivi_application);
638  if (display.compositor)
639  wl_compositor_destroy(display.compositor);
640  wl_registry_destroy(display.registry);
641  wl_display_flush(display.display);
642  return -1;
643  }
644 
645  create_surface(&window);
646  init_gl(&window);
647 
648  //Ctrl+C
649  sigint.sa_handler = signal_int;
650  sigemptyset(&sigint.sa_mask);
651  sigint.sa_flags = SA_RESETHAND;
652  sigaction(SIGINT, &sigint, NULL);
653 
654  eglSwapBuffers(window.display->egl.dpy, window.egl_surface);
655 
656  wm->activateWindow(main_role);
657 
658  /* The mainloop here is a little subtle. Redrawing will cause
659  * EGL to read events so we can just call
660  * wl_display_dispatch_pending() to handle any events that got
661  * queued up as a side effect. */
662  while (running) {
663  wl_display_dispatch_pending(display.display);
664  redraw(&window, NULL, 0);
665  }
666 
667  HMI_DEBUG(log_prefix,"simple-egl exiting! ");
668 
669  destroy_surface(&window);
670  fini_egl(&display);
671 
672  if (display.ivi_application)
673  ivi_application_destroy(display.ivi_application);
674 
675  if (display.compositor)
676  wl_compositor_destroy(display.compositor);
677 
678  wl_registry_destroy(display.registry);
679  wl_display_flush(display.display);
680  wl_display_disconnect(display.display);
681 
682  return 0;
683 }
static const struct wl_message ivi_surface_events[]
Definition: simple-egl.cpp:81
+
struct window * window
Definition: simple-egl.cpp:126
+ +
static void registry_handle_global(void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version)
Definition: simple-egl.cpp:493
+
GLuint rotation_uniform
Definition: simple-egl.cpp:140
+
LibWindowmanager * wm
Definition: simple-egl.cpp:67
+
struct wl_seat * seat
Definition: simple-egl.cpp:120
+
static void init_gl(struct window *window)
Definition: simple-egl.cpp:285
+
uint32_t g_id_ivisurf
Definition: simple-egl.cpp:59
+
int init_wm(LibWindowmanager *wm, struct window *window)
Definition: simple-egl.cpp:527
+
EGLSurface surface
Definition: simple-egl.cpp:105
+
struct window::@1 gl
+
const struct wl_interface ivi_surface_interface
Definition: simple-egl.cpp:85
+
const char * main_role
Definition: simple-egl.cpp:64
+
uint32_t benchmark_time
Definition: simple-egl.cpp:145
+ +
int opaque
Definition: simple-egl.cpp:151
+
typedef EGLBoolean(EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC)(EGLDisplay dpy
+
EGLSurface EGLint * rects
Definition: simple-egl.cpp:105
+ +
static const struct wl_interface * types[]
Definition: simple-egl.cpp:69
+
static const struct wl_message ivi_application_requests[]
Definition: simple-egl.cpp:91
+
const char * _keyParameter
+
EGLDisplay dpy
Definition: simple-egl.cpp:122
+
EGLSurface egl_surface
Definition: simple-egl.cpp:149
+
string app_name
Definition: simple-egl.cpp:63
+
static GLuint create_shader(struct window *window, const char *source, GLenum shader_type)
Definition: simple-egl.cpp:259
+
GLuint pos
Definition: simple-egl.cpp:141
+
#define EGL_BUFFER_AGE_EXT
Definition: simple-egl.cpp:110
+
static void signal_int(int signum)
Definition: simple-egl.cpp:521
+
static const char * frag_shader_text
Definition: simple-egl.cpp:164
+
static void create_surface(struct window *window)
Definition: simple-egl.cpp:337
+
static void redraw(void *data, struct wl_callback *callback, uint32_t time)
Definition: simple-egl.cpp:389
+
EGLConfig conf
Definition: simple-egl.cpp:124
+ +
struct wl_egl_window * native
Definition: simple-egl.cpp:146
+
EGLSurface EGLint EGLint n_rects
Definition: simple-egl.cpp:105
+
string token
Definition: simple-egl.cpp:61
+
struct wl_surface * surface
Definition: simple-egl.cpp:147
+
static const char * vert_shader_text
Definition: simple-egl.cpp:154
+
struct ivi_application * ivi_application
Definition: simple-egl.cpp:127
+
LibHomeScreen * hs
Definition: simple-egl.cpp:66
+
struct display::@0 egl
+
GLuint col
Definition: simple-egl.cpp:142
+
struct wl_callback * callback
Definition: simple-egl.cpp:150
+
PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC swap_buffers_with_damage
Definition: simple-egl.cpp:129
+
const struct wl_interface ivi_application_interface
Definition: simple-egl.cpp:95
+
struct wl_registry * registry
Definition: simple-egl.cpp:118
+
static int running
Definition: simple-egl.cpp:171
+
struct display * display
Definition: simple-egl.cpp:137
+
const char * _keyArea
+ +
EGLContext ctx
Definition: simple-egl.cpp:123
+
long port
Definition: simple-egl.cpp:60
+
static const struct wl_registry_listener registry_listener
Definition: simple-egl.cpp:515
+
static void create_ivi_surface(struct window *window, struct display *display)
Definition: simple-egl.cpp:322
+
struct ivi_surface * ivi_surface
Definition: simple-egl.cpp:148
+
struct geometry geometry window_size
Definition: simple-egl.cpp:138
+ +
int init(const int port, const std::string &token)
+ +
int frame_sync
Definition: simple-egl.cpp:151
+
struct wl_display * display
Definition: simple-egl.cpp:117
+
static void fini_egl(struct display *display)
Definition: simple-egl.cpp:252
+
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:38
+
static void init_egl(struct display *display, struct window *window)
Definition: simple-egl.cpp:174
+
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:42
+
const char * _areaNormal
+
static void registry_handle_global_remove(void *data, struct wl_registry *registry, uint32_t name)
Definition: simple-egl.cpp:510
+
int main(int argc, char **argv)
Definition: simple-egl.cpp:589
+
struct wl_compositor * compositor
Definition: simple-egl.cpp:119
+
int buffer_size
Definition: simple-egl.cpp:151
+
const char * log_prefix
Definition: simple-egl.cpp:58
+ +
static void destroy_surface(struct window *window)
Definition: simple-egl.cpp:370
+
int fullscreen
Definition: simple-egl.cpp:151
+
int init_hs(LibHomeScreen *hs)
Definition: simple-egl.cpp:565
+
static const struct wl_message ivi_surface_requests[]
Definition: simple-egl.cpp:77
+
uint32_t frames
Definition: simple-egl.cpp:145
+
void set_event_handler(enum EventType et, handler_func f)
+
+ + + + diff --git a/doc/api-ref/html/de/dca/hs-clientmanager_8h.html b/doc/api-ref/html/de/dca/hs-clientmanager_8h.html new file mode 100644 index 0000000..81b17ae --- /dev/null +++ b/doc/api-ref/html/de/dca/hs-clientmanager_8h.html @@ -0,0 +1,136 @@ + + + + + + +HomeScreenBinding: src/hs-clientmanager.h File Reference + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ + +
+
+ +
+
hs-clientmanager.h File Reference
+
+
+
#include <string>
+#include <mutex>
+#include <memory>
+#include <unordered_map>
+#include "hs-helper.h"
+#include "hs-client.h"
+
+

Go to the source code of this file.

+ + + + + + +

+Classes

struct  HS_ClientCtxt
 
class  HS_ClientManager
 
+ + + +

+Typedefs

typedef struct HS_ClientCtxt HS_ClientCtxt
 
+

Typedef Documentation

+ +
+
+ + + + +
typedef struct HS_ClientCtxt HS_ClientCtxt
+
+ +
+
+
+ + + + diff --git a/doc/api-ref/html/de/dca/hs-clientmanager_8h_source.html b/doc/api-ref/html/de/dca/hs-clientmanager_8h_source.html new file mode 100644 index 0000000..349281b --- /dev/null +++ b/doc/api-ref/html/de/dca/hs-clientmanager_8h_source.html @@ -0,0 +1,117 @@ + + + + + + +HomeScreenBinding: src/hs-clientmanager.h Source File + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ + +
+
+
+
hs-clientmanager.h
+
+
+Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 TOYOTA MOTOR CORPORATION
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef HOMESCREEN_CLIENTMANAGER_H
18 #define HOMESCREEN_CLIENTMANAGER_H
19 
20 #include <string>
21 #include <mutex>
22 #include <memory>
23 #include <unordered_map>
24 #include "hs-helper.h"
25 #include "hs-client.h"
26 
27 typedef struct HS_ClientCtxt
28 {
29  std::string id;
30  HS_ClientCtxt(const char *appid)
31  {
32  id = appid;
33  }
35 
36 
38 public:
40  ~HS_ClientManager() = default;
41  HS_ClientManager(HS_ClientManager const &) = delete;
42  HS_ClientManager &operator=(HS_ClientManager const &) = delete;
44  HS_ClientManager &operator=(HS_ClientManager &&) = delete;
45 
46  static HS_ClientManager* instance(void);
47  int init(void);
48  void removeClientCtxt(void *data);
49 
50  int tap_shortcut(afb_req_t request);
51  int showWindow(afb_req_t request);
52  int hideWindow(afb_req_t request);
53  int replyShowWindow(afb_req_t request);
54  int on_screen_message(afb_req_t request);
55  int on_screen_reply(afb_req_t request);
56  int subscribe(afb_req_t request);
57  int unsubscribe(afb_req_t request);
58  int showNotification(afb_req_t request);
59  int showInformation(afb_req_t request);
60 
61 private:
62  HS_ClientCtxt* createClientCtxt(afb_req_t req, std::string appid);
63  HS_Client* addClient(afb_req_t req, std::string appid);
64  void removeClient(std::string appid);
65 
66 private:
67  static HS_ClientManager* me;
68  std::unordered_map<std::string, HS_Client*> client_list;
69  std::unordered_map<std::string, HS_ClientCtxt*> appid2ctxt;
70  std::mutex mtx;
71 };
72 
73 #endif // HOMESCREEN_CLIENTMANAGER_H
HS_ClientCtxt(const char *appid)
+
static void showWindow(afb_req_t request)
Definition: homescreen.cpp:194
+
static void on_screen_reply(afb_req_t request)
Definition: homescreen.cpp:113
+
static void on_screen_message(afb_req_t request)
Definition: homescreen.cpp:85
+
static void subscribe(afb_req_t request)
Definition: homescreen.cpp:140
+ + +
static void unsubscribe(afb_req_t request)
Definition: homescreen.cpp:167
+ +
static void showInformation(afb_req_t request)
Definition: homescreen.cpp:306
+ + +
static void hideWindow(afb_req_t request)
Definition: homescreen.cpp:221
+
std::string id
+
static void replyShowWindow(afb_req_t request)
Definition: homescreen.cpp:248
+
static void showNotification(afb_req_t request)
Definition: homescreen.cpp:277
+
static void tap_shortcut(afb_req_t request)
Definition: homescreen.cpp:58
+
static int init(afb_api_t api)
Definition: homescreen.cpp:368
+
+ + + + diff --git a/doc/api-ref/html/de/dd0/class_lib_home_screen.html b/doc/api-ref/html/de/dd0/class_lib_home_screen.html index 2181e10..66e6319 100644 --- a/doc/api-ref/html/de/dd0/class_lib_home_screen.html +++ b/doc/api-ref/html/de/dd0/class_lib_home_screen.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: LibHomeScreen Class Reference @@ -12,6 +11,9 @@ + @@ -29,19 +31,40 @@
- + - - - - + +
@@ -72,9 +96,17 @@ $(function() { - @@ -90,17 +122,17 @@ Public Member Functions - + - - + + - + @@ -110,15 +142,40 @@ Public Member Functions + + + + + + + + + + - +

Public Types

enum  EventType { Event_TapShortcut = 1, +
enum  EventType {
+  Event_ShowWindow = 1, +Event_TapShortcut = 1, Event_OnScreenMessage, -Event_OnScreenReply +Event_OnScreenReply, +
+  Event_HideWindow, +Event_ReplyShowWindow, +Event_ShowNotification, +Event_ShowInformation +
}
 
using handler_func = std::function< void(json_object *)>
 
LibHomeScreenoperator= (const LibHomeScreen &)=delete
 
int init (const int port, const std::string &token)
int init (const int port, const std::string &token)
 
int tapShortcut (const char *application_name)
 
int tapShortcut (const char *application_id)
 
int onScreenMessage (const char *display_message)
 
int onScreenReply (const char *reply_message)
 
void set_event_handler (enum EventType et, handler_func f)
 
void registerCallback (void(*event_cb)(const std::string &event, struct json_object *event_contents), void(*reply_cb)(struct json_object *reply_contents), void(*hangup_cb)(void)=nullptr)
void registerCallback (void(*event_cb)(const std::string &event, struct json_object *event_contents), void(*reply_cb)(struct json_object *reply_contents), void(*hangup_cb)(void)=nullptr)
 
int call (const std::string &verb, struct json_object *arg)
 
 
int unsubscribe (const std::string &event_name)
 
int showWindow (const char *application_id, json_object *json)
 
int hideWindow (const char *application_id)
 
int replyShowWindow (const char *application_id, json_object *json)
 
int showNotification (json_object *json)
 
int showInformation (json_object *json)
 
void on_hangup (void *closure, struct afb_wsj1 *wsj)
 
void on_call (void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg)
 
void on_event (void *closure, const char *event, struct afb_wsj1_msg *msg)
void on_event (void *closure, const char *event, struct afb_wsj1_msg *msg)
 
void on_reply (void *closure, struct afb_wsj1_msg *msg)
 
+ + + + + + + + + + + + + +

+Public Attributes

const char * _keyParameter = "parameter"
 
const char * _keyArea = "area"
 
const char * _areaNormal = "normal"
 
const char * _areaFullScreen = "fullscreen"
 
const char * _areaSplitMain = "split.main"
 
const char * _areaSplitSub = "split.sub"
 
@@ -128,11 +185,9 @@ Static Public Attributes

Static Public Attributes

static const std::vector< std::string > api_list

Detailed Description

-

Definition at line 32 of file libhomescreen.hpp.

+

Definition at line 31 of file libhomescreen.hpp.

Member Typedef Documentation

- -

◆ handler_func

- +
@@ -142,14 +197,12 @@ Static Public Attributes
-

Definition at line 42 of file libhomescreen.hpp.

+

Definition at line 40 of file libhomescreen.hpp.

Member Enumeration Documentation

- -

◆ EventType

- +
@@ -159,22 +212,38 @@ Static Public Attributes
- - - + + + + + + + +
Enumerator
Event_TapShortcut 
Event_OnScreenMessage 
Event_OnScreenReply 
Enumerator
Event_ShowWindow  +
Event_TapShortcut  +
Event_OnScreenMessage  +
Event_OnScreenReply  +
Event_HideWindow  +
Event_ReplyShowWindow  +
Event_ShowNotification  +
Event_ShowInformation  +
-

Definition at line 44 of file libhomescreen.hpp.

-

Constructor & Destructor Documentation

- -

◆ LibHomeScreen() [1/2]

- +
@@ -188,13 +257,11 @@ Static Public Attributes

constructor

-

Definition at line 83 of file libhomescreen.cpp.

-
84 {
85 }
+

Definition at line 93 of file libhomescreen.cpp.

+
94 {
95 }
- -

◆ ~LibHomeScreen()

- +
@@ -208,13 +275,11 @@ Static Public Attributes

destructor

-

Definition at line 90 of file libhomescreen.cpp.

-
91 {
92  if(mploop)
93  {
94  sd_event_unref(mploop);
95  }
96  if(sp_websock != NULL)
97  {
98  afb_wsj1_unref(sp_websock);
99  }
100 }
+

Definition at line 100 of file libhomescreen.cpp.

+
101 {
102  if(mploop)
103  {
104  sd_event_unref(mploop);
105  }
106  if(sp_websock != NULL)
107  {
108  afb_wsj1_unref(sp_websock);
109  }
110 }
- -

◆ LibHomeScreen() [2/2]

- +
@@ -239,9 +304,7 @@ Static Public Attributes

Member Function Documentation

- -

◆ call() [1/2]

- +
@@ -267,9 +330,7 @@ Static Public Attributes - -

◆ call() [2/2]

- +
@@ -305,17 +366,45 @@ Static Public Attributes

Note

To call HomeScreen's APIs, the application should set its function name, arguments to JSON format.

-

Definition at line 360 of file libhomescreen.cpp.

-
361 {
362  int ret;
363  if(!sp_websock)
364  {
365  return -1;
366  }
367  if (!has_verb(string(verb)))
368  {
369  HMI_ERROR("libhomescreen","verb doesn't exit");
370  return -1;
371  }
372  ret = afb_wsj1_call_j(sp_websock, API, verb, arg, _on_reply_static, this);
373  if (ret < 0) {
374  HMI_ERROR("libhomescreen","Failed to call verb:%s",verb);
375  }
376  return ret;
377 }
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:18
-
static const char API[]
-
static bool has_verb(const string &verb)
-
static void _on_reply_static(void *closure, struct afb_wsj1_msg *msg)
+

Definition at line 377 of file libhomescreen.cpp.

+
378 {
379  int ret;
380  if(!sp_websock)
381  {
382  return -1;
383  }
384  if (!has_verb(string(verb)))
385  {
386  HMI_ERROR("libhomescreen","verb doesn't exit");
387  return -1;
388  }
389  ret = afb_wsj1_call_j(sp_websock, API, verb, arg, _on_reply_static, this);
390  if (ret < 0) {
391  HMI_ERROR("libhomescreen","Failed to call verb:%s",verb);
392  }
393  return ret;
394 }
static const char API[]
+
static bool has_verb(const string &verb)
+
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:38
+
static void _on_reply_static(void *closure, struct afb_wsj1_msg *msg)
- -

◆ init()

+ +
+
+
+ + + + + + + +
int LibHomeScreen::hideWindow (const char * application_id)
+
+

Sending hide window event

+

Call HomeScreen Service's hideWindow verb to release id's screen.

+

Parameters

+
    +
  • application_id [in] : This argument should be specified to the application's id.
  • +
+

Return

+
    +
  • Returns 0 on success or -1 in case of error.
  • +
+

Definition at line 503 of file libhomescreen.cpp.

+
504 {
505  if(!sp_websock)
506  {
507  return -1;
508  }
509 
510  struct json_object* j_obj = json_object_new_object();
511  struct json_object* val = json_object_new_string(application_id);
512  json_object_object_add(j_obj, ApplicationId, val);
513 
514  return this->call("hideWindow", j_obj);
515 }
static const char ApplicationId[]
+
int call(const std::string &verb, struct json_object *arg)
+
+
+
+
@@ -349,15 +438,15 @@ Static Public Attributes

Note

Use this constructor

-

Definition at line 116 of file libhomescreen.cpp.

-
117 {
118  int ret = 0;
119  if(port > 0 && token.size() > 0)
120  {
121  mport = port;
122  mtoken = token;
123  }
124  else
125  {
126  HMI_ERROR("libhomescreen","port and token should be > 0, Initial port and token uses.");
127  }
128 
129  ret = initialize_websocket();
130  if(ret != 0 )
131  {
132  HMI_ERROR("libhomescreen","Failed to initialize websocket");
133  }
134  else{
135  HMI_DEBUG("libhomescreen","Initialized");
136  }
137 
138  return ret;
139 }
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:18
-
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:22
+

Definition at line 126 of file libhomescreen.cpp.

+
127 {
128  int ret = 0;
129  if(port > 0 && token.size() > 0)
130  {
131  mport = port;
132  mtoken = token;
133  }
134  else
135  {
136  HMI_ERROR("libhomescreen","port and token should be > 0, Initial port and token uses.");
137  }
138 
139  ret = initialize_websocket();
140  if(ret != 0 )
141  {
142  HMI_ERROR("libhomescreen","Failed to initialize websocket");
143  }
144  else{
145  HMI_DEBUG("libhomescreen","Initialized");
146  }
147 
148  return ret;
149 }
string token
Definition: simple-egl.cpp:61
+
long port
Definition: simple-egl.cpp:60
+
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:38
+
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:42
- -

◆ on_call()

- +
@@ -393,13 +482,11 @@ Static Public Attributes
-

Definition at line 448 of file libhomescreen.cpp.

-
449 {
450 }
+

Definition at line 606 of file libhomescreen.cpp.

+
607 {
608 }
- -

◆ on_event()

- +
@@ -429,20 +516,23 @@ Static Public Attributes
-

Definition at line 458 of file libhomescreen.cpp.

-
459 {
460  HMI_DEBUG("libhomescreen","event: (%s) msg: (%s).", event, afb_wsj1_msg_object_s(msg));
461 
462  if (strstr(event, API) == NULL) {
463  return;
464  }
465 
466  struct json_object* ev_contents = afb_wsj1_msg_object_j(msg);
467  struct json_object *json_data = json_object_object_get(ev_contents, "data");
468 
469  if(onEvent != nullptr)
470  {
471  const string ev(event);
472  onEvent(ev, ev_contents);
473  }
474 
475  const char* event_only = strchr(event, '/');
476  if (event_only != nullptr) {
477  event_only = event_only + 1;
478  }
479 
480  if (strcasecmp(event_only, LibHomeScreen::event_list[0].c_str()) == 0) {
481  auto i = this->handlers.find(Event_TapShortcut);
482  if ( i != this->handlers.end() ) {
483  i->second(json_data);
484  }
485  }
486  else if (strcasecmp(event_only, LibHomeScreen::event_list[1].c_str()) == 0) {
487  auto i = this->handlers.find(Event_OnScreenMessage);
488  if ( i != this->handlers.end() ) {
489  i->second(json_data);
490  }
491  }
492  else if (strcasecmp(event_only, LibHomeScreen::event_list[2].c_str()) == 0) {
493  auto i = this->handlers.find(Event_OnScreenReply);
494  if ( i != this->handlers.end() ) {
495  i->second(json_data);
496  }
497  }
498 
499  json_object_put(ev_contents);
500 }
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:22
- -
static const char API[]
- - -
static const std::vector< std::string > event_list
- +

Definition at line 616 of file libhomescreen.cpp.

+
617 {
618  HMI_DEBUG("libhomescreen","event: (%s) msg: (%s).", event, afb_wsj1_msg_object_s(msg));
619 
620  if (strstr(event, API) == NULL) {
621  return;
622  }
623 
624  struct json_object* ev_contents = afb_wsj1_msg_object_j(msg);
625  struct json_object *json_data;
626  if(!json_object_object_get_ex(ev_contents, "data", &json_data)) {
627  HMI_ERROR("libhomescreen", "got ev_contents error.");
628  return;
629  }
630 
631  if(onEvent != nullptr)
632  {
633  const string ev(event);
634  onEvent(ev, ev_contents);
635  }
636 
637  const char* event_type = nullptr;
638  struct json_object *json_event_type;
639  if(json_object_object_get_ex(json_data, "type", &json_event_type)) {
640  event_type = json_object_get_string(json_event_type);
641  }
642  else {
643  HMI_WARNING("libhomescreen","event_type is null.");
644  return;
645  }
646 
647  if (strcasecmp(event_type, LibHomeScreen::event_list[0].c_str()) == 0) {
648  auto i = this->handlers.find(Event_ShowWindow);
649  if ( i != this->handlers.end() ) {
650  i->second(json_data);
651  }
652  }
653  else if (strcasecmp(event_type, LibHomeScreen::event_list[1].c_str()) == 0) {
654  auto i = this->handlers.find(Event_OnScreenMessage);
655  if ( i != this->handlers.end() ) {
656  i->second(json_data);
657  }
658  }
659  else if (strcasecmp(event_type, LibHomeScreen::event_list[2].c_str()) == 0) {
660  auto i = this->handlers.find(Event_OnScreenReply);
661  if ( i != this->handlers.end() ) {
662  i->second(json_data);
663  }
664  }
665  else if (strcasecmp(event_type, LibHomeScreen::event_list[3].c_str()) == 0) {
666  auto i = this->handlers.find(Event_HideWindow);
667  if ( i != this->handlers.end() ) {
668  i->second(json_data);
669  }
670  }
671  else if (strcasecmp(event_type, LibHomeScreen::event_list[4].c_str()) == 0) {
672  auto i = this->handlers.find(Event_ReplyShowWindow);
673  if ( i != this->handlers.end() ) {
674  i->second(json_data);
675  }
676  }
677  else if (strcasecmp(event_type, LibHomeScreen::event_list[5].c_str()) == 0) {
678  auto i = this->handlers.find(Event_ShowNotification);
679  if ( i != this->handlers.end() ) {
680  i->second(json_data);
681  }
682  }
683  else if (strcasecmp(event_type, LibHomeScreen::event_list[6].c_str()) == 0) {
684  auto i = this->handlers.find(Event_ShowInformation);
685  if ( i != this->handlers.end() ) {
686  i->second(json_data);
687  }
688  }
689 }
static const char API[]
+ + + + + + +
#define HMI_WARNING(prefix, args,...)
Definition: hmi-debug.h:39
+ +
static const std::vector< std::string > event_list
+
#define HMI_ERROR(prefix, args,...)
Definition: hmi-debug.h:38
+
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:42
- -

◆ on_hangup()

- +
@@ -466,14 +556,12 @@ Static Public Attributes
-

Definition at line 439 of file libhomescreen.cpp.

-
440 {
441  HMI_DEBUG("libhomescreen","%s called", __FUNCTION__);
442  if(onHangup != nullptr)
443  {
444  onHangup();
445  }
446 }
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:22
+

Definition at line 597 of file libhomescreen.cpp.

+
598 {
599  HMI_DEBUG("libhomescreen","called");
600  if(onHangup != nullptr)
601  {
602  onHangup();
603  }
604 }
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:42
- -

◆ on_reply()

- +
@@ -498,14 +586,12 @@ Static Public Attributes

msg is like ({"response":{"verb":"subscribe","error":0},"jtype":"afb-reply","request":{"status":"success","info":"homescreen binder subscribe event name [on_screen_message]"}}) msg is like ({"response":{"verb":"tap_shortcut","error":0},"jtype":"afb-reply","request":{"status":"success","info":"afb_event_push event [tap_shortcut]"}})

-

Definition at line 506 of file libhomescreen.cpp.

-
507 {
508  HMI_DEBUG("libhomescreen","msg: (%s)", afb_wsj1_msg_object_s(msg));
509  if(onReply != nullptr)
510  {
511  struct json_object* reply = afb_wsj1_msg_object_j(msg);
512  onReply(reply);
513 
514  json_object_put(reply);
515  }
516 }
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:22
+

Definition at line 695 of file libhomescreen.cpp.

+
696 {
697  HMI_DEBUG("libhomescreen","msg: (%s)", afb_wsj1_msg_object_s(msg));
698  if(onReply != nullptr)
699  {
700  struct json_object* reply = afb_wsj1_msg_object_j(msg);
701  onReply(reply);
702  }
703 }
#define HMI_DEBUG(prefix, args,...)
Definition: hmi-debug.h:42
- -

◆ onScreenMessage()

- +
@@ -529,14 +615,12 @@ Static Public Attributes
  • Returns 0 on success or -1 in case of error.
  • -

    Definition at line 244 of file libhomescreen.cpp.

    -
    245 {
    246  if(!sp_websock)
    247  {
    248  return -1;
    249  }
    250 
    251  struct json_object* j_obj = json_object_new_object();
    252  struct json_object* val = json_object_new_string(display_message);
    253  json_object_object_add(j_obj, "display_message", val);
    254  return this->call("on_screen_message", j_obj);
    255 }
    int call(const std::string &verb, struct json_object *arg)
    +

    Definition at line 242 of file libhomescreen.cpp.

    +
    243 {
    244  if(!sp_websock)
    245  {
    246  return -1;
    247  }
    248 
    249  struct json_object* j_obj = json_object_new_object();
    250  struct json_object* val = json_object_new_string(display_message);
    251  json_object_object_add(j_obj, "display_message", val);
    252  return this->call("on_screen_message", j_obj);
    253 }
    int call(const std::string &verb, struct json_object *arg)
    - -

    ◆ onScreenReply()

    - +
    @@ -560,14 +644,12 @@ Static Public Attributes
  • Returns 0 on success or -1 in case of error.
  • -

    Definition at line 268 of file libhomescreen.cpp.

    -
    269 {
    270  if(!sp_websock)
    271  {
    272  return -1;
    273  }
    274 
    275  struct json_object* j_obj = json_object_new_object();
    276  struct json_object* val = json_object_new_string(reply_message);
    277  json_object_object_add(j_obj, "reply_message", val);
    278  return this->call("on_screen_reply", j_obj);
    279 }
    int call(const std::string &verb, struct json_object *arg)
    +

    Definition at line 266 of file libhomescreen.cpp.

    +
    267 {
    268  if(!sp_websock)
    269  {
    270  return -1;
    271  }
    272 
    273  struct json_object* j_obj = json_object_new_object();
    274  struct json_object* val = json_object_new_string(reply_message);
    275  json_object_object_add(j_obj, "reply_message", val);
    276  return this->call("on_screen_reply", j_obj);
    277 }
    int call(const std::string &verb, struct json_object *arg)
    - -

    ◆ operator=()

    - +
    @@ -591,16 +673,14 @@ Static Public Attributes - -

    ◆ registerCallback()

    - +
    - + @@ -633,13 +713,53 @@ Static Public Attributes

    Note

    Event callback is invoked by home screen for event you subscribed. If you would like to get event, please call subscribe function before/after this function

    -

    Definition at line 155 of file libhomescreen.cpp.

    -
    159 {
    160  onEvent = event_cb;
    161  onReply = reply_cb;
    162  onHangup = hangup_cb;
    163 }
    +

    Definition at line 165 of file libhomescreen.cpp.

    +
    169 {
    170  onEvent = event_cb;
    171  onReply = reply_cb;
    172  onHangup = hangup_cb;
    173 }
    - -

    ◆ set_event_handler()

    + +
    +
    +
    void LibHomeScreen::registerCallback (void(*)(const std::string &event, struct json_object *event_contents) void(*)(const std::string &event, struct json_object *event_contents)  event_cb,
    + + + + + + + + + + + + + + + + + +
    int LibHomeScreen::replyShowWindow (const char * application_id,
    json_object * json 
    )
    +
    +

    Sending reply onscreen message event

    +

    Call HomeScreen Service's replyShowWindow verb to reply onscreen message.

    +

    Parameters

    +
      +
    • application_id [in] : This argument should be specified to the onscreen reply to applilcation id.
    • +
    • json [in] : This argument should be specified to the json parameters.
    • +
    +

    Return

    +
      +
    • Returns 0 on success or -1 in case of error.
    • +
    +

    Definition at line 530 of file libhomescreen.cpp.

    +
    531 {
    532  if(!sp_websock)
    533  {
    534  return -1;
    535  }
    536 
    537  if (json == nullptr) {
    538  HMI_WARNING("libhomescreen", "replyShowWindow`s parameter is null");
    539  return -1;
    540  }
    541 
    542  struct json_object* j_obj = json_object_new_object();
    543  struct json_object* val = json_object_new_string(application_id);
    544  json_object_object_add(j_obj, ApplicationId, val);
    545  json_object_object_add(j_obj, "parameter", json);
    546 
    547  return this->call("replyShowWindow", j_obj);
    548 }
    static const char ApplicationId[]
    +
    int call(const std::string &verb, struct json_object *arg)
    +
    #define HMI_WARNING(prefix, args,...)
    Definition: hmi-debug.h:39
    +
    +
    +
    +
    @@ -670,20 +790,123 @@ Static Public Attributes
  • f [in] : event handler
  • Return

    -

    Nothing

    - -

    Definition at line 293 of file libhomescreen.cpp.

    -
    294 {
    295  if (et >= 1 && et <= 3) {
    296  switch (et) {
    297  case Event_TapShortcut:
    299  break;
    302  break;
    303  case Event_OnScreenReply:
    305  break;
    306  }
    307 
    308  this->handlers[et] = std::move(f);
    309  }
    310 }
    - -
    int subscribe(const std::string &event_name)
    -
    static const std::vector< std::string > event_list
    - +

    Nothing

    +

    Note

    +

    Don't release json_object by json_object_put in handler_func. The resource is released by libafbwsc library.

    + +

    Definition at line 295 of file libhomescreen.cpp.

    +
    296 {
    297  if (et >= 1 && et <= 7) {
    298  switch (et) {
    299 /* case Event_TapShortcut:
    300  this->subscribe(LibHomeScreen::event_list[0]);
    301  break;*/
    302  case Event_ShowWindow:
    304  break;
    307  break;
    308  case Event_OnScreenReply:
    310  break;
    311  case Event_HideWindow:
    313  break;
    316  break;
    319  break;
    322  break;
    323  }
    324 
    325  this->handlers[et] = std::move(f);
    326  }
    327 }
    + + + + +
    int subscribe(const std::string &event_name)
    + + +
    static const std::vector< std::string > event_list
    - -

    ◆ subscribe()

    + +
    +
    +
    + + + + + + + +
    int LibHomeScreen::showInformation (json_object * json)
    +
    +

    Sending show information event

    +

    Call HomeScreen Service's information verb to show notification on Information Bar.

    +

    Parameters

    +
      +
    • json [in] : This argument should be specified to the json parameters.
    • +
    +

    Return

    +
      +
    • Returns 0 on success or -1 in case of error.
    • +
    +

    Definition at line 584 of file libhomescreen.cpp.

    +
    585 {
    586  if(!sp_websock)
    587  {
    588  return -1;
    589  }
    590 
    591  return this->call("showInformation", json);
    592 }
    int call(const std::string &verb, struct json_object *arg)
    +
    +
    +
    + +
    +
    + + + + + + + + +
    int LibHomeScreen::showNotification (json_object * json)
    +
    +

    Sending show notification event

    +

    Call HomeScreen Service's notification verb to show notification on Status Bar.

    +

    Parameters

    +
      +
    • json [in] : This argument should be specified to the json parameters.
    • +
    +

    Return

    +
      +
    • Returns 0 on success or -1 in case of error.
    • +
    + +

    Definition at line 562 of file libhomescreen.cpp.

    +
    563 {
    564  if(!sp_websock)
    565  {
    566  return -1;
    567  }
    568 
    569  return this->call("showNotification", json);
    570 }
    int call(const std::string &verb, struct json_object *arg)
    +
    +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + +
    int LibHomeScreen::showWindow (const char * application_id,
    json_object * json 
    )
    +
    +

    Sending show window event

    +

    Call HomeScreen Service's showWindow verb to request display id's screen.

    +

    Parameters

    +
      +
    • application_id [in] : This argument should be specified to the application's id.
    • +
    • json [in] : This argument should be specified to the json parameters.
    • +
    +

    Return

    +
      +
    • Returns 0 on success or -1 in case of error.
    • +
    + +

    Definition at line 467 of file libhomescreen.cpp.

    +
    468 {
    469  if(!sp_websock)
    470  {
    471  return -1;
    472  }
    473 
    474  struct json_object* j_obj = json_object_new_object();
    475  struct json_object* val = json_object_new_string(application_id);
    476  json_object_object_add(j_obj, ApplicationId, val);
    477 
    478  if (json == nullptr) {
    479  struct json_object* j_json = json_object_new_object();
    480  struct json_object* value = json_object_new_string("normal");
    481  json_object_object_add(j_json, "area", value);
    482  json_object_object_add(j_obj, "parameter", j_json);
    483  }
    484  else {
    485  json_object_object_add(j_obj, "parameter", json);
    486  }
    487 
    488  return this->call("showWindow", j_obj);
    489 }
    static const char ApplicationId[]
    +
    int call(const std::string &verb, struct json_object *arg)
    +
    +
    +
    +
    @@ -708,16 +931,14 @@ Static Public Attributes

    Note

    This function enables to get an event to your callback function.

    -

    Definition at line 392 of file libhomescreen.cpp.

    -
    393 {
    394  if(!sp_websock)
    395  {
    396  return -1;
    397  }
    398  struct json_object* j_obj = json_object_new_object();
    399  json_object_object_add(j_obj, "event", json_object_new_string(event_name.c_str()));
    400 
    401  int ret = afb_wsj1_call_j(sp_websock, API, "subscribe", j_obj, _on_reply_static, this);
    402  if (ret < 0) {
    403  HMI_ERROR("libhomescreen","Failed to call verb:%s",__FUNCTION__);
    404  }
    405  return ret;
    406 }
    #define HMI_ERROR(prefix, args,...)
    Definition: hmi-debug.h:18
    -
    static const char API[]
    -
    static void _on_reply_static(void *closure, struct afb_wsj1_msg *msg)
    +

    Definition at line 409 of file libhomescreen.cpp.

    +
    410 {
    411  if(!sp_websock)
    412  {
    413  return -1;
    414  }
    415  struct json_object* j_obj = json_object_new_object();
    416  json_object_object_add(j_obj, "event", json_object_new_string(event_name.c_str()));
    417 
    418  int ret = afb_wsj1_call_j(sp_websock, API, "subscribe", j_obj, _on_reply_static, this);
    419  if (ret < 0) {
    420  HMI_ERROR("libhomescreen","Failed to call verb");
    421  }
    422  return ret;
    423 }
    static const char API[]
    +
    #define HMI_ERROR(prefix, args,...)
    Definition: hmi-debug.h:38
    +
    static void _on_reply_static(void *closure, struct afb_wsj1_msg *msg)
    - -

    ◆ tapShortcut()

    - +
    @@ -725,7 +946,7 @@ Static Public Attributes - +
    int LibHomeScreen::tapShortcut ( const char * application_name)application_id)
    @@ -734,21 +955,19 @@ Static Public Attributes

    When HomeScreen shortcut area is tapped, sending a event

    Parameters

      -
    • application_name [in] : Tapped application name (label)
    • +
    • application_id [in] : Tapped application id (label)

    Return

    • Returns 0 on success or -1 in case of error.
    -

    Definition at line 220 of file libhomescreen.cpp.

    -
    221 {
    222  if(!sp_websock)
    223  {
    224  return -1;
    225  }
    226 
    227  struct json_object* j_obj = json_object_new_object();
    228  struct json_object* val = json_object_new_string(application_name);
    229  json_object_object_add(j_obj, "application_name", val);
    230  return this->call("tap_shortcut", j_obj);
    231 }
    int call(const std::string &verb, struct json_object *arg)
    +

    Definition at line 222 of file libhomescreen.cpp.

    +
    223 {
    224  struct json_object* obj = json_object_new_object();
    225  struct json_object* val = json_object_new_string("normal");
    226  json_object_object_add(obj, "area", val);
    227 
    228  return showWindow(application_id, obj);
    229 }
    int showWindow(const char *application_id, json_object *json)
    - -

    ◆ unsubscribe()

    - +
    @@ -773,17 +992,99 @@ Static Public Attributes

    Note

    This function disables to get an event to your callback function.

    -

    Definition at line 421 of file libhomescreen.cpp.

    -
    422 {
    423  if(!sp_websock)
    424  {
    425  return -1;
    426  }
    427  struct json_object* j_obj = json_object_new_object();
    428  json_object_object_add(j_obj, "event", json_object_new_string(event_name.c_str()));
    429 
    430  int ret = afb_wsj1_call_j(sp_websock, API, "unsubscribe", j_obj, _on_reply_static, this);
    431  if (ret < 0) {
    432  HMI_ERROR("libhomescreen","Failed to call verb:%s",__FUNCTION__);
    433  }
    434  return ret;
    435 }
    #define HMI_ERROR(prefix, args,...)
    Definition: hmi-debug.h:18
    -
    static const char API[]
    -
    static void _on_reply_static(void *closure, struct afb_wsj1_msg *msg)
    +

    Definition at line 438 of file libhomescreen.cpp.

    +
    439 {
    440  if(!sp_websock)
    441  {
    442  return -1;
    443  }
    444  struct json_object* j_obj = json_object_new_object();
    445  json_object_object_add(j_obj, "event", json_object_new_string(event_name.c_str()));
    446 
    447  int ret = afb_wsj1_call_j(sp_websock, API, "unsubscribe", j_obj, _on_reply_static, this);
    448  if (ret < 0) {
    449  HMI_ERROR("libhomescreen","Failed to call verb");
    450  }
    451  return ret;
    452 }
    static const char API[]
    +
    #define HMI_ERROR(prefix, args,...)
    Definition: hmi-debug.h:38
    +
    static void _on_reply_static(void *closure, struct afb_wsj1_msg *msg)

    Member Data Documentation

    - -

    ◆ api_list

    + +
    +
    +
    + + + +
    const char* LibHomeScreen::_areaFullScreen = "fullscreen"
    +
    + +

    Definition at line 59 of file libhomescreen.hpp.

    + +
    +
    + +
    +
    + + + + +
    const char* LibHomeScreen::_areaNormal = "normal"
    +
    + +

    Definition at line 58 of file libhomescreen.hpp.

    + +
    +
    + +
    +
    + + + + +
    const char* LibHomeScreen::_areaSplitMain = "split.main"
    +
    + +

    Definition at line 60 of file libhomescreen.hpp.

    + +
    +
    + +
    +
    + + + + +
    const char* LibHomeScreen::_areaSplitSub = "split.sub"
    +
    +

    Definition at line 61 of file libhomescreen.hpp.

    + +
    +
    + +
    +
    + + + + +
    const char* LibHomeScreen::_keyArea = "area"
    +
    + +

    Definition at line 55 of file libhomescreen.hpp.

    + +
    +
    + +
    +
    + + + + +
    const char* LibHomeScreen::_keyParameter = "parameter"
    +
    + +

    Definition at line 54 of file libhomescreen.hpp.

    + +
    +
    +
    @@ -800,14 +1101,12 @@ Static Public Attributes
    -Initial value:
    {
    std::string("ping"),
    std::string("tap_shortcut"),
    std::string("on_screen_message"),
    std::string("on_screen_reply"),
    std::string("subscribe"),
    std::string("unsubscribe")
    }
    -

    Definition at line 50 of file libhomescreen.hpp.

    +Initial value:
    {
    std::string("ping"),
    std::string("tap_shortcut"),
    std::string("on_screen_message"),
    std::string("on_screen_reply"),
    std::string("subscribe"),
    std::string("unsubscribe"),
    std::string("showWindow"),
    std::string("hideWindow"),
    std::string("replyShowWindow"),
    std::string("showNotification"),
    std::string("showInformation")
    }
    +

    Definition at line 63 of file libhomescreen.hpp.

    - -

    ◆ event_list

    - +
    @@ -824,8 +1123,8 @@ Static Public Attributes
    -Initial value:
    {
    std::string("tap_shortcut"),
    std::string("on_screen_message"),
    std::string("on_screen_reply"),
    std::string("none")
    }
    -

    Definition at line 51 of file libhomescreen.hpp.

    +Initial value:
    {
    std::string("showWindow"),
    std::string("on_screen_message"),
    std::string("on_screen_reply"),
    std::string("hideWindow"),
    std::string("replyShowWindow"),
    std::string("showNotification"),
    std::string("showInformation"),
    std::string("none")
    }
    +

    Definition at line 64 of file libhomescreen.hpp.

    @@ -838,7 +1137,7 @@ Static Public Attributes diff --git a/doc/api-ref/html/df/d37/structwindow-members.html b/doc/api-ref/html/df/d37/structwindow-members.html new file mode 100644 index 0000000..c6ccdf7 --- /dev/null +++ b/doc/api-ref/html/df/d37/structwindow-members.html @@ -0,0 +1,116 @@ + + + + + + +HomeScreenBinding: Member List + + + + + + + + + + +
    +
    + + + + + + +
    +
    HomeScreenBinding +
    +
    +
    + + + + + + +
    +
    + + +
    + +
    + +
    +
    +
    +
    window Member List
    +
    + + + + + diff --git a/doc/api-ref/html/df/d43/libhomescreen_8hpp.html b/doc/api-ref/html/df/d43/libhomescreen_8hpp.html index c164aaf..52673d2 100644 --- a/doc/api-ref/html/df/d43/libhomescreen_8hpp.html +++ b/doc/api-ref/html/df/d43/libhomescreen_8hpp.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: include/libhomescreen.hpp File Reference @@ -12,6 +11,9 @@ + @@ -29,19 +31,39 @@
    - + - - - - + +
    #include <functional>
    #include <json-c/json.h>
    #include <systemd/sd-event.h>
    -#include <afb/afb-binding.h>
    #include <afb/afb-wsj1.h>
    #include <afb/afb-ws-client.h>
    @@ -90,7 +111,7 @@ Classes diff --git a/doc/api-ref/html/df/d43/libhomescreen_8hpp_source.html b/doc/api-ref/html/df/d43/libhomescreen_8hpp_source.html index 5e2f196..bb84463 100644 --- a/doc/api-ref/html/df/d43/libhomescreen_8hpp_source.html +++ b/doc/api-ref/html/df/d43/libhomescreen_8hpp_source.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: include/libhomescreen.hpp Source File @@ -12,6 +11,9 @@ + @@ -29,19 +31,39 @@
    - + - - - - + +
    libhomescreen.hpp
    -Go to the documentation of this file.
    1 /*
    2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
    3  *
    4  * Licensed under the Apache License, Version 2.0 (the "License");
    5  * you may not use this file except in compliance with the License.
    6  * You may obtain a copy of the License at
    7  *
    8  * http://www.apache.org/licenses/LICENSE-2.0
    9  *
    10  * Unless required by applicable law or agreed to in writing, software
    11  * distributed under the License is distributed on an "AS IS" BASIS,
    12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  * See the License for the specific language governing permissions and
    14  * limitations under the License.
    15  */
    16 
    17 #ifndef LIBHOMESCREEN_H
    18 #define LIBHOMESCREEN_H
    19 #include <vector>
    20 #include <map>
    21 #include <string>
    22 #include <functional>
    23 #include <json-c/json.h>
    24 #include <systemd/sd-event.h>
    25 extern "C"
    26 {
    27 #include <afb/afb-binding.h>
    28 #include <afb/afb-wsj1.h>
    29 #include <afb/afb-ws-client.h>
    30 }
    31 
    33 {
    34 public:
    35  LibHomeScreen();
    37 
    38  LibHomeScreen(const LibHomeScreen &) = delete;
    39  LibHomeScreen &operator=(const LibHomeScreen &) = delete;
    40 
    41  // using handler_func = std::function<void(const char*)>;
    42  using handler_func = std::function<void(json_object*)>;
    43 
    44  enum EventType {
    48  };
    49 
    50  static const std::vector<std::string> api_list;
    51  static const std::vector<std::string> event_list;
    52 
    53  /* Method */
    54  int init(const int port, const std::string& token);
    55 
    56  int tapShortcut(const char* application_name);
    57  int onScreenMessage(const char* display_message);
    58  int onScreenReply(const char* reply_message);
    59 
    60  void set_event_handler(enum EventType et, handler_func f);
    61 
    62  void registerCallback(
    63  void (*event_cb)(const std::string& event, struct json_object* event_contents),
    64  void (*reply_cb)(struct json_object* reply_contents),
    65  void (*hangup_cb)(void) = nullptr);
    66 
    67  int call(const std::string& verb, struct json_object* arg);
    68  int call(const char* verb, struct json_object* arg);
    69  int subscribe(const std::string& event_name);
    70  int unsubscribe(const std::string& event_name);
    71 
    72 private:
    73  int initialize_websocket();
    74 
    75  void (*onEvent)(const std::string& event, struct json_object* event_contents);
    76  void (*onReply)(struct json_object* reply);
    77  void (*onHangup)(void);
    78 
    79  struct afb_wsj1* sp_websock;
    80  struct afb_wsj1_itf minterface;
    81  sd_event* mploop;
    82  std::string muri;
    83 
    84  int mport = 2000;
    85  std::string mtoken = "hs";
    86 
    87  std::map<EventType, handler_func> handlers;
    88 
    89 public:
    90  /* Don't use/ Internal only */
    91  void on_hangup(void *closure, struct afb_wsj1 *wsj);
    92  void on_call(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg);
    93  void on_event(void *closure, const char *event, struct afb_wsj1_msg *msg);
    94  void on_reply(void *closure, struct afb_wsj1_msg *msg);
    95 };
    96 
    97 #endif /* LIBHOMESCREEN_H */
    void on_event(void *closure, const char *event, struct afb_wsj1_msg *msg)
    -
    void on_reply(void *closure, struct afb_wsj1_msg *msg)
    -
    int onScreenReply(const char *reply_message)
    +Go to the documentation of this file.
    1 /*
    2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
    3  *
    4  * Licensed under the Apache License, Version 2.0 (the "License");
    5  * you may not use this file except in compliance with the License.
    6  * You may obtain a copy of the License at
    7  *
    8  * http://www.apache.org/licenses/LICENSE-2.0
    9  *
    10  * Unless required by applicable law or agreed to in writing, software
    11  * distributed under the License is distributed on an "AS IS" BASIS,
    12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  * See the License for the specific language governing permissions and
    14  * limitations under the License.
    15  */
    16 
    17 #ifndef LIBHOMESCREEN_H
    18 #define LIBHOMESCREEN_H
    19 #include <vector>
    20 #include <map>
    21 #include <string>
    22 #include <functional>
    23 #include <json-c/json.h>
    24 #include <systemd/sd-event.h>
    25 extern "C"
    26 {
    27 #include <afb/afb-wsj1.h>
    28 #include <afb/afb-ws-client.h>
    29 }
    30 
    32 {
    33 public:
    34  LibHomeScreen();
    36 
    37  LibHomeScreen(const LibHomeScreen &) = delete;
    38  LibHomeScreen &operator=(const LibHomeScreen &) = delete;
    39 
    40  using handler_func = std::function<void(json_object*)>;
    41 
    42  enum EventType {
    51  };
    52 
    53  /* Key for json obejct */
    54  const char *_keyParameter = "parameter";
    55  const char *_keyArea = "area";
    56 
    57  /* display area */
    58  const char *_areaNormal = "normal";
    59  const char *_areaFullScreen = "fullscreen";
    60  const char *_areaSplitMain = "split.main";
    61  const char *_areaSplitSub = "split.sub";
    62 
    63  static const std::vector<std::string> api_list;
    64  static const std::vector<std::string> event_list;
    65 
    66  /* Method */
    67  int init(const int port, const std::string& token);
    68 
    69  int tapShortcut(const char* application_id);
    70  int onScreenMessage(const char* display_message);
    71  int onScreenReply(const char* reply_message);
    72 
    73  void set_event_handler(enum EventType et, handler_func f);
    74 
    75  void registerCallback(
    76  void (*event_cb)(const std::string& event, struct json_object* event_contents),
    77  void (*reply_cb)(struct json_object* reply_contents),
    78  void (*hangup_cb)(void) = nullptr);
    79 
    80  int call(const std::string& verb, struct json_object* arg);
    81  int call(const char* verb, struct json_object* arg);
    82  int subscribe(const std::string& event_name);
    83  int unsubscribe(const std::string& event_name);
    84 
    85  int showWindow(const char* application_id, json_object* json);
    86  int hideWindow(const char* application_id);
    87  int replyShowWindow(const char* application_id, json_object* json);
    88  int showNotification(json_object* json);
    89  int showInformation(json_object* json);
    90 
    91 
    92 private:
    93  int initialize_websocket();
    94 
    95  void (*onEvent)(const std::string& event, struct json_object* event_contents);
    96  void (*onReply)(struct json_object* reply);
    97  void (*onHangup)(void);
    98 
    99  struct afb_wsj1* sp_websock;
    100  struct afb_wsj1_itf minterface;
    101  sd_event* mploop;
    102  std::string muri;
    103 
    104  int mport = 2000;
    105  std::string mtoken = "hs";
    106 
    107  std::map<EventType, handler_func> handlers;
    108 
    109 public:
    110  /* Don't use/ Internal only */
    111  void on_hangup(void *closure, struct afb_wsj1 *wsj);
    112  void on_call(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg);
    113  void on_event(void *closure, const char *event, struct afb_wsj1_msg *msg);
    114  void on_reply(void *closure, struct afb_wsj1_msg *msg);
    115 };
    116 
    117 #endif /* LIBHOMESCREEN_H */
    void on_event(void *closure, const char *event, struct afb_wsj1_msg *msg)
    +
    void on_reply(void *closure, struct afb_wsj1_msg *msg)
    +
    int onScreenReply(const char *reply_message)
    LibHomeScreen & operator=(const LibHomeScreen &)=delete
    -
    std::function< void(json_object *)> handler_func
    -
    void on_call(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg)
    - - - +
    const char * _areaFullScreen
    +
    std::function< void(json_object *)> handler_func
    +
    void on_call(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg)
    +
    const char * _areaSplitSub
    +
    int tapShortcut(const char *application_id)
    +
    int hideWindow(const char *application_id)
    +
    int showWindow(const char *application_id, json_object *json)
    +
    const char * _keyParameter
    +
    int replyShowWindow(const char *application_id, json_object *json)
    + + + + +
    string token
    Definition: simple-egl.cpp:61
    +
    int call(const std::string &verb, struct json_object *arg)
    -
    void on_hangup(void *closure, struct afb_wsj1 *wsj)
    -
    int tapShortcut(const char *application_name)
    -
    int subscribe(const std::string &event_name)
    - - -
    static const std::vector< std::string > event_list
    -
    int init(const int port, const std::string &token)
    -
    int onScreenMessage(const char *display_message)
    - - -
    static const std::vector< std::string > api_list
    -
    int unsubscribe(const std::string &event_name)
    -
    void set_event_handler(enum EventType et, handler_func f)
    -
    void registerCallback(void(*event_cb)(const std::string &event, struct json_object *event_contents), void(*reply_cb)(struct json_object *reply_contents), void(*hangup_cb)(void)=nullptr)
    - +
    int showInformation(json_object *json)
    +
    void on_hangup(void *closure, struct afb_wsj1 *wsj)
    +
    int subscribe(const std::string &event_name)
    + + +
    const char * _keyArea
    + + +
    long port
    Definition: simple-egl.cpp:60
    +
    static const std::vector< std::string > event_list
    +
    int init(const int port, const std::string &token)
    +
    const char * _areaSplitMain
    +
    const char * _areaNormal
    +
    int onScreenMessage(const char *display_message)
    + + +
    static const std::vector< std::string > api_list
    +
    int unsubscribe(const std::string &event_name)
    +
    void set_event_handler(enum EventType et, handler_func f)
    +
    void registerCallback(void(*event_cb)(const std::string &event, struct json_object *event_contents), void(*reply_cb)(struct json_object *reply_contents), void(*hangup_cb)(void)=nullptr)
    + +
    int showNotification(json_object *json)
    diff --git a/doc/api-ref/html/df/d66/hs-helper_8cpp.html b/doc/api-ref/html/df/d66/hs-helper_8cpp.html new file mode 100644 index 0000000..303434a --- /dev/null +++ b/doc/api-ref/html/df/d66/hs-helper_8cpp.html @@ -0,0 +1,449 @@ + + + + + + +HomeScreenBinding: src/hs-helper.cpp File Reference + + + + + + + + + + +
    +
    + + + + + + +
    +
    HomeScreenBinding +
    +
    +
    + + + + + + +
    +
    + + +
    + +
    + + +
    +
    + +
    +
    hs-helper.cpp File Reference
    +
    +
    +
    #include <string.h>
    +#include <cstdarg>
    +#include "hs-helper.h"
    +
    +

    Go to the source code of this file.

    + + + + + + + + + + + + + + + + +

    +Functions

    REQ_ERROR get_value_uint16 (const afb_req_t request, const char *source, uint16_t *out_id)
     
    REQ_ERROR get_value_int16 (const afb_req_t request, const char *source, int16_t *out_id)
     
    REQ_ERROR get_value_int32 (const afb_req_t request, const char *source, int32_t *out_id)
     
    void hs_add_object_to_json_object (struct json_object *j_obj, int count,...)
     
    void hs_add_object_to_json_object_str (struct json_object *j_obj, int count,...)
     
    void hs_add_object_to_json_object_func (struct json_object *j_obj, const char *verb_name, int count,...)
     
    int hs_search_event_name_index (const char *value)
     
    + + + +

    +Variables

    const char * evlist []
     
    +

    Function Documentation

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    REQ_ERROR get_value_int16 (const afb_req_t request,
    const char * source,
    int16_t * out_id 
    )
    +
    +

    get int16 value from source

    +

    Parameters

    +
      +
    • request : Describes the request by bindings from afb-daemon
    • +
    • source : input source
    • +
    • out_id : output int16 value
    • +
    +

    Return

    +

    error code

    + +

    Definition at line 82 of file hs-helper.cpp.

    +
    83 {
    84  char* endptr;
    85  const char* tmp = afb_req_value (request, source);
    86  if(!tmp)
    87  {
    88  return REQ_FAIL;
    89  }
    90  long tmp_id = strtol(tmp,&endptr,10);
    91 
    92  /* error check of range */
    93  if( (tmp_id > INT16_MAX) || (tmp_id < INT16_MIN) )
    94  {
    95  return OUT_RANGE;
    96  }
    97  if(*endptr != '\0')
    98  {
    99  return NOT_NUMBER;
    100  }
    101 
    102  *out_id = (int16_t)tmp_id;
    103  return REQ_OK;
    104 }
    + + + +
    +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    REQ_ERROR get_value_int32 (const afb_req_t request,
    const char * source,
    int32_t * out_id 
    )
    +
    +

    get int32 value from source

    +

    Parameters

    +
      +
    • request : Describes the request by bindings from afb-daemon
    • +
    • source : input source
    • +
    • out_id : output int32 value
    • +
    +

    Return

    +

    error code

    + +

    Definition at line 118 of file hs-helper.cpp.

    +
    119 {
    120  char* endptr;
    121  const char* tmp = afb_req_value (request, source);
    122  if(!tmp)
    123  {
    124  return REQ_FAIL;
    125  }
    126  long tmp_id = strtol(tmp,&endptr,10);
    127 
    128  /* error check of range */
    129  if( (tmp_id > INT32_MAX) || (tmp_id < INT32_MIN) )
    130  {
    131  return OUT_RANGE;
    132  }
    133  if(*endptr != '\0')
    134  {
    135  return NOT_NUMBER;
    136  }
    137 
    138  *out_id = (int32_t)tmp_id;
    139  return REQ_OK;
    140 }
    + + + +
    +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    REQ_ERROR get_value_uint16 (const afb_req_t request,
    const char * source,
    uint16_t * out_id 
    )
    +
    +

    get uint16 value from source

    +

    Parameters

    +
      +
    • request : Describes the request by bindings from afb-daemon
    • +
    • source : input source
    • +
    • out_id : output uint16 value
    • +
    +

    Return

    +

    error code

    + +

    Definition at line 46 of file hs-helper.cpp.

    +
    47 {
    48  char* endptr;
    49  const char* tmp = afb_req_value (request, source);
    50  if(!tmp)
    51  {
    52  return REQ_FAIL;
    53  }
    54  long tmp_id = strtol(tmp,&endptr,10);
    55 
    56  /* error check of range */
    57  if( (tmp_id > UINT16_MAX) || (tmp_id < 0) )
    58  {
    59  return OUT_RANGE;
    60  }
    61  if(*endptr != '\0')
    62  {
    63  return NOT_NUMBER;
    64  }
    65 
    66  *out_id = (uint16_t)tmp_id;
    67  return REQ_OK;
    68 }
    + + + +
    +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    void hs_add_object_to_json_object (struct json_object * j_obj,
    int count,
     ... 
    )
    +
    +

    add int object to json object

    +

    Parameters

    +
      +
    • j_obj : the json object will join in int json object
    • +
    • count : input parameter number
    • +
    • ... : parameter list
    • +
    +

    Return

    +

    None

    + +

    Definition at line 154 of file hs-helper.cpp.

    +
    155 {
    156  va_list args;
    157  va_start(args, count);
    158  for(int i = 0; i < count; ++i )
    159  {
    160  char *key = va_arg(args, char*);
    161  int value = va_arg(args, int);
    162  json_object_object_add(j_obj, key, json_object_new_int((int32_t)value));
    163  ++i;
    164  }
    165  va_end(args);
    166 }
    +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    void hs_add_object_to_json_object_func (struct json_object * j_obj,
    const char * verb_name,
    int count,
     ... 
    )
    +
    +

    add new json object to json object

    +

    Parameters

    +
      +
    • j_obj : the json object will join in new json object
    • +
    • verb_name : new json object's verb value
    • +
    • count : input parameter number
    • +
    • ... : parameter list
    • +
    +

    Return

    +

    None

    + +

    Definition at line 207 of file hs-helper.cpp.

    +
    208 {
    209  va_list args;
    210  va_start(args, count);
    211 
    212  json_object_object_add(j_obj,"verb", json_object_new_string(verb_name));
    213 
    214  for(int i = 0; i < count; ++i )
    215  {
    216  char *key = va_arg(args, char*);
    217  int value = va_arg(args, int);
    218  json_object_object_add(j_obj, key, json_object_new_int((int32_t)value));
    219  ++i;
    220  }
    221  va_end(args);
    222 }
    +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    void hs_add_object_to_json_object_str (struct json_object * j_obj,
    int count,
     ... 
    )
    +
    +

    add string object to json object

    +

    Parameters

    +
      +
    • j_obj : the json object will join in string json object
    • +
    • count : input parameter number
    • +
    • ... : parameter list
    • +
    +

    Return

    +

    None

    + +

    Definition at line 180 of file hs-helper.cpp.

    +
    181 {
    182  va_list args;
    183  va_start(args, count);
    184  for(int i = 0; i < count; ++i )
    185  {
    186  char *key = va_arg(args, char*);
    187  char *value = va_arg(args, char*);
    188  json_object_object_add(j_obj, key, json_object_new_string(value));
    189  ++i;
    190  }
    191  va_end(args);
    192 }
    +
    +
    + +
    +
    + + + + + + + + +
    int hs_search_event_name_index (const char * value)
    +
    +

    search event position in event list

    +

    Parameters

    +
      +
    • value : searched event name
    • +
    +

    Return

    +

    event's index in event list

    + +

    Definition at line 234 of file hs-helper.cpp.

    +
    235 {
    236  size_t buf_size = 50;
    237  size_t size = sizeof evlist / sizeof *evlist;
    238  int ret = -1;
    239  for(size_t i = 0 ; i < size ; ++i)
    240  {
    241  if(!strncmp(value, evlist[i], buf_size))
    242  {
    243  ret = i;
    244  break;
    245  }
    246  }
    247  return ret;
    248 }
    const char * evlist[]
    Definition: hs-helper.cpp:22
    +
    +
    +
    +

    Variable Documentation

    + +
    +
    + + + + +
    const char* evlist[]
    +
    +Initial value:
    = {
    "tap_shortcut",
    "on_screen_message",
    "on_screen_reply",
    "showWindow",
    "hideWindow",
    "replyShowWindow",
    "showNotification",
    "showInformation",
    "reserved"
    }
    +

    Definition at line 22 of file hs-helper.cpp.

    + +
    +
    +
    + + + + diff --git a/doc/api-ref/html/df/d66/hs-helper_8cpp_source.html b/doc/api-ref/html/df/d66/hs-helper_8cpp_source.html new file mode 100644 index 0000000..d0f5e2a --- /dev/null +++ b/doc/api-ref/html/df/d66/hs-helper_8cpp_source.html @@ -0,0 +1,113 @@ + + + + + + +HomeScreenBinding: src/hs-helper.cpp Source File + + + + + + + + + + +
    +
    + + + + + + +
    +
    HomeScreenBinding +
    +
    +
    + + + + + + +
    +
    + + +
    + +
    + + +
    +
    +
    +
    hs-helper.cpp
    +
    +
    +Go to the documentation of this file.
    1 /*
    2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
    3  *
    4  * Licensed under the Apache License, Version 2.0 (the "License");
    5  * you may not use this file except in compliance with the License.
    6  * You may obtain a copy of the License at
    7  *
    8  * http://www.apache.org/licenses/LICENSE-2.0
    9  *
    10  * Unless required by applicable law or agreed to in writing, software
    11  * distributed under the License is distributed on an "AS IS" BASIS,
    12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  * See the License for the specific language governing permissions and
    14  * limitations under the License.
    15  */
    16 
    17 #include <string.h>
    18 #include <cstdarg>
    19 #include "hs-helper.h"
    20 
    21 
    22 const char* evlist[] = {
    23  "tap_shortcut",
    24  "on_screen_message",
    25  "on_screen_reply",
    26  "showWindow",
    27  "hideWindow",
    28  "replyShowWindow",
    29  "showNotification",
    30  "showInformation",
    31  "reserved"
    32  };
    33 
    46 REQ_ERROR get_value_uint16(const afb_req_t request, const char *source, uint16_t *out_id)
    47 {
    48  char* endptr;
    49  const char* tmp = afb_req_value (request, source);
    50  if(!tmp)
    51  {
    52  return REQ_FAIL;
    53  }
    54  long tmp_id = strtol(tmp,&endptr,10);
    55 
    56  /* error check of range */
    57  if( (tmp_id > UINT16_MAX) || (tmp_id < 0) )
    58  {
    59  return OUT_RANGE;
    60  }
    61  if(*endptr != '\0')
    62  {
    63  return NOT_NUMBER;
    64  }
    65 
    66  *out_id = (uint16_t)tmp_id;
    67  return REQ_OK;
    68 }
    69 
    82 REQ_ERROR get_value_int16(const afb_req_t request, const char *source, int16_t *out_id)
    83 {
    84  char* endptr;
    85  const char* tmp = afb_req_value (request, source);
    86  if(!tmp)
    87  {
    88  return REQ_FAIL;
    89  }
    90  long tmp_id = strtol(tmp,&endptr,10);
    91 
    92  /* error check of range */
    93  if( (tmp_id > INT16_MAX) || (tmp_id < INT16_MIN) )
    94  {
    95  return OUT_RANGE;
    96  }
    97  if(*endptr != '\0')
    98  {
    99  return NOT_NUMBER;
    100  }
    101 
    102  *out_id = (int16_t)tmp_id;
    103  return REQ_OK;
    104 }
    105 
    118 REQ_ERROR get_value_int32(const afb_req_t request, const char *source, int32_t *out_id)
    119 {
    120  char* endptr;
    121  const char* tmp = afb_req_value (request, source);
    122  if(!tmp)
    123  {
    124  return REQ_FAIL;
    125  }
    126  long tmp_id = strtol(tmp,&endptr,10);
    127 
    128  /* error check of range */
    129  if( (tmp_id > INT32_MAX) || (tmp_id < INT32_MIN) )
    130  {
    131  return OUT_RANGE;
    132  }
    133  if(*endptr != '\0')
    134  {
    135  return NOT_NUMBER;
    136  }
    137 
    138  *out_id = (int32_t)tmp_id;
    139  return REQ_OK;
    140 }
    141 
    154 void hs_add_object_to_json_object(struct json_object* j_obj, int count,...)
    155 {
    156  va_list args;
    157  va_start(args, count);
    158  for(int i = 0; i < count; ++i )
    159  {
    160  char *key = va_arg(args, char*);
    161  int value = va_arg(args, int);
    162  json_object_object_add(j_obj, key, json_object_new_int((int32_t)value));
    163  ++i;
    164  }
    165  va_end(args);
    166 }
    167 
    180 void hs_add_object_to_json_object_str(struct json_object* j_obj, int count,...)
    181 {
    182  va_list args;
    183  va_start(args, count);
    184  for(int i = 0; i < count; ++i )
    185  {
    186  char *key = va_arg(args, char*);
    187  char *value = va_arg(args, char*);
    188  json_object_object_add(j_obj, key, json_object_new_string(value));
    189  ++i;
    190  }
    191  va_end(args);
    192 }
    193 
    207 void hs_add_object_to_json_object_func(struct json_object* j_obj, const char* verb_name, int count, ...)
    208 {
    209  va_list args;
    210  va_start(args, count);
    211 
    212  json_object_object_add(j_obj,"verb", json_object_new_string(verb_name));
    213 
    214  for(int i = 0; i < count; ++i )
    215  {
    216  char *key = va_arg(args, char*);
    217  int value = va_arg(args, int);
    218  json_object_object_add(j_obj, key, json_object_new_int((int32_t)value));
    219  ++i;
    220  }
    221  va_end(args);
    222 }
    223 
    234 int hs_search_event_name_index(const char* value)
    235 {
    236  size_t buf_size = 50;
    237  size_t size = sizeof evlist / sizeof *evlist;
    238  int ret = -1;
    239  for(size_t i = 0 ; i < size ; ++i)
    240  {
    241  if(!strncmp(value, evlist[i], buf_size))
    242  {
    243  ret = i;
    244  break;
    245  }
    246  }
    247  return ret;
    248 }
    REQ_ERROR get_value_uint16(const afb_req_t request, const char *source, uint16_t *out_id)
    Definition: hs-helper.cpp:46
    + +
    REQ_ERROR get_value_int16(const afb_req_t request, const char *source, int16_t *out_id)
    Definition: hs-helper.cpp:82
    + + + + +
    void hs_add_object_to_json_object_str(struct json_object *j_obj, int count,...)
    Definition: hs-helper.cpp:180
    +
    void hs_add_object_to_json_object(struct json_object *j_obj, int count,...)
    Definition: hs-helper.cpp:154
    +
    REQ_ERROR
    Definition: hs-helper.h:29
    +
    const char * evlist[]
    Definition: hs-helper.cpp:22
    +
    void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
    Definition: hs-helper.cpp:207
    +
    REQ_ERROR get_value_int32(const afb_req_t request, const char *source, int32_t *out_id)
    Definition: hs-helper.cpp:118
    +
    int hs_search_event_name_index(const char *value)
    Definition: hs-helper.cpp:234
    +
    + + + + diff --git a/doc/api-ref/html/df/d76/hmi-debug_8h.html b/doc/api-ref/html/df/d76/hmi-debug_8h.html deleted file mode 100644 index 3931c00..0000000 --- a/doc/api-ref/html/df/d76/hmi-debug_8h.html +++ /dev/null @@ -1,435 +0,0 @@ - - - - - - - -HomeScreenBinding: include/hmi-debug.h File Reference - - - - - - - - - -
    -
    - - - - - - -
    -
    HomeScreenBinding -
    -
    -
    - - - - - - - - -
    -
    - - -
    - -
    - - -
    -
    - -
    -
    hmi-debug.h File Reference
    -
    -
    -
    #include <time.h>
    -#include <stdio.h>
    -#include <afb/afb-binding.h>
    -
    -

    Go to the source code of this file.

    - - - - - - - - - - - - -

    -Macros

    #define HMI_ERROR(prefix, args, ...)   _HMI_LOG(LOG_LEVEL_ERROR, __FILE__, __FUNCTION__, __LINE__, prefix, args, ##__VA_ARGS__)
     
    #define HMI_WARNING(prefix, args, ...)   _HMI_LOG(LOG_LEVEL_WARNING, __FILE__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
     
    #define HMI_NOTICE(prefix, args, ...)   _HMI_LOG(LOG_LEVEL_NOTICE, __FILE__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
     
    #define HMI_INFO(prefix, args, ...)   _HMI_LOG(LOG_LEVEL_INFO, __FILE__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
     
    #define HMI_DEBUG(prefix, args, ...)   _HMI_LOG(LOG_LEVEL_DEBUG, __FILE__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
     
    - - - -

    -Enumerations

    enum  LOG_LEVEL {
    -  LOG_LEVEL_NONE = 0, -LOG_LEVEL_ERROR, -LOG_LEVEL_WARNING, -LOG_LEVEL_NOTICE, -
    -  LOG_LEVEL_INFO, -LOG_LEVEL_DEBUG, -LOG_LEVEL_MAX = LOG_LEVEL_ERROR -
    - }
     
    - - - -

    -Functions

    static void _HMI_LOG (enum LOG_LEVEL level, const char *file, const char *func, const int line, const char *prefix, const char *log,...)
     
    - - - -

    -Variables

    static char ERROR_FLAG [6][20] = {"NONE", "ERROR", "WARNING", "NOTICE", "INFO", "DEBUG"}
     
    -

    Macro Definition Documentation

    - -

    ◆ HMI_DEBUG

    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    #define HMI_DEBUG( prefix,
     args,
     ... 
    )   _HMI_LOG(LOG_LEVEL_DEBUG, __FILE__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
    -
    - -

    Definition at line 22 of file hmi-debug.h.

    - -
    -
    - -

    ◆ HMI_ERROR

    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    #define HMI_ERROR( prefix,
     args,
     ... 
    )   _HMI_LOG(LOG_LEVEL_ERROR, __FILE__, __FUNCTION__, __LINE__, prefix, args, ##__VA_ARGS__)
    -
    - -

    Definition at line 18 of file hmi-debug.h.

    - -
    -
    - -

    ◆ HMI_INFO

    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    #define HMI_INFO( prefix,
     args,
     ... 
    )   _HMI_LOG(LOG_LEVEL_INFO, __FILE__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
    -
    - -

    Definition at line 21 of file hmi-debug.h.

    - -
    -
    - -

    ◆ HMI_NOTICE

    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    #define HMI_NOTICE( prefix,
     args,
     ... 
    )   _HMI_LOG(LOG_LEVEL_NOTICE, __FILE__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
    -
    - -

    Definition at line 20 of file hmi-debug.h.

    - -
    -
    - -

    ◆ HMI_WARNING

    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    #define HMI_WARNING( prefix,
     args,
     ... 
    )   _HMI_LOG(LOG_LEVEL_WARNING, __FILE__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
    -
    - -

    Definition at line 19 of file hmi-debug.h.

    - -
    -
    -

    Enumeration Type Documentation

    - -

    ◆ LOG_LEVEL

    - -
    -
    - - - - -
    enum LOG_LEVEL
    -
    - - - - - - - - -
    Enumerator
    LOG_LEVEL_NONE 
    LOG_LEVEL_ERROR 
    LOG_LEVEL_WARNING 
    LOG_LEVEL_NOTICE 
    LOG_LEVEL_INFO 
    LOG_LEVEL_DEBUG 
    LOG_LEVEL_MAX 
    - -

    Definition at line 8 of file hmi-debug.h.

    - -
    -
    -

    Function Documentation

    - -

    ◆ _HMI_LOG()

    - -
    -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    static void _HMI_LOG (enum LOG_LEVEL level,
    const char * file,
    const char * func,
    const int line,
    const char * prefix,
    const char * log,
     ... 
    )
    -
    -static
    -
    - -

    Definition at line 26 of file hmi-debug.h.

    -
    27 {
    28  const int log_level = (getenv("USE_HMI_DEBUG") == NULL)?0:atoi(getenv("USE_HMI_DEBUG"));
    29  if(log_level < level)
    30  {
    31  return;
    32  }
    33 
    34  char *message;
    35  struct timespec tp;
    36  unsigned int time;
    37 
    38  clock_gettime(CLOCK_REALTIME, &tp);
    39  time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
    40 
    41  va_list args;
    42  va_start(args, log);
    43  if (log == NULL || vasprintf(&message, log, args) < 0)
    44  message = NULL;
    45  fprintf(stderr, "[%10.3f] [%s %s] [%s:%d] >>> %s \n", time / 1000.0, prefix, ERROR_FLAG[level], func, line, message);
    46  va_end(args);
    47  free(message);
    48 }
    static char ERROR_FLAG[6][20]
    Definition: hmi-debug.h:24
    -
    -
    -
    -

    Variable Documentation

    - -

    ◆ ERROR_FLAG

    - -
    -
    - - - - - -
    - - - - -
    char ERROR_FLAG[6][20] = {"NONE", "ERROR", "WARNING", "NOTICE", "INFO", "DEBUG"}
    -
    -static
    -
    - -

    Definition at line 24 of file hmi-debug.h.

    - -
    -
    -
    - - - - diff --git a/doc/api-ref/html/df/d76/hmi-debug_8h_source.html b/doc/api-ref/html/df/d76/hmi-debug_8h_source.html deleted file mode 100644 index 80b0c61..0000000 --- a/doc/api-ref/html/df/d76/hmi-debug_8h_source.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - -HomeScreenBinding: include/hmi-debug.h Source File - - - - - - - - - -
    -
    - - - - - - -
    -
    HomeScreenBinding -
    -
    -
    - - - - - - - - -
    -
    - - -
    - -
    - - -
    -
    -
    -
    hmi-debug.h
    -
    -
    -Go to the documentation of this file.
    1 #ifndef __HMI_DEBUG_H__
    2 #define __HMI_DEBUG_H__
    3 
    4 #include <time.h>
    5 #include <stdio.h>
    6 #include <afb/afb-binding.h>
    7 
    8 enum LOG_LEVEL{
    16 };
    17 
    18 #define HMI_ERROR(prefix, args,...) _HMI_LOG(LOG_LEVEL_ERROR, __FILE__, __FUNCTION__, __LINE__, prefix, args, ##__VA_ARGS__)
    19 #define HMI_WARNING(prefix, args,...) _HMI_LOG(LOG_LEVEL_WARNING, __FILE__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
    20 #define HMI_NOTICE(prefix, args,...) _HMI_LOG(LOG_LEVEL_NOTICE, __FILE__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
    21 #define HMI_INFO(prefix, args,...) _HMI_LOG(LOG_LEVEL_INFO, __FILE__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
    22 #define HMI_DEBUG(prefix, args,...) _HMI_LOG(LOG_LEVEL_DEBUG, __FILE__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
    23 
    24 static char ERROR_FLAG[6][20] = {"NONE", "ERROR", "WARNING", "NOTICE", "INFO", "DEBUG"};
    25 
    26 static void _HMI_LOG(enum LOG_LEVEL level, const char* file, const char* func, const int line, const char* prefix, const char* log, ...)
    27 {
    28  const int log_level = (getenv("USE_HMI_DEBUG") == NULL)?0:atoi(getenv("USE_HMI_DEBUG"));
    29  if(log_level < level)
    30  {
    31  return;
    32  }
    33 
    34  char *message;
    35  struct timespec tp;
    36  unsigned int time;
    37 
    38  clock_gettime(CLOCK_REALTIME, &tp);
    39  time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
    40 
    41  va_list args;
    42  va_start(args, log);
    43  if (log == NULL || vasprintf(&message, log, args) < 0)
    44  message = NULL;
    45  fprintf(stderr, "[%10.3f] [%s %s] [%s:%d] >>> %s \n", time / 1000.0, prefix, ERROR_FLAG[level], func, line, message);
    46  va_end(args);
    47  free(message);
    48 }
    49 
    50 #endif //__HMI_DEBUG_H__
    - - - -
    static char ERROR_FLAG[6][20]
    Definition: hmi-debug.h:24
    -
    LOG_LEVEL
    Definition: hmi-debug.h:8
    - - -
    static void _HMI_LOG(enum LOG_LEVEL level, const char *file, const char *func, const int line, const char *prefix, const char *log,...)
    Definition: hmi-debug.h:26
    - -
    - - - - diff --git a/doc/api-ref/html/df/d7d/structevent.html b/doc/api-ref/html/df/d7d/structevent.html deleted file mode 100644 index 2fcc0eb..0000000 --- a/doc/api-ref/html/df/d7d/structevent.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - -HomeScreenBinding: event Struct Reference - - - - - - - - - -
    -
    - - - - - - -
    -
    HomeScreenBinding -
    -
    -
    - - - - - - - - -
    -
    - - -
    - -
    - -
    -
    - -
    -
    event Struct Reference
    -
    -
    - - - - - - -

    -Public Attributes

    const char * name
     
    struct afb_event * event
     
    -

    Detailed Description

    -
    -

    Definition at line 35 of file homescreen.c.

    -

    Member Data Documentation

    - -

    ◆ event

    - -
    -
    - - - - -
    struct afb_event* event::event
    -
    - -

    Definition at line 37 of file homescreen.c.

    - -
    -
    - -

    ◆ name

    - -
    -
    - - - - -
    const char* event::name
    -
    - -

    Definition at line 36 of file homescreen.c.

    - -
    -
    -
    The documentation for this struct was generated from the following file: -
    - - - - diff --git a/doc/api-ref/html/df/dac/test_8cpp.html b/doc/api-ref/html/df/dac/test_8cpp.html deleted file mode 100644 index 00f9515..0000000 --- a/doc/api-ref/html/df/dac/test_8cpp.html +++ /dev/null @@ -1,334 +0,0 @@ - - - - - - - -HomeScreenBinding: libhomescreen/test.cpp File Reference - - - - - - - - - -
    -
    - - - - - - -
    -
    HomeScreenBinding -
    -
    -
    - - - - - - - - -
    -
    - - -
    - -
    - - -
    -
    - -
    -
    test.cpp File Reference
    -
    -
    -
    #include <libhomescreen.hpp>
    -#include <iostream>
    -#include <glib-2.0/glib.h>
    -#include <fcntl.h>
    -#include <string>
    -#include <sys/types.h>
    -#include <sys/stat.h>
    -#include <thread>
    -#include <exception>
    -#include <vector>
    -#include <sstream>
    -#include <functional>
    -
    -

    Go to the source code of this file.

    - - - - - - - - - - - - - - -

    -Functions

    static vector< string > split (const string &str, char sep)
     
    static void usage ()
     
    static void call_test ()
     
    static void onRep (struct json_object *reply_contents)
     
    static void onEv (const string &event, struct json_object *event_contents)
     
    int main (int argc, char **argv)
     
    - - - -

    -Variables

    LibHomeScreenhs
     
    -

    Function Documentation

    - -

    ◆ call_test()

    - -
    -
    - - - - - -
    - - - - - - - -
    static void call_test ()
    -
    -static
    -
    - -

    Definition at line 51 of file test.cpp.

    -
    52 {
    53  string command;
    54 
    55  cout << "input verb and argments" << endl;
    56 
    57  /* read the buffer */
    58  for(;;){
    59  char line[1023];
    60  cin.getline(line, sizeof(line));
    61  command = line;
    62  if(command.empty()){
    63  continue;
    64  }
    65 
    66  vector<string> v_command = split(command, ' ');
    67  /*for(auto itr = v_command.begin(); itr != v_command.end(); ++itr)
    68  {
    69  cout << *itr <<endl;
    70  }*/
    71  size_t num = v_command.size();
    72  if(num % 2 == 0){
    73  cout << "If command contains args, please input <key,value> in argument part" << endl;
    74  continue;
    75  }
    76  /* create json object */
    77  struct json_object* j_obj = json_object_new_object();
    78  for(int i = 1;i < (v_command.size()) ;++i){
    79  struct json_object* val = json_object_new_string(v_command[i+1].c_str());
    80  json_object_object_add(j_obj, v_command[i].c_str(), val);
    81  ++i;
    82  }
    83  /* call verb via LibHomeScreen */
    84  hs->call(v_command[0], j_obj);
    85  /* free vector */
    86  vector<string>().swap(v_command);
    87  string().swap(command);
    88  }
    89 }
    static vector< string > split(const string &str, char sep)
    Definition: test.cpp:105
    -
    LibHomeScreen * hs
    Definition: test.cpp:33
    -
    int call(const std::string &verb, struct json_object *arg)
    -
    -
    -
    - -

    ◆ main()

    - -
    -
    - - - - - - - - - - - - - - - - - - -
    int main (int argc,
    char ** argv 
    )
    -
    - -

    Definition at line 117 of file test.cpp.

    -
    118 {
    119  int ret;
    120  if(argc == 1)
    121  {
    122  printf("Please input port num in first argument, and token in second argument");
    123  usage();
    124  return 0;
    125  }
    126  if(argc == 2)
    127  {
    128  string av(argv[1]);
    129  if( (av == "-h") || (av == "--help"))
    130  {
    131  usage();
    132  return 0;
    133  }
    134  }
    135 
    136  string port_string(argv[1]);
    137  string token(argv[2]);
    138  char* endptr;
    139  long port = strtol(port_string.c_str(),&endptr,10);
    140 
    141  /* error check of range */
    142  if( (port > 20000) || (port < 0) )
    143  {
    144  printf("input under 20000(temporary number)");
    145  return 0;
    146  }
    147  if(*endptr != '\0')
    148  {
    149  printf("not number");
    150  return 0;
    151  }
    152 
    153  cout << "Call test for LibHomeScreen" << endl;
    154  hs = new LibHomeScreen();
    155  hs->init(port, token);
    156 
    157  // hs->registerCallback(&onEv, &onRep);
    158  //
    159  // hs->subscribe(event_list[0]); // tap_shortcut event subscribe
    160  // hs->subscribe(event_list[1]);
    161 
    162  hs->set_event_handler(LibHomeScreen::Event_TapShortcut, [](json_object *object){
    163  const char *application_name = json_object_get_string(
    164  json_object_object_get(object, "application_name"));
    165  cout << "set_event_handler Event_TapShortcut application_name = " << application_name << endl;
    166  });
    167 
    169  const char *display_message = json_object_get_string(
    170  json_object_object_get(object, "display_message"));
    171  cout << "set_event_handler Event_OnScreenMessage display_message = " << display_message << endl;
    172  });
    173 
    174  hs->set_event_handler(LibHomeScreen::Event_OnScreenReply, [](json_object *object){
    175  const char *reply_message = json_object_get_string(
    176  json_object_object_get(object, "reply_message"));
    177  cout << "set_event_handler Event_OnScreenReply reply_message = " << reply_message << endl;
    178  });
    179 
    180  if (ret < 0) {
    181  printf("failed to create event loop");
    182  return -1;
    183  }
    184 
    185  call_test();
    186 
    187  return 0;
    188 }
    static void usage()
    Definition: test.cpp:35
    -
    LibHomeScreen * hs
    Definition: test.cpp:33
    - - -
    static void call_test()
    Definition: test.cpp:51
    -
    int init(const int port, const std::string &token)
    - -
    void set_event_handler(enum EventType et, handler_func f)
    - -
    -
    -
    - -

    ◆ onEv()

    - -
    -
    - - - - - -
    - - - - - - - - - - - - - - - - - - -
    static void onEv (const string & event,
    struct json_object * event_contents 
    )
    -
    -static
    -
    - -

    Definition at line 98 of file test.cpp.

    -
    99 {
    100  const char* str = json_object_to_json_string(event_contents);
    101  cout << "test.cpp [CB onEvent]: event: " << event.c_str() << " contents: " << str << endl;
    102  //json_object_put(event_contents); do not release!!!
    103 }
    -
    -
    - -

    ◆ onRep()

    - -
    -
    - - - - - -
    - - - - - - - - -
    static void onRep (struct json_object * reply_contents)
    -
    -static
    -
    - -

    Definition at line 91 of file test.cpp.

    -
    92 {
    93  const char* str = json_object_to_json_string(reply_contents);
    94  cout << "test.cpp [CB onRep]: " << str << endl;
    95  //json_object_put(reply_contents); do not release!!!
    96 }
    -
    -
    - -

    ◆ split()

    - -
    -
    - - - - - -
    - - - - - - - - - - - - - - - - - - -
    static vector< string > split (const string & str,
    char sep 
    )
    -
    -static
    -
    - -

    Definition at line 105 of file test.cpp.

    -
    106 {
    107  vector<string> v;
    108  stringstream ss(str);
    109  string buffer;
    110  while( getline(ss, buffer, sep) ) {
    111  if(!buffer.empty())
    112  v.push_back(buffer);
    113  }
    114  return v;
    115 }
    -
    -
    - -

    ◆ usage()

    - -
    -
    - - - - - -
    - - - - - - - -
    static void usage ()
    -
    -static
    -
    - -

    Definition at line 35 of file test.cpp.

    -
    36 {
    37  cout << "verb "<< "key:arg" << endl;
    38  cout << "example:" << endl;
    39  cout << "ping" << endl;
    40  cout << "------- -------- --- " << endl;
    41  cout << " verb key value" << endl;
    42  cout << "verb list:" << endl;
    43  for(auto itr = LibHomeScreen::api_list.begin(); itr != LibHomeScreen::api_list.end(); ++itr)
    44  {
    45  cout << " " << *itr << endl;
    46  }
    47  // Todo output api list
    48  exit(0);
    49 }
    static const std::vector< std::string > api_list
    -
    -
    -
    -

    Variable Documentation

    - -

    ◆ hs

    - -
    -
    - - - - -
    LibHomeScreen* hs
    -
    - -

    Definition at line 33 of file test.cpp.

    - -
    -
    -
    - - - - diff --git a/doc/api-ref/html/df/dac/test_8cpp_source.html b/doc/api-ref/html/df/dac/test_8cpp_source.html deleted file mode 100644 index 2a5c650..0000000 --- a/doc/api-ref/html/df/dac/test_8cpp_source.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - -HomeScreenBinding: libhomescreen/test.cpp Source File - - - - - - - - - -
    -
    - - - - - - -
    -
    HomeScreenBinding -
    -
    -
    - - - - - - - - -
    -
    - - -
    - -
    - - -
    -
    -
    -
    test.cpp
    -
    -
    -Go to the documentation of this file.
    1 /*
    2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
    3  *
    4  * Licensed under the Apache License, Version 2.0 (the "License");
    5  * you may not use this file except in compliance with the License.
    6  * You may obtain a copy of the License at
    7  *
    8  * http://www.apache.org/licenses/LICENSE-2.0
    9  *
    10  * Unless required by applicable law or agreed to in writing, software
    11  * distributed under the License is distributed on an "AS IS" BASIS,
    12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  * See the License for the specific language governing permissions and
    14  * limitations under the License.
    15  */
    16 
    17 #include <libhomescreen.hpp>
    18 #include <iostream>
    19 #include <glib-2.0/glib.h>
    20 #include <fcntl.h>
    21 #include <string>
    22 #include <sys/types.h>
    23 #include <sys/stat.h>
    24 #include <thread>
    25 #include <exception>
    26 #include <vector>
    27 #include <sstream>
    28 #include <functional>
    29 
    30 using namespace std;
    31 
    32 static vector<string> split(const string& str, char sep);
    34 
    35 static void usage()
    36 {
    37  cout << "verb "<< "key:arg" << endl;
    38  cout << "example:" << endl;
    39  cout << "ping" << endl;
    40  cout << "------- -------- --- " << endl;
    41  cout << " verb key value" << endl;
    42  cout << "verb list:" << endl;
    43  for(auto itr = LibHomeScreen::api_list.begin(); itr != LibHomeScreen::api_list.end(); ++itr)
    44  {
    45  cout << " " << *itr << endl;
    46  }
    47  // Todo output api list
    48  exit(0);
    49 }
    50 
    51 static void call_test()
    52 {
    53  string command;
    54 
    55  cout << "input verb and argments" << endl;
    56 
    57  /* read the buffer */
    58  for(;;){
    59  char line[1023];
    60  cin.getline(line, sizeof(line));
    61  command = line;
    62  if(command.empty()){
    63  continue;
    64  }
    65 
    66  vector<string> v_command = split(command, ' ');
    67  /*for(auto itr = v_command.begin(); itr != v_command.end(); ++itr)
    68  {
    69  cout << *itr <<endl;
    70  }*/
    71  size_t num = v_command.size();
    72  if(num % 2 == 0){
    73  cout << "If command contains args, please input <key,value> in argument part" << endl;
    74  continue;
    75  }
    76  /* create json object */
    77  struct json_object* j_obj = json_object_new_object();
    78  for(int i = 1;i < (v_command.size()) ;++i){
    79  struct json_object* val = json_object_new_string(v_command[i+1].c_str());
    80  json_object_object_add(j_obj, v_command[i].c_str(), val);
    81  ++i;
    82  }
    83  /* call verb via LibHomeScreen */
    84  hs->call(v_command[0], j_obj);
    85  /* free vector */
    86  vector<string>().swap(v_command);
    87  string().swap(command);
    88  }
    89 }
    90 
    91 static void onRep(struct json_object* reply_contents)
    92 {
    93  const char* str = json_object_to_json_string(reply_contents);
    94  cout << "test.cpp [CB onRep]: " << str << endl;
    95  //json_object_put(reply_contents); do not release!!!
    96 }
    97 
    98 static void onEv(const string& event, struct json_object* event_contents)
    99 {
    100  const char* str = json_object_to_json_string(event_contents);
    101  cout << "test.cpp [CB onEvent]: event: " << event.c_str() << " contents: " << str << endl;
    102  //json_object_put(event_contents); do not release!!!
    103 }
    104 
    105 static vector<string> split(const string& str, char sep)
    106 {
    107  vector<string> v;
    108  stringstream ss(str);
    109  string buffer;
    110  while( getline(ss, buffer, sep) ) {
    111  if(!buffer.empty())
    112  v.push_back(buffer);
    113  }
    114  return v;
    115 }
    116 
    117 int main(int argc, char **argv)
    118 {
    119  int ret;
    120  if(argc == 1)
    121  {
    122  printf("Please input port num in first argument, and token in second argument");
    123  usage();
    124  return 0;
    125  }
    126  if(argc == 2)
    127  {
    128  string av(argv[1]);
    129  if( (av == "-h") || (av == "--help"))
    130  {
    131  usage();
    132  return 0;
    133  }
    134  }
    135 
    136  string port_string(argv[1]);
    137  string token(argv[2]);
    138  char* endptr;
    139  long port = strtol(port_string.c_str(),&endptr,10);
    140 
    141  /* error check of range */
    142  if( (port > 20000) || (port < 0) )
    143  {
    144  printf("input under 20000(temporary number)");
    145  return 0;
    146  }
    147  if(*endptr != '\0')
    148  {
    149  printf("not number");
    150  return 0;
    151  }
    152 
    153  cout << "Call test for LibHomeScreen" << endl;
    154  hs = new LibHomeScreen();
    155  hs->init(port, token);
    156 
    157  // hs->registerCallback(&onEv, &onRep);
    158  //
    159  // hs->subscribe(event_list[0]); // tap_shortcut event subscribe
    160  // hs->subscribe(event_list[1]);
    161 
    162  hs->set_event_handler(LibHomeScreen::Event_TapShortcut, [](json_object *object){
    163  const char *application_name = json_object_get_string(
    164  json_object_object_get(object, "application_name"));
    165  cout << "set_event_handler Event_TapShortcut application_name = " << application_name << endl;
    166  });
    167 
    168  hs->set_event_handler(LibHomeScreen::Event_OnScreenMessage, [](json_object *object){
    169  const char *display_message = json_object_get_string(
    170  json_object_object_get(object, "display_message"));
    171  cout << "set_event_handler Event_OnScreenMessage display_message = " << display_message << endl;
    172  });
    173 
    174  hs->set_event_handler(LibHomeScreen::Event_OnScreenReply, [](json_object *object){
    175  const char *reply_message = json_object_get_string(
    176  json_object_object_get(object, "reply_message"));
    177  cout << "set_event_handler Event_OnScreenReply reply_message = " << reply_message << endl;
    178  });
    179 
    180  if (ret < 0) {
    181  printf("failed to create event loop");
    182  return -1;
    183  }
    184 
    185  call_test();
    186 
    187  return 0;
    188 }
    static void usage()
    Definition: test.cpp:35
    -
    static vector< string > split(const string &str, char sep)
    Definition: test.cpp:105
    - - -
    LibHomeScreen * hs
    Definition: test.cpp:33
    - - - -
    int call(const std::string &verb, struct json_object *arg)
    -
    static void onEv(const string &event, struct json_object *event_contents)
    Definition: test.cpp:98
    -
    int main(int argc, char **argv)
    Definition: test.cpp:117
    -
    static void call_test()
    Definition: test.cpp:51
    -
    static void onRep(struct json_object *reply_contents)
    Definition: test.cpp:91
    -
    int init(const int port, const std::string &token)
    - -
    static const std::vector< std::string > api_list
    -
    void set_event_handler(enum EventType et, handler_func f)
    - -
    - - - - diff --git a/doc/api-ref/html/dir_0f70dc74e67ded1ed6ea12b5a24cac83.html b/doc/api-ref/html/dir_0f70dc74e67ded1ed6ea12b5a24cac83.html deleted file mode 100644 index 00ae245..0000000 --- a/doc/api-ref/html/dir_0f70dc74e67ded1ed6ea12b5a24cac83.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - -HomeScreenBinding: include/libhomescreen Directory Reference - - - - - - - - - -
    -
    - - - - - - -
    -
    HomeScreenBinding -
    -
    -
    - - - - - - - - -
    -
    - - -
    - -
    - - -
    -
    -
    -
    libhomescreen Directory Reference
    -
    -
    - - - - -

    -Files

    file  libhomescreen.hpp [code]
     
    -
    - - - - diff --git a/doc/api-ref/html/dir_65f76d62445e9e84c0450b12bf77c3bc.html b/doc/api-ref/html/dir_65f76d62445e9e84c0450b12bf77c3bc.html index ff64d77..e6ce462 100644 --- a/doc/api-ref/html/dir_65f76d62445e9e84c0450b12bf77c3bc.html +++ b/doc/api-ref/html/dir_65f76d62445e9e84c0450b12bf77c3bc.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: libhomescreen Directory Reference @@ -12,6 +11,9 @@ + @@ -29,19 +31,39 @@
    - + - - - - + + @@ -79,7 +101,7 @@ Files diff --git a/doc/api-ref/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html b/doc/api-ref/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html index 167382f..b5ca08e 100644 --- a/doc/api-ref/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html +++ b/doc/api-ref/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: src Directory Reference @@ -12,6 +11,9 @@ + @@ -29,19 +31,39 @@
    - + - - - - + +

    Files

    -file  homescreen.c [code] +file  hmi-debug.h [code] +  +file  homescreen.cpp [code] +  +file  hs-client.cpp [code] +  +file  hs-client.h [code] +  +file  hs-clientmanager.cpp [code] +  +file  hs-clientmanager.h [code]   -file  hs-helper.c [code] +file  hs-helper.cpp [code]   file  hs-helper.h [code]   @@ -81,7 +113,7 @@ Files diff --git a/doc/api-ref/html/dir_a01af9eb3c502936dfd53c3f8e45721d.html b/doc/api-ref/html/dir_a01af9eb3c502936dfd53c3f8e45721d.html deleted file mode 100644 index 925bba0..0000000 --- a/doc/api-ref/html/dir_a01af9eb3c502936dfd53c3f8e45721d.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - -HomeScreenBinding: homescreen_service Directory Reference - - - - - - - - - -
    -
    - - - - - - -
    -
    HomeScreenBinding -
    -
    -
    - - - - - - - - -
    -
    - - -
    - -
    - - -
    -
    -
    -
    homescreen_service Directory Reference
    -
    -
    - - - - - - - - -

    -Files

    file  homescreen.c [code]
     
    file  hs-helper.c [code]
     
    file  hs-helper.h [code]
     
    -
    - - - - diff --git a/doc/api-ref/html/dir_d44c64559bbebec7f509842c48db8b23.html b/doc/api-ref/html/dir_d44c64559bbebec7f509842c48db8b23.html index a25c052..934d1e0 100644 --- a/doc/api-ref/html/dir_d44c64559bbebec7f509842c48db8b23.html +++ b/doc/api-ref/html/dir_d44c64559bbebec7f509842c48db8b23.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: include Directory Reference @@ -12,6 +11,9 @@ + @@ -29,19 +31,39 @@
    - + - - - - + +

    Files

    -file  hmi-debug.h [code] +file  hmi-debug.h [code]   file  libhomescreen.hpp [code]   @@ -79,7 +101,7 @@ Files diff --git a/doc/api-ref/html/doxygen.css b/doc/api-ref/html/doxygen.css index 4f1ab91..1425ec5 100644 --- a/doc/api-ref/html/doxygen.css +++ b/doc/api-ref/html/doxygen.css @@ -1,13 +1,9 @@ -/* The standard CSS for doxygen 1.8.13 */ +/* The standard CSS for doxygen 1.8.11 */ body, table, div, p, dl { font: 400 14px/22px Roboto,sans-serif; } -p.reference, p.definition { - font: 400 14px/22px Roboto,sans-serif; -} - /* @group Heading Levels */ h1.groupheader { @@ -177,7 +173,7 @@ pre.fragment { } div.fragment { - padding: 0px; + padding: 4px 6px; margin: 4px 8px 4px 2px; background-color: #FBFCFD; border: 1px solid #C4CFE5; @@ -236,15 +232,6 @@ span.lineno a:hover { background-color: #C8C8C8; } -.lineno { - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - div.ah, span.ah { background-color: black; font-weight: bold; @@ -514,29 +501,6 @@ table.memberdecls { /* Styles for detailed member documentation */ -.memtitle { - padding: 8px; - border-top: 1px solid #A8B8D9; - border-left: 1px solid #A8B8D9; - border-right: 1px solid #A8B8D9; - border-top-right-radius: 4px; - border-top-left-radius: 4px; - margin-bottom: -1px; - background-image: url('nav_f.png'); - background-repeat: repeat-x; - background-color: #E2E8F2; - line-height: 1.25; - font-weight: 300; - float:left; -} - -.permalink -{ - font-size: 65%; - display: inline-block; - vertical-align: middle; -} - .memtemplate { font-size: 80%; color: #4665A2; @@ -575,7 +539,7 @@ table.memberdecls { } .memname { - font-weight: 400; + font-weight: bold; margin-left: 6px; } @@ -591,24 +555,24 @@ table.memberdecls { color: #253555; font-weight: bold; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); - background-color: #DFE5F1; + background-image:url('nav_f.png'); + background-repeat:repeat-x; + background-color: #E2E8F2; /* opera specific markup */ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); border-top-right-radius: 4px; + border-top-left-radius: 4px; /* firefox specific markup */ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; -moz-border-radius-topright: 4px; + -moz-border-radius-topleft: 4px; /* webkit specific markup */ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); -webkit-border-top-right-radius: 4px; + -webkit-border-top-left-radius: 4px; } -.overload { - font-family: "courier new",courier,monospace; - font-size: 65%; -} - .memdoc, dl.reflist dd { border-bottom: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; @@ -950,7 +914,6 @@ table.fieldtable { padding-bottom: 4px; padding-top: 5px; text-align:left; - font-weight: 400; -moz-border-radius-topleft: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-left-radius: 4px; @@ -1215,11 +1178,6 @@ dl.section dd { text-align: center; } -.plantumlgraph -{ - text-align: center; -} - .diagraph { text-align: center; @@ -1515,82 +1473,3 @@ tr.heading h2 { } } -/* @group Markdown */ - -/* -table.markdownTable { - border-collapse:collapse; - margin-top: 4px; - margin-bottom: 4px; -} - -table.markdownTable td, table.markdownTable th { - border: 1px solid #2D4068; - padding: 3px 7px 2px; -} - -table.markdownTableHead tr { -} - -table.markdownTableBodyLeft td, table.markdownTable th { - border: 1px solid #2D4068; - padding: 3px 7px 2px; -} - -th.markdownTableHeadLeft th.markdownTableHeadRight th.markdownTableHeadCenter th.markdownTableHeadNone { - background-color: #374F7F; - color: #FFFFFF; - font-size: 110%; - padding-bottom: 4px; - padding-top: 5px; -} - -th.markdownTableHeadLeft { - text-align: left -} - -th.markdownTableHeadRight { - text-align: right -} - -th.markdownTableHeadCenter { - text-align: center -} -*/ - -table.markdownTable { - border-collapse:collapse; - margin-top: 4px; - margin-bottom: 4px; -} - -table.markdownTable td, table.markdownTable th { - border: 1px solid #2D4068; - padding: 3px 7px 2px; -} - -table.markdownTable tr { -} - -th.markdownTableHeadLeft, th.markdownTableHeadRight, th.markdownTableHeadCenter, th.markdownTableHeadNone { - background-color: #374F7F; - color: #FFFFFF; - font-size: 110%; - padding-bottom: 4px; - padding-top: 5px; -} - -th.markdownTableHeadLeft, td.markdownTableBodyLeft { - text-align: left -} - -th.markdownTableHeadRight, td.markdownTableBodyRight { - text-align: right -} - -th.markdownTableHeadCenter, td.markdownTableBodyCenter { - text-align: center -} - - -/* @end */ diff --git a/doc/api-ref/html/files.html b/doc/api-ref/html/files.html index 821231f..822468b 100644 --- a/doc/api-ref/html/files.html +++ b/doc/api-ref/html/files.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: File List @@ -12,6 +11,9 @@ + @@ -29,19 +31,39 @@
    - + - - - - + +
    Here is a list of all files with brief descriptions:
    @@ -81,7 +108,7 @@ $(function() { diff --git a/doc/api-ref/html/functions.html b/doc/api-ref/html/functions.html index 4aa87d0..8675686 100644 --- a/doc/api-ref/html/functions.html +++ b/doc/api-ref/html/functions.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: Class Members @@ -12,6 +11,9 @@ + @@ -29,19 +31,74 @@ - + - - - - + + + +
    -
    Here is a list of all class members with links to the classes they belong to:
    - + - - - - + + +
    - + - - - - + + +
     
      +
    • Event_HideWindow +: LibHomeScreen +
    • Event_OnScreenMessage : LibHomeScreen
    • Event_OnScreenReply : LibHomeScreen
    • +
    • Event_ReplyShowWindow +: LibHomeScreen +
    • +
    • Event_ShowInformation +: LibHomeScreen +
    • +
    • Event_ShowNotification +: LibHomeScreen +
    • +
    • Event_ShowWindow +: LibHomeScreen +
    • Event_TapShortcut : LibHomeScreen
    • @@ -74,7 +122,7 @@ $(function() { diff --git a/doc/api-ref/html/functions_func.html b/doc/api-ref/html/functions_func.html index 500e2d4..eee39df 100644 --- a/doc/api-ref/html/functions_func.html +++ b/doc/api-ref/html/functions_func.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: Class Members - Functions @@ -12,6 +11,9 @@ + @@ -29,19 +31,64 @@
    - + - - - - + + + +
    - + - - - - + + +
    - + - - - - + + + +
    @@ -77,7 +295,7 @@ $(function() { diff --git a/doc/api-ref/html/globals.html b/doc/api-ref/html/globals.html index 1498f7c..8d129dd 100644 --- a/doc/api-ref/html/globals.html +++ b/doc/api-ref/html/globals.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: File Members @@ -12,6 +11,9 @@ + @@ -29,19 +31,74 @@
    - + - - - - + + + +
    Here is a list of all file members with links to the files they belong to:
    -

    - _ -

    @@ -337,7 +548,7 @@ $(function() { diff --git a/doc/api-ref/html/globals_defs.html b/doc/api-ref/html/globals_defs.html index 24c615c..d645915 100644 --- a/doc/api-ref/html/globals_defs.html +++ b/doc/api-ref/html/globals_defs.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: File Members @@ -12,6 +11,9 @@ + @@ -29,19 +31,50 @@ - + - - - - + + +
     
    @@ -93,7 +146,7 @@ $(function() { diff --git a/doc/api-ref/html/globals_enum.html b/doc/api-ref/html/globals_enum.html index 6acaf5d..ecf263b 100644 --- a/doc/api-ref/html/globals_enum.html +++ b/doc/api-ref/html/globals_enum.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: File Members @@ -12,6 +11,9 @@ + @@ -29,19 +31,50 @@ - + - - - - + + +
     
    • LOG_LEVEL -: hmi-debug.h +: hmi-debug.h
    • REQ_ERROR : hs-helper.h @@ -71,7 +104,7 @@ $(function() { diff --git a/doc/api-ref/html/globals_eval.html b/doc/api-ref/html/globals_eval.html index 6619ccf..a0832f1 100644 --- a/doc/api-ref/html/globals_eval.html +++ b/doc/api-ref/html/globals_eval.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: File Members @@ -12,6 +11,9 @@ + @@ -29,19 +31,50 @@
    - + - - - - + + +
     
    - + - - - - + + + +
      -

    - _ -

    @@ -205,7 +311,7 @@ $(function() { diff --git a/doc/api-ref/html/globals_type.html b/doc/api-ref/html/globals_type.html index e873bff..32bde21 100644 --- a/doc/api-ref/html/globals_type.html +++ b/doc/api-ref/html/globals_type.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: File Members @@ -12,6 +11,9 @@ + @@ -29,19 +31,50 @@ - + - - - - + + +
     
    diff --git a/doc/api-ref/html/globals_vars.html b/doc/api-ref/html/globals_vars.html index 364ae73..fe6dfd3 100644 --- a/doc/api-ref/html/globals_vars.html +++ b/doc/api-ref/html/globals_vars.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: File Members @@ -12,6 +11,9 @@ + @@ -29,19 +31,68 @@ - + - - - - + + + +
    @@ -110,7 +283,7 @@ $(function() { diff --git a/doc/api-ref/html/index.html b/doc/api-ref/html/index.html index 9766905..ec4dbce 100644 --- a/doc/api-ref/html/index.html +++ b/doc/api-ref/html/index.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: Main Page @@ -12,6 +11,9 @@ + @@ -29,19 +31,33 @@
    - + - - - - +