diff options
author | 2017-06-05 19:16:27 +0200 | |
---|---|---|
committer | 2017-06-05 19:16:27 +0200 | |
commit | 13b637356a92d68e5dfed6990443e6937f1ed9c6 (patch) | |
tree | 7510c9fd267a8957b581eea810916c05e1a7a287 /high-can-binding/high-can-binding-hat.cpp |
Initial Commit
Change-Id: I4a832208f3db9f5fece82f44cc957c6c1bb91d6c
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'high-can-binding/high-can-binding-hat.cpp')
-rw-r--r-- | high-can-binding/high-can-binding-hat.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/high-can-binding/high-can-binding-hat.cpp b/high-can-binding/high-can-binding-hat.cpp new file mode 100644 index 0000000..01f6ab1 --- /dev/null +++ b/high-can-binding/high-can-binding-hat.cpp @@ -0,0 +1,47 @@ +#include "high-can-binding-hat.hpp" +#include <cstddef> +/// Interface between the daemon and the binding +const struct afb_binding_interface *binder_interface; +extern "C" +{ + #include <afb/afb-service-itf.h> + struct afb_service srvitf; +}; +static const struct afb_verb_desc_v1 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." }, + { .name= "get", .session= AFB_SESSION_NONE, .callback= get, .info= "high can get viwi request." }, +}; + +static const struct afb_binding binding_desc { + AFB_BINDING_VERSION_1, + { + "High level CAN bus service", + "high-can", + verbs + } +}; + +const struct afb_binding *afbBindingV1Register (const struct afb_binding_interface *itf) +{ + binder_interface = itf; + NOTICE(binder_interface, "high level afbBindingV1Register"); + + 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) +{ + srvitf = service; + //NOTICE(binder_interface, "before afb_daemon_require_api"); + //afb_daemon_require_api(binder_interface->daemon, "low-can", 1); + NOTICE(binder_interface, "high level binding is initializing"); + initHigh(service); + NOTICE(binder_interface, "high level binding is initialized and running"); + return 0; +} |