#include "config-parser.hpp"
-#include "../low-can-binding.hpp"
+#include "../binding/low-can-hat.hpp"
namespace utils
{
/// @brief constructor using path to file
config_parser_t::config_parser_t(std::string conf_file)
- : config_content_{}
+ : filepath_{conf_file}, config_content_{}
{
config_content_.read_file(conf_file);
}
+ const std::string& config_parser_t::filepath() const
+ {
+ return filepath_;
+ }
+
/// @brief read the conf_file_ and parse it into an INIReader object
/// to search into later.
bool config_parser_t::check_conf()
{
if (config_content_.size() <= 0)
{
- ERROR(binder_interface, "%s: Can't load the INI config file.", __FUNCTION__);
+ ERROR("Can't load the INI config file.");
return false;
}
- DEBUG(binder_interface, "%s: Configuration file parsed", __FUNCTION__);
+ DEBUG("Configuration file parsed");
return true;
}
/// have to test the returned value.
///
/// @return A const vector with string of linux CAN devices.
- const std::vector<std::string> config_parser_t::get_devices_name()
+ const std::vector<std::pair<std::string, std::string> > config_parser_t::get_devices_name()
{
- std::vector<std::string> devices_name;
+ std::vector<std::pair<std::string, std::string> > devices_name;
std::map<std::string, std::string> bus_mapping = config_content_.get_keys("CANbus-mapping");
for(const auto& busIt : bus_mapping )
{
- devices_name.push_back(busIt.second);
+ devices_name.push_back(std::make_pair(busIt.first, busIt.second));
}
return devices_name;