}
}
-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();
{
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;
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(); }
, 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",
})}
} // 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",
})}
} // 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",
})}
} // 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",
const std::string configuration_t::get_diagnostic_bus() const
{
- return "can0";
+ return "hs";
}
#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}
{}
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_;
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();
// 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();
{
// 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));
// 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;
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();
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();
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)