diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app.cpp | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/src/app.cpp b/src/app.cpp index 9e27ea8..c09081e 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -700,7 +700,8 @@ void App::api_activate_surface(char const *appid, char const *drawing_name, char bool ret = this->do_allocate_window_resource(new_req); // layer manager task - const char* msg = this->check_surface_exist(new_req, drawing_name); // this function will be integrated in do_allocate_window_resource() + // this function will be integrated in do_allocate_window_resource() + const char* msg = this->check_surface_exist(new_req, drawing_name); if(msg){ HMI_SEQ_DEBUG(new_req,"surface doesn't exist"); @@ -708,7 +709,8 @@ void App::api_activate_surface(char const *appid, char const *drawing_name, char app_list.removeRequest(new_req); return; } - this->lm_layout_change(new_req, drawing_name); // this function will be integrated in do_allocate_window_resource() + // this function will be integrated in do_allocate_window_resource() + this->lm_layout_change(new_req, drawing_name); reply(nullptr); } @@ -716,9 +718,13 @@ void App::api_activate_surface(char const *appid, char const *drawing_name, char void App::api_deactivate_surface(char const *appid, char const *drawing_name, const reply_func &reply) { ST(); - auto const &surface_id = this->lookup_id(drawing_name); + /* + * Check Phase + */ std::string id = appid; + std::string role = drawing_name; + std::string area = ""; //drawing_area; if(!app_list.contains(id)){ reply("app doesn't request 'requestSurface' yet"); @@ -726,6 +732,38 @@ void App::api_deactivate_surface(char const *appid, char const *drawing_name, co } auto client = app_list.lookUpClient(id); + /* + * Queueing Phase + */ + unsigned current = app_list.currentSequenceNumber(); + unsigned requested_num = app_list.getSequenceNumber(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()); + reply("already requested"); + return; + } + + WMRequest req = WMRequest(id, role, area, Task::TASK_RELEASE); + unsigned new_req = app_list.addAllocateRequest(req); + app_list.req_dump(); + + HMI_SEQ_DEBUG(current, "%s start sequence with %s, %s", id.c_str(), role.c_str(), area.c_str()); + + if (new_req != current) + { + // Add request, then invoked after the previous task is finished + HMI_SEQ_DEBUG(new_req, "request is accepted"); + reply(nullptr); + return; + } + + /* + * Do allocate tasks + */ + //bool ret = this->do_allocate_window_resource(new_req); + + auto const &surface_id = this->lookup_id(drawing_name); if (!surface_id) { reply("Surface does not exist"); |