From bfa54cba9b6a8a9201e7d27694d865ae6d5b5c6a Mon Sep 17 00:00:00 2001 From: zheng_wenlong Date: Mon, 8 Jul 2019 17:47:04 +0900 Subject: try to fix ignore issue --- src/libhomescreen.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/libhomescreen.cpp') diff --git a/src/libhomescreen.cpp b/src/libhomescreen.cpp index fa22da4..4d96cb8 100644 --- a/src/libhomescreen.cpp +++ b/src/libhomescreen.cpp @@ -334,8 +334,20 @@ void LibHomeScreen::set_event_handler(enum EventType et, handler_func f) */ void LibHomeScreen::publishSubscription(void) { + struct json_object* j_obj = json_object_new_array(); for(auto &it : handlers) { - this->subscribe(LibHomeScreen::event_list[it.first - 1]); + json_object_array_add(j_obj, json_object_new_string(LibHomeScreen::event_list[it.first - 1].c_str())); + } + + if(!sp_websock) { + return; + } + struct json_object* push_obj = json_object_new_object(); + json_object_object_add(push_obj, "event", j_obj); + + int ret = afb_wsj1_call_j(sp_websock, API, "subscribe", push_obj, _on_reply_static, this); + if (ret < 0) { + HMI_ERROR("libhomescreen","Failed to call subscribe."); } } @@ -432,6 +444,7 @@ int LibHomeScreen::subscribe(const string& event_name) if (ret < 0) { HMI_ERROR("libhomescreen","Failed to call verb"); } + afb_wsj1_call_j(sp_websock, API, "subscribe", j_obj, _on_reply_static, this); return ret; } -- cgit 1.2.3-korg