* AppList API
* Member variable(Not use sequence)
Change-Id: Ie0d3d0394c5e050e894b11a91aab97f5bac73f00
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
void App::timerHandler()
{
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.removeRequest(seq);
+ g_app_list.removeRequest(req_num);
g_app_list.next();
g_app_list.reqDump();
if (g_app_list.haveRequest())
g_app_list.next();
g_app_list.reqDump();
if (g_app_list.haveRequest())
- 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
if (g_timer_ev_src == nullptr)
{
// firsttime set into sd_event
- 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)
{
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);
}
}
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)
{
auto const &surface_id = this->lookup_id(action.role.c_str());
if (!surface_id)
{
TODO: emit syncDraw with application*/
if (msg)
{
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;
}
//g_app_list.removeRequest(req_num);
return false;
}
- //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)
{
}
else if (ret && sync_draw_happen)
{
std::string hack_appid = "hack";
std::string hack_role = main;
std::string hack_area = str_area_main;
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,
// >>> HACK
this->emit_syncdraw(main.c_str(), str_area_main.c_str(),
area_rect_main.x, area_rect_main.y,
- 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());
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());
- 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());
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());
-void App::do_enddraw(unsigned request_seq)
+void App::do_enddraw(unsigned req_num)
- 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)
{
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());
}
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
/* 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()
{
// 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);
}
HMI_SEQ_DEBUG(req, "Do next request");
do_transition(req);
}
{
std::string id(appid);
std::string role(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 (g_app_list.endDrawFullfilled(current_seq))
+ if (g_app_list.endDrawFullfilled(current_req))
{
// do task for endDraw
//this->stop_timer();
{
// do task for endDraw
//this->stop_timer();
- this->do_enddraw(current_seq);
+ this->do_enddraw(current_req);
- 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())
{
g_app_list.next();
if (g_app_list.haveRequest())
{
- HMI_SEQ_INFO(current_seq, "Wait other App call endDraw");
+ HMI_SEQ_INFO(current_req, "Wait other App call endDraw");
void emit_invisible(char const *label);
void emit_visible(char const *label);
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();
void process_request();
void set_timer();
void stop_timer();
return this->app2client.size();
}
return this->app2client.size();
}
-unsigned AppList::currentSequenceNumber()
+unsigned AppList::currentRequestNumber()
{
return this->current_req;
}
// Is this function necessary ?
{
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))
{
{
for (const auto &x : this->req_list)
{
// Since app will not request twice and more, comparing appid is enough?
if ((x.trigger.appid == appid))
{
{
if (this->req_list.size() == 0)
{
{
if (this->req_list.size() == 0)
{
- req.seq_num = current_req;
+ req.req_num = current_req;
- 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);
}
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()
}
bool AppList::requestFinished()
{
for (auto &x : this->req_list)
{
{
for (auto &x : this->req_list)
{
- if (req_num == x.seq_num)
+ if (req_num == x.req_num)
{
for (auto &x : this->req_list)
{
{
for (auto &x : this->req_list)
{
- if (req_num == x.seq_num)
+ if (req_num == x.req_num)
{
return x.sync_draw_req;
}
{
return x.sync_draw_req;
}
bool result = false;
for (auto &x : this->req_list)
{
bool result = false;
for (auto &x : this->req_list)
{
- if (req_num != x.seq_num)
+ if (req_num != x.req_num)
bool result = false;
for (auto &x : req_list)
{
bool result = false;
for (auto &x : req_list)
{
- if (req_num != x.seq_num)
+ if (req_num != x.req_num)
+/**
+ * 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)
{
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)
- if (req_num == x.seq_num)
+ if (req_num == x.req_num)
{
for (auto &y : x.sync_draw_req)
{
{
for (auto &y : x.sync_draw_req)
{
/**
* @brief check all actions of the requested sequence is finished
/**
* @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)
* @return true if all action is set.
*/
bool AppList::endDrawFullfilled(unsigned req_num)
bool result = false;
for (const auto &x : req_list)
{
bool result = false;
for (const auto &x : req_list)
{
- if (req_num < x.seq_num)
+ if (req_num < x.req_num)
- if (req_num == x.seq_num)
+ if (req_num == x.req_num)
{
result = true;
for (const auto &y : x.sync_draw_req)
{
result = true;
for (const auto &y : x.sync_draw_req)
-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(),
{
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;
DUMP("current request : %d", current_req);
for (const auto &x : req_list)
{
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(),
DUMP("Trigger : (APPID :%s, ROLE :%s, AREA :%s, TASK: %d)",
x.trigger.appid.c_str(),
x.trigger.role.c_str(),
void removeSurface(unsigned surface);
// Request Interface
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
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
WMRequest::WMRequest() {}
WMRequest::WMRequest(string appid, string role, string area, Task task)
WMRequest::WMRequest() {}
WMRequest::WMRequest(string appid, string role, string area, Task task)
trigger{appid, role, area, task},
sync_draw_req(0)
{
trigger{appid, role, area, task},
sync_draw_req(0)
{
WMRequest::WMRequest(const WMRequest &obj)
{
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;
}
this->trigger = obj.trigger;
this->sync_draw_req = obj.sync_draw_req;
}
virtual ~WMRequest();
WMRequest(const WMRequest &obj);
virtual ~WMRequest();
WMRequest(const WMRequest &obj);
struct WMTrigger trigger;
std::vector<struct WMAction> sync_draw_req;
};
struct WMTrigger trigger;
std::vector<struct WMAction> sync_draw_req;
};