{
}
-AppList::~AppList() {}
-
void AppList::addClient(const string &appid, const string &role)
{
shared_ptr<WMClient> client = std::make_shared<WMClient>(appid, role);
this->app2client.erase(appid);
}
-bool AppList::contains(const string &appid)
+bool AppList::contains(const string &appid) const
{
auto result = this->app2client.find(appid);
return (this->app2client.end() != result) ? true : false;
return this->app2client.at(appid);
}
-int AppList::countClient()
+int AppList::countClient() const
{
return this->app2client.size();
}
-unsigned AppList::currentSequenceNumber()
+unsigned AppList::currentRequestNumber() const
{
return this->current_req;
}
-// Is this function necessary ?
-unsigned AppList::getSequenceNumber(const string &appid)
+WMError AppList::popFloatingSurface(unsigned pid, unsigned *surface)
+{
+ WMError ret = WMError::NO_ENTRY;
+
+ for (auto itr = this->floating_surfaces.begin(); itr != this->floating_surfaces.end(); ++itr)
+ {
+ if(pid == itr->pid){
+ *surface = itr->surface_id;
+ itr = this->floating_surfaces.erase(itr);
+ ret = WMError::SUCCESS;
+ HMI_DEBUG("wm", "Erase surface %d", *surface);
+ break;
+ }
+ }
+ return ret;
+}
+
+WMError AppList::popFloatingSurface(const std::string &appid, unsigned *surface)
+{
+ HMI_ERROR("wm", "This function is not implemented");
+ return WMError::SUCCESS;
+}
+
+void AppList::addFloatingClient(const std::string &appid, unsigned layer, const std::string &role)
+{
+}
+
+void AppList::addFloatingSurface(unsigned surface, unsigned pid)
+{
+ struct FloatingSurface fsurface{surface, pid};
+ this->floating_surfaces.push_back(fsurface);
+}
+
+void AppList::removeFloatingSurface(unsigned surface)
+{
+ for (auto itr = this->floating_surfaces.begin(); itr != this->floating_surfaces.end(); ++itr)
+ {
+ if (surface == itr->surface_id)
+ {
+ HMI_DEBUG("wm", "Erase surface %d", itr->surface_id);
+ itr = this->floating_surfaces.erase(itr);
+ break;
+ }
+ }
+}
+
+WMError AppList::appendRole(const std::string &id, const std::string &role, unsigned surface)
+{
+ WMError wm_err = WMError::NO_ENTRY;
+ if (this->contains(id))
+ {
+ auto x = this->lookUpClient(id);
+ x->addSurface(role, surface);
+ wm_err = WMError::SUCCESS;
+ }
+ return wm_err;
+}
+
+unsigned AppList::getRequestNumber(const string &appid) const
{
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
-}
-
-bool AppList::requestFinished()
-{
- return this->req_list.empty();
+ return req.req_num; // return 1; if you test time_expire
}
struct WMTrigger AppList::getRequest(unsigned req_num)
{
- for (auto &x : this->req_list)
+ for (const 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 AppList::setAction(unsigned req_num, const struct WMAction &action)
+WMError AppList::setAction(unsigned req_num, const struct WMAction &action)
{
- bool result = false;
+ WMError result = WMError::FAIL;
for (auto &x : this->req_list)
{
- if (req_num != x.seq_num)
+ if (req_num != x.req_num)
{
continue;
}
x.sync_draw_req.push_back(action);
- result = true;
+ result = WMError::SUCCESS;
break;
}
* otherwise (visible is false) app should be invisible. Then enddraw_finished param is set to true.
* This function doesn't support actions for focus yet.
*/
-bool AppList::setAction(unsigned req_num, const string &appid, const string &role, const string &area, bool visible)
+WMError AppList::setAction(unsigned req_num, const string &appid, const string &role, const string &area, bool visible)
{
- bool result = false;
+ WMError result = WMError::NOT_REGISTERED;
for (auto &x : req_list)
{
- if (req_num != x.seq_num)
+ if (req_num != x.req_num)
{
continue;
}
WMAction action{appid, role, area, visible, edraw_f};
x.sync_draw_req.push_back(action);
- result = true;
+ result = WMError::SUCCESS;
break;
}
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;
}));
}
}
}
-bool AppList::haveRequest()
+bool AppList::haveRequest() const
{
return !this->req_list.empty();
}
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(),