void App::timerHandler()
{
unsigned seq = app_list.currentSequenceNumber();
- HMI_SEQ_DEBUG(seq, "Timer expired remove Request");
+ HMI_SEQ_DEBUG(seq, "Timer expired, remove Request");
app_list.req_dump();
app_list.removeRequest(seq);
app_list.next();
bool App::subscribeEventForApp(const std::string &appid, afb_req req, const std::string &evname)
{
- if(!app_list.contains(appid)){
+ if(app_list.contains(appid) != WMError::SUCCESS){
HMI_DEBUG("wm", "Client %s is not registered", appid.c_str());
return false;
}
}
}
-bool App::lm_release(const struct WMAction &action)
+WMError App::lm_release(const struct WMAction &action)
{
//auto const &surface_id = this->lookup_id(drawing_name);
+ WMError ret = WMError::LAYOUT_CHANGE_FAIL;
unsigned req_num = app_list.currentSequenceNumber();
auto const &surface_id = this->lookup_id(action.role.c_str());
if (!surface_id)
{
HMI_SEQ_ERROR(req_num, "Surface does not exist");
- return false;
+ return ret;
}
if (*surface_id == this->layers.main_surface)
{
HMI_SEQ_ERROR(req_num, "Cannot deactivate main_surface");
- return false;
+ return ret;
}
auto o_state = *this->layers.get_layout_state(*surface_id);
if (o_state == nullptr)
{
HMI_SEQ_ERROR(req_num, "Could not find layer for surface");
- return false;
+ return ret;
}
struct LayoutState &state = *o_state;
if (state.main == -1)
{
HMI_SEQ_ERROR(req_num, "No surface active");
- return false;
+ return ret;
}
// Check against main_surface, main_surface_name is the configuration item.
{
HMI_SEQ_DEBUG(req_num, "Refusing to deactivate main_surface %d", *surface_id);
//reply(nullptr);
- return true;
+ return WMError::SUCCESS;
}
if ((state.main == *surface_id) && (state.sub == *surface_id))
{
HMI_SEQ_ERROR(req_num, "Surface is not active");
- return false;
+ return ret;
}
if (state.main == *surface_id)
this->enqueue_flushdraw(state.main);
});
}
- return true;
+ return WMError::SUCCESS;
}
-bool App::lm_layout_change(const struct WMAction &action)
+WMError App::lm_layout_change(const struct WMAction &action)
{
const char *msg = this->check_surface_exist(action.role.c_str());
{
HMI_SEQ_DEBUG(app_list.currentSequenceNumber(), msg);
//app_list.removeRequest(req_num);
- return false;
+ return WMError::LAYOUT_CHANGE_FAIL;
}
this->lm_layout_change(action.role.c_str());
- return true;
+ return WMError::SUCCESS;
}
-bool App::do_transition(unsigned req_num)
+WMError App::do_transition(unsigned req_num)
{
/*
* Check Policy
{
is_activate = false;
}
- bool ret = app_list.setAction(req_num, trigger.appid, trigger.role, trigger.area, is_activate);
+ WMError ret = app_list.setAction(req_num, trigger.appid, trigger.role, trigger.area, is_activate);
app_list.req_dump();
- if (!ret)
+ if (ret != WMError::SUCCESS)
{
HMI_SEQ_ERROR(req_num, "Failed to set action");
return ret;
{
sync_draw_happen = true;
ret = lm_layout_change(y);
- if (!ret)
+ if (ret != WMError::SUCCESS)
{
- HMI_SEQ_ERROR(req_num, "Failed layout change: %s", y.appid.c_str());
+ HMI_SEQ_ERROR(req_num, "%s: appid: %s, role: %s, area: %s",
+ errorDescription(ret), y.appid.c_str(), y.role.c_str(), y.area.c_str());
app_list.removeRequest(req_num);
break;
// TODO: if transition fails, what should we do?
}
}
- if (!ret)
+ if (ret != WMError::SUCCESS)
{
//this->emit_error(request_seq, 0 /*error_num*/, "error happens"); // test
}
- else if (ret && sync_draw_happen)
+ else if (sync_draw_happen)
{
this->set_timer();
}
std::string role = drawing_name;
std::string area = drawing_area;
- if (!app_list.contains(id))
+ if (app_list.contains(id) != WMError::SUCCESS)
{
reply("app doesn't request 'requestSurface' yet");
return;
auto client = app_list.lookUpClient(id);
- // test
- HMI_DEBUG("wm", "test");
- client->emitError(WM_CLIENT_ERROR_EVENT::UNKNOWN_ERROR);
-
/*
* Queueing Phase
*/
/*
* Do allocate tasks
*/
- bool ret = this->do_transition(new_req);
+ WMError ret = this->do_transition(new_req);
- if (!ret)
+ if (ret != WMError::SUCCESS)
{
- HMI_SEQ_ERROR(new_req, "failed to do_transition");
+ HMI_SEQ_ERROR(new_req, errorDescription(ret));
//this->emit_error()
}
}
std::string role = drawing_name;
std::string area = ""; //drawing_area;
- if (!app_list.contains(id))
+ if (app_list.contains(id) != WMError::SUCCESS)
{
reply("app doesn't request 'requestSurface' yet");
return;
/*
* Do allocate tasks
*/
- bool ret = this->do_transition(new_req);
+ WMError ret = this->do_transition(new_req);
- if (!ret)
+ if (ret != WMError::SUCCESS)
{
- HMI_SEQ_ERROR(new_req, "failed to do_transition");
+ HMI_SEQ_ERROR(new_req, errorDescription(ret));
//this->emit_error()
}
}
{
unsigned req = app_list.currentSequenceNumber();
HMI_SEQ_DEBUG(req, "Do next request");
- do_transition(req);
+ WMError rc = do_transition(req);
+ if(rc != WMError::SUCCESS){
+ HMI_SEQ_ERROR(req, errorDescription(rc));
+ }
}
void App::api_enddraw(char const *appid, char const *drawing_name)