summaryrefslogtreecommitdiffstats
path: root/low-can-binding/binding/low-can-cb.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-11-20 15:31:14 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2020-01-09 15:55:03 +0100
commit04b7efcdd1a8dfdf461c78d083aabee5445e54bd (patch)
treeccb146ebee3324b2e220430d476b1d9addaa451c /low-can-binding/binding/low-can-cb.cpp
parent47322aceac11e3142af4339260a74ccfba675e17 (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. Bug-AGL: SPEC-2988 Change-Id: Id986d19751db958ad5cf3b7f2b2c5443d4ceb062 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding/binding/low-can-cb.cpp')
-rw-r--r--low-can-binding/binding/low-can-cb.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/low-can-binding/binding/low-can-cb.cpp b/low-can-binding/binding/low-can-cb.cpp
index 35c6d9ee..3037994a 100644
--- a/low-can-binding/binding/low-can-cb.cpp
+++ b/low-can-binding/binding/low-can-cb.cpp
@@ -65,6 +65,7 @@ int config_low_can(afb_api_t apiHandle, CtlSectionT *section, json_object *json_
application_t *application = (application_t*) ctrlConfig->external;
int active_message_set;
+ json_object *dev_mapping = nullptr;
const char *diagnotic_bus = nullptr;
if(wrap_json_unpack(json_obj, "{si, ss}",
@@ -74,6 +75,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))
@@ -867,7 +874,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();