diff options
Diffstat (limited to 'src/low_can_client.cpp')
-rw-r--r-- | src/low_can_client.cpp | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/src/low_can_client.cpp b/src/low_can_client.cpp index e0568e5..4afe4c3 100644 --- a/src/low_can_client.cpp +++ b/src/low_can_client.cpp @@ -27,14 +27,14 @@ extern "C" { namespace wm { LowCanClient::LowCanClient() : - vehicle_speed_(0), - trans_gear_pos_(0), - headlamp_status_(FALSE), - parking_brake_status_(TRUE), - accel_pedal_pos_(0), - accel_pedal_stt_(FALSE), - lightstatus_brake_status_(TRUE), - is_changed_accel_pedal_stt_(false) + vehicle_speed(0), + trans_gear_pos(0), + headlamp_status(FALSE), + 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"); } @@ -62,12 +62,12 @@ void LowCanClient::initialize() { // Set Event json_object *json_obj = json_object_new_object(); json_object_object_add(json_obj, "event", - json_object_new_string(this->kSignalName_[i])); + json_object_new_string(this->kSignalName[i])); // Set filter - if (0 != strcmp("", this->kFilterValue_[i])) { + if (0 != strcmp("", this->kFilterValue[i])) { json_object_object_add(json_obj, "filter", - json_tokener_parse(this->kFilterValue_[i])); + json_tokener_parse(this->kFilterValue[i])); } HMI_DEBUG("wm:lcc", "subscribe message:%s", json_object_get_string(json_obj)); @@ -88,51 +88,51 @@ 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_[SignalNoVehicliSpeed])) { + 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_); + this->vehicle_speed = jh::getIntFromJson(object, "value"); + HMI_DEBUG("wm:lcc", "Update vehicle speed:%d", this->vehicle_speed); } - else if (strstr(name, this->kSignalName_[SignalNoTransGearPos])) { + 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_); + 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_[SignalNoHeadlame])) { + 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_); + this->headlamp_status = jh::getBoolFromJson(object, "value"); + HMI_DEBUG("wm:lcc", "Update headlamp status:%d", this->headlamp_status); } - else if (strstr(name, this->kSignalName_[SignalNoParkingBrake])) { + 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_); + 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_[SignalNoAccelPedalPos])) { + else if (strstr(name, this->kSignalName[SignalNoAccelPedalPos])) { // Clear flag for whether accel pedal state is changed - this->is_changed_accel_pedal_stt_ = false; + this->is_changed_accel_pedal_stt = false; // Update accelerator pedal status - this->accel_pedal_pos_ = jh::getDoubleFromJson(object, "value"); - HMI_DEBUG("wm:lcc", "Update accelerator pedal position:%lf", this->accel_pedal_pos_); + this->accel_pedal_pos = jh::getDoubleFromJson(object, "value"); + HMI_DEBUG("wm:lcc", "Update accelerator pedal position:%lf", this->accel_pedal_pos); bool accel_pedal_stt; - if (0 != this->accel_pedal_pos_) { + if (0 != this->accel_pedal_pos) { accel_pedal_stt = true; } else { accel_pedal_stt = false; } - if (accel_pedal_stt != this->accel_pedal_stt_) { - this->is_changed_accel_pedal_stt_ = true; - this->accel_pedal_stt_ = accel_pedal_stt; + if (accel_pedal_stt != this->accel_pedal_stt) { + this->is_changed_accel_pedal_stt = true; + this->accel_pedal_stt = accel_pedal_stt; } } - else if (strstr(name, this->kSignalName_[SignalNoLightstatusBrake])) { + 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_); + this->lightstatus_brake_status = jh::getBoolFromJson(object, "value"); + HMI_DEBUG("wm:lcc", "Update lightstatus brake status:%d", this->lightstatus_brake_status); } return name; @@ -141,43 +141,43 @@ const char* LowCanClient::analyzeCanSignal(struct json_object *object) { bool LowCanClient::isChangedAccelPedalState() { HMI_DEBUG("wm:lcc", "Call"); - return this->is_changed_accel_pedal_stt_; + return this->is_changed_accel_pedal_stt; } int LowCanClient::getCurrentTransGearState() { HMI_DEBUG("wm:lcc", "Call"); - return this->trans_gear_pos_; + return this->trans_gear_pos; } bool LowCanClient::getCurrentHeadlampState() { HMI_DEBUG("wm:lcc", "Call"); - return (bool)this->headlamp_status_; + return (bool)this->headlamp_status; } bool LowCanClient::getCurrentParkingBrakeState() { HMI_DEBUG("wm:lcc", "Call"); - return (bool)this->parking_brake_status_; + return (bool)this->parking_brake_status; } double LowCanClient::getCurrentAccelPedalPosition() { HMI_DEBUG("wm:lcc", "Call"); - return this->accel_pedal_pos_; + return this->accel_pedal_pos; } bool LowCanClient::getCurrentAccelPedalState() { HMI_DEBUG("wm:lcc", "Call"); - return this->accel_pedal_stt_; + return this->accel_pedal_stt; } bool LowCanClient::getCurrentLightstatusBrakeState() { HMI_DEBUG("wm:lcc", "Call"); - return (bool)this->lightstatus_brake_status_; + return (bool)this->lightstatus_brake_status; } |