+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_.isChangedParkingBrakeState()) {
+ // If parking brake state is changed
+ HMI_DEBUG("wm", "Parking Brake state is changed");
+
+ // Get parking brake state
+ const char* parking_brake_state = g_afb_instance->lcc_.getCurrentParkingBrakeState();
+
+ // Allocate window resource
+ g_afb_instance->app.allocateWindowResource(parking_brake_state, nullptr,
+ nullptr, nullptr,
+ [](const char* errmsg){
+ if (errmsg != nullptr) {
+ HMI_ERROR("wm", errmsg);
+ }
+ });
+ }
+ if (g_afb_instance->lcc_.isChangedAccelPedalState()) {
+ // If accelerator pedal state is changed
+ HMI_DEBUG("wm", "Accelerator Pedal state is changed");
+
+ // Get parking brake state
+ const char* accel_pedal_state = g_afb_instance->lcc_.getCurrentAccelPedalState();
+
+#if 0 // TODO: PolicyManager can not use accelerator pedal state
+ // Allocate window resource
+ g_afb_instance->app.allocateWindowResource(accel_pedal_state, nullptr,
+ nullptr, nullptr,
+ [](const char* errmsg){
+ if (errmsg != nullptr) {
+ HMI_ERROR("wm", errmsg);
+ }
+ });
+#endif
+ }
+ else 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);
+ }
+ });
+ }
+ }
+}
+