X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fapplist.cpp;h=473d68751446bbfe1305260f0f351dae04d393d4;hb=22d63828288132cde8124cf660cab89df26bb925;hp=79df62c3b3597de2c87d1566348be5818a311c65;hpb=7526846697e4485bca995f01a130f5e34a40b690;p=apps%2Fagl-service-windowmanager.git diff --git a/src/applist.cpp b/src/applist.cpp index 79df62c..473d687 100644 --- a/src/applist.cpp +++ b/src/applist.cpp @@ -73,6 +73,35 @@ void AppList::addClient(const string &appid, unsigned layer, unsigned surface, c this->clientDump(); } +void AppList::addClient(const string &appid, unsigned layer, const string &role) +{ + std::lock_guard lock(this->mtx); + shared_ptr client = std::make_shared(appid, layer, role); + this->app2client[appid] = client; + this->clientDump(); +} + +/** + * Add Client to the list + * + * This function is overload function. + * But this function just register application. + * So an application does not have role, surface, layer. + * Client need to register role and layer afterward. + * + * @param string[in] Application id. This will be the key to withdraw the information. + * @return None + * @attention This function should be called once for the app + * Caller should take care not to be called more than once. + */ +void AppList::addClient(const string &appid) +{ + std::lock_guard lock(this->mtx); + shared_ptr client = std::make_shared(appid, 0, ""); + this->app2client[appid] = client; + this->clientDump(); +} + /** * Remove WMClient from the list * @@ -132,7 +161,14 @@ void AppList::removeSurface(unsigned surface){ */ shared_ptr AppList::lookUpClient(const string &appid) { - return this->app2client.at(appid); + if(this->app2client.count(appid) != 0) + { + return this->app2client.at(appid); + } + else + { + return nullptr; + } } /** @@ -154,17 +190,16 @@ int AppList::countClient() const * Returns AppID if found. * * @param unsigned[in] surfaceID - * @param string[in] role * @param bool[in,out] AppID is found or not * @return AppID * @attention If AppID is not found, param found will be false. */ -string AppList::getAppID(unsigned surface, const string& role, bool* found) const +string AppList::getAppID(unsigned surface, bool* found) const { *found = false; for (const auto &x : this->app2client) { - if(x.second->surfaceID(role) == surface){ + if(x.second->surfaceID() == surface){ *found = true; return x.second->appID(); } @@ -296,6 +331,10 @@ const vector &AppList::getActions(unsigned req_num, bool* found } } HMI_SEQ_ERROR(req_num, "Couldn't get action with the request : %d", req_num); + { + static vector empty; + return empty; + } } /**