diff options
author | Clément Bénier <clement.benier@iot.bzh> | 2019-11-15 11:20:34 +0100 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2020-01-09 14:40:41 +0100 |
commit | 6cc152447e74b1ce7fab6c7aa1f9b4e5e8232444 (patch) | |
tree | 2e4f9dd31136abd18e5c1c52c8bf2a0ec8921331 /low-can-binding/can/can-decoder.hpp | |
parent | 03a4775eefeeba913f69d331e3930700a567c4c5 (diff) |
sign: handle decode methods sign from can value
- add enumeration that represents the way of encoding:
enum sign_t
{
UNSIGNED = 0,
SIGN_BIT = 1,
ONES_COMPLEMENT = 2,
TWOS_COMPLEMENT = 3,
SIGN_BIT_EXTERN = 4
};
- the function handle_sign allows to transform value if negative and
return the sign of the value in order to be multiplied at the end ot the
parcing
Bug-AGL: SPEC-3021
Change-Id: I5766a286488170d930422474b4c4f3a8578ca726
Signed-off-by: Clément Bénier <clement.benier@iot.bzh>
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding/can/can-decoder.hpp')
-rw-r--r-- | low-can-binding/can/can-decoder.hpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/low-can-binding/can/can-decoder.hpp b/low-can-binding/can/can-decoder.hpp index a5e3acbe..02a2c7e1 100644 --- a/low-can-binding/can/can-decoder.hpp +++ b/low-can-binding/can/can-decoder.hpp @@ -24,6 +24,7 @@ class decoder_t { public: + static int handle_sign(const signal_t& signal, std::vector<uint8_t>& data_signal, uint8_t new_end_bit, const std::vector<uint8_t>& can_data); static float parse_signal_bitfield(signal_t& signal, std::shared_ptr<message_t> message); static openxc_DynamicField decode_state(signal_t& signal, std::shared_ptr<message_t> message, bool* send); |