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())
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
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)
{
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;
}
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)
{
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,
/*
* 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());
/*
* 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());
}
}
-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);
}
{
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)
{
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())
{
}
else
{
- HMI_SEQ_INFO(current_seq, "Wait other App call endDraw");
+ HMI_SEQ_INFO(current_req, "Wait other App call endDraw");
return;
}
}
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;
{
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()
{
for (auto &x : this->req_list)
{
- if (req_num == x.seq_num)
+ if (req_num == x.req_num)
{
return x.trigger;
}
{
for (auto &x : this->req_list)
{
- if (req_num == x.seq_num)
+ if (req_num == x.req_num)
{
return x.sync_draw_req;
}
bool result = false;
for (auto &x : this->req_list)
{
- if (req_num != x.seq_num)
+ if (req_num != x.req_num)
{
continue;
}
bool result = false;
for (auto &x : req_list)
{
- if (req_num != x.seq_num)
+ if (req_num != x.req_num)
{
continue;
}
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)
{
/**
* @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)
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)
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;
}));
}
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(),