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 196 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, profinet::OneOctetShift, payload, and transferStatus.

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

+ 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 253 of file rt.h.

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

Referenced by 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 260 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 246 of file rt.h.

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

Referenced by 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 239 of file rt.h.

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

Referenced by profinet::cyclic::CyclicController::ProcessInputFrame(), 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 32 of file rt.cpp.

References cycleCounter, dataStatus, frameId, profinet::LowByteMask, profinet::OneOctetShift, payload, and transferStatus.

Referenced by profinet::rt::BuildEthernetFrame().

+ 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 45 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 202 of file rt.h.

Referenced by FromBytes(), profinet::cyclic::CyclicController::ProcessInputFrame(), profinet::cyclic::CyclicController::SendOutputFrame(), 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 224 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 218 of file rt.h.

◆ DATA_RUN

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

Alias for DATA_STATUS_PROVIDER_RUN, for readability at call sites.

Definition at line 221 of file rt.h.

◆ DATA_VALID

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

Alias for DATA_STATUS_VALID, for readability at call sites.

Definition at line 215 of file rt.h.

◆ dataStatus

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

Data status bitmask (see DATA_STATUS_* constants).

Definition at line 205 of file rt.h.

Referenced by FromBytes(), IsOk(), IsPrimary(), IsRunning(), IsValid(), profinet::cyclic::CyclicController::SendOutputFrame(), and ToBytes().

◆ frameId

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

Frame ID identifying which IOCR this frame belongs to.

Definition at line 199 of file rt.h.

Referenced by FromBytes(), profinet::cyclic::CyclicController::ProcessInputFrame(), profinet::cyclic::CyclicController::SendOutputFrame(), ToBytes(), and ToString().

◆ payload

Bytes profinet::rt::RTFrame::payload

C_SDU payload: process data plus IOPS/IOCS trailers.

Definition at line 211 of file rt.h.

Referenced by FromBytes(), profinet::cyclic::CyclicController::ProcessInputFrame(), profinet::cyclic::CyclicController::SendOutputFrame(), ToBytes(), and ToString().

◆ transferStatus

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

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