Define func_list as static 85/20185/3
authorwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
Tue, 19 Feb 2019 01:29:53 +0000 (09:29 +0800)
committerwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
Thu, 14 Mar 2019 05:58:34 +0000 (13:58 +0800)
For sharing func_list between all client instance,
define func_list as static.

Change-Id: I8a0a131128e057cc55a2d3efb76b66033dd20a04
Signed-off-by: wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
src/hs-client.cpp
src/hs-client.h

index dd91e10..e0d4bf0 100644 (file)
@@ -27,6 +27,21 @@ static const char _parameter[] = "parameter";
 static const char _replyto[] = "replyto";
 static const char _caller[] = "caller";
 
+// homescreen-service event and event handler function list
+const std::unordered_map<std::string, HS_Client::func_handler> HS_Client::func_list {
+    {"tap_shortcut",        &HS_Client::tap_shortcut},
+    {"showWindow",          &HS_Client::showWindow},
+    {"hideWindow",          &HS_Client::hideWindow},
+    {"replyShowWindow",     &HS_Client::replyShowWindow},
+    {"on_screen_message",   &HS_Client::on_screen_message},
+    {"on_screen_reply",     &HS_Client::on_screen_reply},
+    {"subscribe",           &HS_Client::subscribe},
+    {"unsubscribe",         &HS_Client::unsubscribe},
+    {"showNotification",    &HS_Client::showNotification},
+    {"showInformation",     &HS_Client::showInformation},
+    {"application-list-changed", nullptr}
+};
+
 /**
  * HS_Client construction function
  *
index 5b384b1..ac4d004 100644 (file)
@@ -46,18 +46,7 @@ private:
     int showInformation(afb_req_t request);
 
     typedef int (HS_Client::*func_handler)(afb_req_t);
-    const std::unordered_map<std::string, func_handler> func_list {
-        {"tap_shortcut",        &HS_Client::tap_shortcut},
-        {"showWindow",          &HS_Client::showWindow},
-        {"hideWindow",          &HS_Client::hideWindow},
-        {"replyShowWindow",     &HS_Client::replyShowWindow},
-        {"on_screen_message",   &HS_Client::on_screen_message},
-        {"on_screen_reply",     &HS_Client::on_screen_reply},
-        {"subscribe",           &HS_Client::subscribe},
-        {"unsubscribe",         &HS_Client::unsubscribe},
-        {"showNotification",    &HS_Client::showNotification},
-        {"showInformation",     &HS_Client::showInformation}
-    };
+    static const std::unordered_map<std::string, func_handler> func_list;
     bool checkEvent(const char* event);
     bool isSupportEvent(const char* event);