aboutsummaryrefslogtreecommitdiffstats
path: root/src/low_can_client.cpp
diff options
context:
space:
mode:
authorYuta Doi <yuta-d@witz-inc.co.jp>2018-05-14 18:39:23 +0900
committerYuta Doi <yuta-d@witz-inc.co.jp>2018-05-14 18:39:23 +0900
commita21dd2b748731f1bbe956da6d22a87cc1412de30 (patch)
treed5b1fd447ded544b3a20385d1e48362b10f58c6f /src/low_can_client.cpp
parentbfadb522b21256fde7283746b90116c237e57a5b (diff)
Add transmission gear position event in PolicyManager
Change-Id: Ibf528b5ab3877d2cf094920fd0723873fb12647c 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.cpp35
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");