diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-09-28 11:09:17 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-09-28 11:12:40 +0200 |
commit | 91a8304cf1c9d7139840f95c1ad971c9603ed5bf (patch) | |
tree | 08267435b188721419ee8bea65943cc4d80305a0 /low-can-binding/binding/low-can-cb.cpp | |
parent | a8eaf1f71c2906140b600314dfe935fab3a06bf2 (diff) |
Use afb_genskel tools to generate api definition
Generated files hand fixed because of usage of C++
which has to use c++ binding function afb::auth to
add afb_auth struct
Change-Id: I80ee9cb751cc813754c949d8746aec197da6d52f
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.cpp | 24 |
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; +} |