diff options
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 | 8 |
2 files changed, 12 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 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(); |