diff options
Diffstat (limited to 'CAN-binder/low-can-binding')
7 files changed, 27 insertions, 11 deletions
diff --git a/CAN-binder/low-can-binding/binding/configuration-generated.cpp b/CAN-binder/low-can-binding/binding/configuration-generated.cpp index bce469e..2939fc8 100644 --- a/CAN-binder/low-can-binding/binding/configuration-generated.cpp +++ b/CAN-binder/low-can-binding/binding/configuration-generated.cpp @@ -6,7 +6,7 @@ configuration_t::configuration_t() , can_message_set_{ {std::make_shared<can_message_set_t>(can_message_set_t{0,"example", { // beginning can_message_definition_ vector - {std::make_shared<can_message_definition_t>(can_message_definition_t{"can0",0x3D9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, + {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x3D9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, { // beginning can_signals vector {std::make_shared<can_signal_t> (can_signal_t{ "engine.speed", @@ -64,7 +64,7 @@ configuration_t::configuration_t() })} } // end can_signals vector })} // end can_message_definition entry -, {std::make_shared<can_message_definition_t>(can_message_definition_t{"can0",0x3E9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, +, {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x3E9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, { // beginning can_signals vector {std::make_shared<can_signal_t> (can_signal_t{ "vehicle.average.speed", @@ -86,7 +86,7 @@ configuration_t::configuration_t() })} } // end can_signals vector })} // end can_message_definition entry -, {std::make_shared<can_message_definition_t>(can_message_definition_t{"can0",0x4D1,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, +, {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x4D1,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, { // beginning can_signals vector {std::make_shared<can_signal_t> (can_signal_t{ "engine.oil.temp", @@ -126,7 +126,7 @@ configuration_t::configuration_t() })} } // end can_signals vector })} // end can_message_definition entry -, {std::make_shared<can_message_definition_t>(can_message_definition_t{"can0",0x620,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, +, {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x620,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, { // beginning can_signals vector {std::make_shared<can_signal_t> (can_signal_t{ "doors.boot.open", @@ -480,7 +480,7 @@ configuration_t::configuration_t() const std::string configuration_t::get_diagnostic_bus() const { - return "can0"; + return "hs"; } diff --git a/CAN-binder/low-can-binding/can/can-message-definition.cpp b/CAN-binder/low-can-binding/can/can-message-definition.cpp index ec6292a..e0f55a6 100644 --- a/CAN-binder/low-can-binding/can/can-message-definition.cpp +++ b/CAN-binder/low-can-binding/can/can-message-definition.cpp @@ -17,6 +17,8 @@ #include "can-message-definition.hpp" +#include "../binding/configuration.hpp" + can_message_definition_t::can_message_definition_t(const std::string bus) : parent_{nullptr}, bus_{bus}, last_value_{CAN_MESSAGE_SIZE} {} @@ -71,6 +73,12 @@ const std::string can_message_definition_t::get_bus_name() const return bus_; } +const std::string can_message_definition_t::get_bus_device_name() const +{ + return configuration_t::instance().get_can_bus_manager() + .get_can_device_name(bus_); +} + uint32_t can_message_definition_t::get_id() const { return id_; diff --git a/CAN-binder/low-can-binding/can/can-message-definition.hpp b/CAN-binder/low-can-binding/can/can-message-definition.hpp index 233d8ce..3e15036 100644 --- a/CAN-binder/low-can-binding/can/can-message-definition.hpp +++ b/CAN-binder/low-can-binding/can/can-message-definition.hpp @@ -60,6 +60,7 @@ public: can_message_definition_t(const std::string bus, uint32_t id, can_message_format_t format, frequency_clock_t frequency_clock, bool force_send_changed, const std::vector<std::shared_ptr<can_signal_t> >& can_signals); const std::string get_bus_name() const; + const std::string get_bus_device_name() const; uint32_t get_id() const; std::vector<std::shared_ptr<can_signal_t> >& get_can_signals(); diff --git a/CAN-binder/low-can-binding/can/can-signals.cpp b/CAN-binder/low-can-binding/can/can-signals.cpp index 9a87613..e49c727 100644 --- a/CAN-binder/low-can-binding/can/can-signals.cpp +++ b/CAN-binder/low-can-binding/can/can-signals.cpp @@ -228,7 +228,7 @@ int can_signal_t::create_rx_filter() // Make sure that socket has been opened. if(! socket_) socket_.open( - get_message()->get_bus_name()); + get_message()->get_bus_device_name()); uint32_t can_id = get_message()->get_id(); diff --git a/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp b/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp index 1a382af..199054b 100644 --- a/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp +++ b/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp @@ -86,7 +86,7 @@ int diagnostic_manager_t::add_rx_filter(uint32_t can_id) { // Make sure that socket has been opened. if(! socket_) - socket_.open(bus_); + socket_.open(get_bus_device_name()); struct utils::simple_bcm_msg bcm_msg; memset(&bcm_msg.msg_head, 0, sizeof(bcm_msg.msg_head)); @@ -142,7 +142,7 @@ bool diagnostic_manager_t::shims_send(const uint32_t arbitration_id, const uint8 // Make sure that socket has been opened. if(! tx_socket) tx_socket.open( - dm.get_can_bus()); + dm.get_bus_device_name()); struct utils::simple_bcm_msg bcm_msg; struct can_frame cfd; @@ -191,11 +191,17 @@ void diagnostic_manager_t::shims_logger(const char* format, ...) void diagnostic_manager_t::shims_timer() {} -std::string diagnostic_manager_t::get_can_bus() +const std::string diagnostic_manager_t::get_bus_name() const { return bus_; } +const std::string diagnostic_manager_t::get_bus_device_name() const +{ + return configuration_t::instance().get_can_bus_manager() + .get_can_device_name(bus_); +} + active_diagnostic_request_t* diagnostic_manager_t::get_last_recurring_requests() const { return recurring_requests_.back(); diff --git a/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.hpp b/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.hpp index 894cf63..9f19b01 100644 --- a/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.hpp +++ b/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.hpp @@ -67,7 +67,8 @@ public: bool initialize(); utils::socketcan_bcm_t& get_socket(); - std::string get_can_bus(); + const std::string get_bus_name() const; + const std::string get_bus_device_name() const; active_diagnostic_request_t* get_last_recurring_requests() const; DiagnosticShims& get_shims(); diff --git a/CAN-binder/low-can-binding/utils/openxc-utils.cpp b/CAN-binder/low-can-binding/utils/openxc-utils.cpp index 286b2f5..5f06504 100644 --- a/CAN-binder/low-can-binding/utils/openxc-utils.cpp +++ b/CAN-binder/low-can-binding/utils/openxc-utils.cpp @@ -41,7 +41,7 @@ openxc_VehicleMessage build_VehicleMessage(active_diagnostic_request_t* request, message.has_diagnostic_response = true; message.diagnostic_response.has_bus = true; message.diagnostic_response.bus = conf.get_can_bus_manager().get_can_device_index( - conf.get_diagnostic_manager().get_can_bus()); + conf.get_diagnostic_manager().get_bus_name()); message.diagnostic_response.has_message_id = true; if(request->get_id() != OBD2_FUNCTIONAL_BROADCAST_ID) |