+void on_event(const char *event, struct json_object *object){
+ HMI_DEBUG("wm", "event:%s", event);
+
+ // If receive low can signal
+ if (strstr(event, "low-can")) {
+ // Analyze low can signal
+ g_afb_instance->lcc_.analyzeCanSignal(object);
+
+ if (g_afb_instance->lcc_.isChangedCarState()) {
+ // If car state is changed
+ HMI_DEBUG("wm", "Car state is changed");
+
+ // Get car state
+ const char* car_state = g_afb_instance->lcc_.getCurrentCarState();
+
+ // Allocate window resource
+ g_afb_instance->app.allocateWindowResource(car_state, nullptr,
+ nullptr, nullptr,
+ [](const char* errmsg){
+ if (errmsg != nullptr) {
+ HMI_ERROR("wm", errmsg);
+ }
+ });
+ }
+ else if (g_afb_instance->lcc_.isChangedLampState()) {
+ // If lamp state is changed
+ HMI_DEBUG("wm", "Lamp state is changed");
+
+ // Get lamp state
+ const char* lamp_state = g_afb_instance->lcc_.getCurrentLampState();
+
+ // Allocate window resource
+ g_afb_instance->app.allocateWindowResource(lamp_state, nullptr,
+ nullptr, nullptr,
+ [](const char* errmsg){
+ if (errmsg != nullptr) {
+ HMI_ERROR("wm", errmsg);
+ }
+ });
+ }
+ }
+}
+