summaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/can
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-10 09:47:50 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-05-10 18:45:55 +0200
commit4e95381b037b783b5f4193134732cb96ff6f52cf (patch)
tree191da42926b23bdc679af4d32db06297065311a8 /CAN-binder/low-can-binding/can
parent415de819e774a7dbe7aa6073c23b6387b1365b9d (diff)
Implement setting last_value at message definition level.
In addition to signal last_values, now message last value is also set. Change-Id: I87c2be3e4e68073d7708b2ddf681889576337410 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-decoder.cpp1
-rw-r--r--CAN-binder/low-can-binding/can/can-message-definition.cpp4
-rw-r--r--CAN-binder/low-can-binding/can/can-message-definition.hpp2
-rw-r--r--CAN-binder/low-can-binding/can/can-message.cpp10
-rw-r--r--CAN-binder/low-can-binding/can/can-message.hpp1
-rw-r--r--CAN-binder/low-can-binding/can/can-signals.cpp2
-rw-r--r--CAN-binder/low-can-binding/can/can-signals.hpp2
7 files changed, 20 insertions, 2 deletions
diff --git a/CAN-binder/low-can-binding/can/can-decoder.cpp b/CAN-binder/low-can-binding/can/can-decoder.cpp
index f36c4b94..442e3738 100644
--- a/CAN-binder/low-can-binding/can/can-decoder.cpp
+++ b/CAN-binder/low-can-binding/can/can-decoder.cpp
@@ -172,6 +172,7 @@ openxc_DynamicField decoder_t::translateSignal(can_signal_t& signal, can_message
*send = false;
}
signal.set_last_value(value);
+ signal.get_message().set_last_value(message);
return decoded_value;
}
diff --git a/CAN-binder/low-can-binding/can/can-message-definition.cpp b/CAN-binder/low-can-binding/can/can-message-definition.cpp
index 98294289..3603bf27 100644
--- a/CAN-binder/low-can-binding/can/can-message-definition.cpp
+++ b/CAN-binder/low-can-binding/can/can-message-definition.cpp
@@ -57,4 +57,8 @@ const std::string& can_message_definition_t::get_bus_name() const
uint32_t can_message_definition_t::get_id() const
{
return id_;
+
+void can_message_definition_t::set_last_value(const can_message_t& cm)
+{
+ last_value_= cm.get_data_vector();
} \ No newline at end of file
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 c3ce2ee3..42eef89f 100644
--- a/CAN-binder/low-can-binding/can/can-message-definition.hpp
+++ b/CAN-binder/low-can-binding/can/can-message-definition.hpp
@@ -54,4 +54,6 @@ public:
const std::string& get_bus_name() const;
uint32_t get_id() const;
+
+ void set_last_value(const can_message_t& cm);
};
diff --git a/CAN-binder/low-can-binding/can/can-message.cpp b/CAN-binder/low-can-binding/can/can-message.cpp
index ac2610e5..3fe2a5c8 100644
--- a/CAN-binder/low-can-binding/can/can-message.cpp
+++ b/CAN-binder/low-can-binding/can/can-message.cpp
@@ -100,6 +100,16 @@ const uint8_t* can_message_t::get_data() const
}
///
+/// @brief Retrieve data_ member whole vector
+///
+/// @return the vector as is
+///
+const std::vector<uint8_t> can_message_t::get_data_vector() const
+{
+ return data_;
+}
+
+///
/// @brief Retrieve length_ member value.
///
/// @return length_ class member
diff --git a/CAN-binder/low-can-binding/can/can-message.hpp b/CAN-binder/low-can-binding/can/can-message.hpp
index d38f7ba2..a7c74521 100644
--- a/CAN-binder/low-can-binding/can/can-message.hpp
+++ b/CAN-binder/low-can-binding/can/can-message.hpp
@@ -64,6 +64,7 @@ public:
can_message_format_t get_format() const;
uint8_t get_flags() const;
const uint8_t* get_data() const;
+ const std::vector<uint8_t> get_data_vector() const;
uint8_t get_length() const;
void set_format(const can_message_format_t new_format);
diff --git a/CAN-binder/low-can-binding/can/can-signals.cpp b/CAN-binder/low-can-binding/can/can-signals.cpp
index d072fb36..ec0b311d 100644
--- a/CAN-binder/low-can-binding/can/can-signals.cpp
+++ b/CAN-binder/low-can-binding/can/can-signals.cpp
@@ -71,7 +71,7 @@ utils::socketcan_bcm_t can_signal_t::get_socket() const
return socket_;
}
-const can_message_definition_t& can_signal_t::get_message() const
+can_message_definition_t& can_signal_t::get_message() const
{
return configuration_t::instance().get_can_message_definition(message_set_id_, message_id_);
}
diff --git a/CAN-binder/low-can-binding/can/can-signals.hpp b/CAN-binder/low-can-binding/can/can-signals.hpp
index 6152b79a..75faedf0 100644
--- a/CAN-binder/low-can-binding/can/can-signals.hpp
+++ b/CAN-binder/low-can-binding/can/can-signals.hpp
@@ -132,7 +132,7 @@ public:
bool received);
utils::socketcan_bcm_t get_socket() const;
- const can_message_definition_t& get_message() const;
+ can_message_definition_t& get_message() const;
const std::string& get_generic_name() const;
const std::string get_name() const;
const std::string& get_prefix() const;