aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CAN-binder/libs/ini-config/ini-config.cpp11
-rw-r--r--CAN-binder/libs/ini-config/ini-config.hpp2
-rw-r--r--CAN-binder/low-can-binding/binding/configuration-generated.cpp10
-rw-r--r--CAN-binder/low-can-binding/can/can-message-definition.cpp8
-rw-r--r--CAN-binder/low-can-binding/can/can-message-definition.hpp1
-rw-r--r--CAN-binder/low-can-binding/can/can-signals.cpp2
-rw-r--r--CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp12
-rw-r--r--CAN-binder/low-can-binding/diagnostic/diagnostic-manager.hpp3
-rw-r--r--CAN-binder/low-can-binding/utils/openxc-utils.cpp2
9 files changed, 36 insertions, 15 deletions
diff --git a/CAN-binder/libs/ini-config/ini-config.cpp b/CAN-binder/libs/ini-config/ini-config.cpp
index 631a020..ef3ab25 100644
--- a/CAN-binder/libs/ini-config/ini-config.cpp
+++ b/CAN-binder/libs/ini-config/ini-config.cpp
@@ -58,9 +58,10 @@ void ini_config::read_file(const std::string& filename)
}
}
-std::map<std::string, std::string> ini_config::get_keys(const std::string& section)
+ini_config::map ini_config::get_keys(const std::string& section, bool wo_prefix)
{
- std::map<std::string, std::string> ret;
+ map ret;
+ std::string key;
std::string prefix = section + '/';
for(auto i = config_.begin();
@@ -69,7 +70,11 @@ std::map<std::string, std::string> ini_config::get_keys(const std::string& secti
{
if (starts_with(i->first, prefix))
{
- ret[i->first] = i->second;
+ if(wo_prefix)
+ key = i->first.substr(section.size()+1);
+ else
+ key = i->first;
+ ret[key] = i->second;
}
}
return ret;
diff --git a/CAN-binder/libs/ini-config/ini-config.hpp b/CAN-binder/libs/ini-config/ini-config.hpp
index 3a15454..4c8cc11 100644
--- a/CAN-binder/libs/ini-config/ini-config.hpp
+++ b/CAN-binder/libs/ini-config/ini-config.hpp
@@ -32,7 +32,7 @@ public:
void read_file(const std::string& filename);
- map get_keys(const std::string& section);
+ map get_keys(const std::string& section, bool wo_prefix=true);
std::string get_value(const std::string& section, const std::string& key);
typename map::size_type size() const { return config_.size(); }
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)