summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libhomescreen.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/libhomescreen.cpp b/src/libhomescreen.cpp
index cfd382d..c3e76ba 100644
--- a/src/libhomescreen.cpp
+++ b/src/libhomescreen.cpp
@@ -471,27 +471,29 @@ void LibHomeScreen::on_event(void *closure, const char *event, struct afb_wsj1_m
onEvent(ev, ev_contents);
}
- const char* event_only = strchr(event, '/');
- if (event_only != nullptr) {
- event_only = event_only + 1;
- }else{
- HMI_WARNING("libhomescreen","event_only is null.");
+ const char* event_type = nullptr;
+ struct json_object *json_event_type;
+ if(json_object_object_get_ex(json_data, "type", &json_event_type)) {
+ event_type = json_object_get_string(json_event_type);
+ }
+ else {
+ HMI_WARNING("libhomescreen","event_type is null.");
return;
}
- if (strcasecmp(event_only, LibHomeScreen::event_list[0].c_str()) == 0) {
+ if (strcasecmp(event_type, LibHomeScreen::event_list[0].c_str()) == 0) {
auto i = this->handlers.find(Event_TapShortcut);
if ( i != this->handlers.end() ) {
i->second(json_data);
}
}
- else if (strcasecmp(event_only, LibHomeScreen::event_list[1].c_str()) == 0) {
+ else if (strcasecmp(event_type, LibHomeScreen::event_list[1].c_str()) == 0) {
auto i = this->handlers.find(Event_OnScreenMessage);
if ( i != this->handlers.end() ) {
i->second(json_data);
}
}
- else if (strcasecmp(event_only, LibHomeScreen::event_list[2].c_str()) == 0) {
+ else if (strcasecmp(event_type, LibHomeScreen::event_list[2].c_str()) == 0) {
auto i = this->handlers.find(Event_OnScreenReply);
if ( i != this->handlers.end() ) {
i->second(json_data);