// TODO: application requests by old role,
// so convert role old to new
const char *role = this->convertRoleOldToNew(drawing_name);
- string str = role;
+ string s_role = role;
+ string s_appid = appid;
string l_name;
- // auto lid = this->layers.get_layer_id(string(role));
- unsigned lid = this->lc->getNewLayerID(str, &l_name);
- unsigned sid = std::stol(ivi_id);
-
- if (lid == 0)
+ if(!g_app_list.contains(s_appid))
{
- //register drawing_name as fallback and make it displayed.
- lid = this->lc->getNewLayerID(str, &l_name);
- HMI_DEBUG("%s is not registered in layers.json, then fallback as normal app", role);
- if (lid == 0)
+ // auto lid = this->layers.get_layer_id(string(role));
+ unsigned l_id = this->lc->getNewLayerID(s_role, &l_name);
+ if (l_id == 0)
{
- return "Drawing name does not match any role, fallback is disabled";
+ /**
+ * register drawing_name as fallback and make it displayed.
+ */
+ l_id = this->lc->getNewLayerID("fallback", &l_name);
+ HMI_DEBUG("%s is not registered in layers.json, then fallback as normal app", role);
+ if (l_id == 0)
+ {
+ return "Designated role does not match any role, fallback is disabled";
+ }
}
+ this->lc->createNewLayer(l_id);
+ // add client into the db
+ g_app_list.addClient(s_appid, l_id, s_role);
}
- this->lc->createNewLayer(lid);
-
- auto rname = this->id_alloc.lookup(str);
+ unsigned sid = std::stol(ivi_id);
+ auto rname = this->id_alloc.lookup(s_role);
if (rname)
{
return "Surface already present";
}
+ if(this->tmp_surface2app.count(sid) != 0)
+ {
+ this->tmp_surface2app.erase(sid);
+ }
+
// register pair drawing_name and ivi_id
this->id_alloc.register_name_id(role, sid);
// this->layout_commit();
// add client into the db
- string appid_str(appid);
- g_app_list.addClient(appid_str, lid, string(role));
+ // g_app_list.addClient(appid_str, lid, s_role);
+ auto client = g_app_list.lookUpClient(s_appid);
+ client->addSurface(sid);
// Set role map of (new, old)
this->rolenew2old[role] = string(drawing_name);
else
{
HMI_NOTICE("Unknown surface %d", surface_id);
+ this->tmp_surface2app[surface_id] = ""; /* Store for requestSurfaceXDG */
}
}