Simplify processing event
[apps/agl-service-can-low-level.git] / CAN-binder / low-can-binding / utils / config-parser.cpp
index 60ea118..3f33812 100644 (file)
 
 #include "config-parser.hpp"
 
-#include "../binding/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()
@@ -47,14 +52,14 @@ namespace utils
        /// 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;