summaryrefslogtreecommitdiffstats
path: root/low-can-binding/can/signals.cpp
diff options
context:
space:
mode:
authorCorentin Le Gall <corentin.legall@iot.bzh>2019-11-18 16:48:20 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2020-01-09 14:40:41 +0100
commit77a19477d3cb63b5af519853489cc90ead0a111b (patch)
tree9c1b34399e45a8870e3b2d01058e9a6c3481c7e8 /low-can-binding/can/signals.cpp
parent6cc152447e74b1ce7fab6c7aa1f9b4e5e8232444 (diff)
decoder: Fix bit_position swapping
-Added an attribute to signals that tells if the bit_position has been swapped. -Test if bit_size and bit_position gives an "out of range" data Bug-AGL: SPEC-3022 Change-Id: I589565ca923ec807da2d4f0db7c4c92fb737b579 Signed-off-by: Corentin Le Gall <corentin.legall@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding/can/signals.cpp')
-rwxr-xr-xlow-can-binding/can/signals.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/low-can-binding/can/signals.cpp b/low-can-binding/can/signals.cpp
index da8df988..28246a05 100755
--- a/low-can-binding/can/signals.cpp
+++ b/low-can-binding/can/signals.cpp
@@ -71,6 +71,7 @@ signal_t::signal_t(
, sign_{sign}
, bit_sign_position_{bit_sign_position}
, unit_{unit}
+ ,bit_position_is_swapped_{false}
{}
signal_t::signal_t(
@@ -104,6 +105,7 @@ signal_t::signal_t(
, decoder_{decoder}
, encoder_{encoder}
, received_{received}
+ , bit_position_is_swapped_{false}
{}
std::shared_ptr<message_definition_t> signal_t::get_message() const
@@ -251,3 +253,13 @@ const std::string signal_t::get_unit() const
{
return unit_;
}
+
+bool signal_t::bit_position_is_swapped() const
+{
+ return bit_position_is_swapped_;
+}
+
+void signal_t::bit_position_is_swapped_reverse()
+{
+ bit_position_is_swapped_ = !bit_position_is_swapped_;
+}