aboutsummaryrefslogtreecommitdiffstats
path: root/src/hs-clientmanager.cpp
diff options
context:
space:
mode:
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;
+}