From 44d7237fde80af222939445055a94a0e50e82935 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Tue, 18 Apr 2017 20:23:14 +0200 Subject: Use a system INI configuration file to get devices mapping Instead of specifying a JSON configuration file with CAN devices name, it uses a mapping configuration file that map a high level device names to a real low level names. File path is to be specified into the generated source code which is /etc/dev-mapping.conf for now. Configuration file uses INI file format and is parsed using inih library cpp wrapper. Change-Id: Ibde104e76cd78a6cc86f6eec4f66c274b7567d43 Signed-off-by: Romain Forlot --- CAN-binder/low-can-binding/utils/config-parser.hpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'CAN-binder/low-can-binding/utils/config-parser.hpp') diff --git a/CAN-binder/low-can-binding/utils/config-parser.hpp b/CAN-binder/low-can-binding/utils/config-parser.hpp index e6bd9d2..2d50485 100644 --- a/CAN-binder/low-can-binding/utils/config-parser.hpp +++ b/CAN-binder/low-can-binding/utils/config-parser.hpp @@ -23,21 +23,23 @@ #include #include +#include +#include "INIReader.h" namespace utils { + /// @brief A configuration file parser that handle INI configuration + /// file format. class config_parser_t { private: - int conf_file_; /*!< conf_file_ - file that handle the binding configuration file */ - std::string config_content_; /*!< config_content_ - String that contains the content of config file */ - std::vector devices_name_; /*!< devices_name - Found devices name after reading configuration file */ + INIReader config_content_; /*!< config_content_ - Parsed content of INI file.*/ - void parse_devices_name(); public: config_parser_t(int conf_file); + config_parser_t(std::string conf_file); - void read_conf(); - std::vector get_devices_name(); + bool check_conf(); + const std::vector get_devices_name(); }; } -- cgit 1.2.3-korg