diff options
-rw-r--r-- | low-can-binding/can/can-decoder.cpp | 9 | ||||
-rw-r--r-- | low-can-binding/can/message/message.hpp | 21 | ||||
-rw-r--r-- | plugins/agl-vcar-signals.cpp | 12 |
3 files changed, 23 insertions, 19 deletions
diff --git a/low-can-binding/can/can-decoder.cpp b/low-can-binding/can/can-decoder.cpp index ae10cd98..488fdfb8 100644 --- a/low-can-binding/can/can-decoder.cpp +++ b/low-can-binding/can/can-decoder.cpp @@ -106,13 +106,16 @@ float decoder_t::parse_signal_bitfield(signal_t& signal, std::shared_ptr<message uint8_t new_start_bit = 0; uint8_t new_end_bit = 0; - if(signal.get_message()->frame_layout_is_bigendian()) - { + if(signal.get_message()->get_flags() & CONTINENTAL_BIT_POSITION) + bit_position = converter_t::continental_bit_position_mess(message->get_length(), + signal.get_bit_position(), + bit_size); + if(signal.get_message()->get_flags() & BIT_POSITION_REVERSED) bit_position = converter_t::bit_position_swap(message->get_length(), signal.get_bit_position(), bit_size); + if(signal.get_message()->get_flags() & FRAME_LAYOUT_IS_BIGENDIAN) message->frame_swap(); - } data = message->get_data_vector(); converter_t::signal_to_bits_bytes(bit_position, bit_size, new_start_byte, new_end_byte, new_start_bit, new_end_bit); diff --git a/low-can-binding/can/message/message.hpp b/low-can-binding/can/message/message.hpp index cc478c33..2c27f1f3 100644 --- a/low-can-binding/can/message/message.hpp +++ b/low-can-binding/can/message/message.hpp @@ -35,16 +35,17 @@ /** * FLAGS */ - -#define INVALID_FLAG 0x0001 -#define CAN_PROTOCOL 0x0002 -#define J1939_PROTOCOL 0x0004 -#define J1939_ADDR_CLAIM_PROTOCOL 0x0008 -#define ISOTP_PROTOCOL 0x0010 -#define ISOTP_SEND 0x0020 -#define ISOTP_RECEIVE 0x0040 -#define CAN_PROTOCOL_WITH_FD_FRAME 0x0080 -#define FRAME_LAYOUT_IS_BIGENDIAN 0x0100 // LE stand for Little Endian +#define CAN_PROTOCOL 0x0001 +#define CAN_PROTOCOL_WITH_FD_FRAME 0x0002 +#define J1939_ADDR_CLAIM_PROTOCOL 0x0004 +#define J1939_PROTOCOL 0x0008 +#define ISOTP_PROTOCOL 0x0010 +#define ISOTP_SEND 0x0020 +#define ISOTP_RECEIVE 0x0040 +#define FRAME_LAYOUT_IS_BIGENDIAN 0x0080 +#define BIT_POSITION_REVERSED 0x0100 +#define CONTINENTAL_BIT_POSITION 0x0200 +#define INVALID_FLAG 0x8000 /// @class message_t /// diff --git a/plugins/agl-vcar-signals.cpp b/plugins/agl-vcar-signals.cpp index 8c1b03f8..946d0564 100644 --- a/plugins/agl-vcar-signals.cpp +++ b/plugins/agl-vcar-signals.cpp @@ -9,7 +9,7 @@ CTLP_CAPI_REGISTER("agl-vcar-signals"); std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set_t{0,"AGL Virtual Car", { // beginning message_definition_ vector - {std::make_shared<message_definition_t>(message_definition_t{"ls",0x30,"",8,0,frequency_clock_t(5.00000f),true, + {std::make_shared<message_definition_t>(message_definition_t{"ls",0x30,"",8,CAN_PROTOCOL,frequency_clock_t(5.00000f),true, { // beginning signals vector {std::make_shared<signal_t> (signal_t{ "hvac.fan.speed",// generic_name @@ -105,7 +105,7 @@ std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set })} } // end signals vector })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3D9,"",8,128,frequency_clock_t(5.00000f),true, +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3D9,"",8,CAN_PROTOCOL_WITH_FD_FRAME,frequency_clock_t(5.00000f),true, { // beginning signals vector {std::make_shared<signal_t> (signal_t{ "engine.speed",// generic_name @@ -178,7 +178,7 @@ std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set })} } // end signals vector })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3E9,"",8,0,frequency_clock_t(5.00000f),true, +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3E9,"",8,CAN_PROTOCOL,frequency_clock_t(5.00000f),true, { // beginning signals vector {std::make_shared<signal_t> (signal_t{ "vehicle.average.speed",// generic_name @@ -205,7 +205,7 @@ std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set })} } // end signals vector })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x4D1,"",8,0,frequency_clock_t(5.00000f),true, +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x4D1,"",8,CAN_PROTOCOL,frequency_clock_t(5.00000f),true, { // beginning signals vector {std::make_shared<signal_t> (signal_t{ "engine.oil.temp",// generic_name @@ -255,7 +255,7 @@ std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set })} } // end signals vector })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x620,"",8,0,frequency_clock_t(5.00000f),true, +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x620,"",8,CAN_PROTOCOL,frequency_clock_t(5.00000f),true, { // beginning signals vector {std::make_shared<signal_t> (signal_t{ "doors.boot.open",// generic_name @@ -374,7 +374,7 @@ std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set })} } // end signals vector })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x799,"",8,0,frequency_clock_t(5.00000f),true, +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x799,"",8,CAN_PROTOCOL,frequency_clock_t(5.00000f),true, { // beginning signals vector {std::make_shared<signal_t> (signal_t{ "windows.front_left.open",// generic_name |