summaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/can
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-16 17:37:07 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-05-19 11:36:43 +0200
commitd91f5f743bc6f6ec9aadfe96187b45dc93043f61 (patch)
treee79bb26cb4ad4c97c07941ab6f31bb6b7c3fde22 /CAN-binder/low-can-binding/can
parentfd3978709abbb3ed46caaf48c1d2f45b2c74fa89 (diff)
Include diagnostic_message_t into can_message_set.
Change-Id: I7372e469752dd8e90dc9431b9e5c67df12f56c29 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/can')
-rw-r--r--CAN-binder/low-can-binding/can/can-bus.cpp2
-rw-r--r--CAN-binder/low-can-binding/can/can-bus.hpp6
-rw-r--r--CAN-binder/low-can-binding/can/can-message-definition.hpp1
-rw-r--r--CAN-binder/low-can-binding/can/can-message-set.cpp16
-rw-r--r--CAN-binder/low-can-binding/can/can-message-set.hpp9
-rw-r--r--CAN-binder/low-can-binding/can/can-signals.hpp2
6 files changed, 27 insertions, 9 deletions
diff --git a/CAN-binder/low-can-binding/can/can-bus.cpp b/CAN-binder/low-can-binding/can/can-bus.cpp
index 17a77650..06338b4e 100644
--- a/CAN-binder/low-can-binding/can/can-bus.cpp
+++ b/CAN-binder/low-can-binding/can/can-bus.cpp
@@ -308,7 +308,7 @@ int can_bus_t::get_can_device_index(std::string bus_name) const
return i;
}
-const std::string can_bus_t::get_can_device_name(std::string id_name) const
+std::string can_bus_t::get_can_device_name(std::string id_name) const
{
std::string ret;
for(const auto& d: can_devices_)
diff --git a/CAN-binder/low-can-binding/can/can-bus.hpp b/CAN-binder/low-can-binding/can/can-bus.hpp
index 7fe6ebf3..c300c7f4 100644
--- a/CAN-binder/low-can-binding/can/can-bus.hpp
+++ b/CAN-binder/low-can-binding/can/can-bus.hpp
@@ -26,9 +26,7 @@
#include "openxc.pb.h"
#include "can-message.hpp"
-#include "can-signals.hpp"
#include "../utils/config-parser.hpp"
-#include "../diagnostic/diagnostic-manager.hpp"
#include "../binding/low-can-hat.hpp"
// TODO actual max is 32 but dropped to 24 for memory considerations
@@ -38,6 +36,8 @@
#define CAN_ACTIVE_TIMEOUT_S 30
+class diagnostic_manager_t;
+
/// @brief Object used to handle decoding and manage event queue to be pushed.
///
/// This object is also used to initialize can_bus_dev_t object after reading
@@ -76,7 +76,7 @@ public:
void set_can_devices();
int get_can_device_index(std::string bus_name) const;
- const std::string get_can_device_name(std::string id_name) const;
+ std::string get_can_device_name(std::string id_name) const;
void start_threads();
void stop_threads();
diff --git a/CAN-binder/low-can-binding/can/can-message-definition.hpp b/CAN-binder/low-can-binding/can/can-message-definition.hpp
index 0c7d7c1a..5d8514fa 100644
--- a/CAN-binder/low-can-binding/can/can-message-definition.hpp
+++ b/CAN-binder/low-can-binding/can/can-message-definition.hpp
@@ -30,6 +30,7 @@
#include "can-signals.hpp"
#include "can-message.hpp"
+#include "can-message-set.hpp"
#include "../utils/timer.hpp"
class can_message_set_t;
diff --git a/CAN-binder/low-can-binding/can/can-message-set.cpp b/CAN-binder/low-can-binding/can/can-message-set.cpp
index 9216f3a3..cfa640a6 100644
--- a/CAN-binder/low-can-binding/can/can-message-set.cpp
+++ b/CAN-binder/low-can-binding/can/can-message-set.cpp
@@ -18,18 +18,27 @@
#include "can-message-set.hpp"
+#include "../can/can-message-definition.hpp"
+
can_message_set_t::can_message_set_t(
uint8_t index,
const std::string& name,
- std::vector<std::shared_ptr<can_message_definition_t> > can_messages_definition)
+ std::vector<std::shared_ptr<can_message_definition_t> > can_messages_definition,
+ std::vector<std::shared_ptr<diagnostic_message_t> > diagnostic_messages)
: index_{index}
, name_{name}
, can_messages_definition_{can_messages_definition}
+ , diagnostic_messages_{diagnostic_messages}
{
for(auto& cmd : can_messages_definition_)
{
cmd->set_parent(this);
}
+
+ for(auto& dm : diagnostic_messages_)
+ {
+ dm->set_parent(this);
+ }
}
/// @brief Return vector holding all message definition handled by this message set.
@@ -51,4 +60,9 @@ std::vector<std::shared_ptr<can_signal_t> > can_message_set_t::get_can_signals()
}
return can_signals;
+}
+
+std::vector<std::shared_ptr<diagnostic_message_t> > can_message_set_t::get_diagnostic_messages()
+{
+ return diagnostic_messages_;
} \ No newline at end of file
diff --git a/CAN-binder/low-can-binding/can/can-message-set.hpp b/CAN-binder/low-can-binding/can/can-message-set.hpp
index 9555d005..1cc50429 100644
--- a/CAN-binder/low-can-binding/can/can-message-set.hpp
+++ b/CAN-binder/low-can-binding/can/can-message-set.hpp
@@ -23,9 +23,9 @@
#include <vector>
#include <memory>
-#include "can-message-definition.hpp"
-
class can_signal_t;
+class can_message_definition_t;
+class diagnostic_message_t;
/// @brief A parent wrapper for a particular set of CAN messages and associated
/// CAN buses(e.g. a vehicle or program).
@@ -35,13 +35,16 @@ private:
uint8_t index_; /// < A numerical ID for the message set, ideally the index in an array for fast lookup
const std::string name_; /// < The name of the message set.
std::vector<std::shared_ptr<can_message_definition_t> > can_messages_definition_; ///< Vector holding all message definition handled by this message set.
+ std::vector<std::shared_ptr<diagnostic_message_t> > diagnostic_messages_; ///< Vector holding all diagnostics messages from JSON signals description file. First vector map to message set
public:
can_message_set_t(
uint8_t index,
const std::string& name,
- std::vector<std::shared_ptr<can_message_definition_t> > can_messages_definition);
+ std::vector<std::shared_ptr<can_message_definition_t> > can_messages_definition,
+ std::vector<std::shared_ptr<diagnostic_message_t> > diagnostic_messages);
std::vector<std::shared_ptr<can_message_definition_t> > get_can_message_definition();
std::vector<std::shared_ptr<can_signal_t> > get_can_signals() const;
+ std::vector<std::shared_ptr<diagnostic_message_t> > get_diagnostic_messages();
};
diff --git a/CAN-binder/low-can-binding/can/can-signals.hpp b/CAN-binder/low-can-binding/can/can-signals.hpp
index 1277bf36..addca1d3 100644
--- a/CAN-binder/low-can-binding/can/can-signals.hpp
+++ b/CAN-binder/low-can-binding/can/can-signals.hpp
@@ -24,6 +24,7 @@
#include <memory>
#include "openxc.pb.h"
+#include "can-message-definition.hpp"
#include "../utils/timer.hpp"
#include "../utils/socketcan-bcm.hpp"
#include "can-message.hpp"
@@ -38,7 +39,6 @@ extern "C"
#define MESSAGE_SET_ID 0
class can_signal_t;
-class can_message_definition_t;
///
/// @brief The type signature for a CAN signal decoder.
///