#include "hmi-debug.h"
#include "hs-clientmanager.h"
-static const char _restriction_on[] = "RestrictionOn";
-static const char _restriction_off[] = "RestrictionOff";
/* -------------------------------------HS_PeripheryManager------------------------------------------ */
HMI_ERROR("homescreen-service","restriction init failed.");
}
else {
- periphery_list[std::string("restriction")] = restriction;
+ periphery_list[restriction->getAppid()] = restriction;
}
return ret;
}
*/
void HS_Restriction::onEvent(afb_api_t api, const char *event, struct json_object *object)
{
- if(!isConcernedEvent(event))
- return;
-
- std::string ev = event;
- std::size_t pos = ev.find("/");
- if(pos != std::string::npos) {
- ev = ev.substr(pos + 1);
- }
- else {
- HMI_ERROR("homescreen-service","received event is error.");
- return;
- }
-
- if(ev == _restriction_on) {
- restrictionOn(api, object);
- }
- else if(ev == _restriction_off) {
- restrictionOff(api, object);
- }
- else {
+ auto ip = concerned_event_list.find(std::string(event));
+ if(ip != concerned_event_list.end()) {
+ HMI_NOTICE("homescreen-service","[%s] event received.", event);
+ (this->*(ip->second))(api, object);
}
}