Move declaration to source code
[apps/agl-service-windowmanager.git] / src / wm_client.cpp
index a9ed547..47d0c2d 100644 (file)
@@ -49,7 +49,7 @@ WMClient::WMClient(const string &appid, unsigned layer, unsigned surface, const
 #else
         afb_event ev = afb_daemon_make_event(x.c_str());
 #endif
-        event2list[x] = ev;
+        evname2afb_event[x] = ev;
     }
 }
 
@@ -57,7 +57,7 @@ WMClient::WMClient(const string &appid, const string &role)
     : id(appid),
       layer(0),
       role2surface(0),
-      event2list(0)
+      evname2afb_event(0)
 {
     role2surface[role] = INVALID_SURFACE_ID;
     for (auto x : kWMEvents)
@@ -67,14 +67,10 @@ WMClient::WMClient(const string &appid, const string &role)
 #else
         afb_event ev = afb_daemon_make_event(x.c_str());
 #endif
-        event2list[x] = ev;
+        evname2afb_event[x] = ev;
     }
 }
 
-WMClient::~WMClient()
-{
-}
-
 string WMClient::appID() const
 {
     return this->id;
@@ -106,6 +102,21 @@ unsigned WMClient::layerID() const
     return this->layer;
 }
 
+unsigned WMClient::surfaceID() const
+{
+    return this->surface;
+}
+
+const string& WMClient::getWMLayerName()
+{
+    return this->wm_layer_name;
+}
+
+void WMClient::setRole(const string& role)
+{
+    this->role_list.push_back(role);
+}
+
 /**
  * Set layerID the client belongs to
  *
@@ -174,14 +185,14 @@ bool WMClient::removeRole(const string &role)
     return ret;
 }
 
-#ifndef GTEST_ENABLED
+#if GTEST_ENABLED
 bool WMClient::subscribe(afb_req req, const string &evname)
 {
     if(evname != kKeyError){
         HMI_DEBUG("wm", "error is only enabeled for now");
         return false;
     }
-    int ret = afb_req_subscribe(req, this->event2list[evname]);
+    int ret = afb_req_subscribe(req, this->evname2afb_event[evname]);
     if (ret)
     {
         HMI_DEBUG("wm", "Failed to subscribe %s", evname.c_str());
@@ -192,7 +203,7 @@ bool WMClient::subscribe(afb_req req, const string &evname)
 
 void WMClient::emitError(WM_CLIENT_ERROR_EVENT ev)
 {
-    if (!afb_event_is_valid(this->event2list[kKeyError])){
+    if (!afb_event_is_valid(this->evname2afb_event[kKeyError])){
         HMI_ERROR("wm", "event err is not valid");
         return;
     }
@@ -201,7 +212,7 @@ void WMClient::emitError(WM_CLIENT_ERROR_EVENT ev)
     json_object_object_add(j, kKeyErrorDesc, json_object_new_string(kErrorDescription[ev].c_str()));
     HMI_DEBUG("wm", "error: %d, description:%s", ev, kErrorDescription[ev].c_str());
 
-    int ret = afb_event_push(this->event2list[kKeyError], j);
+    int ret = afb_event_push(this->evname2afb_event[kKeyError], j);
     if (ret != 0)
     {
         HMI_DEBUG("wm", "afb_event_push failed: %m");