const char *value = afb_req_value(request, _event);
if(value) {
HMI_NOTICE("homescreen-service","subscribe event %s", value);
- event_list.insert(std::string(value));
- if(!subscription) {
- ret = afb_req_subscribe(request, my_event);
- if(ret == 0) {
- subscription = true;
+ if(!isSupportEvent(value)) {
+ HMI_NOTICE("homescreen-service","subscibe event isn't existing.");
+ ret = AFB_EVENT_BAD_REQUEST;
+ }
+ else {
+ event_list.insert(std::string(value));
+ if(!subscription) {
+ ret = afb_req_subscribe(request, my_event);
+ if(ret == 0) {
+ subscription = true;
+ }
}
}
}
return true;
}
+/**
+ * check if event is supporting
+ *
+ * #### Parameters
+ * - event: homescreen event, tap_shortcut etc.
+ *
+ * #### Return
+ * true: support
+ * false: not fosupportund
+ *
+ */
+bool HS_Client::isSupportEvent(const char* event)
+{
+ auto ip = func_list.find(std::string(event));
+ if(ip == func_list.end())
+ return false;
+ else
+ return true;
+}
+
/**
* handle homescreen event
*
{"showInformation", &HS_Client::showInformation}
};
bool checkEvent(const char* event);
+ bool isSupportEvent(const char* event);
private:
std::string my_id;