aboutsummaryrefslogtreecommitdiffstats
path: root/src/app.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/app.cpp')
-rw-r--r--src/app.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/app.cpp b/src/app.cpp
index 7191727..1d6b504 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -382,11 +382,15 @@ void App::allocateWindowResource(char const *event, char const *drawing_name,
// Update state and emit event
if ("parking_brake_off" == parking_brake_state) {
this->crr_car_info_.parking_brake_stt = false;
+#if 0 // FOR ALS: using lightstatus brake, so do not emit parking brake event
this->emitParkingBrakeOff();
+#endif
}
else if ("parking_brake_on" == parking_brake_state) {
this->crr_car_info_.parking_brake_stt = true;
+#if 0 // FOR ALS: using lightstatus brake, so do not emit parking brake event
this->emitParkingBrakeOn();
+#endif
}
else {
reply("Unknown parking brake state");
@@ -419,6 +423,33 @@ void App::allocateWindowResource(char const *event, char const *drawing_name,
}
}
+ // Check lightstatus brake state
+ json_object* json_lightstatus_brake;
+ if (!json_object_object_get_ex(json_out, "lightstatus_brake", &json_lightstatus_brake)) {
+ reply("Not found key \"lightstatus_brake\"");
+ return;
+ }
+
+ is_changed = jh::getBoolFromJson(json_lightstatus_brake, "is_changed");
+ if (is_changed) {
+ std::string lightstatus_brake_state = jh::getStringFromJson(json_lightstatus_brake, "state");
+ HMI_DEBUG("wm", "lightstatus_brake_state: %s", lightstatus_brake_state.c_str());
+
+ // Update state and emit event
+ if ("lightstatus_brake_off" == lightstatus_brake_state) {
+ this->crr_car_info_.lightstatus_brake_stt = false;
+ this->emitLightstatusBrakeOff();
+ }
+ else if ("lightstatus_brake_on" == lightstatus_brake_state) {
+ this->crr_car_info_.lightstatus_brake_stt = true;
+ this->emitLightstatusBrakeOn();
+ }
+ else {
+ reply("Unknown lightstatus brake state");
+ return;
+ }
+ }
+
// Check car state
json_object* json_car;
if (!json_object_object_get_ex(json_out, "car", &json_car)) {
@@ -666,6 +697,16 @@ void App::emitParkingBrakeOn() {
this->send_event(kListEventName[Event_ParkingBrakeOn]);
}
+void App::emitLightstatusBrakeOff() {
+ // Send LightstatusBrakeOff event for all application
+ this->send_event(kListEventName[Event_LightstatusBrakeOff]);
+}
+
+void App::emitLightstatusBrakeOn() {
+ // Send LightstatusBrakeOn event for all application
+ this->send_event(kListEventName[Event_LightstatusBrakeOn]);
+}
+
void App::emitCarStop() {
// Send CarStop event for all application
this->send_event(kListEventName[Event_CarStop]);