diff --git a/libuavcan/include/uavcan/internal/transport/can_io.hpp b/libuavcan/include/uavcan/internal/transport/can_io.hpp index bfdfcf4ef7..98efa5431a 100644 --- a/libuavcan/include/uavcan/internal/transport/can_io.hpp +++ b/libuavcan/include/uavcan/internal/transport/can_io.hpp @@ -15,9 +15,8 @@ namespace uavcan { -struct CanRxFrame +struct CanRxFrame : public CanFrame { - CanFrame frame; uint64_t timestamp; uint8_t iface_index; diff --git a/libuavcan/include/uavcan/internal/transport/transfer.hpp b/libuavcan/include/uavcan/internal/transport/transfer.hpp index b7c553ce8f..509ecb1659 100644 --- a/libuavcan/include/uavcan/internal/transport/transfer.hpp +++ b/libuavcan/include/uavcan/internal/transport/transfer.hpp @@ -137,7 +137,7 @@ struct RxFrame bool parse(const CanRxFrame& can_frame) { - if (!frame.parse(can_frame.frame)) + if (!frame.parse(can_frame)) return false; timestamp = can_frame.timestamp; iface_index = can_frame.iface_index; diff --git a/libuavcan/src/transport/can_io.cpp b/libuavcan/src/transport/can_io.cpp index 1cf4f7aa5d..4141a7aea0 100644 --- a/libuavcan/src/transport/can_io.cpp +++ b/libuavcan/src/transport/can_io.cpp @@ -347,7 +347,7 @@ int CanIOManager::receive(CanRxFrame& frame, uint64_t monotonic_deadline) assert(0); // Nonexistent interface continue; } - const int res = iface->receive(frame.frame, frame.timestamp); + const int res = iface->receive(frame, frame.timestamp); if (res == 0) { assert(0); // select() reported that iface has pending RX frames, but receive() returned none diff --git a/libuavcan/test/transport/can/io.cpp b/libuavcan/test/transport/can/io.cpp index 4d337f9259..c51845b108 100644 --- a/libuavcan/test/transport/can/io.cpp +++ b/libuavcan/test/transport/can/io.cpp @@ -196,13 +196,14 @@ TEST(CanIOManager, CanDriverMock) static bool rxFrameEquals(const uavcan::CanRxFrame& rxframe, const uavcan::CanFrame& frame, uint64_t timestamp, int iface_index) { - if (rxframe.frame != frame) + if (static_cast(rxframe) != frame) { std::cout << "Frame mismatch:\n" - << " " << rxframe.frame.toString(uavcan::CanFrame::STR_ALIGNED) << "\n" + << " " << rxframe.toString(uavcan::CanFrame::STR_ALIGNED) << "\n" << " " << frame.toString(uavcan::CanFrame::STR_ALIGNED) << std::endl; } - return (rxframe.frame == frame) && (rxframe.timestamp == timestamp) && (rxframe.iface_index == iface_index); + return (static_cast(rxframe) == frame) && + (rxframe.timestamp == timestamp) && (rxframe.iface_index == iface_index); } TEST(CanIOManager, Reception) diff --git a/libuavcan/test/transport/transfer.cpp b/libuavcan/test/transport/transfer.cpp index 86ec044e2a..1109b52982 100644 --- a/libuavcan/test/transport/transfer.cpp +++ b/libuavcan/test/transport/transfer.cpp @@ -145,7 +145,7 @@ TEST(Transfer, RxFrameParseCompile) ASSERT_FALSE(rx_frame.parse(can_rx_frame)); // Default - can_rx_frame.frame.id = CanFrame::FLAG_EFF; + can_rx_frame.id = CanFrame::FLAG_EFF; ASSERT_TRUE(rx_frame.parse(can_rx_frame)); ASSERT_EQ(0, rx_frame.timestamp); ASSERT_EQ(0, rx_frame.iface_index);