aboutsummaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/can
diff options
context:
space:
mode:
Diffstat (limited to 'CAN-binder/low-can-binding/can')
-rw-r--r--CAN-binder/low-can-binding/can/can-bus.cpp10
-rw-r--r--CAN-binder/low-can-binding/can/can-bus.hpp4
2 files changed, 10 insertions, 4 deletions
diff --git a/CAN-binder/low-can-binding/can/can-bus.cpp b/CAN-binder/low-can-binding/can/can-bus.cpp
index 06338b4e..bd9cde77 100644
--- a/CAN-binder/low-can-binding/can/can-bus.cpp
+++ b/CAN-binder/low-can-binding/can/can-bus.cpp
@@ -294,9 +294,15 @@ void can_bus_t::push_new_vehicle_message(const openxc_VehicleMessage& v_msg)
void can_bus_t::set_can_devices()
{
can_devices_ = conf_file_.get_devices_name();
+
+ if(can_devices_.empty())
+ {
+ ERROR(binder_interface, "%s: No mapping found in config file: '%s'. Check it that it have a CANbus-mapping section.",
+ __FUNCTION__, conf_file_.filepath().c_str());
+ }
}
-int can_bus_t::get_can_device_index(std::string bus_name) const
+int can_bus_t::get_can_device_index(const std::string& bus_name) const
{
int i = 0;
for(const auto& d: can_devices_)
@@ -308,7 +314,7 @@ int can_bus_t::get_can_device_index(std::string bus_name) const
return i;
}
-std::string can_bus_t::get_can_device_name(std::string id_name) const
+const std::string can_bus_t::get_can_device_name(const std::string& id_name) const
{
std::string ret;
for(const auto& d: can_devices_)
diff --git a/CAN-binder/low-can-binding/can/can-bus.hpp b/CAN-binder/low-can-binding/can/can-bus.hpp
index c300c7f4..1efd2049 100644
--- a/CAN-binder/low-can-binding/can/can-bus.hpp
+++ b/CAN-binder/low-can-binding/can/can-bus.hpp
@@ -75,8 +75,8 @@ public:
can_bus_t(can_bus_t&&);
void set_can_devices();
- int get_can_device_index(std::string bus_name) const;
- std::string get_can_device_name(std::string id_name) const;
+ int get_can_device_index(const std::string& bus_name) const;
+ const std::string get_can_device_name(const std::string& id_name) const;
void start_threads();
void stop_threads();