aboutsummaryrefslogtreecommitdiffstats
path: root/src/hs-client.cpp
diff options
context:
space:
mode:
authorwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2019-02-20 13:52:59 +0800
committerwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2019-03-25 19:42:35 +0800
commit211769e800f3a57de55b3774de82af55d2a0160a (patch)
tree07325ab1aeacb9a0c349e1927812e8080ff8744c /src/hs-client.cpp
parent25299ef60fa4df5f590ff364cff004e90376a4bf (diff)
Start app and get runnables list by homescreen
1.start application in showWindow. 2.add "getRunnables" verb. 3.handle "application-list-changed" event from afm-main and add "application-list-changed" event. Bug-AGL: SPEC-2188 Change-Id: I619b97424d20af373a945ff502a8133339916923 Signed-off-by: wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
Diffstat (limited to 'src/hs-client.cpp')
-rw-r--r--src/hs-client.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/hs-client.cpp b/src/hs-client.cpp
index e0d4bf0..c927442 100644
--- a/src/hs-client.cpp
+++ b/src/hs-client.cpp
@@ -465,9 +465,35 @@ int HS_Client::handleRequest(afb_req_t request, const char *verb)
int ret = AFB_EVENT_BAD_REQUEST;
auto ip = func_list.find(std::string(verb));
- if(ip != func_list.end()) {
+ if(ip != func_list.end() && ip->second != nullptr) {
HMI_NOTICE("homescreen-service","[%s]verb found", verb);
ret = (this->*(ip->second))(request);
}
return ret;
+}
+
+/**
+ * push event
+ *
+ * #### Parameters
+ * - event : the event want to push
+ * - param : the parameter contents of event
+ *
+ * #### Return
+ * 0 : success
+ * others : fail
+ *
+ */
+int HS_Client::pushEvent(const char *event, struct json_object *param)
+{
+ if(!checkEvent(event))
+ return 0;
+
+ HMI_NOTICE("homescreen-service","called, event=%s.",event);
+ struct json_object* push_obj = json_object_new_object();
+ hs_add_object_to_json_object_str( push_obj, 4, _application_id, my_id.c_str(), _type, event);
+ if(param != nullptr)
+ json_object_object_add(push_obj, _parameter, param);
+ afb_event_push(my_event, push_obj);
+ return 0;
} \ No newline at end of file