aboutsummaryrefslogtreecommitdiffstats
path: root/src/hs-clientmanager.cpp
diff options
context:
space:
mode:
authorwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2018-11-14 11:12:44 +0800
committerwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2018-11-14 11:12:44 +0800
commit7a123d6d802fe76a6d2eb32adacb2215d5bb873a (patch)
treecd707443b7ab659b071845e8b7b66b708335eb22 /src/hs-clientmanager.cpp
parentc6035c02992d874c1422cb279423017ca4c05eec (diff)
add new features in homescreen-service and homescreen
homescreen-service: add five verbs. 1.showWindow: instead of tap_shortcut and show onscreen. 2.hideWindow: used when want to hide onscreen. 3.replyShowWindow: used when post onscreen reply information to application. 4.showNotification: used by application who want to display notification on homescreen top area. 5.showInformation: used by application who want to display information on homescreen botton area. homescreen: 1.add fullscreen transfer button. 2.display notification and information. Bug-AGL: SPEC-1931 Change-Id: I612e541243ee6502eb90ff1aa2ab4d99bfbc7156 Signed-off-by: wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
Diffstat (limited to 'src/hs-clientmanager.cpp')
-rw-r--r--src/hs-clientmanager.cpp146
1 files changed, 146 insertions, 0 deletions
diff --git a/src/hs-clientmanager.cpp b/src/hs-clientmanager.cpp
index 15897b7..ba29326 100644
--- a/src/hs-clientmanager.cpp
+++ b/src/hs-clientmanager.cpp
@@ -17,6 +17,8 @@
#include "hs-clientmanager.h"
#include "hmi-debug.h"
+static const char _homescreen[] = "homescreen";
+
HS_ClientManager* HS_ClientManager::me = nullptr;
static void cbRemoveClientCtxt(void *data)
@@ -309,3 +311,147 @@ int HS_ClientManager::unsubscribe(afb_req_t request)
}
return ret;
}
+
+/**
+ * showWindow event
+ *
+ * #### Parameters
+ * - request : the request
+ *
+ * #### Return
+ * 0 : success
+ * others : fail
+ *
+ */
+int HS_ClientManager::showWindow(afb_req_t request)
+{
+ int ret = 0;
+ const char* value = afb_req_value(request, _application_id);
+ if (value) {
+ HMI_NOTICE("homescreen-service","request params = %s.", value);
+ std::lock_guard<std::mutex> lock(this->mtx);
+ auto ip = client_list.find(std::string(value));
+ if(ip != client_list.end()) {
+ ret = ip->second->showWindow(request, value);
+ }
+ }
+ else {
+ HMI_NOTICE("homescreen-service","Please input application_id");
+ ret = AFB_EVENT_BAD_REQUEST;
+ }
+ return ret;
+}
+
+/**
+ * hideWindow event
+ *
+ * #### Parameters
+ * - request : the request
+ *
+ * #### Return
+ * 0 : success
+ * others : fail
+ *
+ */
+int HS_ClientManager::hideWindow(afb_req_t request)
+{
+ int ret = 0;
+ const char* value = afb_req_value(request, _application_id);
+ if (value) {
+ HMI_NOTICE("homescreen-service","request params = %s.", value);
+ std::lock_guard<std::mutex> lock(this->mtx);
+ auto ip = client_list.find(std::string(value));
+ if(ip != client_list.end()) {
+ ret = ip->second->hideWindow(request);
+ }
+ }
+ else {
+ HMI_NOTICE("homescreen-service","Please input application_id");
+ ret = AFB_EVENT_BAD_REQUEST;
+ }
+ return ret;
+}
+
+/**
+ * replyShowWindow event
+ *
+ * #### Parameters
+ * - request : the request
+ *
+ * #### Return
+ * 0 : success
+ * others : fail
+ *
+ */
+int HS_ClientManager::replyShowWindow(afb_req_t request)
+{
+ int ret = 0;
+ const char* value = afb_req_value(request, _application_id);
+ if (value) {
+ HMI_NOTICE("homescreen-service","request params = %s.", value);
+ std::lock_guard<std::mutex> lock(this->mtx);
+ auto ip = client_list.find(std::string(value));
+ if(ip != client_list.end()) {
+ ret = ip->second->replyShowWindow(request, value);
+ }
+ }
+ else {
+ HMI_NOTICE("homescreen-service","Please input application_id");
+ ret = AFB_EVENT_BAD_REQUEST;
+ }
+ return ret;
+}
+
+/**
+ * showNotification event
+ *
+ * #### Parameters
+ * - request : the request
+ *
+ * #### Return
+ * 0 : success
+ * others : fail
+ *
+ */
+int HS_ClientManager::showNotification(afb_req_t request)
+{
+ int ret = 0;
+ std::lock_guard<std::mutex> lock(this->mtx);
+ auto ip = client_list.find(_homescreen);
+ if(ip != client_list.end()) {
+ ret = ip->second->showNotification(request);
+ }
+ else {
+ HMI_NOTICE("homescreen-service","not exist sessiion with homescreen");
+ ret = AFB_REQ_SHOWNOTIFICATION_ERROR;
+ }
+
+ return ret;
+}
+
+/**
+ * showInformation event
+ *
+ * #### Parameters
+ * - request : the request
+ *
+ * #### Return
+ * 0 : success
+ * others : fail
+ *
+ */
+int HS_ClientManager::showInformation(afb_req_t request)
+{
+ int ret = 0;
+ std::lock_guard<std::mutex> lock(this->mtx);
+ auto ip = client_list.find(_homescreen);
+ if(ip != client_list.end()) {
+ ret = ip->second->showInformation(request);
+ }
+ else {
+ HMI_NOTICE("homescreen-service","not exist sessiion with homescreen");
+ ret = AFB_REQ_SHOWINFORMATION_ERROR;
+ }
+
+ return ret;
+}