aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-06-07 15:40:27 +0900
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-06-07 15:40:27 +0900
commitd78ae3cd8f316d1830cde4d611b8e42f90dbcc11 (patch)
treec3b332842d6184abcaa22cadb3cb130dbadbc525
parenta181459365cdf50a72b26b1f770577096ba19d4a (diff)
Format source code
Fix character case for * wm-client * wm-error * applist app doesn't complete formating character Change-Id: I7187d7be8bcf158664c4e8e2b090fe4ca7017d12 Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
-rw-r--r--src/app.cpp122
-rw-r--r--src/applist.cpp76
-rw-r--r--src/applist.hpp8
-rw-r--r--src/wm-client.cpp58
-rw-r--r--src/wm-client.hpp4
-rw-r--r--src/wm-error.cpp2
-rw-r--r--src/wm-error.h1
7 files changed, 136 insertions, 135 deletions
diff --git a/src/app.cpp b/src/app.cpp
index 1802c33..1645bfe 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -46,7 +46,7 @@ extern "C"
namespace wm
{
-const unsigned TIME_OUT = 10000000UL; /* 10s */
+const unsigned kTimeOut = 10000000UL; /* 10s */
/* DrawingArea name used by "{layout}.{area}" */
const char kNameLayoutNormal[] = "normal";
@@ -68,11 +68,9 @@ const char kKeyHeightPixel[] = "height_pixel";
const char kKeyWidthMm[] = "width_mm";
const char kKeyHeightMm[] = "height_mm";
-static const std::string task_allocate = "allocate";
-static const std::string task_release = "release";
-static sd_event_source *timer_ev_src = nullptr;
+static sd_event_source *g_timer_ev_src = nullptr;
-static AppList app_list;
+static AppList g_app_list;
namespace
{
@@ -122,13 +120,13 @@ processTimerHandler(sd_event_source *s, uint64_t usec, void *userdata)
void App::timerHandler()
{
- unsigned seq = app_list.currentSequenceNumber();
+ unsigned seq = g_app_list.currentSequenceNumber();
HMI_SEQ_DEBUG(seq, "Timer expired remove Request");
- app_list.req_dump();
- app_list.removeRequest(seq);
- app_list.next();
- app_list.req_dump();
- if (app_list.haveRequest())
+ g_app_list.reqDump();
+ g_app_list.removeRequest(seq);
+ g_app_list.next();
+ g_app_list.reqDump();
+ if (g_app_list.haveRequest())
{
this->process_request();
}
@@ -137,16 +135,16 @@ void App::timerHandler()
void App::removeClient(const std::string &appid)
{
HMI_DEBUG("wm", "Remove clinet %s from list", appid.c_str());
- app_list.removeClient(appid);
+ g_app_list.removeClient(appid);
}
bool App::subscribeEventForApp(const std::string &appid, afb_req req, const std::string &evname)
{
- if(!app_list.contains(appid)){
+ if(!g_app_list.contains(appid)){
HMI_DEBUG("wm", "Client %s is not registered", appid.c_str());
return false;
}
- auto client = app_list.lookUpClient(appid);
+ auto client = g_app_list.lookUpClient(appid);
return client->subscribe(req, evname);
}
@@ -425,12 +423,12 @@ void App::layout_commit()
void App::set_timer()
{
- HMI_SEQ_DEBUG(app_list.currentSequenceNumber(), "Timer set activate");
- if (timer_ev_src == nullptr)
+ HMI_SEQ_DEBUG(g_app_list.currentSequenceNumber(), "Timer set activate");
+ if (g_timer_ev_src == nullptr)
{
// firsttime set into sd_event
- int ret = sd_event_add_time(afb_daemon_get_event_loop(), &timer_ev_src,
- CLOCK_REALTIME, time(NULL) * (1000000UL) + TIME_OUT, 1, processTimerHandler, this);
+ int ret = sd_event_add_time(afb_daemon_get_event_loop(), &g_timer_ev_src,
+ CLOCK_REALTIME, time(NULL) * (1000000UL) + kTimeOut, 1, processTimerHandler, this);
if (ret < 0)
{
HMI_ERROR("wm", "Could't set timer");
@@ -439,16 +437,16 @@ void App::set_timer()
else
{
// update timer limitation after second time
- sd_event_source_set_time(timer_ev_src, time(NULL) * (1000000UL) + TIME_OUT);
- sd_event_source_set_enabled(timer_ev_src, SD_EVENT_ONESHOT);
+ sd_event_source_set_time(g_timer_ev_src, time(NULL) * (1000000UL) + kTimeOut);
+ sd_event_source_set_enabled(g_timer_ev_src, SD_EVENT_ONESHOT);
}
}
void App::stop_timer()
{
- unsigned seq = app_list.currentSequenceNumber();
+ unsigned seq = g_app_list.currentSequenceNumber();
HMI_SEQ_DEBUG(seq, "Timer stop");
- int rc = sd_event_source_set_enabled(timer_ev_src, SD_EVENT_OFF);
+ int rc = sd_event_source_set_enabled(g_timer_ev_src, SD_EVENT_OFF);
if (rc < 0)
{
HMI_SEQ_ERROR(seq, "Timer stop failed");
@@ -458,7 +456,7 @@ void App::stop_timer()
bool App::lm_release(const struct WMAction &action)
{
//auto const &surface_id = this->lookup_id(drawing_name);
- unsigned req_num = app_list.currentSequenceNumber();
+ unsigned req_num = g_app_list.currentSequenceNumber();
auto const &surface_id = this->lookup_id(action.role.c_str());
if (!surface_id)
{
@@ -560,8 +558,8 @@ bool App::lm_layout_change(const struct WMAction &action)
TODO: emit syncDraw with application*/
if (msg)
{
- HMI_SEQ_DEBUG(app_list.currentSequenceNumber(), msg);
- //app_list.removeRequest(req_num);
+ HMI_SEQ_DEBUG(g_app_list.currentSequenceNumber(), msg);
+ //g_app_list.removeRequest(req_num);
return false;
}
this->lm_layout_change(action.role.c_str());
@@ -574,7 +572,7 @@ bool App::do_transition(unsigned req_num)
* Check Policy
*/
// get current trigger
- auto trigger = app_list.getRequest(req_num);
+ auto trigger = g_app_list.getRequest(req_num);
bool is_activate = true;
/* get new status from Policy Manager
@@ -582,23 +580,23 @@ bool App::do_transition(unsigned req_num)
(json_object*?) newLayout = checkPolicy(trigger);
(vector<struct WMAction>&) auto actions = translator.inputActionFromLayout(newLayout, currentLayout)
for(const auto& x : actions){
- app_list.setAciton(req_num, x)
+ g_app_list.setAciton(req_num, x)
}
or
- translator.inputActionFromLayout(newLayout, currentLayout, &app_list, req_num);
+ translator.inputActionFromLayout(newLayout, currentLayout, &g_app_list, req_num);
/* The following error check is not necessary because main.cpp will reject the message form not registered object
} */
HMI_SEQ_NOTICE(req_num, "ATM, Policy manager does't exist, then set WMAction as is");
- if (TASK_RELEASE == trigger.task)
+ if (trigger.task == Task::TASK_RELEASE)
{
is_activate = false;
}
- bool ret = app_list.setAction(req_num, trigger.appid, trigger.role, trigger.area, is_activate);
- app_list.req_dump();
+ bool ret = g_app_list.setAction(req_num, trigger.appid, trigger.role, trigger.area, is_activate);
+ g_app_list.reqDump();
if (!ret)
{
@@ -608,7 +606,7 @@ bool App::do_transition(unsigned req_num)
// layer manager task
bool sync_draw_happen = false;
- for (const auto &y : app_list.getActions(req_num))
+ for (const auto &y : g_app_list.getActions(req_num))
{
/*
do_task(y);
@@ -624,11 +622,11 @@ bool App::do_transition(unsigned req_num)
if (!ret)
{
HMI_SEQ_ERROR(req_num, "Failed layout change: %s", y.appid.c_str());
- app_list.removeRequest(req_num);
+ g_app_list.removeRequest(req_num);
break;
// TODO: if transition fails, what should we do?
}
- /* app_list.lookUpClient(y.appid)->emit_syncdraw(y.role, y.area); */
+ /* g_app_list.lookUpClient(y.appid)->emit_syncdraw(y.role, y.area); */
}
else
{
@@ -636,11 +634,11 @@ bool App::do_transition(unsigned req_num)
if (!ret)
{
HMI_SEQ_ERROR(req_num, "Failed release resource: %s", y.appid.c_str());
- app_list.removeRequest(req_num);
+ g_app_list.removeRequest(req_num);
break;
// TODO: if transition fails, what should we do?
}
- /* app_list.lookUpClient(y.appid)->emit_invisible(y.role, y.area); */
+ /* g_app_list.lookUpClient(y.appid)->emit_invisible(y.role, y.area); */
}
}
@@ -654,7 +652,7 @@ bool App::do_transition(unsigned req_num)
}
else
{
- app_list.removeRequest(req_num); // HACK!!!
+ g_app_list.removeRequest(req_num); // HACK!!!
}
return ret;
}
@@ -852,19 +850,19 @@ void App::api_activate_surface(char const *appid, char const *drawing_name, char
std::string role = drawing_name;
std::string area = drawing_area;
- if (!app_list.contains(id))
+ if (!g_app_list.contains(id))
{
reply("app doesn't request 'requestSurface' yet");
return;
}
- auto client = app_list.lookUpClient(id);
+ auto client = g_app_list.lookUpClient(id);
/*
* Queueing Phase
*/
- unsigned current = app_list.currentSequenceNumber();
- unsigned requested_num = app_list.getSequenceNumber(id);
+ unsigned current = g_app_list.currentSequenceNumber();
+ unsigned requested_num = g_app_list.getSequenceNumber(id);
if (requested_num != 0)
{
HMI_SEQ_INFO(requested_num, "%s %s %s request is already queued", id.c_str(), role.c_str(), area.c_str());
@@ -873,8 +871,8 @@ void App::api_activate_surface(char const *appid, char const *drawing_name, char
}
WMRequest req = WMRequest(id, role, area, Task::TASK_ALLOCATE);
- unsigned new_req = app_list.addAllocateRequest(req);
- app_list.req_dump();
+ unsigned new_req = g_app_list.addAllocateRequest(req);
+ g_app_list.reqDump();
HMI_SEQ_DEBUG(current, "%s start sequence with %s, %s", id.c_str(), role.c_str(), area.c_str());
@@ -909,18 +907,18 @@ void App::api_deactivate_surface(char const *appid, char const *drawing_name, co
std::string role = drawing_name;
std::string area = ""; //drawing_area;
- if (!app_list.contains(id))
+ if (!g_app_list.contains(id))
{
reply("app doesn't request 'requestSurface' yet");
return;
}
- auto client = app_list.lookUpClient(id);
+ auto client = g_app_list.lookUpClient(id);
/*
* Queueing Phase
*/
- unsigned current = app_list.currentSequenceNumber();
- unsigned requested_num = app_list.getSequenceNumber(id);
+ unsigned current = g_app_list.currentSequenceNumber();
+ unsigned requested_num = g_app_list.getSequenceNumber(id);
if (requested_num != 0)
{
HMI_SEQ_INFO(requested_num, "%s %s %s request is already queued", id.c_str(), role.c_str(), area.c_str());
@@ -929,8 +927,8 @@ void App::api_deactivate_surface(char const *appid, char const *drawing_name, co
}
WMRequest req = WMRequest(id, role, area, Task::TASK_RELEASE);
- unsigned new_req = app_list.addAllocateRequest(req);
- app_list.req_dump();
+ unsigned new_req = g_app_list.addAllocateRequest(req);
+ g_app_list.reqDump();
HMI_SEQ_DEBUG(current, "%s start sequence with %s, %s", id.c_str(), role.c_str(), area.c_str());
@@ -996,7 +994,7 @@ void App::lm_enddraw(const char *drawing_name)
void App::do_enddraw(unsigned request_seq)
{
// get actions
- auto actions = app_list.getActions(request_seq);
+ auto actions = g_app_list.getActions(request_seq);
HMI_SEQ_INFO(request_seq, "do endDraw");
for (const auto &act : actions)
@@ -1009,14 +1007,14 @@ void App::do_enddraw(unsigned request_seq)
/* do
{
// emit flush Draw
- //emitFlushDrawToAll(&app_list, request_seq);
+ //emitFlushDrawToAll(&g_app_list, request_seq);
// emit status change event
- } while (!app_list.requestFinished());*/
+ } while (!g_app_list.requestFinished());*/
}
void App::process_request()
{
- unsigned req = app_list.currentSequenceNumber();
+ unsigned req = g_app_list.currentSequenceNumber();
HMI_SEQ_DEBUG(req, "Do next request");
do_transition(req);
}
@@ -1025,8 +1023,8 @@ void App::api_enddraw(char const *appid, char const *drawing_name)
{
std::string id(appid);
std::string role(drawing_name);
- unsigned current_seq = app_list.currentSequenceNumber();
- bool result = app_list.setEndDrawFinished(current_seq, id, role);
+ unsigned current_seq = g_app_list.currentSequenceNumber();
+ bool result = g_app_list.setEndDrawFinished(current_seq, id, role);
if (!result)
{
@@ -1034,7 +1032,7 @@ void App::api_enddraw(char const *appid, char const *drawing_name)
return;
}
- if (app_list.endDrawFullfilled(current_seq))
+ if (g_app_list.endDrawFullfilled(current_seq))
{
// do task for endDraw
//this->stop_timer();
@@ -1042,10 +1040,10 @@ void App::api_enddraw(char const *appid, char const *drawing_name)
this->stop_timer();
- app_list.removeRequest(current_seq);
+ g_app_list.removeRequest(current_seq);
HMI_SEQ_INFO(current_seq, "Finish request");
- app_list.next();
- if (app_list.haveRequest())
+ g_app_list.next();
+ if (g_app_list.haveRequest())
{
this->process_request();
}
@@ -1133,7 +1131,7 @@ void App::surface_removed(uint32_t surface_id)
{
HMI_DEBUG("wm", "surface_id is %u", surface_id);
- app_list.removeSurface(surface_id);
+ g_app_list.removeSurface(surface_id);
}
void App::emit_activated(char const *label)
@@ -1202,8 +1200,8 @@ result<int> App::api_request_surface(char const *appid, char const *drawing_name
// add client into the db
std::string appid_str(appid);
std::string role(drawing_name);
- //app_list.addClient(appid_str, role);
- app_list.addClient(appid_str, *lid, id, role);
+ //g_app_list.addClient(appid_str, role);
+ g_app_list.addClient(appid_str, *lid, id, role);
return Ok<int>(id);
}
diff --git a/src/applist.cpp b/src/applist.cpp
index 8c13f5f..bdb64a9 100644
--- a/src/applist.cpp
+++ b/src/applist.cpp
@@ -20,7 +20,6 @@
using std::shared_ptr;
using std::string;
-using std::unique_ptr;
using std::vector;
namespace wm
@@ -28,8 +27,8 @@ namespace wm
AppList::AppList()
: req_list(0),
- client_list(0),
- current_seq(1)
+ app2client(0),
+ current_req(1)
{
}
@@ -38,32 +37,32 @@ AppList::~AppList() {}
void AppList::addClient(const string &appid, const string &role)
{
shared_ptr<WMClient> client = std::make_shared<WMClient>(appid, role);
- client_list[appid] = client;
- client_dump();
+ this->app2client[appid] = client;
+ this->clientDump();
}
void AppList::addClient(const std::string &appid, unsigned layer, unsigned surface, const std::string &role)
{
shared_ptr<WMClient> client = std::make_shared<WMClient>(appid, layer, surface, role);
- client_list[appid] = client;
- client_dump();
+ this->app2client[appid] = client;
+ this->clientDump();
}
void AppList::removeClient(const string &appid)
{
- client_list.erase(appid);
+ this->app2client.erase(appid);
}
bool AppList::contains(const string &appid)
{
- auto result = client_list.find(appid);
- return (client_list.end() != result) ? true : false;
+ auto result = this->app2client.find(appid);
+ return (this->app2client.end() != result) ? true : false;
}
void AppList::removeSurface(unsigned surface_id){
// This function may be very slow
bool ret = false;
- for (auto &x : client_list)
+ for (auto &x : this->app2client)
{
ret = x.second->removeSurfaceIfExist(surface_id);
if(ret){
@@ -81,23 +80,23 @@ void AppList::removeSurface(unsigned surface_id){
*/
shared_ptr<WMClient> AppList::lookUpClient(const string &appid)
{
- return client_list.at(appid);
+ return this->app2client.at(appid);
}
int AppList::countClient()
{
- return client_list.size();
+ return this->app2client.size();
}
unsigned AppList::currentSequenceNumber()
{
- return current_seq;
+ return this->current_req;
}
// Is this function necessary ?
unsigned AppList::getSequenceNumber(const string &appid)
{
- for (const auto &x : req_list)
+ for (const auto &x : this->req_list)
{
// Since app will not request twice and more, comparing appid is enough?
if ((x.trigger.appid == appid))
@@ -110,27 +109,27 @@ unsigned AppList::getSequenceNumber(const string &appid)
unsigned AppList::addAllocateRequest(WMRequest req)
{
- if (req_list.size() == 0)
+ if (this->req_list.size() == 0)
{
- req.seq_num = current_seq;
+ req.seq_num = current_req;
}
else
{
- HMI_SEQ_DEBUG(current_seq, "real: %d", req_list.back().seq_num + 1);
- req.seq_num = req_list.back().seq_num + 1;
+ HMI_SEQ_DEBUG(this->current_req, "add: %d", this->req_list.back().seq_num + 1);
+ req.seq_num = this->req_list.back().seq_num + 1;
}
- req_list.push_back(req);
+ this->req_list.push_back(req);
return req.seq_num; // return 1; if you test time_expire
}
bool AppList::requestFinished()
{
- return req_list.empty();
+ return this->req_list.empty();
}
struct WMTrigger AppList::getRequest(unsigned req_num)
{
- for (auto &x : req_list)
+ for (auto &x : this->req_list)
{
if (req_num == x.seq_num)
{
@@ -141,7 +140,7 @@ struct WMTrigger AppList::getRequest(unsigned req_num)
const vector<struct WMAction> &AppList::getActions(unsigned req_num)
{
- for (auto &x : req_list)
+ for (auto &x : this->req_list)
{
if (req_num == x.seq_num)
{
@@ -153,7 +152,7 @@ const vector<struct WMAction> &AppList::getActions(unsigned req_num)
bool AppList::setAction(unsigned req_num, const struct WMAction &action)
{
bool result = false;
- for (auto &x : req_list)
+ for (auto &x : this->req_list)
{
if (req_num != x.seq_num)
{
@@ -176,7 +175,8 @@ bool AppList::setAction(unsigned req_num, const string &appid, const string &rol
{
continue;
}
- WMAction action{appid, role, area, visible, false};
+ bool edraw_f = false;
+ WMAction action{appid, role, area, visible, edraw_f};
x.sync_draw_req.push_back(action);
result = true;
@@ -206,7 +206,7 @@ bool AppList::setEndDrawFinished(unsigned req_num, const string &appid, const st
}
}
}
- req_dump();
+ this->reqDump();
return result;
}
@@ -242,30 +242,30 @@ bool AppList::endDrawFullfilled(unsigned req_num)
void AppList::removeRequest(unsigned req_seq)
{
- req_list.erase(remove_if(req_list.begin(), req_list.end(),
- [req_seq](WMRequest x) {
- return x.seq_num == req_seq;
- }));
+ this->req_list.erase(remove_if(this->req_list.begin(), this->req_list.end(),
+ [req_seq](WMRequest x) {
+ return x.seq_num == req_seq;
+ }));
}
void AppList::next()
{
- ++this->current_seq;
- if (0 == this->current_seq)
+ ++this->current_req;
+ if (0 == this->current_req)
{
- this->current_seq = 1;
+ this->current_req = 1;
}
}
bool AppList::haveRequest()
{
- return !req_list.empty();
+ return !this->req_list.empty();
}
-void AppList::client_dump()
+void AppList::clientDump()
{
DUMP("======= client dump =====");
- for (const auto &x : client_list)
+ for (const auto &x : this->app2client)
{
const auto &y = x.second;
y->dumpInfo();
@@ -273,10 +273,10 @@ void AppList::client_dump()
DUMP("======= client dump end=====");
}
-void AppList::req_dump()
+void AppList::reqDump()
{
DUMP("======= req dump =====");
- DUMP("current request : %d", current_seq);
+ DUMP("current request : %d", current_req);
for (const auto &x : req_list)
{
DUMP("requested with : %d", x.seq_num);
diff --git a/src/applist.hpp b/src/applist.hpp
index 241f153..320d36b 100644
--- a/src/applist.hpp
+++ b/src/applist.hpp
@@ -65,13 +65,13 @@ class AppList
struct WMTrigger getRequest(unsigned req_num);
const std::vector<struct WMAction> &getActions(unsigned req_num);
- void client_dump();
- void req_dump();
+ void clientDump();
+ void reqDump();
private:
std::vector<WMRequest> req_list;
- std::unordered_map<std::string, std::shared_ptr<WMClient>> client_list;
- unsigned current_seq;
+ std::unordered_map<std::string, std::shared_ptr<WMClient>> app2client;
+ unsigned current_req;
};
} // namespace wm
diff --git a/src/wm-client.cpp b/src/wm-client.cpp
index 380c841..13dae6f 100644
--- a/src/wm-client.cpp
+++ b/src/wm-client.cpp
@@ -26,16 +26,16 @@ using std::vector;
namespace wm
{
-const vector<string> wm_events = {
+const vector<string> kWMEvents = {
// Private event for applications
"syncDraw", "flushDraw", "visible", "invisible", "active", "inactive", "error"};
-const vector<string> error_description = {
+const vector<string> kErrorDescription = {
"unknown-error"};
-static const char key_drawing_name[] = "drawing_name";
-static const char key_role[] = "role";
-static const char key_err[] = "error";
-static const char key_err_desc[] = "error_description";
+static const char kKeyDrawingName[] = "drawing_name";
+static const char kKeyrole[] = "role";
+static const char kKeyError[] = "error";
+static const char kKeyErrorDesc[] = "kErrorDescription";
WMClient::WMClient(const string &appid, unsigned layerID, unsigned surfaceID, const string &role)
: layer(layerID),
@@ -43,14 +43,14 @@ WMClient::WMClient(const string &appid, unsigned layerID, unsigned surfaceID, co
role2surface(0)
{
role2surface[role] = surfaceID;
- for (auto x : wm_events)
+ for (auto x : kWMEvents)
{
#if GTEST_ENABLED
string ev = x;
#else
afb_event ev = afb_daemon_make_event(x.c_str());
#endif
- event_list[x] = ev;
+ event2list[x] = ev;
}
}
@@ -58,17 +58,17 @@ WMClient::WMClient(const string &appid, const string &role)
: id(appid),
layer(0),
role2surface(0),
- event_list(0)
+ event2list(0)
{
role2surface[role] = INVALID_SURFACE_ID;
- for (auto x : wm_events)
+ for (auto x : kWMEvents)
{
#if GTEST_ENABLED
string ev = x;
#else
afb_event ev = afb_daemon_make_event(x.c_str());
#endif
- event_list[x] = ev;
+ event2list[x] = ev;
}
}
@@ -83,17 +83,17 @@ string WMClient::appID()
unsigned WMClient::surfaceID(const string &role)
{
- if (0 == role2surface.count(role))
+ if (0 == this->role2surface.count(role))
{
HMI_WARNING("wm", "invalid role");
return INVALID_SURFACE_ID;
}
- return role2surface.at(role);
+ return this->role2surface.at(role);
}
unsigned WMClient::layerID()
{
- return layer;
+ return this->layer;
}
void WMClient::registerLayer(unsigned layerID)
@@ -104,22 +104,22 @@ void WMClient::registerLayer(unsigned layerID)
bool WMClient::addSurface(const string &role, unsigned surface)
{
HMI_DEBUG("wm", "Add role %s with surface %d", role.c_str(), surface);
- if (0 != role2surface.count(role))
+ if (0 != this->role2surface.count(role))
{
- HMI_NOTICE("wm", "override surfaceID %d with %d", role2surface[role], surface);
+ HMI_NOTICE("wm", "override surfaceID %d with %d", this->role2surface[role], surface);
}
- role2surface[role] = surface;
+ this->role2surface[role] = surface;
return true;
}
bool WMClient::removeSurfaceIfExist(unsigned surfaceID)
{
bool ret = false;
- for (auto &x : role2surface)
+ for (auto &x : this->role2surface)
{
if (surfaceID == x.second)
{
- role2surface.erase(x.first);
+ this->role2surface.erase(x.first);
ret = true;
break;
}
@@ -130,9 +130,9 @@ bool WMClient::removeSurfaceIfExist(unsigned surfaceID)
bool WMClient::removeRole(const string &role)
{
bool ret = false;
- if (role2surface.count(role) != 0)
+ if (this->role2surface.count(role) != 0)
{
- role2surface.erase(role);
+ this->role2surface.erase(role);
ret = true;
}
return ret;
@@ -140,11 +140,11 @@ bool WMClient::removeRole(const string &role)
bool WMClient::subscribe(afb_req req, const string &evname)
{
- if(evname != key_err){
+ if(evname != kKeyError){
HMI_DEBUG("wm", "error is only enabeled for now");
return false;
}
- int ret = afb_req_subscribe(req, event_list[evname]);
+ int ret = afb_req_subscribe(req, this->event2list[evname]);
if (ret)
{
HMI_DEBUG("wm", "Failed to subscribe %s", evname.c_str());
@@ -155,16 +155,16 @@ bool WMClient::subscribe(afb_req req, const string &evname)
void WMClient::emitError(WM_CLIENT_ERROR_EVENT ev)
{
- if (!afb_event_is_valid(this->event_list[key_err])){
+ if (!afb_event_is_valid(this->event2list[kKeyError])){
HMI_ERROR("wm", "event err is not valid");
return;
}
json_object *j = json_object_new_object();
- json_object_object_add(j, key_err, json_object_new_int(ev));
- json_object_object_add(j, key_err_desc, json_object_new_string(error_description[ev].c_str()));
- HMI_DEBUG("wm", "error: %d, description:%s", ev, error_description[ev].c_str());
+ json_object_object_add(j, kKeyError, json_object_new_int(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->event_list[key_err], j);
+ int ret = afb_event_push(this->event2list[kKeyError], j);
if (ret != 0)
{
HMI_DEBUG("wm", "afb_event_push failed: %m");
@@ -175,7 +175,7 @@ void WMClient::dumpInfo()
{
DUMP("APPID : %s", id.c_str());
DUMP(" LAYER : %d", layer);
- for (const auto &x : role2surface)
+ for (const auto &x : this->role2surface)
{
DUMP(" ROLE : %s , SURFACE : %d", x.first.c_str(), x.second);
}
diff --git a/src/wm-client.hpp b/src/wm-client.hpp
index 4bfb60b..459822d 100644
--- a/src/wm-client.hpp
+++ b/src/wm-client.hpp
@@ -62,9 +62,9 @@ class WMClient
std::unordered_map<std::string, unsigned> role2surface;
#if GTEST_ENABLED
// This is for unit test. afb_make_event occurs sig11 if call not in afb-binding
- std::unordered_map<std::string, std::string> event_list;
+ std::unordered_map<std::string, std::string> event2list;
#else
- std::unordered_map<std::string, struct afb_event> event_list;
+ std::unordered_map<std::string, struct afb_event> event2list;
#endif
};
} // namespace wm
diff --git a/src/wm-error.cpp b/src/wm-error.cpp
index 9f63065..0ced0d7 100644
--- a/src/wm-error.cpp
+++ b/src/wm-error.cpp
@@ -30,6 +30,8 @@ static const char *errorDescription(WMError enum_error_number)
return "Request is dropped, because the high priority request is done";
case TIMEOUT_EXPIRED:
return "Request is dropped, due to time out expiring";
+ case NO_ENTRY:
+ return "No element";
default:
return "Unknown error number. Window manager bug.";
}
diff --git a/src/wm-error.h b/src/wm-error.h
index 9a06aa7..3413c72 100644
--- a/src/wm-error.h
+++ b/src/wm-error.h
@@ -26,6 +26,7 @@ typedef enum WINDOWMANAGER_ERROR
REQ_REJECTED,
REQ_DROPPED,
TIMEOUT_EXPIRED,
+ NO_ENTRY,
UNKNOWN,
ERR_MAX = UNKNOWN
} WMError;