#include <iostream>
#include <algorithm>
#include "applist.hpp"
-#include "../include/hmi-debug.h"
+#include "util.hpp"
using std::shared_ptr;
using std::string;
this->clientDump();
}
+void AppList::addClient(const string &appid, unsigned layer, const string& layer_name, unsigned surface, 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);
+ this->app2client[appid] = client;
+ this->clientDump();
+}
+
/**
* Remove WMClient from the list
*
{
std::lock_guard<std::mutex> lock(this->mtx);
this->app2client.erase(appid);
- HMI_INFO("wm", "Remove client %s", appid.c_str());
+ HMI_INFO("Remove client %s", appid.c_str());
}
/**
{
ret = x.second->removeSurfaceIfExist(surface);
if(ret){
- HMI_DEBUG("wm", "remove surface %d from Client %s finish",
+ HMI_DEBUG("remove surface %d from Client %s finish",
surface, x.second->appID().c_str());
break;
}
});
if (fwd_itr != this->floating_surfaces.cend())
{
- HMI_INFO("wm", "pop floating surface: %d", *surface);
+ HMI_INFO("pop floating surface: %d", *surface);
}
this->floating_surfaces.erase(fwd_itr, this->floating_surfaces.end());
return ret;
WMError AppList::popFloatingSurface(const string &appid, unsigned *surface)
{
- HMI_ERROR("wm", "This function is not implemented");
+ HMI_ERROR("This function is not implemented");
return WMError::SUCCESS;
}
return x.surface_id == surface;
});
if(fwd_itr != this->floating_surfaces.cend()){
- HMI_INFO("wm", "remove floating surface: %d", surface);
+ HMI_INFO("remove floating surface: %d", surface);
}
this->floating_surfaces.erase(fwd_itr, this->floating_surfaces.end());
}
-WMError AppList::appendRole(const string &id, const string &role, unsigned surface)
+WMError AppList::appendRole(const string &id, const string &role)
{
WMError wm_err = WMError::NO_ENTRY;
- HMI_ERROR("wm", "This function is disabled");
- /* if (this->contains(id))
+ if (this->contains(id))
{
auto x = this->lookUpClient(id);
- x->addSurface(role, surface);
+ x->appendRole(role);
wm_err = WMError::SUCCESS;
- } */
+ }
return wm_err;
}