summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/can-decoder.hpp5
-rw-r--r--src/can-utils.hpp2
-rw-r--r--src/can_decode_message.cpp12
-rw-r--r--src/can_event_push.cpp11
-rw-r--r--src/can_reader.cpp7
-rw-r--r--src/low-can-binding.cpp6
-rw-r--r--src/low-can-binding.hpp23
-rw-r--r--src/obd2.hpp4
-rw-r--r--src/openxc-utils.hpp28
9 files changed, 43 insertions, 55 deletions
diff --git a/src/can-decoder.hpp b/src/can-decoder.hpp
index b6234b5..eda7727 100644
--- a/src/can-decoder.hpp
+++ b/src/can-decoder.hpp
@@ -17,6 +17,7 @@
#pragma once
+#include "can-utils.hpp"
class decoder_t
{
@@ -34,7 +35,7 @@ class decoder_t
* Returns the raw value of the signal parsed as a bitfield from the given byte
* array.
*/
- float parseSignalBitfield(const CanSignal& signal, const CanMessage& message);
+ float parseSignalBitfield(const CanSignal& signal, const can_message_t& message);
/* Public: Find and return the corresponding string state for a CAN signal's
* raw integer value.
@@ -130,7 +131,7 @@ class decoder_t
* string or boolean. If 'send' is false, the return value is undefined.
*/
openxc_DynamicField decodeSignal(const CanSignal& signal,
- const CanMessage& message, const CanSignal& signals,
+ const can_message_t& message, const CanSignal& signals,
bool* send);
/* Public: Decode a transformed, human readable value from an raw CAN signal
diff --git a/src/can-utils.hpp b/src/can-utils.hpp
index 0b0971d..58a9873 100644
--- a/src/can-utils.hpp
+++ b/src/can-utils.hpp
@@ -27,8 +27,6 @@
#include "timer.hpp"
#include "openxc.pb.h"
-#include <afb/afb-binding.h>
-#include <afb/afb-service-itf.h>
// TODO actual max is 32 but dropped to 24 for memory considerations
#define MAX_ACCEPTANCE_FILTERS 24
diff --git a/src/can_decode_message.cpp b/src/can_decode_message.cpp
index a28fa18..0f26290 100644
--- a/src/can_decode_message.cpp
+++ b/src/can_decode_message.cpp
@@ -16,17 +16,7 @@
* limitations under the License.
*/
-#include <linux/can.h>
-#include <linux/can/raw.h>
-#include <queue>
-#include <sys/timeb.h>
-
-#include <afb/afb-binding.h>
-
-#include "can-utils.hpp"
-#include "can-decoder.hpp"
-#include "openxc.pb.h"
-#include "openxc-utils.hpp"
+#include "low-can-binding.hpp"
void can_decode_message(can_bus_t &can_bus)
{
diff --git a/src/can_event_push.cpp b/src/can_event_push.cpp
index d3f4cbd..bb69118 100644
--- a/src/can_event_push.cpp
+++ b/src/can_event_push.cpp
@@ -16,16 +16,7 @@
* limitations under the License.
*/
-#include <linux/can.h>
-#include <linux/can/raw.h>
-#include <queue>
-
-#include <afb/afb-binding.h>
-
-#include "can-utils.h"
-#include "openxc-utils.hpp"
-#include "openxc.pb.h"
-#include "json-c/json.h"
+#include "low-can-binding.hpp"
void can_event_push(can_bus_t& can_bus)
{
diff --git a/src/can_reader.cpp b/src/can_reader.cpp
index a8c5cf6..c8891ee 100644
--- a/src/can_reader.cpp
+++ b/src/can_reader.cpp
@@ -16,12 +16,7 @@
* limitations under the License.
*/
-#include <linux/can.h>
-#include <linux/can/raw.h>
-
-#include <afb/afb-binding.h>
-
-#include "can-utils.h"
+#include "low-can-binding.hpp"
void can_reader(can_bus_t &can_bus)
{
diff --git a/src/low-can-binding.cpp b/src/low-can-binding.cpp
index 23aaf90..18346fa 100644
--- a/src/low-can-binding.cpp
+++ b/src/low-can-binding.cpp
@@ -38,10 +38,6 @@
#include <openxc.pb.h>
#include "low-can-binding.hpp"
-#include "openxc-utils.hpp"
-#include "obd2.hpp"
-#include "can-utils.hpp"
-#include "can-signals.hpp"
/********************************************************************************
*
@@ -236,4 +232,4 @@ extern "C"
return 1;
}
-} \ No newline at end of file
+}; \ No newline at end of file
diff --git a/src/low-can-binding.hpp b/src/low-can-binding.hpp
index 20dc5dc..ea2c027 100644
--- a/src/low-can-binding.hpp
+++ b/src/low-can-binding.hpp
@@ -18,7 +18,23 @@
#pragma once
+#include <queue>
+#include <sys/timeb.h>
+#include <linux/can.h>
+#include <json-c/json.h>
+#include <linux/can/raw.h>
+
+#include "obd2.hpp"
+#include "openxc.pb.h"
+#include "can-utils.hpp"
#include "can-signals.hpp"
+#include "can-decoder.hpp"
+#include "openxc-utils.hpp"
+
+/*
+ * Interface between the daemon and the binding
+ */
+static const struct afb_binding_interface *interface;
extern "C"
{
@@ -55,9 +71,4 @@ extern "C"
* @return Exit code, zero if success.
*/
int afbBindingV1ServiceInit(struct afb_service service);
-}
-
-/*
- * Interface between the daemon and the binding
- */
-static const struct afb_binding_interface *interface; \ No newline at end of file
+}; \ No newline at end of file
diff --git a/src/obd2.hpp b/src/obd2.hpp
index 365c683..bdccad6 100644
--- a/src/obd2.hpp
+++ b/src/obd2.hpp
@@ -17,6 +17,10 @@
#include <vector>
#include "uds/uds.h"
+extern "C"
+{
+ #include <afb/afb-binding.h>
+}
enum UNIT {
POURCENT,
diff --git a/src/openxc-utils.hpp b/src/openxc-utils.hpp
index f078c6e..b2b5c7f 100644
--- a/src/openxc-utils.hpp
+++ b/src/openxc-utils.hpp
@@ -18,34 +18,36 @@
#pragma once
-/*
- * Build a specific VehicleMessage containing a SimpleMessage.
+#include "openxc.pb.h"
+
+/**
+ * @brief Build a specific VehicleMessage containing a SimpleMessage.
*/
-openxc_VehicleMessage build_VehicleMessage_with_SimpleMessage(openxc_DynamicField_Type type,
- const openxc_SimpleMessage& message);
+openxc_VehicleMessage build_VehicleMessage_with_SimpleMessage(openxc_DynamicField_Type type, const openxc_SimpleMessage& message);
-/*
- * Build an openxc_SimpleMessage associating a name to an openxc_DynamicField
+/**
+ * @brief Build an openxc_SimpleMessage associating a name to an openxc_DynamicField
*/
openxc_SimpleMessage build_SimpleMessage(const std::string& name, const openxc_DynamicField& value);
-/*
- * Build an openxc_DynamicField depending what we pass as argument
+/**
+ * @brief Build an openxc_DynamicField depending what we pass as argument
*/
openxc_DynamicField build_DynamicField(const std::string& value);
-/*
- * Build an openxc_DynamicField depending what we pass as argument
+/**
+ * @brief Build an openxc_DynamicField depending what we pass as argument
*/
openxc_DynamicField build_DynamicField(double value);
-/*
- * Build an openxc_DynamicField depending what we pass as argument
+/**
+ * @brief Build an openxc_DynamicField depending what we pass as argument
*/
openxc_DynamicField build_DynamicField(bool value);
void jsonify_DynamicField(const openxc_DynamicField& field, const json_object& value);
-/* Extract the simple message value from an openxc_VehicleMessage
+/**
+ * @brief Extract the simple message value from an openxc_VehicleMessage
* and return it, or null if there isn't.
*/
openxc_SimpleMessage get_simple_message(const openxc_VehicleMessage& v_msg);