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

#include <protocol.h>

+ Collaboration diagram for profinet::PNBlockHeader:

Public Member Functions

Bytes ToBytes () const
 Serialize this header back to raw bytes.
 

Static Public Member Functions

static PNBlockHeader Parse (const Bytes &data)
 Parse a block header from raw bytes.
 

Public Attributes

BlockType blockType = BlockType::Unknown
 Block type identifier.
 
std::uint16_t blockLength = 0
 Length in bytes of the block body (excludes Type/Length fields).
 
std::uint8_t blockVersionHigh = 1
 Block format major version.
 
std::uint8_t blockVersionLow = 0
 Block format minor version.
 

Static Public Attributes

static constexpr BlockType IODReadRequestHeader = BlockType::IoDataReadRequest
 Generic 6-byte PROFINET block header (Type + Length + Version).
 
static constexpr std::uint16_t IODReadResponseHeader = 0x8009
 Block type: IODReadResponseHeader.
 
static constexpr std::uint16_t InM0 = 0x0020
 Block type: I&M0.
 
static constexpr std::uint16_t InM0FilterDataSubModul = 0x0030
 Block type: I&M0 filter data (submodule level).
 
static constexpr std::uint16_t InM0FilterDataModul = 0x0031
 Block type: I&M0 filter data (module level).
 
static constexpr std::uint16_t InM0FilterDataDevice = 0x0032
 Block type: I&M0 filter data (device level).
 
static constexpr std::uint16_t DEFAULT_BLOCK_LENGTH = 60
 Default block length.
 
static constexpr std::size_t kSize = 6
 Size in bytes of this header.
 

Detailed Description

Definition at line 845 of file protocol.h.

Member Function Documentation

◆ Parse()

static PNBlockHeader profinet::PNBlockHeader::Parse ( const Bytes data)
inlinestatic

Parse a block header from raw bytes.

Parameters
dataBytes starting at the BlockType field.
Returns
The parsed header.

Definition at line 889 of file protocol.h.

References blockLength, blockType, blockVersionHigh, blockVersionLow, kSize, profinet::wire::Reader::U16(), and profinet::wire::Reader::U8().

Referenced by profinet::ParseAlarmNotification().

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

◆ ToBytes()

Bytes profinet::PNBlockHeader::ToBytes ( ) const
inline

Serialize this header back to raw bytes.

Returns
The encoded bytes.

Definition at line 906 of file protocol.h.

References blockLength, blockType, blockVersionHigh, blockVersionLow, profinet::wire::PutU16(), and profinet::wire::PutU8().

Referenced by profinet::rpc::RPCCon::ApplicationReady(), profinet::rpc::RPCCon::BuildAlarmCrBlock(), profinet::rpc::RPCCon::BuildIocrBlock(), profinet::rpc::RPCCon::Connect(), profinet::rpc::RPCCon::Disconnect(), profinet::rpc::RPCCon::Read(), profinet::rpc::RPCCon::ReadImplicit(), profinet::AlarmListener::SendAck(), profinet::rpc::RPCCon::SendControl(), profinet::rpc::RPCCon::Write(), and profinet::rpc::RPCCon::WriteMultiple().

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

Member Data Documentation

◆ blockLength

◆ blockType

◆ blockVersionHigh

◆ blockVersionLow

◆ DEFAULT_BLOCK_LENGTH

constexpr std::uint16_t profinet::PNBlockHeader::DEFAULT_BLOCK_LENGTH = 60
staticconstexpr

Default block length.

Definition at line 868 of file protocol.h.

Referenced by profinet::rpc::RPCCon::Read().

◆ InM0

constexpr std::uint16_t profinet::PNBlockHeader::InM0 = 0x0020
staticconstexpr

Block type: I&M0.

Definition at line 856 of file protocol.h.

◆ InM0FilterDataDevice

constexpr std::uint16_t profinet::PNBlockHeader::InM0FilterDataDevice = 0x0032
staticconstexpr

Block type: I&M0 filter data (device level).

Definition at line 865 of file protocol.h.

◆ InM0FilterDataModul

constexpr std::uint16_t profinet::PNBlockHeader::InM0FilterDataModul = 0x0031
staticconstexpr

Block type: I&M0 filter data (module level).

Definition at line 862 of file protocol.h.

◆ InM0FilterDataSubModul

constexpr std::uint16_t profinet::PNBlockHeader::InM0FilterDataSubModul = 0x0030
staticconstexpr

Block type: I&M0 filter data (submodule level).

Definition at line 859 of file protocol.h.

◆ IODReadRequestHeader

constexpr BlockType profinet::PNBlockHeader::IODReadRequestHeader = BlockType::IoDataReadRequest
staticconstexpr

Generic 6-byte PROFINET block header (Type + Length + Version).

Block type: IODReadRequestHeader.

Definition at line 850 of file protocol.h.

Referenced by profinet::rpc::RPCCon::Read(), and profinet::rpc::RPCCon::ReadImplicit().

◆ IODReadResponseHeader

constexpr std::uint16_t profinet::PNBlockHeader::IODReadResponseHeader = 0x8009
staticconstexpr

Block type: IODReadResponseHeader.

Definition at line 853 of file protocol.h.

◆ kSize

constexpr std::size_t profinet::PNBlockHeader::kSize = 6
staticconstexpr

Size in bytes of this header.

Definition at line 884 of file protocol.h.

Referenced by Parse().


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