summaryrefslogtreecommitdiffstats
path: root/src/low-can-binding.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-03-08 12:55:47 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-03-16 17:10:39 +0100
commit349c9647be645fbd2e26c67713de648688b4d216 (patch)
tree11152cc1b9c72ef1ec73d8a54f2fd39be78b871f /src/low-can-binding.cpp
parent9f6e6be87701898472db48186c767d23cc7b0f0a (diff)
Make a global variable to a configuration object.
With afb interface, it will be the last global variable needed as it regroup all needed stuff to other class and functions. Change-Id: I3d82b6f748ff22a9a975d15ab9df51f63005737f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/low-can-binding.cpp')
-rw-r--r--src/low-can-binding.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/low-can-binding.cpp b/src/low-can-binding.cpp
index ad73de1..6bce723 100644
--- a/src/low-can-binding.cpp
+++ b/src/low-can-binding.cpp
@@ -22,7 +22,6 @@
#include <mutex>
#include <vector>
#include <thread>
-#include <fcntl.h>
#include <linux/can.h>
#include <json-c/json.h>
#include <systemd/sd-event.h>
@@ -34,10 +33,10 @@
#include "utils/timer.hpp"
#include "utils/signals.hpp"
#include "utils/openxc-utils.hpp"
-#include "configuration.hpp"
// Interface between the daemon and the binding
const struct afb_binding_interface *binder_interface;
+configuration_t *config;
/********************************************************************************
*
@@ -216,9 +215,9 @@ extern "C"
*/
int afbBindingV1ServiceInit(struct afb_service service)
{
- configuration_t config;
+ config = new configuration_t();
- can_bus_manager = config.get_can_bus_manager();
+ can_bus_t can_bus_manager = config->get_can_bus_manager();
/* Open CAN socket */
if(can_bus_manager.init_can_dev() == 0)
@@ -226,6 +225,7 @@ extern "C"
can_bus_manager.start_threads();
return 0;
}
+
ERROR(binder_interface, "There was something wrong with CAN device Initialization. Check your config file maybe");
return 1;
}