11#include <gtest/gtest.h>
37 frame.cycleCounter = 42;
39 frame.transferStatus = 0;
40 frame.payload = {0xDE, 0xAD, 0xBE, 0xEF};
41 frame.payload.resize(40U, 0x00);
53 std::array<std::uint8_t, 6>{
60 std::array<std::uint8_t, 6>{
69 ASSERT_GE(raw.size(), 18U);
71 EXPECT_EQ(raw[12], 0x81);
72 EXPECT_EQ(raw[13], 0x00);
76 ASSERT_TRUE(parsed.has_value());
78 EXPECT_EQ(parsed->frameId, 0xC001U);
79 EXPECT_EQ(parsed->cycleCounter, 42U);
105 raw.insert(raw.end(), rt.begin(), rt.end());
109 ASSERT_TRUE(parsed.has_value());
111 EXPECT_EQ(parsed->frameId, 0xC001U);
133 raw.insert(raw.end(), 46U, 0x00);
Test fixture for RT Ethernet frame serialization.
static RTFrame MakeFrame()
Build the canonical RT frame used by the tests.
std::optional< RTFrame > ParseEthernetFrame(const Bytes &data)
Parse a complete Ethernet frame and extract its RT frame.
TEST_F(RtFrameTest, DISABLED_TaggedEthernetFrameRoundTrips)
Bytes BuildEthernetFrame(const MacAddress &dstMac, const MacAddress &srcMac, const RTFrame &rtFrame)
Build a complete Ethernet frame carrying an RT frame.
std::vector< std::uint8_t > Bytes
Generic byte buffer alias used throughout the library for raw wire data.
Declares PROFINET RT_CLASS_1 cyclic frame and IOCR data structures.
A single PROFINET Real-Time cyclic frame: Frame ID + C_SDU payload + cycle counter/status trailer.
std::uint16_t frameId
Frame ID identifying which IOCR this frame belongs to.
static constexpr std::uint8_t DATA_RUN
Alias for DATA_STATUS_PROVIDER_RUN, for readability at call sites.
static constexpr std::uint8_t DATA_VALID
Alias for DATA_STATUS_VALID, for readability at call sites.