message: Correctly detect extended CAN id. 25/23225/6
authorRomain Forlot <romain.forlot@iot.bzh>
Thu, 21 Nov 2019 16:59:07 +0000 (17:59 +0100)
committerRomain Forlot <romain.forlot@iot.bzh>
Thu, 9 Jan 2020 14:55:03 +0000 (15:55 +0100)
Previous test was always true. This fix the wrong test and then
add the EFF flag correctly on messages using extended
CAN id.

Bug-AGL: SPEC-2988

Change-Id: I69686fd3d5a39ea3a0d1980b4bfa88fe36fb7fe5
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
low-can-binding/can/message-definition.cpp

index 6354127..e6fd862 100644 (file)
@@ -72,9 +72,7 @@ const std::string message_definition_t::get_name() const{
 
 uint32_t message_definition_t::get_id() const
 {
-       return id_ & CAN_EFF_MASK ?
-               id_ | CAN_EFF_FLAG :
-               id_;
+       return ((id_ & CAN_SFF_MASK) != id_) ? id_ | CAN_EFF_FLAG : id_;
 }
 
 bool message_definition_t::is_fd() const