aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-05-29 15:36:29 +0900
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-05-29 15:36:29 +0900
commit943beb60bcfb31c7bceeb90836ab3bea3aaa135a (patch)
treeed4170592de17c5e5601ac95844424396d962fbb /src
parent110754381795eec069eafc36db8617b0017e2f1e (diff)
move layout manager task in do_allocate_resource
Change-Id: I007f5150326a3e0a39afaf2d9c919c235b4aa9a8 Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
Diffstat (limited to 'src')
-rw-r--r--src/app.cpp65
1 files changed, 37 insertions, 28 deletions
diff --git a/src/app.cpp b/src/app.cpp
index c09081e..7f20825 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -434,33 +434,52 @@ void App::stop_timer(){
}
}
-bool App::do_allocate_window_resource(unsigned request_seq)
+bool App::do_allocate_window_resource(unsigned req_num)
{
/*
* Check Policy
*/
// get current trigger
- auto trigger = app_list.getRequest(request_seq);
+ auto trigger = app_list.getRequest(req_num);
+
+ /* get new status from Policy Manager
+
+ (json_object*?) newLayout = checkPolicy(trigger);
+ (vector<struct WMAction>&) auto actions = translator.inputActionFromLayout(newLayout, currentLayout)
+ for(const auto& x : actions){
+ app_list.setAciton(req_num, x)
+ }
+
+ or
+
+ translator.inputActionFromLayout(newLayout, currentLayout, &app_list, req_num);
- // json_object* newState = checkPolicy(role);
/* The following error check is not necessary because main.cpp will reject the message form not registered object
- if(client != nullptr){
- reply("client is not registered");
- return;
} */
- HMI_SEQ_NOTICE(request_seq, "ATM, Policy manager does't exist, then set WMAction as is");
+ HMI_SEQ_NOTICE(req_num, "ATM, Policy manager does't exist, then set WMAction as is");
- bool ret = app_list.setAction(request_seq, trigger.appid, trigger.role, trigger.area);
+ bool ret = app_list.setAction(req_num, trigger.appid, trigger.role, trigger.area);
app_list.req_dump();
- // TODO: Tasks will be changed according to policy manager result
- // do task(onTransition (activate))
- // lm_.updateLayout(jobj);
- // TODO: emit syncDraw with application
+ /*
+ lm_.updateLayout(jobj);
+ TODO: emit syncDraw with application
+
+ client->emit_syncdraw(role); */
- //client->emit_syncdraw(role);
- if (ret) {
+ // layer manager task
+ const char *msg = this->check_surface_exist(req_num, trigger.appid.c_str());
+
+ if (msg)
+ {
+ HMI_SEQ_DEBUG(req_num, msg);
+ app_list.removeRequest(req_num);
+ return false;
+ }
+ this->lm_layout_change(req_num, trigger.appid.c_str());
+
+ if (ret && (msg == nullptr)) {
this->set_timer();
} else {
//this->emit_error(request_seq, 0 /*error_num*/, "error happens"); // test
@@ -686,11 +705,11 @@ void App::api_activate_surface(char const *appid, char const *drawing_name, char
HMI_SEQ_DEBUG(current, "%s start sequence with %s, %s", id.c_str(), role.c_str(), area.c_str());
+ reply(nullptr);
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;
}
@@ -699,20 +718,10 @@ 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
- // 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");
- reply(msg);
- app_list.removeRequest(new_req);
- return;
+ if(!ret){
+ HMI_SEQ_ERROR(new_req, "failed to do_allocate_window_resource");
+ //this->emit_error()
}
- // this function will be integrated in do_allocate_window_resource()
- this->lm_layout_change(new_req, drawing_name);
-
- reply(nullptr);
}
void App::api_deactivate_surface(char const *appid, char const *drawing_name, const reply_func &reply)