aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-06-08 00:23:01 +0900
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-06-08 00:38:15 +0900
commit9cfdd8937209e3e47b551e7a188add100cbae2e7 (patch)
tree037f80b8785cb9a62bf6e55e62ffe21c391b2285
parent46d1ad85e8a4531dcb7dc9599f6c09554e2cdfbb (diff)
Change names. Not use sequence number but request number
* AppList API * Member variable(Not use sequence) Change-Id: Ie0d3d0394c5e050e894b11a91aab97f5bac73f00 Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
-rw-r--r--src/app.cpp60
-rw-r--r--src/app.hpp4
-rw-r--r--src/applist.cpp45
-rw-r--r--src/applist.hpp4
-rw-r--r--src/request.cpp4
-rw-r--r--src/request.hpp2
6 files changed, 62 insertions, 57 deletions
diff --git a/src/app.cpp b/src/app.cpp
index e9f6d92..386524d 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -120,10 +120,10 @@ processTimerHandler(sd_event_source *s, uint64_t usec, void *userdata)
void App::timerHandler()
{
- unsigned seq = g_app_list.currentSequenceNumber();
- HMI_SEQ_DEBUG(seq, "Timer expired remove Request");
+ unsigned req_num = g_app_list.currentRequestNumber();
+ HMI_SEQ_DEBUG(req_num, "Timer expired remove Request");
g_app_list.reqDump();
- g_app_list.removeRequest(seq);
+ g_app_list.removeRequest(req_num);
g_app_list.next();
g_app_list.reqDump();
if (g_app_list.haveRequest())
@@ -423,7 +423,7 @@ void App::layout_commit()
void App::set_timer()
{
- HMI_SEQ_DEBUG(g_app_list.currentSequenceNumber(), "Timer set activate");
+ HMI_SEQ_DEBUG(g_app_list.currentRequestNumber(), "Timer set activate");
if (g_timer_ev_src == nullptr)
{
// firsttime set into sd_event
@@ -444,19 +444,19 @@ void App::set_timer()
void App::stop_timer()
{
- unsigned seq = g_app_list.currentSequenceNumber();
- HMI_SEQ_DEBUG(seq, "Timer stop");
+ unsigned req_num = g_app_list.currentRequestNumber();
+ HMI_SEQ_DEBUG(req_num, "Timer stop");
int rc = sd_event_source_set_enabled(g_timer_ev_src, SD_EVENT_OFF);
if (rc < 0)
{
- HMI_SEQ_ERROR(seq, "Timer stop failed");
+ HMI_SEQ_ERROR(req_num, "Timer stop failed");
}
}
bool App::lm_release(const struct WMAction &action)
{
//auto const &surface_id = this->lookup_id(drawing_name);
- unsigned req_num = g_app_list.currentSequenceNumber();
+ unsigned req_num = g_app_list.currentRequestNumber();
auto const &surface_id = this->lookup_id(action.role.c_str());
if (!surface_id)
{
@@ -558,7 +558,7 @@ bool App::lm_layout_change(const struct WMAction &action)
TODO: emit syncDraw with application*/
if (msg)
{
- HMI_SEQ_DEBUG(g_app_list.currentSequenceNumber(), msg);
+ HMI_SEQ_DEBUG(g_app_list.currentRequestNumber(), msg);
//g_app_list.removeRequest(req_num);
return false;
}
@@ -644,7 +644,7 @@ bool App::do_transition(unsigned req_num)
if (!ret)
{
- //this->emit_error(request_seq, 0 /*error_num*/, "error happens"); // test
+ //this->emit_error(req_num, 0 /*error_num*/, "error happens"); // test
}
else if (ret && sync_draw_happen)
{
@@ -763,8 +763,8 @@ void App::lm_layout_change(const char *drawing_name)
std::string hack_appid = "hack";
std::string hack_role = main;
std::string hack_area = str_area_main;
- g_app_list.setAction(g_app_list.currentSequenceNumber(), hack_appid, hack_role, hack_area, true);
- g_app_list.setEndDrawFinished(g_app_list.currentSequenceNumber(), hack_appid, hack_role); // This process is illegal
+ g_app_list.setAction(g_app_list.currentRequestNumber(), hack_appid, hack_role, hack_area, true);
+ g_app_list.setEndDrawFinished(g_app_list.currentRequestNumber(), hack_appid, hack_role); // This process is illegal
// >>> HACK
this->emit_syncdraw(main.c_str(), str_area_main.c_str(),
area_rect_main.x, area_rect_main.y,
@@ -869,8 +869,8 @@ void App::api_activate_surface(char const *appid, char const *drawing_name, char
/*
* Queueing Phase
*/
- unsigned current = g_app_list.currentSequenceNumber();
- unsigned requested_num = g_app_list.getSequenceNumber(id);
+ unsigned current = g_app_list.currentRequestNumber();
+ unsigned requested_num = g_app_list.getRequestNumber(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());
@@ -925,8 +925,8 @@ void App::api_deactivate_surface(char const *appid, char const *drawing_name, co
/*
* Queueing Phase
*/
- unsigned current = g_app_list.currentSequenceNumber();
- unsigned requested_num = g_app_list.getSequenceNumber(id);
+ unsigned current = g_app_list.currentRequestNumber();
+ unsigned requested_num = g_app_list.getRequestNumber(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());
@@ -999,30 +999,30 @@ void App::lm_enddraw(const char *drawing_name)
}
}
-void App::do_enddraw(unsigned request_seq)
+void App::do_enddraw(unsigned req_num)
{
// get actions
- auto actions = g_app_list.getActions(request_seq);
- HMI_SEQ_INFO(request_seq, "do endDraw");
+ auto actions = g_app_list.getActions(req_num);
+ HMI_SEQ_INFO(req_num, "do endDraw");
for (const auto &act : actions)
{
- HMI_SEQ_DEBUG(request_seq, "visible %s", act.role.c_str());
+ HMI_SEQ_DEBUG(req_num, "visible %s", act.role.c_str());
this->lm_enddraw(act.role.c_str());
}
- HMI_SEQ_INFO(request_seq, "emit flushDraw");
+ HMI_SEQ_INFO(req_num, "emit flushDraw");
/* do
{
// emit flush Draw
- //emitFlushDrawToAll(&g_app_list, request_seq);
+ //emitFlushDrawToAll(&g_app_list, req_num);
// emit status change event
} while (!g_app_list.requestFinished());*/
}
void App::process_request()
{
- unsigned req = g_app_list.currentSequenceNumber();
+ unsigned req = g_app_list.currentRequestNumber();
HMI_SEQ_DEBUG(req, "Do next request");
do_transition(req);
}
@@ -1031,8 +1031,8 @@ void App::api_enddraw(char const *appid, char const *drawing_name)
{
std::string id(appid);
std::string role(drawing_name);
- unsigned current_seq = g_app_list.currentSequenceNumber();
- bool result = g_app_list.setEndDrawFinished(current_seq, id, role);
+ unsigned current_req = g_app_list.currentRequestNumber();
+ bool result = g_app_list.setEndDrawFinished(current_req, id, role);
if (!result)
{
@@ -1040,16 +1040,16 @@ void App::api_enddraw(char const *appid, char const *drawing_name)
return;
}
- if (g_app_list.endDrawFullfilled(current_seq))
+ if (g_app_list.endDrawFullfilled(current_req))
{
// do task for endDraw
//this->stop_timer();
- this->do_enddraw(current_seq);
+ this->do_enddraw(current_req);
this->stop_timer();
- g_app_list.removeRequest(current_seq);
- HMI_SEQ_INFO(current_seq, "Finish request");
+ g_app_list.removeRequest(current_req);
+ HMI_SEQ_INFO(current_req, "Finish request");
g_app_list.next();
if (g_app_list.haveRequest())
{
@@ -1058,7 +1058,7 @@ void App::api_enddraw(char const *appid, char const *drawing_name)
}
else
{
- HMI_SEQ_INFO(current_seq, "Wait other App call endDraw");
+ HMI_SEQ_INFO(current_req, "Wait other App call endDraw");
return;
}
}
diff --git a/src/app.hpp b/src/app.hpp
index 25a72cb..2ee3560 100644
--- a/src/app.hpp
+++ b/src/app.hpp
@@ -261,9 +261,9 @@ struct App
void emit_invisible(char const *label);
void emit_visible(char const *label);
- bool do_transition(unsigned sequence_number);
+ bool do_transition(unsigned req_num);
- void do_enddraw(unsigned sequence_number);
+ void do_enddraw(unsigned req_num);
void process_request();
void set_timer();
void stop_timer();
diff --git a/src/applist.cpp b/src/applist.cpp
index 66289ea..462a0d8 100644
--- a/src/applist.cpp
+++ b/src/applist.cpp
@@ -88,20 +88,20 @@ int AppList::countClient()
return this->app2client.size();
}
-unsigned AppList::currentSequenceNumber()
+unsigned AppList::currentRequestNumber()
{
return this->current_req;
}
// Is this function necessary ?
-unsigned AppList::getSequenceNumber(const string &appid)
+unsigned AppList::getRequestNumber(const string &appid)
{
for (const auto &x : this->req_list)
{
// Since app will not request twice and more, comparing appid is enough?
if ((x.trigger.appid == appid))
{
- return x.seq_num;
+ return x.req_num;
}
}
return 0;
@@ -111,15 +111,15 @@ unsigned AppList::addAllocateRequest(WMRequest req)
{
if (this->req_list.size() == 0)
{
- req.seq_num = current_req;
+ req.req_num = current_req;
}
else
{
- 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;
+ HMI_SEQ_DEBUG(this->current_req, "add: %d", this->req_list.back().req_num + 1);
+ req.req_num = this->req_list.back().req_num + 1;
}
this->req_list.push_back(req);
- return req.seq_num; // return 1; if you test time_expire
+ return req.req_num; // return 1; if you test time_expire
}
bool AppList::requestFinished()
@@ -131,7 +131,7 @@ struct WMTrigger AppList::getRequest(unsigned req_num)
{
for (auto &x : this->req_list)
{
- if (req_num == x.seq_num)
+ if (req_num == x.req_num)
{
return x.trigger;
}
@@ -142,7 +142,7 @@ const vector<struct WMAction> &AppList::getActions(unsigned req_num)
{
for (auto &x : this->req_list)
{
- if (req_num == x.seq_num)
+ if (req_num == x.req_num)
{
return x.sync_draw_req;
}
@@ -154,7 +154,7 @@ bool AppList::setAction(unsigned req_num, const struct WMAction &action)
bool result = false;
for (auto &x : this->req_list)
{
- if (req_num != x.seq_num)
+ if (req_num != x.req_num)
{
continue;
}
@@ -178,7 +178,7 @@ bool AppList::setAction(unsigned req_num, const string &appid, const string &rol
bool result = false;
for (auto &x : req_list)
{
- if (req_num != x.seq_num)
+ if (req_num != x.req_num)
{
continue;
}
@@ -192,16 +192,21 @@ bool AppList::setAction(unsigned req_num, const string &appid, const string &rol
return result;
}
+/**
+ * This function checks
+ * * req_num is equal to current request number
+ * * appid and role are equeal to the appid and role stored in action list(sync_draw_req)
+ */
bool AppList::setEndDrawFinished(unsigned req_num, const string &appid, const string &role)
{
bool result = false;
for (auto &x : req_list)
{
- if (req_num < x.seq_num)
+ if (req_num < x.req_num)
{
break;
}
- if (req_num == x.seq_num)
+ if (req_num == x.req_num)
{
for (auto &y : x.sync_draw_req)
{
@@ -219,7 +224,7 @@ bool AppList::setEndDrawFinished(unsigned req_num, const string &appid, const st
/**
* @brief check all actions of the requested sequence is finished
- * @param unsigned sequence_num
+ * @param unsigned request_number
* @return true if all action is set.
*/
bool AppList::endDrawFullfilled(unsigned req_num)
@@ -227,11 +232,11 @@ bool AppList::endDrawFullfilled(unsigned req_num)
bool result = false;
for (const auto &x : req_list)
{
- if (req_num < x.seq_num)
+ if (req_num < x.req_num)
{
break;
}
- if (req_num == x.seq_num)
+ if (req_num == x.req_num)
{
result = true;
for (const auto &y : x.sync_draw_req)
@@ -247,11 +252,11 @@ bool AppList::endDrawFullfilled(unsigned req_num)
return result;
}
-void AppList::removeRequest(unsigned req_seq)
+void AppList::removeRequest(unsigned req_num)
{
this->req_list.erase(remove_if(this->req_list.begin(), this->req_list.end(),
- [req_seq](WMRequest x) {
- return x.seq_num == req_seq;
+ [req_num](WMRequest x) {
+ return x.req_num == req_num;
}));
}
@@ -286,7 +291,7 @@ void AppList::reqDump()
DUMP("current request : %d", current_req);
for (const auto &x : req_list)
{
- DUMP("requested with : %d", x.seq_num);
+ DUMP("requested with : %d", x.req_num);
DUMP("Trigger : (APPID :%s, ROLE :%s, AREA :%s, TASK: %d)",
x.trigger.appid.c_str(),
x.trigger.role.c_str(),
diff --git a/src/applist.hpp b/src/applist.hpp
index 320d36b..a5f64d4 100644
--- a/src/applist.hpp
+++ b/src/applist.hpp
@@ -47,8 +47,8 @@ class AppList
void removeSurface(unsigned surface);
// Request Interface
- unsigned currentSequenceNumber();
- unsigned getSequenceNumber(const std::string &appid);
+ unsigned currentRequestNumber();
+ unsigned getRequestNumber(const std::string &appid);
unsigned addAllocateRequest(WMRequest req);
/* TODO: consider, which is better WMClient or std::string appid?
if appid is key to manage resources, it is better to select std::string
diff --git a/src/request.cpp b/src/request.cpp
index 97b9f49..069f8ff 100644
--- a/src/request.cpp
+++ b/src/request.cpp
@@ -24,7 +24,7 @@ using std::string;
WMRequest::WMRequest() {}
WMRequest::WMRequest(string appid, string role, string area, Task task)
- : seq_num(0),
+ : req_num(0),
trigger{appid, role, area, task},
sync_draw_req(0)
{
@@ -36,7 +36,7 @@ WMRequest::~WMRequest()
WMRequest::WMRequest(const WMRequest &obj)
{
- this->seq_num = obj.seq_num;
+ this->req_num = obj.req_num;
this->trigger = obj.trigger;
this->sync_draw_req = obj.sync_draw_req;
}
diff --git a/src/request.hpp b/src/request.hpp
index 9a97abb..ab1ef95 100644
--- a/src/request.hpp
+++ b/src/request.hpp
@@ -54,7 +54,7 @@ struct WMRequest
virtual ~WMRequest();
WMRequest(const WMRequest &obj);
- unsigned seq_num;
+ unsigned req_num;
struct WMTrigger trigger;
std::vector<struct WMAction> sync_draw_req;
};