summaryrefslogtreecommitdiffstats
path: root/src/low-can-binding.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-03-08 02:41:56 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-03-16 17:09:03 +0100
commit2049aca0927b55f2a256fd60ff686616b73eecb7 (patch)
treeeb4e195c796aa5cc69bdedd772a659b4f83fe9d9 /src/low-can-binding.cpp
parent64d3ead0ce87091a3489dd9796a9f77f241c468b (diff)
Beginning of work of get central configuration object
that will be used by the binding to access generated elements. It will hold generated structure/objects and make a resume to the binding configuration. Idea is to have an object that can be inherited in the generated code to extend its functionnalities or change some of its behoviors. Change-Id: If2ce5cbe2eb98a74a8e3f13000ee02855674216f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/low-can-binding.cpp')
-rw-r--r--src/low-can-binding.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/low-can-binding.cpp b/src/low-can-binding.cpp
index 41a6ab6..79b1691 100644
--- a/src/low-can-binding.cpp
+++ b/src/low-can-binding.cpp
@@ -40,13 +40,9 @@ extern "C"
#include <afb/afb-service-itf.h>
};
-/*
- * Interface between the daemon and the binding
- */
+// Interface between the daemon and the binding
const struct afb_binding_interface *binder_interface;
-can_bus_t *can_bus_handler;
-
/********************************************************************************
*
* Subscription and unsubscription
@@ -224,16 +220,14 @@ extern "C"
*/
int afbBindingV1ServiceInit(struct afb_service service)
{
- int fd_conf;
- fd_conf = afb_daemon_rootdir_open_locale(binder_interface->daemon, "can_buses.json", O_RDONLY, NULL);
+ configuration_t config;
- /* Initialize the CAN bus handler */
- can_bus_handler = new can_bus_t(fd_conf);
+ can_bus_manager = config.get_can_bus_manager();
/* Open CAN socket */
- if(can_bus_handler->init_can_dev() == 0)
+ if(can_bus_manager.init_can_dev() == 0)
{
- can_bus_handler->start_threads();
+ can_bus_manager.start_threads();
return 0;
}
ERROR(binder_interface, "There was something wrong with CAN device Initialization. Check your config file maybe");