PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
Loading...
Searching...
No Matches
profinet::rt::RTFrame Struct Reference

A single PROFINET Real-Time cyclic frame: Frame ID + C_SDU payload + cycle counter/status trailer. More...

#include <rt.h>

+ Collaboration diagram for profinet::rt::RTFrame:

Public Member Functions

Bytes ToBytes () const
 Serialize this frame back to raw bytes.
 
bool IsValid () const
 Whether the DataStatus valid bit is set.
 
bool IsRunning () const
 Whether the DataStatus provider-run bit is set.
 
bool IsOk () const
 Whether the DataStatus station-OK bit is set.
 
bool IsPrimary () const
 Whether the DataStatus state bit indicates Primary.
 
std::string ToString () const
 Human-readable summary of this frame, for logging/debugging.
 

Static Public Member Functions

static RTFrame FromBytes (const Bytes &data)
 Parse an RT frame from raw bytes (after the Ethernet header).
 

Public Attributes

std::uint16_t frameId = 0
 Frame ID identifying which IOCR this frame belongs to.
 
std::uint16_t cycleCounter = 0
 Cycle counter, incremented each transmission.
 
std::uint8_t dataStatus = 0
 Data status bitmask (see DATA_STATUS_* constants).
 
std::uint8_t transferStatus = 0
 Transfer status (0 = OK).
 
Bytes payload
 C_SDU payload: process data plus IOPS/IOCS trailers.
 

Static Public Attributes

static constexpr std::uint8_t DATA_VALID = DATA_STATUS_VALID
 Alias for DATA_STATUS_VALID, for readability at call sites.
 
static constexpr std::uint8_t DATA_PRIMARY = DATA_STATUS_STATE
 Alias for DATA_STATUS_STATE, for readability at call sites.
 
static constexpr std::uint8_t DATA_RUN = DATA_STATUS_PROVIDER_RUN
 Alias for DATA_STATUS_PROVIDER_RUN, for readability at call sites.
 
static constexpr std::uint8_t DATA_OK = DATA_STATUS_STATION_OK
 Alias for DATA_STATUS_STATION_OK, for readability at call sites.
 

Detailed Description

A single PROFINET Real-Time cyclic frame: Frame ID + C_SDU payload + cycle counter/status trailer.

Definition at line 207 of file rt.h.

Member Function Documentation

◆ FromBytes()

RTFrame profinet::rt::RTFrame::FromBytes ( const Bytes &  data)
static

Parse an RT frame from raw bytes (after the Ethernet header).

Parameters
dataBytes starting at the Frame ID field.
Returns
The parsed frame.

Throws std::runtime_error if Data is too short (< 6 bytes).

Definition at line 14 of file rt.cpp.

References cycleCounter, dataStatus, frameId, payload, profinet::wire::Reader::ReadBytes(), profinet::wire::Reader::Remaining(), transferStatus, profinet::wire::Reader::U16(), and profinet::wire::Reader::U8().

Referenced by profinet::rt::ParseEthernetFrame(), profinet::cyclic::CyclicController::ProcessInputFrame(), profinet::TEST(), profinet::TEST(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsOk()

bool profinet::rt::RTFrame::IsOk ( ) const
inline

Whether the DataStatus station-OK bit is set.

Returns
True if DATA_STATUS_STATION_OK is set.

Definition at line 264 of file rt.h.

References profinet::rt::DATA_STATUS_STATION_OK, and dataStatus.

Referenced by TEST_F(), and ToString().

+ Here is the caller graph for this function:

◆ IsPrimary()

bool profinet::rt::RTFrame::IsPrimary ( ) const
inline

Whether the DataStatus state bit indicates Primary.

Returns
True if DATA_STATUS_STATE is set.

Definition at line 271 of file rt.h.

References profinet::rt::DATA_STATUS_STATE, and dataStatus.

Referenced by ToString().

+ Here is the caller graph for this function:

◆ IsRunning()

bool profinet::rt::RTFrame::IsRunning ( ) const
inline

Whether the DataStatus provider-run bit is set.

Returns
True if DATA_STATUS_PROVIDER_RUN is set.

Definition at line 257 of file rt.h.

References profinet::rt::DATA_STATUS_PROVIDER_RUN, and dataStatus.

Referenced by TEST_F(), and ToString().

+ Here is the caller graph for this function:

◆ IsValid()

bool profinet::rt::RTFrame::IsValid ( ) const
inline

Whether the DataStatus valid bit is set.

Returns
True if DATA_STATUS_VALID is set.

Definition at line 250 of file rt.h.

References profinet::rt::DATA_STATUS_VALID, and dataStatus.

Referenced by TEST_F(), and ToString().

+ Here is the caller graph for this function:

◆ ToBytes()

Bytes profinet::rt::RTFrame::ToBytes ( ) const

Serialize this frame back to raw bytes.

Returns
FrameId(2) + Payload + CycleCounter(2) + DataStatus(1) + TransferStatus(1).

Definition at line 37 of file rt.cpp.

References cycleCounter, dataStatus, frameId, payload, profinet::wire::PutBigEndian(), and transferStatus.

Referenced by profinet::rt::BuildEthernetFrame(), and profinet::cyclic::ReceivedIopsTest::BuildInputFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ToString()

std::string profinet::rt::RTFrame::ToString ( ) const

Human-readable summary of this frame, for logging/debugging.

Returns
A string like "RTFrame(id=0xC001, cycle=5, status=VALID|RUN, payload=40B)".

Definition at line 48 of file rt.cpp.

References cycleCounter, frameId, IsOk(), IsPrimary(), IsRunning(), IsValid(), and payload.

+ Here is the call graph for this function:

Member Data Documentation

◆ cycleCounter

std::uint16_t profinet::rt::RTFrame::cycleCounter = 0

Cycle counter, incremented each transmission.

Definition at line 213 of file rt.h.

Referenced by profinet::cyclic::ReceivedIopsTest::BuildInputFrame(), FromBytes(), profinet::sim::TEST(), profinet::sim::TEST(), TEST_F(), ToBytes(), and ToString().

◆ DATA_OK

constexpr std::uint8_t profinet::rt::RTFrame::DATA_OK = DATA_STATUS_STATION_OK
staticconstexpr

Alias for DATA_STATUS_STATION_OK, for readability at call sites.

Definition at line 235 of file rt.h.

◆ DATA_PRIMARY

constexpr std::uint8_t profinet::rt::RTFrame::DATA_PRIMARY = DATA_STATUS_STATE
staticconstexpr

Alias for DATA_STATUS_STATE, for readability at call sites.

Definition at line 229 of file rt.h.

◆ DATA_RUN

constexpr std::uint8_t profinet::rt::RTFrame::DATA_RUN = DATA_STATUS_PROVIDER_RUN
staticconstexpr

◆ DATA_VALID

constexpr std::uint8_t profinet::rt::RTFrame::DATA_VALID = DATA_STATUS_VALID
staticconstexpr

◆ dataStatus

std::uint8_t profinet::rt::RTFrame::dataStatus = 0

Data status bitmask (see DATA_STATUS_* constants).

Definition at line 216 of file rt.h.

Referenced by profinet::cyclic::ReceivedIopsTest::BuildInputFrame(), FromBytes(), IsOk(), IsPrimary(), IsRunning(), IsValid(), profinet::sim::TEST(), profinet::sim::TEST(), TEST_F(), and ToBytes().

◆ frameId

◆ payload

Bytes profinet::rt::RTFrame::payload

C_SDU payload: process data plus IOPS/IOCS trailers.

Definition at line 222 of file rt.h.

Referenced by profinet::cyclic::ReceivedIopsTest::BuildInputFrame(), FromBytes(), profinet::sim::TEST(), profinet::sim::TEST(), TEST_F(), ToBytes(), and ToString().

◆ transferStatus

std::uint8_t profinet::rt::RTFrame::transferStatus = 0

Transfer status (0 = OK).

Definition at line 219 of file rt.h.

Referenced by profinet::cyclic::ReceivedIopsTest::BuildInputFrame(), FromBytes(), profinet::sim::TEST(), and ToBytes().


The documentation for this struct was generated from the following files: