diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-04-18 20:23:14 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-04-18 20:23:14 +0200 |
commit | 44d7237fde80af222939445055a94a0e50e82935 (patch) | |
tree | a65cd2e82fc70ddeed4fbf3b2cd05c4b025c8f90 /CAN-binder/low-can-binding/can/can-bus.hpp | |
parent | 3642f8f2545f22f2e574bbd820e67229516e9149 (diff) |
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 <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/can/can-bus.hpp')
-rw-r--r-- | CAN-binder/low-can-binding/can/can-bus.hpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/CAN-binder/low-can-binding/can/can-bus.hpp b/CAN-binder/low-can-binding/can/can-bus.hpp index eb47476..5715c74 100644 --- a/CAN-binder/low-can-binding/can/can-bus.hpp +++ b/CAN-binder/low-can-binding/can/can-bus.hpp @@ -27,6 +27,7 @@ #include "openxc.pb.h" #include "can-message.hpp" #include "can-bus-dev.hpp" +#include "../utils/config-parser.hpp" #include "../diagnostic/active-diagnostic-request.hpp" #include "../low-can-binding.hpp" @@ -48,7 +49,7 @@ class can_bus_t { private: - int conf_file_; ///< configuration file handle used to initialize can_bus_dev_t objects. + utils::config_parser_t& conf_file_; ///< configuration file handle used to initialize can_bus_dev_t objects. void can_decode_message(); std::thread th_decoding_; ///< thread that'll handle decoding a can frame @@ -69,7 +70,7 @@ private: static std::map<std::string, std::shared_ptr<can_bus_dev_t>> can_devices_; ///< Can device map containing all can_bus_dev_t objects initialized during init_can_dev function public: - can_bus_t(int conf_file); + can_bus_t(utils::config_parser_t conf_file); can_bus_t(can_bus_t&&); int init_can_dev(); |