diff options
author | 2019-11-20 15:31:14 +0100 | |
---|---|---|
committer | 2019-12-03 19:46:26 +0100 | |
commit | 1f57e04d955877654ce4ac055dbb533281ce4af5 (patch) | |
tree | 38d5f3afcf358329c3d5c6e0f834c6217608f831 /low-can-binding/binding | |
parent | 7eb266ac372a3ccfc0857a6a63d9f6c88afa1ffd (diff) |
can-bus: Use configuration from JSON file
Use configuration from JSON file instead of the old INI file. Now all configuration files
lies within the binding tree.
Change-Id: Id986d19751db958ad5cf3b7f2b2c5443d4ceb062
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding/binding')
-rw-r--r-- | low-can-binding/binding/application.cpp | 5 | ||||
-rw-r--r-- | low-can-binding/binding/low-can-cb.cpp | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/low-can-binding/binding/application.cpp b/low-can-binding/binding/application.cpp index 063a11da..bb3bf15b 100644 --- a/low-can-binding/binding/application.cpp +++ b/low-can-binding/binding/application.cpp @@ -25,6 +25,11 @@ #define MICROSECONDS_IN_SECOND 1000000 #define ENGINE_VALUE_TIMEOUT 5 +application_t::application_t() + : can_bus_manager_{} + , message_set_{} +{} + /// @brief Return singleton instance of configuration object. application_t& application_t::instance() { diff --git a/low-can-binding/binding/low-can-cb.cpp b/low-can-binding/binding/low-can-cb.cpp index d1325d35..7182dbfc 100644 --- a/low-can-binding/binding/low-can-cb.cpp +++ b/low-can-binding/binding/low-can-cb.cpp @@ -73,6 +73,12 @@ int config_low_can(afb_api_t apiHandle, CtlSectionT *section, json_object *json_ application->set_active_message_set((uint8_t)active_message_set); + if(wrap_json_unpack(json_obj, "{so}", + "dev-mapping", &dev_mapping)) + return -1; + + application->get_can_bus_manager().set_can_devices(dev_mapping); + /// Initialize Diagnostic manager that will handle obd2 requests. /// We pass by default the first CAN bus device to its Initialization. if(! application_t::instance().get_diagnostic_manager().initialize(diagnotic_bus)) @@ -865,7 +871,6 @@ int init_binding(afb_api_t api) return -1; } - can_bus_manager.set_can_devices(); can_bus_manager.start_threads(); utils::signals_manager_t& sm = utils::signals_manager_t::instance(); |