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

ExpectedSubmoduleBlockReq (0x0104) builder. More...

#include <blocks.h>

+ Collaboration diagram for profinet::blocks::ExpectedSubmoduleBlockReq:

Public Member Functions

ExpectedSubmoduleBlockReqAddSubmodule (std::uint32_t api, std::uint16_t slot, std::uint16_t subslot, std::uint32_t moduleIdent, std::uint32_t submoduleIdent, std::uint16_t submoduleType=0, std::uint16_t inputLength=0, std::uint16_t outputLength=0)
 Add a single submodule.
 
Bytes ToBytes () const
 Serialize the complete block to raw bytes.
 

Static Public Attributes

static constexpr std::uint16_t expectedSubmoduleBlockReqBlockType = 0x0104
 Block type identifier for ExpectedSubmoduleBlockReq.
 

Private Attributes

std::vector< ExpectedSubmoduleAPIapis
 APIs added so far, each with its own module/submodule list.
 

Detailed Description

ExpectedSubmoduleBlockReq (0x0104) builder.

Per IEC 61158-6-10 and the Wireshark/p-net reference implementations, there is NO NumberOfDataDescriptions field: the data descriptions follow SubmoduleProperties directly, and their count is implied by SubmoduleProperties.type (NO_IO: 1 zero-length Input description; INPUT: 1 Input; OUTPUT: 1 Output; INPUT_OUTPUT: Input then Output).

Note: rpc.cpp's RPCCon::buildExpectedSubmoduleBlock() has its own simplified inline builder for the flattened rpc::IOSlot model used by RPCCon::Connect()'s cyclic-IO setup path; this class is the more general, directly-ported version and is the one to prefer for new code that needs multiple APIs or more control over module/submodule properties.

Definition at line 674 of file blocks.h.

Member Function Documentation

◆ AddSubmodule()

ExpectedSubmoduleBlockReq & profinet::blocks::ExpectedSubmoduleBlockReq::AddSubmodule ( std::uint32_t  api,
std::uint16_t  slot,
std::uint16_t  subslot,
std::uint32_t  moduleIdent,
std::uint32_t  submoduleIdent,
std::uint16_t  submoduleType = 0,
std::uint16_t  inputLength = 0,
std::uint16_t  outputLength = 0 
)

Add a single submodule.

Parameters
apiAPI number.
slotSlot number.
subslotSubslot number.
moduleIdentExpected module ident number.
submoduleIdentExpected submodule ident number.
submoduleType0=NO_IO, 1=INPUT, 2=OUTPUT, or 3=INPUT_OUTPUT.
inputLengthInput data length in bytes (used if SubmoduleType includes INPUT).
outputLengthOutput data length in bytes (used if SubmoduleType includes OUTPUT).
Returns
*this, for chaining.

Definition at line 860 of file blocks.cpp.

References profinet::blocks::ExpectedSubmoduleSlot::api, profinet::blocks::ExpectedSubmoduleAPI::api, apis, profinet::blocks::ExpectedSubmodule::dataDescriptions, profinet::blocks::ExpectedSubmoduleAPI::slots, profinet::blocks::ExpectedSubmodule::submoduleIdentNumber, profinet::blocks::ExpectedSubmodule::submoduleProperties, and profinet::blocks::ExpectedSubmodule::subslotNumber.

Referenced by profinet::rpc::RPCCon::BuildExpectedSubmoduleBlock(), and profinet::rpc::RPCCon::BuildUnifiedExpectedSubmoduleBlock().

+ Here is the caller graph for this function:

◆ ToBytes()

Bytes profinet::blocks::ExpectedSubmoduleBlockReq::ToBytes ( ) const

Serialize the complete block to raw bytes.

Returns
The encoded bytes.

Definition at line 934 of file blocks.cpp.

References apis, expectedSubmoduleBlockReqBlockType, profinet::wire::PutU16(), and profinet::wire::PutU8().

Referenced by profinet::rpc::RPCCon::BuildExpectedSubmoduleBlock(), and profinet::rpc::RPCCon::BuildUnifiedExpectedSubmoduleBlock().

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

Member Data Documentation

◆ apis

std::vector<ExpectedSubmoduleAPI> profinet::blocks::ExpectedSubmoduleBlockReq::apis
private

APIs added so far, each with its own module/submodule list.

Definition at line 701 of file blocks.h.

Referenced by AddSubmodule(), and ToBytes().

◆ expectedSubmoduleBlockReqBlockType

constexpr std::uint16_t profinet::blocks::ExpectedSubmoduleBlockReq::expectedSubmoduleBlockReqBlockType = 0x0104
staticconstexpr

Block type identifier for ExpectedSubmoduleBlockReq.

Definition at line 678 of file blocks.h.

Referenced by ToBytes().


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