using std::shared_ptr;
using std::string;
using std::unique_ptr;
+using std::vector;
namespace wm {
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();
}
void AppList::removeClient(const string &appid){
unsigned AppList::addAllocateRequest(WMRequest req){
if(req_list.size() == 0){
- req.seq_num = 1;
+ req.seq_num = current_seq;
}
else{
+ HMI_SEQ_DEBUG(current_seq, "real: %d", req_list.back().seq_num + 1);
req.seq_num = req_list.back().seq_num + 1;
}
req_list.push_back(req);
- return req.seq_num;
+ return req.seq_num; // return 1; if you test time_expire
}
bool AppList::requestFinished(){
return req_list.empty();
}
-bool AppList::setAction(unsigned request_seq, const string &appid, const string &role, const string &area){
+struct WMTrigger AppList::getRequest(unsigned req_num){
+ for(auto& x : req_list){
+ if (req_num == x.seq_num)
+ {
+ return x.trigger;
+ }
+ }
+}
+
+const vector<struct WMAction>& AppList::getActions(unsigned req_num){
+ for (auto &x : req_list)
+ {
+ if (req_num == x.seq_num)
+ {
+ return x.sync_draw_req;
+ }
+ }
+}
+
+bool AppList::setAction(unsigned req_num, const struct WMAction &action){
+ bool result = false;
+ for (auto &x : req_list)
+ {
+ if (req_num != x.seq_num)
+ {
+ continue;
+ }
+ x.sync_draw_req.push_back(action);
+ result = true;
+ break;
+ }
+
+ return result;
+}
+
+bool AppList::setAction(unsigned req_num, const string &appid, const string &role, const string &area, bool visible){
bool result = false;
for (auto& x : req_list)
{
- if (request_seq != x.seq_num)
+ if (req_num != x.seq_num)
{
continue;
}
- WMAction action{appid, role, area, false};
+ WMAction action{appid, role, area, visible, false};
x.sync_draw_req.push_back(action);
result = true;
return result;
}
-bool AppList::setEndDrawFinished(unsigned request_seq, const string &appid, const string &role){
+bool AppList::setEndDrawFinished(unsigned req_num, const string &appid, const string &role){
bool result = false;
for (auto& x : req_list)
{
- if (request_seq < x.seq_num)
+ if (req_num < x.seq_num)
{
break;
}
- if (request_seq == x.seq_num)
+ if (req_num == x.seq_num)
{
for(auto& y : x.sync_draw_req){
if (y.appid == appid && y.role == role)
* @param unsigned sequence_num
* @return true if all action is set.
*/
-bool AppList::endDrawFullfilled(unsigned request_seq){
+bool AppList::endDrawFullfilled(unsigned req_num){
bool result = false;
for (const auto& x : req_list)
{
- if(request_seq < x.seq_num){
+ if(req_num < x.seq_num){
break;
}
- if(request_seq == x.seq_num){
+ if(req_num == x.seq_num){
result = true;
for(const auto& y : x.sync_draw_req){
result &= y.end_draw_finished;
void AppList::req_dump()
{
DUMP("======= req dump =====");
- DUMP("current sequence: %d", current_seq);
+ DUMP("current request : %d", current_seq);
for(const auto& x : req_list){
- DUMP("sequence number: %d", x.seq_num);
+ DUMP("requested with : %d", x.seq_num);
DUMP("Trigger : (APPID :%s, ROLE :%s, AREA :%s, TASK: %d)",
x.trigger.appid.c_str(),
x.trigger.role.c_str(),
for (const auto& y : x.sync_draw_req){
DUMP(
- "Action : (APPID :%s, ROLE :%s, AREA :%s, END_RAW_FINISHED: %d)",
+ "Action : (APPID :%s, ROLE :%s, AREA :%s, END_DRAW_FINISHED: %d)",
y.appid.c_str(),
y.role.c_str(),
y.area.c_str(),