aboutsummaryrefslogtreecommitdiffstats
path: root/include/libhomescreen.hpp
diff options
context:
space:
mode:
authorzheng_wenlong <wenlong_zheng@nexty-ele.com>2017-10-23 14:42:50 +0900
committerZheng Wenlong <wenlong_zheng@nexty-ele.com>2017-10-30 04:21:39 +0000
commit06a2777ce769346ba85aee9f38ccb237a2d72915 (patch)
treed6fffd3399b155ee6cd8c7801a58e19427741722 /include/libhomescreen.hpp
parent46f7c260dd5e79116e7c6571cacbda1b89495c9e (diff)
Remove the redundant thread loop
Because libhomescreen already has a thread to receive events, we can remove the thread loop in libhomescreen. Related Commit: https://gerrit.automotivelinux.org/gerrit/#/c/11403/ BUG-AGL: SPEC-989 Change-Id: I32d65efcf32f3395719837339659ff94b3e64889 Signed-off-by: zheng_wenlong <wenlong_zheng@nexty-ele.com>
Diffstat (limited to 'include/libhomescreen.hpp')
-rw-r--r--include/libhomescreen.hpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/include/libhomescreen.hpp b/include/libhomescreen.hpp
index 06e9ad8..5720368 100644
--- a/include/libhomescreen.hpp
+++ b/include/libhomescreen.hpp
@@ -35,26 +35,26 @@ public:
LibHomeScreen();
~LibHomeScreen();
- LibHomeScreen(const LibHomeScreen &) = delete;
- LibHomeScreen &operator=(const LibHomeScreen &) = delete;
+ LibHomeScreen(const LibHomeScreen &) = delete;
+ LibHomeScreen &operator=(const LibHomeScreen &) = delete;
- using handler_func = std::function<void(const char*)>;
+ using handler_func = std::function<void(const char*)>;
- enum EventType {
- Event_TapShortcut = 1,
- Event_OnScreenMessage
- };
+ enum EventType {
+ Event_TapShortcut = 1,
+ Event_OnScreenMessage
+ };
- static const std::vector<std::string> api_list;
- static const std::vector<std::string> event_list;
+ static const std::vector<std::string> api_list;
+ static const std::vector<std::string> event_list;
/* Method */
- 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 onScreenMessage(const char* display_message);
+ int tapShortcut(const char* application_name);
+ int onScreenMessage(const char* display_message);
- void set_event_handler(enum EventType et, handler_func f);
+ void set_event_handler(enum EventType et, handler_func f);
void registerCallback(
void (*event_cb)(const std::string& event, struct json_object* event_contents),
@@ -68,8 +68,7 @@ public:
private:
int initialize_websocket();
- int runEventloop();
-
+
void (*onEvent)(const std::string& event, struct json_object* event_contents);
void (*onReply)(struct json_object* reply);
void (*onHangup)(void);
@@ -82,7 +81,7 @@ private:
int mport = 2000;
std::string mtoken = "hs";
- std::map<EventType, handler_func> handlers;
+ std::map<EventType, handler_func> handlers;
public:
/* Don't use/ Internal only */