From 77a19477d3cb63b5af519853489cc90ead0a111b Mon Sep 17 00:00:00 2001 From: Corentin Le Gall Date: Mon, 18 Nov 2019 16:48:20 +0100 Subject: 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 Signed-off-by: Romain Forlot --- low-can-binding/can/can-decoder.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'low-can-binding/can/can-decoder.cpp') diff --git a/low-can-binding/can/can-decoder.cpp b/low-can-binding/can/can-decoder.cpp index 19594afa..76ea79e6 100644 --- a/low-can-binding/can/can-decoder.cpp +++ b/low-can-binding/can/can-decoder.cpp @@ -350,9 +350,10 @@ openxc_DynamicField decoder_t::decode_state(signal_t& signal, std::shared_ptr message, bool* send) { - if(!signal.get_message()->frame_layout_is_little()) + if(!signal.get_message()->frame_layout_is_little() && !signal.bit_position_is_swapped()) { signal.set_bit_position(converter_t::bit_position_swap(signal.get_bit_position(),signal.get_bit_size())); + signal.bit_position_is_swapped_reverse(); } // Must call the decoders every time, regardless of if we are going to // decide to send the signal or not. -- cgit 1.2.3-korg