summaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/binding/low-can-hat.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-06-08 15:25:27 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-06-09 11:43:31 +0200
commit32fb0e5b1949ef115e92de9457cb4e83854e51f2 (patch)
treebb9444fb67783eda6a187acf17bcdffcdea4f8ec /CAN-binder/low-can-binding/binding/low-can-hat.cpp
parentce2bd1c557ae2cb44db1794909f129e82286c305 (diff)
Migration to AFB Binding V2
No more binder interface needed to use logging macros and others stuff like make_event or any other calls Change-Id: Iaee60697373bc8a0e67518e924b36b5389533e68 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/binding/low-can-hat.cpp')
-rw-r--r--CAN-binder/low-can-binding/binding/low-can-hat.cpp38
1 files changed, 16 insertions, 22 deletions
diff --git a/CAN-binder/low-can-binding/binding/low-can-hat.cpp b/CAN-binder/low-can-binding/binding/low-can-hat.cpp
index e8e56297..7113b69a 100644
--- a/CAN-binder/low-can-binding/binding/low-can-hat.cpp
+++ b/CAN-binder/low-can-binding/binding/low-can-hat.cpp
@@ -28,39 +28,33 @@
#include "application.hpp"
#include "../can/can-bus.hpp"
-// Interface between the daemon and the binding
-const struct afb_binding_interface *binder_interface;
-
extern "C"
{
- static const struct afb_verb_desc_v1 verbs[]=
+ static int initv2();
+
+ static const struct afb_verb_v2 verbs[]=
{
- { .name= "subscribe", .session= AFB_SESSION_NONE, .callback= subscribe, .info= "subscribe to notification of CAN bus messages." },
- { .name= "unsubscribe", .session= AFB_SESSION_NONE, .callback= unsubscribe, .info= "unsubscribe a previous subscription." }
+ { .verb= "subscribe", .callback= subscribe, .auth= NULL, .session= AFB_SESSION_NONE},
+ { .verb= "unsubscribe", .callback= unsubscribe, .auth= NULL, .session= AFB_SESSION_NONE},
+ { .verb= NULL, .callback= NULL, .auth= NULL, .session= 0}
};
- static const struct afb_binding binding_desc {
- AFB_BINDING_VERSION_1,
- {
- "Low level CAN bus service",
- "low-can",
- verbs
- }
+ const struct afb_binding_v2 afbBindingV2 {
+ .api = "low-can",
+ .specification = NULL,
+ .verbs = verbs,
+ .preinit = NULL,
+ .init = initv2,
+ .onevent = NULL,
+ .noconcurrency = 0
};
- const struct afb_binding *afbBindingV1Register (const struct afb_binding_interface *itf)
- {
- binder_interface = itf;
-
- return &binding_desc;
- }
-
/// @brief Initialize the binding.
///
/// @param[in] service Structure which represent the Application Framework Binder.
///
/// @return Exit code, zero if success.
- int afbBindingV1ServiceInit(struct afb_service service)
+ static int initv2()
{
can_bus_t& can_bus_manager = application_t::instance().get_can_bus_manager();
@@ -73,7 +67,7 @@ extern "C"
if(application_t::instance().get_diagnostic_manager().initialize())
return 0;
- ERROR(binder_interface, "%s: There was something wrong with CAN device Initialization.", __FUNCTION__);
+ ERROR("There was something wrong with CAN device Initialization.");
return 1;
}
};