this->clientDump();
}
-void AppList::addClient(const string &appid, unsigned layer, const string& layer_name, unsigned surface, const string &role)
+void AppList::addClient(const string &appid, unsigned layer, const string &role)
{
std::lock_guard<std::mutex> lock(this->mtx);
- shared_ptr<WMClient> client = std::make_shared<WMClient>(appid, layer, layer_name, surface, role);
+ shared_ptr<WMClient> client = std::make_shared<WMClient>(appid, layer, role);
this->app2client[appid] = client;
this->clientDump();
}
*/
void addClient(const std::string &appid, unsigned layer,
unsigned surface, const std::string &role);
- void addClient(const std::string &appid, unsigned layer,
- const std::string& layer_name, unsigned surface, const std::string &role);
+ void addClient(const std::string &appid, unsigned layer, const std::string &role);
void removeClient(const std::string &appid);
bool contains(const std::string &appid) const;
int countClient() const;
// so convert role old to new
const char *role = this->convertRoleOldToNew(drawing_name);
string l_name;
+ string s_appid = appid;
+ string s_role = drawing_name;
- // auto lid = this->layers.get_layer_id(string(role));
- unsigned l_id = this->lc->getNewLayerID(role, &l_name);
- if (l_id == 0)
+ if(!g_app_list.contains(s_appid))
{
- /**
- * register drawing_name as fallback and make it displayed.
- */
- // lid = this->layers.get_layer_id(string("fallback"));
- l_id = this->lc->getNewLayerID("fallback", &l_name);
- HMI_DEBUG("%s is not registered in layers.json, then fallback as normal app", role);
+ // auto lid = this->layers.get_layer_id(string(role));
+ unsigned l_id = this->lc->getNewLayerID(s_role, &l_name);
if (l_id == 0)
{
- return Err<int>("Designated role does not match any role, fallback is disabled");
+ /**
+ * register drawing_name as fallback and make it displayed.
+ */
+ // lid = this->layers.get_layer_id(string("fallback"));
+ 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 Err<int>("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(l_id);
-
// generate surface ID for ivi-shell application
auto rname = this->id_alloc.lookup(string(role));
// HMI_DEBUG("Set main_surface id to %u", id);
// }
- // add client into the db
- string appid_str(appid);
- g_app_list.addClient(appid_str, l_id, l_name, id, string(role));
+
/* if(g_app_list.contains(appid_str))
{
// add client into the db
string appid_str(appid);
- g_app_list.addClient(appid_str, lid, l_name, sid, string(role));
+ g_app_list.addClient(appid_str, lid, string(role));
// Set role map of (new, old)
this->rolenew2old[role] = string(drawing_name);
else{
HMI_INFO("Create new client: %s, surface: %d into layer: %d with role: %s",
id.c_str(), surface, lid, role.c_str());
- g_app_list.addClient(id, lid, l_name, surface, role);
+ g_app_list.addClient(id, lid, role);
}
// register pair drawing_name and ivi_id
}
}
-WMClient::WMClient(const string &appid, unsigned layer,
- const string& layer_name, unsigned surface, const string &role)
- : id(appid), layer(layer), wm_layer_name(layer_name),
- role2surface(0)
+WMClient::WMClient(const string &appid, unsigned layer, const string &role)
+ : id(appid),
+ layer(layer),
+ main_role(role),
+ role2surface(0),
+ evname2afb_event(0)
{
- role2surface[role] = surface;
+ role2surface[role] = INVALID_SURFACE_ID;
for (auto x : kWMEvents)
{
#if GTEST_ENABLED
return this->surface;
}
-const string& WMClient::getWMLayerName()
-{
- return this->wm_layer_name;
-}
-
void WMClient::setRole(const string& role)
{
this->role_list.clear();
WMClient(const std::string &appid, unsigned layer,
unsigned surface, const std::string &role);
WMClient(const std::string &appid, const std::string &role);
+ WMClient(const std::string &appid, unsigned layer, const std::string &role);
WMClient(const std::string &appid, unsigned layer,
const std::string& layer_name, unsigned surface, const std::string &role);
~WMClient() = default;
std::string appID() const;
unsigned surfaceID(const std::string &role) const;
unsigned layerID() const;
- const std::string& getWMLayerName();
unsigned surfaceID() const;
std::vector<unsigned> renderOrder() const;
std::string role(unsigned surface) const;
private:
std::string id;
unsigned layer;
- std::string wm_layer_name;
std::string main_role;
std::string area;
unsigned surface; // currently, main application has only one surface.