diff options
Diffstat (limited to 'src/low_can_client.cpp')
-rw-r--r-- | src/low_can_client.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/low_can_client.cpp b/src/low_can_client.cpp index 025418a..e3e472f 100644 --- a/src/low_can_client.cpp +++ b/src/low_can_client.cpp @@ -140,6 +140,15 @@ void LowCanClient::analyzeCanSignal(struct json_object *object) { } } + // Update transmission gear position state + if (TransGearPosValN == this->trans_gear_pos_) { + this->crr_accel_pedal_state_ = "trans_gear_neutral"; + } + else { + this->crr_accel_pedal_state_ = "trans_gear_not_neutral"; + } + HMI_DEBUG("wm:lcc", "Current transmission gear state:%s", this->crr_trans_gear_state_.c_str()); + // Update lamp state if (true == this->headlamp_status_) { this->crr_lamp_state_ = "lamp_on"; @@ -167,6 +176,15 @@ void LowCanClient::analyzeCanSignal(struct json_object *object) { } HMI_DEBUG("wm:lcc", "Current accelerator pedal state:%s", this->crr_accel_pedal_state_.c_str()); + // If transmission gear state is changed, + // backup current state for previous state and set flag + if (this->prv_trans_gear_state_ != this->crr_trans_gear_state_) { + HMI_DEBUG("wm:lcc", "Transmission Gear is changed: %s -> %s", + this->prv_trans_gear_state_.c_str(), this->crr_trans_gear_state_.c_str()); + this->prv_trans_gear_state_ = this->crr_trans_gear_state_; + this->is_changed_trans_gear_state_ = true; + } + // If lamp state is changed, // backup current state for previous state and set flag if (this->prv_lamp_state_ != this->crr_lamp_state_) { @@ -195,6 +213,13 @@ void LowCanClient::analyzeCanSignal(struct json_object *object) { } } +bool LowCanClient::isChangedTransGearState() { + HMI_DEBUG("wm:lcc", "Call"); + + // Return changed flag + return this->is_changed_trans_gear_state_; +} + bool LowCanClient::isChangedLampState() { HMI_DEBUG("wm:lcc", "Call"); @@ -216,6 +241,16 @@ bool LowCanClient::isChangedAccelPedalState() { return this->is_changed_accel_pedal_state_; } +const char* LowCanClient::getCurrentTransGearState() { + HMI_DEBUG("wm:lcc", "Call"); + + // Clear changed flag + this->is_changed_trans_gear_state_ = false; + + // Return current transmission gear state + return this->crr_trans_gear_state_.c_str(); +} + const char* LowCanClient::getCurrentLampState() { HMI_DEBUG("wm:lcc", "Call"); |