diff options
author | wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com> | 2019-03-26 14:55:18 +0800 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2019-03-28 11:00:52 +0000 |
commit | 2d1c8cc2f43d021ad75adc16f0606fb52615d9a6 (patch) | |
tree | a5907015c127922568f291a5b1451600380bd960 /src/hs-appinfo.h | |
parent | aa43a07d4e86421aefec8c603018d14f5e249087 (diff) |
Impove event process
1. manager event list in hs_instance.
2. add setEventHook interface to hook event.
Change-Id: I65a64f2d16343eb68d22fd1ad9d5fbf565f5967a
Signed-off-by: wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
Diffstat (limited to 'src/hs-appinfo.h')
-rw-r--r-- | src/hs-appinfo.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/hs-appinfo.h b/src/hs-appinfo.h index 7747f52..3355686 100644 --- a/src/hs-appinfo.h +++ b/src/hs-appinfo.h @@ -47,14 +47,14 @@ public: static HS_AppInfo* instance(void); int init(afb_api_t api); - void onEvent(afb_api_t api, const char *event, struct json_object *object); + int onEvent(afb_api_t api, const char *event, struct json_object *object); void getRunnables(struct json_object **object); std::string getAppProperty(const std::string appid, std::string key) const; std::string checkAppId(const std::string &appid); private: - void updateAppDetailList(afb_api_t api, struct json_object *object); + int updateAppDetailList(afb_api_t api, struct json_object *object); void createAppDetailList(struct json_object *object); std::string parseAppDetail(struct json_object *object, AppDetail &info) const; void addAppDetail(struct json_object *object); @@ -72,10 +72,8 @@ private: "restriction" }; - typedef void (HS_AppInfo::*func_handler)(afb_api_t, struct json_object*); - const std::unordered_map<std::string, func_handler> concerned_event_list { - {"afm-main/application-list-changed", &HS_AppInfo::updateAppDetailList} - }; + typedef int (HS_AppInfo::*func_handler)(afb_api_t, struct json_object*); + static const std::unordered_map<std::string, func_handler> concerned_event_list; private: static HS_AppInfo* me; |