diff options
author | Yuta Doi <yuta-d@witz-inc.co.jp> | 2018-05-21 19:58:50 +0900 |
---|---|---|
committer | Yuta Doi <yuta-d@witz-inc.co.jp> | 2018-05-21 19:58:50 +0900 |
commit | b4083090dc8bf7adaad23dc11d629be839c7b5cf (patch) | |
tree | b665d824226abb8a36d127a0429d20837bf186c7 /src/low_can_client.cpp | |
parent | bf19dc1568478b646959e3e0bd58c54814facfa6 (diff) |
Add lightstatus brake ON/OFF event
Change-Id: Id2c61fc6e102394f5ba08effe0cfac448b337176
Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
Diffstat (limited to 'src/low_can_client.cpp')
-rw-r--r-- | src/low_can_client.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/low_can_client.cpp b/src/low_can_client.cpp index 192e124..c02a71c 100644 --- a/src/low_can_client.cpp +++ b/src/low_can_client.cpp @@ -33,6 +33,7 @@ LowCanClient::LowCanClient() : parking_brake_status_(TRUE), accel_pedal_pos_(0), accel_pedal_stt_(FALSE), + lightstatus_brake_status_(TRUE), is_changed_accel_pedal_stt_(false) { HMI_DEBUG("wm:lcc", "Call"); @@ -56,6 +57,7 @@ void LowCanClient::initialize() { // low-can subscribe { "event": "headlamp_status" } // low-can subscribe { "event": "parking_brake_status" } // low-can subscribe { "event": "accelerator.pedal.position" } + // low-can subscribe { "event": "lightstatus.brake" } for (int i=SignalNoMin; i<=SignalNoMax; i++) { // Set Event json_object *json_obj = json_object_new_object(); @@ -87,27 +89,27 @@ const char* LowCanClient::analyzeCanSignal(struct json_object *object) { const char* name = jh::getStringFromJson(object, "name"); HMI_DEBUG("wm:lcc", "CAN signal name:%s", name); - if (strstr(name, this->kSignalName_[0])) { + if (strstr(name, this->kSignalName_[SignalNoVehicliSpeed])) { // Update vehicle speed this->vehicle_speed_ = jh::getIntFromJson(object, "value"); HMI_DEBUG("wm:lcc", "Update vehicle speed:%d", this->vehicle_speed_); } - else if (strstr(name, this->kSignalName_[1])) { + else if (strstr(name, this->kSignalName_[SignalNoTransGearPos])) { // Update transmission gear position this->trans_gear_pos_ = jh::getIntFromJson(object, "value"); HMI_DEBUG("wm:lcc", "Update transmission gear position:%d", this->trans_gear_pos_); } - else if (strstr(name, this->kSignalName_[2])) { + else if (strstr(name, this->kSignalName_[SignalNoHeadlame])) { // Update headlamp status this->headlamp_status_ = jh::getBoolFromJson(object, "value"); HMI_DEBUG("wm:lcc", "Update headlamp status:%d", this->headlamp_status_); } - else if (strstr(name, this->kSignalName_[3])) { + else if (strstr(name, this->kSignalName_[SignalNoParkingBrake])) { // Update parking gear status this->parking_brake_status_ = jh::getBoolFromJson(object, "value"); HMI_DEBUG("wm:lcc", "Update parking brake status:%d", this->parking_brake_status_); } - else if (strstr(name, this->kSignalName_[4])) { + else if (strstr(name, this->kSignalName_[SignalNoAccelPedalPos])) { // Clear flag for whether accel pedal state is changed this->is_changed_accel_pedal_stt_ = false; @@ -128,6 +130,11 @@ const char* LowCanClient::analyzeCanSignal(struct json_object *object) { this->accel_pedal_stt_ = accel_pedal_stt; } } + else if (strstr(name, this->kSignalName_[SignalNoLightstatusBrake])) { + // Update lightstatus brake status + this->lightstatus_brake_status_ = jh::getBoolFromJson(object, "value"); + HMI_DEBUG("wm:lcc", "Update lightstatus brake status:%d", this->lightstatus_brake_status_); + } return name; } @@ -168,5 +175,11 @@ bool LowCanClient::getCurrentAccelPedalState() { return this->accel_pedal_stt_; } +bool LowCanClient::getCurrentLightstatusBrakeState() { + HMI_DEBUG("wm:lcc", "Call"); + + return (bool)this->lightstatus_brake_status_; +} + } // namespace wm |