summaryrefslogtreecommitdiffstats
path: root/low-can-binding/binding/low-can-cb.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'low-can-binding/binding/low-can-cb.cpp')
-rw-r--r--low-can-binding/binding/low-can-cb.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/low-can-binding/binding/low-can-cb.cpp b/low-can-binding/binding/low-can-cb.cpp
index e84a9c70..3145065a 100644
--- a/low-can-binding/binding/low-can-cb.cpp
+++ b/low-can-binding/binding/low-can-cb.cpp
@@ -17,6 +17,7 @@
*/
#include "low-can-hat.hpp"
+#include "low-can-apidef.h"
#include <map>
#include <queue>
@@ -36,7 +37,6 @@
#include "../diagnostic/diagnostic-message.hpp"
#include "../utils/openxc-utils.hpp"
-
///******************************************************************************
///
/// SystemD event loop Callbacks
@@ -632,3 +632,25 @@ void list(struct afb_req request)
else
afb_req_fail(request, "error", NULL);
}
+
+/// @brief Initialize the binding.
+///
+/// @param[in] service Structure which represent the Application Framework Binder.
+///
+/// @return Exit code, zero if success.
+int initv2()
+{
+ can_bus_t& can_bus_manager = application_t::instance().get_can_bus_manager();
+
+ can_bus_manager.set_can_devices();
+ can_bus_manager.start_threads();
+
+ /// Initialize Diagnostic manager that will handle obd2 requests.
+ /// We pass by default the first CAN bus device to its Initialization.
+ /// TODO: be able to choose the CAN bus device that will be use as Diagnostic bus.
+ if(application_t::instance().get_diagnostic_manager().initialize())
+ return 0;
+
+ AFB_ERROR("There was something wrong with CAN device Initialization.");
+ return 1;
+}