}
}
-void App::removeClient(const std::string &appid){
+void App::removeClient(const std::string &appid)
+{
HMI_DEBUG("wm", "Remove clinet %s from list", appid.c_str());
app_list.removeClient(appid);
}
+bool App::subscribeEventForApp(const std::string &appid, afb_req req, const std::string &evname)
+{
+ if(!app_list.contains(appid)){
+ HMI_DEBUG("wm", "Client %s is not registered", appid.c_str());
+ return false;
+ }
+ auto client = app_list.lookUpClient(appid);
+ return client->subscribe(req, evname);
+}
+
/**
* App Impl
*/
this->display->flush();
}
-void App::set_timer(){
+void App::set_timer()
+{
HMI_SEQ_DEBUG(app_list.currentSequenceNumber(), "Timer set activate");
if (timer_ev_src == nullptr)
{
}
}
-void App::stop_timer(){
+void App::stop_timer()
+{
unsigned seq = app_list.currentSequenceNumber();
HMI_SEQ_DEBUG(seq, "Timer stop");
int rc = sd_event_source_set_enabled(timer_ev_src, SD_EVENT_OFF);
- if(rc < 0){
+ if (rc < 0)
+ {
HMI_SEQ_ERROR(seq, "Timer stop failed");
}
}
bool ret = app_list.setAction(req_num, trigger.appid, trigger.role, trigger.area, is_activate);
app_list.req_dump();
- if(!ret){
+ if (!ret)
+ {
HMI_SEQ_ERROR(req_num, "Failed to set action");
return ret;
}
/*
do_task(y);
*/
- /* TODO
+ /* TODO
but current we can't do do_task,
so divide the processing into lm_layout_change and lm_release
*/
{
sync_draw_happen = true;
ret = lm_layout_change(y);
- if(!ret){
+ if (!ret)
+ {
HMI_SEQ_ERROR(req_num, "Failed layout change: %s", y.appid.c_str());
app_list.removeRequest(req_num);
break;
}
/* app_list.lookUpClient(y.appid)->emit_syncdraw(y.role, y.area); */
}
- else{
+ else
+ {
ret = lm_release(y);
if (!ret)
{
}
}
- if(!ret){
+ if (!ret)
+ {
//this->emit_error(request_seq, 0 /*error_num*/, "error happens"); // test
}
- else if (ret && sync_draw_happen){
+ else if (ret && sync_draw_happen)
+ {
this->set_timer();
}
- else{
+ else
+ {
app_list.removeRequest(req_num); // HACK!!!
}
return ret;
}
-void App::lm_layout_change(const char* drawing_name)
+void App::lm_layout_change(const char *drawing_name)
{
auto const &surface_id = this->lookup_id(drawing_name);
auto layer_id = this->layers.get_layer_id(*surface_id);
}
}
-const char* App::check_surface_exist(const char* drawing_name)
+const char *App::check_surface_exist(const char *drawing_name)
{
auto const &surface_id = this->lookup_id(drawing_name);
if (!surface_id)
std::string role = drawing_name;
std::string area = drawing_area;
- if(!app_list.contains(id)){
+ if (!app_list.contains(id))
+ {
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
*/
*/
bool ret = this->do_transition(new_req);
- if(!ret){
+ if (!ret)
+ {
HMI_SEQ_ERROR(new_req, "failed to do_transition");
//this->emit_error()
}
*/
std::string id = appid;
std::string role = drawing_name;
- std::string area = ""; //drawing_area;
+ std::string area = ""; //drawing_area;
- if(!app_list.contains(id)){
+ if (!app_list.contains(id))
+ {
reply("app doesn't request 'requestSurface' yet");
return;
}
}
}
-void App::lm_enddraw(const char* drawing_name){
+void App::lm_enddraw(const char *drawing_name)
+{
HMI_DEBUG("wm", "end draw %s", drawing_name);
for (unsigned i = 0, iend = this->pending_end_draw.size(); i < iend; i++)
{
auto actions = app_list.getActions(request_seq);
HMI_SEQ_INFO(request_seq, "do endDraw");
- for(const auto& act : actions){
+ for (const auto &act : actions)
+ {
HMI_SEQ_DEBUG(request_seq, "visible %s", act.role.c_str());
this->lm_enddraw(act.role.c_str());
}
HMI_SEQ_INFO(request_seq, "emit flushDraw");
-/* do
+ /* do
{
// emit flush Draw
//emitFlushDrawToAll(&app_list, request_seq);
this->lookup_name(surface_id).value_or("unknown-name").c_str());
}*/
- // search pid from surfaceID
+ // search pid from surfaceID
- // pick up appid from pid from application manager
+ // pick up appid from pid from application manager
- // check appid then add it to the client
+ // check appid then add it to the client
}
void App::surface_removed(uint32_t surface_id)