|
PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
|
Connection to a PROFINET IO-Device: establishes an AR (Application Relationship) and performs acyclic read/write and CONTROL operations. More...
#include <rpc.h>
Inheritance diagram for profinet::rpc::RPCCon:
Collaboration diagram for profinet::rpc::RPCCon:Public Member Functions | |
| RPCCon (RPCCon &&)=delete | |
| Deleted move constructor to prevent moving instances of this class. | |
| RPCCon & | operator= (RPCCon &&)=delete |
| Deleted move assignment operator to prevent moving instances of this class. | |
| RPCCon (const dcp::DCPDeviceDescription &info, RPCConOptions options={}, std::unique_ptr< IRpcTransport > rpcTransport=nullptr, std::unique_ptr< IRpcTransport > ccontrolTransport=nullptr, asio::io_context *context=nullptr) | |
| Prepare a PROFINET DCE/RPC connection object for an IO-device (does not connect yet). | |
| ~RPCCon () | |
| Disconnect (best-effort) and close the underlying sockets. | |
| RPCCon (const RPCCon &)=delete | |
| Not copyable because the connection owns non-copyable Asio sockets. | |
| RPCCon & | operator= (const RPCCon &)=delete |
| Not copyable because the connection owns non-copyable Asio sockets. | |
| std::optional< ConnectResult > | Connect (std::optional< MacAddress > srcMac=std::nullopt, bool withAlarmCr=false, std::optional< IOCRSetup > iocrSetup=std::nullopt) override |
| Establish (or re-establish) the AR with the device. | |
| PNIODHeader | Read (std::uint32_t api, std::uint16_t slot, std::uint16_t subslot, std::uint16_t idx) override |
| Read a data record via slot/subslot/index (AR must be connected). | |
| PNIODHeader | ReadImplicit (std::uint32_t api, std::uint16_t slot, std::uint16_t subslot, std::uint16_t idx) override |
| Read a data record without an established AR. | |
| void | Write (std::uint32_t api, std::uint16_t slot, std::uint16_t subslot, std::uint16_t idx, const Bytes &data) override |
| Write a data record via slot/subslot/index (AR must be connected). | |
| std::vector< blocks::WriteMultipleResult > | WriteMultiple (const std::vector< WriteItem > &writes) override |
| Write multiple records atomically via IODWriteMultipleReq (0xE040). | |
| Bytes | ReadRaw (std::uint16_t idx, std::uint16_t slot=0, std::uint16_t subslot=1) |
| Read a raw record payload by index (convenience wrapper over Read()). | |
| PNInM0 | ReadIm0 (std::uint16_t slot=0, std::uint16_t subslot=1) override |
| Read I&M0 (mandatory identification data). | |
| PNInM1 | ReadIm1 (std::uint16_t slot=0, std::uint16_t subslot=1) override |
| Read I&M1 (tag function/location). | |
| PNInM2 | ReadIm2 (std::uint16_t slot=0, std::uint16_t subslot=1) override |
| Read I&M2 (installation date). | |
| PNInM3 | ReadIm3 (std::uint16_t slot=0, std::uint16_t subslot=1) override |
| Read I&M3 (free-text descriptor). | |
| PNInM4 | ReadIm4 (std::uint16_t slot=0, std::uint16_t subslot=1) override |
| Read I&M4 (PROFIsafe signature). | |
| PNInM5 | ReadIm5 (std::uint16_t slot=0, std::uint16_t subslot=1) override |
| Read I&M5 (free-text annotation). | |
| PNInM6 | ReadIm6 (std::uint16_t slot=0, std::uint16_t subslot=1) override |
| Read I&M6 (reserved). | |
| PNInM7 | ReadIm7 (std::uint16_t slot=0, std::uint16_t subslot=1) override |
| Read I&M7 (reserved). | |
| PNInM8 | ReadIm8 (std::uint16_t slot=0, std::uint16_t subslot=1) override |
| Read I&M8 (reserved). | |
| PNInM9 | ReadIm9 (std::uint16_t slot=0, std::uint16_t subslot=1) override |
| Read I&M9 (reserved). | |
| PNInM10 | ReadIm10 (std::uint16_t slot=0, std::uint16_t subslot=1) override |
| Read I&M10 (reserved). | |
| PNInM11 | ReadIm11 (std::uint16_t slot=0, std::uint16_t subslot=1) override |
| Read I&M11 (reserved). | |
| PNInM12 | ReadIm12 (std::uint16_t slot=0, std::uint16_t subslot=1) override |
| Read I&M12 (reserved). | |
| PNInM13 | ReadIm13 (std::uint16_t slot=0, std::uint16_t subslot=1) override |
| Read I&M13 (reserved). | |
| PNInM14 | ReadIm14 (std::uint16_t slot=0, std::uint16_t subslot=1) override |
| Read I&M14 (reserved). | |
| PNInM15 | ReadIm15 (std::uint16_t slot=0, std::uint16_t subslot=1) override |
| Read I&M15 (reserved). | |
| AllIM | ReadAllIm (std::uint16_t slot=0, std::uint16_t subslot=1) override |
| Read all I&M records a device supports. | |
| blocks::ModuleDiffBlock | ReadModuleDiff () override |
| Read and parse the device's ModuleDiffBlock. | |
| diagnosis::DiagnosisData | ReadDiagnosis (std::uint16_t slot=0, std::uint16_t subslot=0, std::uint16_t index=0xF000) override |
| Read and parse diagnosis data at the given location/index. | |
| std::map< std::uint16_t, diagnosis::DiagnosisData > | ReadAllDiagnosis () override |
| Read diagnosis from all standard diagnosis indices. | |
| blocks::PDRealData | ReadPdRealData () override |
| Read and parse the device's PDRealData (physical topology). | |
| blocks::RealIdentificationData | ReadRealIdentificationData () override |
| Read and parse the device's RealIdentificationData (logical structure). | |
| std::vector< blocks::SlotInfo > | DiscoverSlots () override |
| Convenience accessor for ReadRealIdentificationData().Slots. | |
| std::pair< blocks::PDRealData, blocks::RealIdentificationData > | DiscoverTopology () override |
| Read both PDRealData and RealIdentificationData in one call. | |
| std::map< std::uint16_t, IndexProbeResult > | EnumerateIndices (std::uint16_t slot=0, std::uint16_t subslot=1, std::optional< std::vector< std::uint16_t > > customIndices=std::nullopt) override |
| Probe a set of indices and report which are readable/empty/erroring. | |
| Bytes | PrmBegin () override |
| Send PrmBegin (start of the parameterization phase). | |
| Bytes | PrmEnd () override |
| Send PrmEnd (end of the parameterization phase). | |
| Bytes | ReadyForRtClass3 () override |
| Send ReadyForRTClass3 (isochronous real-time readiness). | |
| Bytes | ApplicationReady (double timeoutSec=30.0) override |
| Wait for the device's CControl/ApplicationReady request and confirm it. | |
| void | Disconnect () override |
| Send Release to terminate the AR. | |
| void | Close () noexcept override |
| Disconnect() and close the underlying sockets. | |
| bool | IsConnected () const override |
| Whether the AR is currently established. | |
| const dcp::DCPDeviceDescription & | Info () const override |
| The device this connection targets. | |
| const std::array< std::uint8_t, uuidLenght > & | ArUuid () const |
| The AR UUID for this connection. | |
| std::uint16_t | SessionKey () const |
| The session key for this connection. | |
| std::uint16_t | LocalAlarmRef () const override |
| Controller's own local alarm reference. | |
| int | DeviceAlarmRef () const override |
| Device's local alarm reference, from AlarmCRBlockRes. | |
| bool | HasAlarmCr () const override |
| Whether an AlarmCR was successfully established. | |
| std::vector< EPMEndpoint > | EpmLookup (const std::string &ip, std::uint16_t port=RPC_PORT, double timeoutSec=DEFAULT_TIMEOUT, std::optional< std::string > interfaceFilter=std::nullopt) override |
| Query a device's Endpoint Mapper for available RPC endpoints. | |
Public Member Functions inherited from profinet::rpc::IRPCCon | |
| virtual | ~IRPCCon ()=default |
| Virtual destructor. | |
Private Member Functions | |
| PNRPCHeader | CreateRpc (std::uint16_t operation, const Bytes &nrd) |
| Build an RPC header for the given operation and NRD body. | |
| Bytes | BuildAlarmCrBlock (int transport=0, int priority=0) const |
| Build an AlarmCRBlockReq for inclusion in the CONNECT request. | |
| PNRPCHeader | SendReceive (const PNRPCHeader &request) |
| Send an RPC request and synchronously wait for its response. | |
| void | CloseSockets () noexcept |
| Close the RPC and CControl UDP sockets. | |
| void | CheckTimeout () |
| Reconnect if the AR has been idle longer than CONNECTION_TIMEOUT. | |
| Bytes | SendControl (BlockType blockType, ControlCommand controlCommand, bool waitResponse=true, const Bytes &subBlocks={}) |
| Send a CONTROL operation and optionally wait for its response. | |
Static Private Member Functions | |
| static PNNRDData | CreateNrd (const Bytes &payload) |
| Wrap a payload in an NRD (Network Representation Data) header. | |
| static int | ParseAlarmCrResponse (const Bytes &responseData) |
| Parse the AlarmCRBlockRes from a CONNECT response. | |
| static Bytes | BuildIocrBlock (IocrType iocrType, const IOCRSetup &setup) |
| Build an IOCRBlockReq (header + API object list) for the CONNECT request. | |
| static Bytes | BuildExpectedSubmoduleBlock (const IOCRSetup &setup) |
| Build an ExpectedSubmoduleBlockReq for the CONNECT request. | |
| static std::uint16_t | ParseIocrResponse (const Bytes &responseData, int iocrType) |
| Parse an IOCRBlockRes from a CONNECT response. | |
Private Attributes | |
| dcp::DCPDeviceDescription | info |
| DCP-discovered description of the target device. | |
| double | timeout |
| Default RPC response timeout in seconds. | |
| std::array< std::uint8_t, 3 > | dataRepresentation {0x00, 0x00, 0x00} |
| AR DREP for this connection. | |
| std::array< std::uint8_t, uuidLenght > | arUuid {} |
| AR UUID for this connection. | |
| std::array< std::uint8_t, uuidLenght > | activityUuid {} |
| Activity UUID for the current RPC exchange. | |
| std::array< std::uint8_t, uuidLenght > | interfaceUuid {} |
| Interface UUID for the current RPC exchange. | |
| std::array< std::uint8_t, uuidLenght > | localObjectUuid {} |
| This controller's own object UUID. | |
| std::array< std::uint8_t, uuidLenght > | remoteObjectUuid {} |
| The target device's object UUID. | |
| bool | live = false |
| Whether the AR is currently established. | |
| bool | reconnecting = false |
| Whether timeout has occured and reconnection is needed. | |
| std::chrono::steady_clock::time_point | liveMonotonic {} |
| Timestamp of the last successful RPC exchange, for CONNECTION_TIMEOUT tracking. | |
| std::optional< MacAddress > | srcMac |
| Source MAC address used to establish the AR. | |
| std::uint16_t | sessionKey = 0 |
| Session key for this connection. | |
| std::uint16_t | alarmRef = 0x8001 |
| Controller's own local alarm reference. | |
| int | deviceAlarmRef = 0 |
| Device's local alarm reference, if an AlarmCR was established. | |
| bool | alarmCrEnabled = false |
| Whether an AlarmCR was successfully established. | |
| std::uint32_t | sequenceNumber = 0 |
| Monotonically increasing RPC sequence number. | |
| int | inputIocrRef = 0 |
| IOCR reference for the input (device -> controller) IOCR. | |
| int | outputIocrRef = 0 |
| IOCR reference for the output (controller -> device) IOCR. | |
| std::uint16_t | inputFrameId = 0 |
| Frame ID assigned to the input IOCR. | |
| std::uint16_t | outputFrameId = 0 |
| Frame ID assigned to the output IOCR. | |
| std::optional< IOCRSetup > | iocrSetup |
| Cyclic IO configuration used for the current AR, if any. | |
| std::unique_ptr< asio::io_context > | rpcContext |
| std::unique_ptr< IAsioIoContextRunner > | rpcContextRunner |
| asio::io_context & | ioContext |
| Asio execution context used by the RPC transport. | |
| std::unique_ptr< IRpcTransport > | rpcTransport |
| std::unique_ptr< IRpcTransport > | ccontrolTransport |
| std::unique_ptr< IRpcTransport > | ccontrolResponseTransport |
Friends | |
| class | RpcTests |
| FRIEND_CLASS declaration granting access to the specific test case for validating CreateRpc. | |
Connection to a PROFINET IO-Device: establishes an AR (Application Relationship) and performs acyclic read/write and CONTROL operations.
Example:
|
delete |
Deleted move constructor to prevent moving instances of this class.
|
explicit |
Prepare a PROFINET DCE/RPC connection object for an IO-device (does not connect yet).
The constructor initializes the Asio UDP transports but does not establish a PROFINET Application Relationship. The AR is established by Connect().
| info | DCP-discovered description of the target device. |
| options | A configured RPCConOption in which you can set timeoutSec |
| rpcTransport | An optional injectable RPC connection for general DCE/RPC communication, for testing mainly. |
| ccontrolTransport | An optional injectable RPC connection for control DCE/RPC communication, for testing mainly. Default RPC response timeout. |
Definition at line 573 of file rpc.cpp.
References activityUuid, arUuid, profinet::rpc::BuildObjectUuid(), profinet::dcp::DCPDeviceDescription::deviceHigh, profinet::dcp::DCPDeviceDescription::deviceLow, profinet::PNRPCHeader::IfaceUuidDevice(), info, interfaceUuid, ioContext, profinet::dcp::DCPDeviceDescription::ip, localObjectUuid, remoteObjectUuid, profinet::rpc::RPC_PORT, profinet::rpc::RPCConOptions::rpcPort, profinet::dcp::DCPDeviceDescription::vendorHigh, and profinet::dcp::DCPDeviceDescription::vendorLow.
Here is the call graph for this function:| profinet::rpc::RPCCon::~RPCCon | ( | ) |
|
delete |
Not copyable because the connection owns non-copyable Asio sockets.
|
overridevirtual |
Wait for the device's CControl/ApplicationReady request and confirm it.
| timeoutSec | How long to wait for the request. |
Sent by the device after PrmEnd. Throws RPCTimeoutError if nothing arrives within TimeoutSec.
| Offset (Dec) | Offset (Hex) | Field Name | Size (Bytes) | Description / Parsing Logic |
|---|---|---|---|---|
| 0 | 0x00 | rpc_vers | 1 | Protocol Version (0x04) |
| 1 | 0x01 | ptype | 1 | Packet Type (0x00 = Req, 0x02 = Resp) |
| 2 | 0x02 | flags1 | 1 | First flags group |
| 3 | 0x03 | flags2 | 1 | Second flags group |
| 4 | 0x04 | drep | 3 | Data Representation (drep[0] defines Endianness) |
| 7 | 0x07 | serial_hi | 1 | Split tracking sequence byte (High) |
| 8 | 0x08 | object | 16 | Object UUID (DREP-aware) |
| 24 | 0x18 | if_id | 16 | Interface UUID (DREP-aware) |
| 40 | 0x28 | act_id | 16 | Activity UUID (DREP-aware) |
| 56 | 0x38 | server_boot | 4 | Server Boot Time (DREP-aware, skipped here) |
| 60 | 0x3C | if_vers | 4 | Interface Version (DREP-aware) |
| 64 | 0x40 | seqnum | 4 | Sequence Number (DREP-aware) |
| 68 | 0x44 | opnum | 2 | Operation Number (DREP-aware) |
| 70–77 | 0x46–0x4D | Hint/Len/Frag | 8 | Internal routing data (skipped here) |
| 78 | 0x4E | auth_proto | 1 | Authentication Protocol ID |
| 79 | 0x4F | serial_lo | 1 | Split tracking sequence byte (Low) |
Implements profinet::rpc::IRPCCon.
Definition at line 1903 of file rpc.cpp.
References profinet::PNIODReleaseBlock::arUuid, arUuid, profinet::rpc::BLOCK_IOD_CONTROL_APP_READY_REQ, profinet::PNIODReleaseBlock::blockHeader, profinet::blockHeaderLength, profinet::PNBlockHeader::blockLength, profinet::PNBlockHeader::blockType, profinet::PNBlockHeader::blockVersionHigh, profinet::PNBlockHeader::blockVersionLow, ccontrolTransport, CheckTimeout(), profinet::PNRPCHeader::CONTROL, profinet::ControlApplicationReadyResponse, profinet::PNIODReleaseBlock::controlBlockProperties, profinet::PNIODReleaseBlock::controlCommand, profinet::PNRPCHeader::defaultActivityHint, profinet::PNRPCHeader::defaultInterfaceHint, profinet::Done, profinet::PNIODHeader::kContolCommandOffset, profinet::rpc::raw::LastFragment, live, liveMonotonic, profinet::rpc::raw::NoFack, profinet::PNIODReleaseBlock::padding1, profinet::PNIODReleaseBlock::padding2, profinet::rpc::raw::ParseRawRpcHeader(), profinet::wire::PutFixed(), profinet::wire::PutLittleEndian(), profinet::wire::PutU16(), profinet::wire::PutU32(), profinet::PNRPCHeader::REQUEST, profinet::PNRPCHeader::RESPONSE, profinet::PNIODReleaseBlock::sessionKey, sessionKey, profinet::wire::Reader::SkipTo(), profinet::PNBlockHeader::ToBytes(), profinet::PNIODReleaseBlock::ToBytes(), profinet::wire::Reader::U16(), profinet::wire::Reader::U32(), and profinet::wire::Reader::U32LittleEndian().
Here is the call graph for this function:
|
inline |
The AR UUID for this connection.
Definition at line 421 of file rpc.h.
References arUuid.
Referenced by TEST_F(), profinet::rpc::TEST_F(), and profinet::rpc::TEST_F().
Here is the caller graph for this function:
|
private |
Build an AlarmCRBlockReq for inclusion in the CONNECT request.
| transport | Transport type (0 = RTA over Ethernet). |
| priority | Alarm priority. |
Definition at line 653 of file rpc.cpp.
References profinet::PNAlarmCRBlockReq::alarmCrProperties, profinet::PNAlarmCRBlockReq::alarmCrTagHeaderHigh, profinet::PNAlarmCRBlockReq::alarmCrTagHeaderLow, profinet::PNAlarmCRBlockReq::alarmCrType, alarmRef, profinet::PNAlarmCRBlockReq::BLOCK_TYPE, profinet::PNAlarmCRBlockReq::blockHeader, profinet::blockHeaderLength, profinet::PNBlockHeader::blockLength, profinet::PNBlockHeader::blockType, profinet::PNBlockHeader::blockVersionHigh, profinet::PNBlockHeader::blockVersionLow, profinet::PNAlarmCRBlockReq::DEFAULT_MAX_ALARM_DATA_LENGTH, profinet::PNAlarmCRBlockReq::DEFAULT_RTA_RETRIES, profinet::PNAlarmCRBlockReq::DEFAULT_RTA_TIMEOUT_FACTOR, profinet::PNAlarmCRBlockReq::DEFAULT_TAG_HEADER_HIGH, profinet::PNAlarmCRBlockReq::DEFAULT_TAG_HEADER_LOW, profinet::PNAlarmCRBlockReq::etherTypeLT, profinet::IP_ETHERTYPE, profinet::PNAlarmCRBlockReq::kSize, profinet::PNAlarmCRBlockReq::localAlarmReference, profinet::PNAlarmCRBlockReq::maxAlarmDataLength, profinet::PROFINET_ETHERTYPE, profinet::PNAlarmCRBlockReq::rtaRetries, profinet::PNAlarmCRBlockReq::rtaTimeoutFactor, profinet::PNBlockHeader::ToBytes(), profinet::PNAlarmCRBlockReq::ToBytes(), profinet::rpc::VERSION_HIGH, and profinet::rpc::VERSION_LOW.
Referenced by Connect().
Here is the call graph for this function:
Here is the caller graph for this function:Build an ExpectedSubmoduleBlockReq for the CONNECT request.
| setup | Cyclic IO configuration describing the expected slots. |
Definition at line 1079 of file rpc.cpp.
References profinet::blocks::ExpectedSubmoduleBlockReq::AddSubmodule(), profinet::blocks::ExpectedSubmoduleBlockReq::Clear(), profinet::blocks::InputAndOutput, profinet::blocks::InputOnly, profinet::blocks::None, profinet::blocks::OutputOnly, profinet::rpc::IOCRSetup::slots, and profinet::blocks::ExpectedSubmoduleBlockReq::ToBytes().
Referenced by Connect().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Build an IOCRBlockReq (header + API object list) for the CONNECT request.
| iocrType | IOCR type (Input/Output). |
| setup | Cyclic IO configuration. |
Definition at line 703 of file rpc.cpp.
References profinet::rpc::Advanced, profinet::rpc::IOCRSetup::applicationRelations, profinet::PNIOCRBlockReqHeader::BLOCK_TYPE, profinet::PNIOCRBlockReqHeader::blockHeader, profinet::PNBlockHeader::blockLength, profinet::PNBlockHeader::blockType, profinet::PNBlockHeader::blockVersionHigh, profinet::PNBlockHeader::blockVersionLow, profinet::PNIOCRBlockReqHeader::dataHoldFactor, profinet::rpc::IOCRSetup::dataHoldFactor, profinet::PNIOCRBlockReqHeader::dataLength, profinet::PNIOCRBlockReqHeader::etherTypeLT, profinet::PNIOCRBlockReqHeader::frameId, profinet::PNIOCRBlockReqHeader::frameSendOffset, profinet::Input, profinet::PNIOCRBlockReqHeader::iocrMulticastMac, profinet::PNIOCRBlockReqHeader::iocrProperties, profinet::PNIOCRBlockReqHeader::iocrReference, profinet::PNIOCRBlockReqHeader::iocrTagHeader, profinet::PNIOCRBlockReqHeader::iocrType, profinet::PNIOCRBlockReqHeader::kSize, profinet::PNIOCRBlockReqHeader::numberOfApis, profinet::Output, profinet::PNIOCRBlockReqHeader::phase, profinet::PROFINET_ETHERTYPE, profinet::wire::PutU16(), profinet::wire::PutU32(), profinet::PNIOCRBlockReqHeader::reductionRatio, profinet::rpc::IOCRSetup::reductionRatio, profinet::PNIOCRBlockReqHeader::sendClockFactor, profinet::rpc::IOCRSetup::sendClockFactor, profinet::PNIOCRBlockReqHeader::sequence, profinet::rpc::IOCRSetup::slots, profinet::rpc::ApplicationRelations::startupMode, profinet::PNBlockHeader::ToBytes(), profinet::PNIOCRBlockReqHeader::ToBytes(), profinet::rpc::VERSION_HIGH, profinet::rpc::VERSION_LOW, profinet::PNIOCRBlockReqHeader::watchdogFactor, and profinet::rpc::IOCRSetup::watchdogFactor.
Referenced by Connect(), and profinet::rpc::RpcTests::InvokeBuildIocrBlock().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Reconnect if the AR has been idle longer than CONNECTION_TIMEOUT.
Definition at line 1210 of file rpc.cpp.
References Connect(), profinet::rpc::CONNECTION_TIMEOUT, live, liveMonotonic, and reconnecting.
Referenced by ApplicationReady(), Read(), SendReceive(), Write(), and WriteMultiple().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtualnoexcept |
Disconnect() and close the underlying sockets.
Called automatically by the destructor.
Implements profinet::rpc::IRPCCon.
Definition at line 2139 of file rpc.cpp.
References ccontrolTransport, Disconnect(), and rpcTransport.
Referenced by ~RPCCon(), profinet::device::ProfinetDevice::ReadImplicit(), and TEST_F().
Here is the call graph for this function:
Here is the caller graph for this function:
|
privatenoexcept |
Close the RPC and CControl UDP sockets.
|
overridevirtual |
Establish (or re-establish) the AR with the device.
| srcMac | Source MAC address; required on the first call. |
| withAlarmCr | Whether to also request an AlarmCR (not all devices support it). |
| iocrSetup | If set, also establish cyclic IO (EXPERIMENTAL). |
Throws RPCConnectionError on failure.
Implements profinet::rpc::IRPCCon.
Definition at line 1223 of file rpc.cpp.
References activityUuid, profinet::rpc::Advanced, alarmCrEnabled, profinet::ApplicationRelationRequest, profinet::PNNRDData::argsMaximumStatus, profinet::PNARBlockRequest::arProperties, profinet::PNARBlockRequest::arType, profinet::PNARBlockRequest::arUuid, arUuid, profinet::rpc::ConnectResult::arUuid, profinet::PNARBlockRequest::blockHeader, profinet::blockHeaderLength, profinet::PNBlockHeader::blockLength, profinet::PNBlockHeader::blockType, profinet::PNBlockHeader::blockVersionHigh, profinet::PNBlockHeader::blockVersionLow, BuildAlarmCrBlock(), BuildExpectedSubmoduleBlock(), BuildIocrBlock(), profinet::PNARBlockRequest::cmInitiatorActivityTimeoutFactor, profinet::PNARBlockRequest::cmInitiatorMacAddress, profinet::PNARBlockRequest::cmInitiatorObjectUuid, profinet::PNARBlockRequest::cmInitiatorStationName, profinet::PNRPCHeader::CONNECT, CreateNrd(), CreateRpc(), dataRepresentation, deviceAlarmRef, profinet::PNIOError::FromArgsStatus(), profinet::PNARBlockRequest::initiatorUdpRtport, profinet::Input, inputFrameId, iocrSetup, profinet::PNARBlockRequest::kFixedSize, live, localObjectUuid, profinet::Output, outputFrameId, profinet::PNNRDData::Parse(), ParseAlarmCrResponse(), ParseIocrResponse(), profinet::rpc::raw::ParseRawRpcHeader(), profinet::PNRPCHeader::payload, profinet::PNNRDData::payload, profinet::PROFINET_ETHERTYPE, reconnecting, SendReceive(), profinet::PNARBlockRequest::sessionKey, sessionKey, srcMac, profinet::PNARBlockRequest::stationNameLength, profinet::PNNRDData::ToBytes(), profinet::PNBlockHeader::ToBytes(), profinet::PNARBlockRequest::ToBytes(), profinet::rpc::VERSION_HIGH, and profinet::rpc::VERSION_LOW.
Referenced by CheckTimeout(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), 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:Wrap a payload in an NRD (Network Representation Data) header.
| payload | Payload to wrap. |
Definition at line 641 of file rpc.cpp.
References profinet::PNNRDData::actualCount, profinet::PNNRDData::argsLength, profinet::PNNRDData::argsMaximumStatus, profinet::PNNRDData::maximumCount, profinet::PNNRDData::offset, profinet::PNNRDData::payload, and payload.
Referenced by Connect(), Disconnect(), Read(), ReadImplicit(), SendControl(), Write(), and WriteMultiple().
Here is the caller graph for this function:
|
private |
Build an RPC header for the given operation and NRD body.
| operation | RPC operation number. |
| nrd | Serialized NRD body. |
Definition at line 615 of file rpc.cpp.
References profinet::PNRPCHeader::activityHint, profinet::PNRPCHeader::activityUuid, activityUuid, profinet::PNRPCHeader::authenticationProtocol, profinet::PNRPCHeader::dataRepresentation, profinet::PNRPCHeader::defaultActivityHint, profinet::PNRPCHeader::defaultInterfaceHint, profinet::PNRPCHeader::flags1, profinet::PNRPCHeader::flags2, profinet::PNRPCHeader::fragmentNumber, profinet::rpc::raw::Idempotent, profinet::PNRPCHeader::interfaceHint, profinet::PNRPCHeader::interfaceUuid, interfaceUuid, profinet::PNRPCHeader::interfaceVersion, profinet::PNRPCHeader::lengthOfBody, profinet::PNRPCHeader::objectUuid, profinet::PNRPCHeader::operationNumber, profinet::PNRPCHeader::packetType, profinet::PNRPCHeader::payload, remoteObjectUuid, profinet::PNRPCHeader::REQUEST, profinet::PNRPCHeader::sequenceNumber, sequenceNumber, profinet::PNRPCHeader::serialNrHigh, profinet::PNRPCHeader::serialNrLow, profinet::PNRPCHeader::serverBootTime, and profinet::PNRPCHeader::version.
Referenced by Connect(), Disconnect(), Read(), ReadImplicit(), SendControl(), Write(), and WriteMultiple().
Here is the caller graph for this function:
|
inlineoverridevirtual |
Device's local alarm reference, from AlarmCRBlockRes.
Needed by AlarmEndpoint::DeviceRef regardless of whether cyclic IO (and thus a ConnectResult) was also requested.
Implements profinet::rpc::IRPCCon.
Definition at line 446 of file rpc.h.
References deviceAlarmRef.
|
overridevirtual |
Send Release to terminate the AR.
Best-effort, does not wait for a response. Safe to call when not connected (no-op).
Implements profinet::rpc::IRPCCon.
Definition at line 2101 of file rpc.cpp.
References profinet::PNIODReleaseBlock::arUuid, arUuid, profinet::PNIODReleaseBlock::blockHeader, profinet::blockHeaderLength, profinet::PNBlockHeader::blockLength, profinet::PNBlockHeader::blockType, profinet::PNBlockHeader::blockVersionHigh, profinet::PNBlockHeader::blockVersionLow, profinet::PNIODReleaseBlock::controlBlockProperties, profinet::PNIODReleaseBlock::controlCommand, CreateNrd(), CreateRpc(), live, profinet::PNIODReleaseBlock::padding1, profinet::PNIODReleaseBlock::padding2, profinet::Release, profinet::PNRPCHeader::RELEASE, profinet::ReleaseRequest, rpcTransport, profinet::PNIODReleaseBlock::sessionKey, sessionKey, profinet::PNRPCHeader::ToBytes(), profinet::PNNRDData::ToBytes(), profinet::PNBlockHeader::ToBytes(), and profinet::PNIODReleaseBlock::ToBytes().
Referenced by Close(), TEST_F(), and TEST_F().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Convenience accessor for ReadRealIdentificationData().Slots.
Implements profinet::rpc::IRPCCon.
Definition at line 1713 of file rpc.cpp.
References ReadRealIdentificationData(), and profinet::blocks::RealIdentificationData::slots.
Here is the call graph for this function:
|
overridevirtual |
Read both PDRealData and RealIdentificationData in one call.
Implements profinet::rpc::IRPCCon.
Definition at line 1718 of file rpc.cpp.
References ReadPdRealData(), and ReadRealIdentificationData().
Here is the call graph for this function:
|
overridevirtual |
Probe a set of indices and report which are readable/empty/erroring.
| slot | Slot number to probe. |
| subslot | Subslot number to probe. |
| customIndices | If provided, only these indices are probed; otherwise the standard catalog (I&M, diagnosis, port/interface, device) is used. |
Implements profinet::rpc::IRPCCon.
Definition at line 1723 of file rpc.cpp.
References profinet::DeviceIndices(), profinet::DiagnosisIndices(), profinet::rpc::IndexProbeResult::error, profinet::PNIOError::errorCode1, profinet::rpc::IndexProbeResult::errorCode1, profinet::PNIOError::errorCode2, profinet::rpc::IndexProbeResult::errorCode2, profinet::EXPECTED_ID_SUBSLOT, profinet::GetIndexName(), profinet::ImIndices(), profinet::InterfaceIndices(), profinet::MODULE_DIFF_BLOCK, profinet::Name, profinet::rpc::IndexProbeResult::name, profinet::PNIODHeader::payload, profinet::PortIndices(), Read(), profinet::REAL_ID_SUBSLOT, profinet::RECORD_INPUT_DATA, profinet::RECORD_OUTPUT_DATA, profinet::rpc::IndexProbeResult::size, and profinet::rpc::IndexProbeResult::status.
Here is the call graph for this function:
|
overridevirtual |
Query a device's Endpoint Mapper for available RPC endpoints.
| ioContext | Asio execution context. |
| ip | IPv4 address of the device to query. |
| port | UDP port of the device's Endpoint Mapper (defaults to RPC_PORT). |
| timeoutSec | How long to wait for a response. |
| interfaceFilter | If set, only endpoints for this interface UUID are requested. |
Implements profinet::rpc::IRPCCon.
Definition at line 330 of file rpc.cpp.
References profinet::PNRPCHeader::defaultActivityHint, profinet::PNRPCHeader::defaultInterfaceHint, profinet::rpc::EPM_INQUIRY_ALL, profinet::rpc::EPM_INQUIRY_INTERFACE, profinet::rpc::EPM_LOOKUP, profinet::wire::Reader::Fixed(), profinet::rpc::raw::Idempotent, ioContext, profinet::PNRPCHeader::kFixedSize, profinet::rpc::raw::RawRpcHeader::kLittleEndianDrepFlag, profinet::rpc::RpcTransport::Open(), profinet::rpc::ParseEpmTower(), profinet::wire::PutFixed(), profinet::wire::PutLittleEndian(), profinet::PNRPCHeader::REQUEST, profinet::rpc::RpcTransport::SendReceive(), profinet::wire::Reader::SkipTo(), profinet::rpc::StringToUuidBytes(), profinet::wire::Reader::U16LittleEndian(), profinet::wire::Reader::U32LittleEndian(), profinet::rpc::UUID_EPM_V4, profinet::rpc::UuidBytesToString(), and profinet::uuidLenght.
Here is the call graph for this function:
|
inlineoverridevirtual |
Whether an AlarmCR was successfully established.
Implements profinet::rpc::IRPCCon.
Definition at line 453 of file rpc.h.
References alarmCrEnabled.
Referenced by TEST_F().
Here is the caller graph for this function:
|
inlineoverridevirtual |
The device this connection targets.
Implements profinet::rpc::IRPCCon.
Definition at line 414 of file rpc.h.
References info.
Referenced by TEST_F().
Here is the caller graph for this function:
|
inlineoverridevirtual |
Whether the AR is currently established.
Implements profinet::rpc::IRPCCon.
Definition at line 407 of file rpc.h.
References live.
Referenced by TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
Here is the caller graph for this function:
|
inlineoverridevirtual |
Controller's own local alarm reference.
Implements profinet::rpc::IRPCCon.
Definition at line 435 of file rpc.h.
References alarmRef.
Not copyable because the connection owns non-copyable Asio sockets.
Deleted move assignment operator to prevent moving instances of this class.
|
staticprivate |
Parse the AlarmCRBlockRes from a CONNECT response.
| responseData | Raw CONNECT response NRD payload. |
Definition at line 679 of file rpc.cpp.
References profinet::PNAlarmCRBlockRes::BLOCK_TYPE, profinet::blockHeaderLength, profinet::PNAlarmCRBlockRes::Parse(), and profinet::rpc::PeekBlockHeader().
Referenced by Connect().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Parse an IOCRBlockRes from a CONNECT response.
| responseData | Raw CONNECT response NRD payload. |
| iocrType | IOCR type to look for (Input or Output). |
Definition at line 1132 of file rpc.cpp.
References profinet::PNIOCRBlockRes::BLOCK_TYPE, profinet::blockHeaderLength, profinet::PNIOCRBlockRes::Parse(), and profinet::rpc::PeekBlockHeader().
Referenced by Connect(), and profinet::rpc::RpcTests::InvokeParseIocrResponse().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Send PrmBegin (start of the parameterization phase).
Implements profinet::rpc::IRPCCon.
Definition at line 1843 of file rpc.cpp.
References profinet::ParameterizationBeginRequest, profinet::PrmBegin, and SendControl().
Here is the call graph for this function:
|
overridevirtual |
Send PrmEnd (end of the parameterization phase).
Implements profinet::rpc::IRPCCon.
Definition at line 1847 of file rpc.cpp.
References profinet::ControlPrmEndRequest, profinet::PrmEnd, and SendControl().
Here is the call graph for this function:
|
overridevirtual |
Read a data record via slot/subslot/index (AR must be connected).
| api | API number. |
| slot | Slot number. |
| subslot | Subslot number. |
| idx | Record data index to read. |
Throws PNIOError on a device-reported error, RPCTimeoutError on timeout.
Implements profinet::rpc::IRPCCon.
Definition at line 1364 of file rpc.cpp.
References profinet::PNIODHeader::api, profinet::PNNRDData::argsMaximumStatus, profinet::PNIODHeader::arUuid, arUuid, profinet::PNIODHeader::blockHeader, profinet::blockHeaderLength, profinet::PNBlockHeader::blockLength, profinet::PNBlockHeader::blockType, profinet::PNBlockHeader::blockVersionHigh, profinet::PNBlockHeader::blockVersionLow, CheckTimeout(), CreateNrd(), CreateRpc(), profinet::PNBlockHeader::DEFAULT_BLOCK_LENGTH, profinet::PNIOError::FromArgsStatus(), profinet::PNIODHeader::index, profinet::PNBlockHeader::IODReadRequestHeader, profinet::PNIODHeader::length, profinet::PNIODHeader::padding1, profinet::PNIODHeader::padding2, profinet::PNNRDData::Parse(), profinet::PNIODHeader::Parse(), profinet::PNRPCHeader::payload, profinet::PNNRDData::payload, profinet::PNRPCHeader::READ, SendReceive(), profinet::PNIODHeader::sequenceNumber, profinet::PNIODHeader::slot, profinet::PNIODHeader::subslot, profinet::PNIODHeader::targetArUuid, profinet::PNNRDData::ToBytes(), profinet::PNIODHeader::ToBytes(), profinet::PNBlockHeader::ToBytes(), profinet::rpc::VERSION_HIGH, and profinet::rpc::VERSION_LOW.
Referenced by EnumerateIndices(), ReadDiagnosis(), ReadIm0(), ReadIm1(), ReadIm10(), ReadIm11(), ReadIm12(), ReadIm13(), ReadIm14(), ReadIm15(), ReadIm2(), ReadIm3(), ReadIm4(), ReadIm5(), ReadIm6(), ReadIm7(), ReadIm8(), ReadIm9(), ReadModuleDiff(), ReadPdRealData(), ReadRaw(), and ReadRealIdentificationData().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Read diagnosis from all standard diagnosis indices.
Covers subslot/device/API-level indices.
Implements profinet::rpc::IRPCCon.
Definition at line 1671 of file rpc.cpp.
References profinet::diagnosis::DiagnosisData::entries, and ReadDiagnosis().
Here is the call graph for this function:
|
overridevirtual |
Read all I&M records a device supports.
| slot | Slot number (defaults to 0, the device's DAP). |
| subslot | Subslot number (defaults to 1). |
Implements profinet::rpc::IRPCCon.
Definition at line 1540 of file rpc.cpp.
References profinet::rpc::AllIM::im0, profinet::rpc::AllIM::im1, profinet::rpc::AllIM::im10, profinet::rpc::AllIM::im11, profinet::rpc::AllIM::im12, profinet::rpc::AllIM::im13, profinet::rpc::AllIM::im14, profinet::rpc::AllIM::im15, profinet::rpc::AllIM::im2, profinet::rpc::AllIM::im3, profinet::rpc::AllIM::im4, profinet::rpc::AllIM::im5, profinet::rpc::AllIM::im6, profinet::rpc::AllIM::im7, profinet::rpc::AllIM::im8, profinet::rpc::AllIM::im9, ReadIm0(), ReadIm1(), ReadIm10(), ReadIm11(), ReadIm12(), ReadIm13(), ReadIm14(), ReadIm15(), ReadIm2(), ReadIm3(), ReadIm4(), ReadIm5(), ReadIm6(), ReadIm7(), ReadIm8(), and ReadIm9().
Here is the call graph for this function:
|
overridevirtual |
Read and parse diagnosis data at the given location/index.
| slot | Slot number to read diagnosis for. |
| subslot | Subslot number to read diagnosis for. |
| index | Diagnosis record index to read. |
Falls back from the full block parser to the simple parser if the full parse yields no entries. Returns an empty DiagnosisData (does not throw) on any RPCError.
Implements profinet::rpc::IRPCCon.
Definition at line 1638 of file rpc.cpp.
References profinet::diagnosis::DiagnosisData::api, profinet::diagnosis::DiagnosisData::entries, profinet::diagnosis::ParseDiagnosisBlock(), profinet::diagnosis::ParseDiagnosisSimple(), profinet::PNIODHeader::payload, profinet::diagnosis::DiagnosisData::rawData, Read(), profinet::diagnosis::DiagnosisData::slot, and profinet::diagnosis::DiagnosisData::subslot.
Referenced by ReadAllDiagnosis().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Read I&M0 (mandatory identification data).
| slot | Slot number (defaults to 0, the device's DAP). |
| subslot | Subslot number (defaults to 1). |
Implements profinet::rpc::IRPCCon.
Definition at line 1475 of file rpc.cpp.
References profinet::PNInM0::IDX, profinet::PNInM0::Parse(), payload, and Read().
Referenced by ReadAllIm().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Read I&M1 (tag function/location).
| slot | Slot number (defaults to 0, the device's DAP). |
| subslot | Subslot number (defaults to 1). |
Implements profinet::rpc::IRPCCon.
Definition at line 1479 of file rpc.cpp.
References profinet::PNInM1::IDX, profinet::PNInM1::Parse(), payload, and Read().
Referenced by ReadAllIm().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Read I&M10 (reserved).
| slot | Slot number (defaults to 0, the device's DAP). |
| subslot | Subslot number (defaults to 1). |
Implements profinet::rpc::IRPCCon.
Definition at line 1515 of file rpc.cpp.
References profinet::PNInMReserved< Idx >::IDX, profinet::PNInMReserved< Idx >::Parse(), payload, and Read().
Referenced by ReadAllIm().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Read I&M11 (reserved).
| slot | Slot number (defaults to 0, the device's DAP). |
| subslot | Subslot number (defaults to 1). |
Implements profinet::rpc::IRPCCon.
Definition at line 1519 of file rpc.cpp.
References profinet::PNInMReserved< Idx >::IDX, profinet::PNInMReserved< Idx >::Parse(), payload, and Read().
Referenced by ReadAllIm().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Read I&M12 (reserved).
| slot | Slot number (defaults to 0, the device's DAP). |
| subslot | Subslot number (defaults to 1). |
Implements profinet::rpc::IRPCCon.
Definition at line 1523 of file rpc.cpp.
References profinet::PNInMReserved< Idx >::IDX, profinet::PNInMReserved< Idx >::Parse(), payload, and Read().
Referenced by ReadAllIm().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Read I&M13 (reserved).
| slot | Slot number (defaults to 0, the device's DAP). |
| subslot | Subslot number (defaults to 1). |
Implements profinet::rpc::IRPCCon.
Definition at line 1527 of file rpc.cpp.
References profinet::PNInMReserved< Idx >::IDX, profinet::PNInMReserved< Idx >::Parse(), payload, and Read().
Referenced by ReadAllIm().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Read I&M14 (reserved).
| slot | Slot number (defaults to 0, the device's DAP). |
| subslot | Subslot number (defaults to 1). |
Implements profinet::rpc::IRPCCon.
Definition at line 1531 of file rpc.cpp.
References profinet::PNInMReserved< Idx >::IDX, profinet::PNInMReserved< Idx >::Parse(), payload, and Read().
Referenced by ReadAllIm().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Read I&M15 (reserved).
| slot | Slot number (defaults to 0, the device's DAP). |
| subslot | Subslot number (defaults to 1). |
Implements profinet::rpc::IRPCCon.
Definition at line 1535 of file rpc.cpp.
References profinet::PNInMReserved< Idx >::IDX, profinet::PNInMReserved< Idx >::Parse(), payload, and Read().
Referenced by ReadAllIm().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Read I&M2 (installation date).
| slot | Slot number (defaults to 0, the device's DAP). |
| subslot | Subslot number (defaults to 1). |
Implements profinet::rpc::IRPCCon.
Definition at line 1483 of file rpc.cpp.
References profinet::PNInM2::IDX, profinet::PNInM2::Parse(), payload, and Read().
Referenced by ReadAllIm().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Read I&M3 (free-text descriptor).
| slot | Slot number (defaults to 0, the device's DAP). |
| subslot | Subslot number (defaults to 1). |
Implements profinet::rpc::IRPCCon.
Definition at line 1487 of file rpc.cpp.
References profinet::PNInM3::IDX, profinet::PNInM3::Parse(), payload, and Read().
Referenced by ReadAllIm().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Read I&M4 (PROFIsafe signature).
| slot | Slot number (defaults to 0, the device's DAP). |
| subslot | Subslot number (defaults to 1). |
Implements profinet::rpc::IRPCCon.
Definition at line 1491 of file rpc.cpp.
References profinet::PNInM4::IDX, profinet::PNInM4::Parse(), payload, and Read().
Referenced by ReadAllIm().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Read I&M5 (free-text annotation).
| slot | Slot number (defaults to 0, the device's DAP). |
| subslot | Subslot number (defaults to 1). |
Implements profinet::rpc::IRPCCon.
Definition at line 1495 of file rpc.cpp.
References profinet::PNInM5::IDX, profinet::PNInM5::Parse(), payload, and Read().
Referenced by ReadAllIm().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Read I&M6 (reserved).
| slot | Slot number (defaults to 0, the device's DAP). |
| subslot | Subslot number (defaults to 1). |
Implements profinet::rpc::IRPCCon.
Definition at line 1499 of file rpc.cpp.
References profinet::PNInMReserved< Idx >::IDX, profinet::PNInMReserved< Idx >::Parse(), payload, and Read().
Referenced by ReadAllIm().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Read I&M7 (reserved).
| slot | Slot number (defaults to 0, the device's DAP). |
| subslot | Subslot number (defaults to 1). |
Implements profinet::rpc::IRPCCon.
Definition at line 1503 of file rpc.cpp.
References profinet::PNInMReserved< Idx >::IDX, profinet::PNInMReserved< Idx >::Parse(), payload, and Read().
Referenced by ReadAllIm().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Read I&M8 (reserved).
| slot | Slot number (defaults to 0, the device's DAP). |
| subslot | Subslot number (defaults to 1). |
Implements profinet::rpc::IRPCCon.
Definition at line 1507 of file rpc.cpp.
References profinet::PNInMReserved< Idx >::IDX, profinet::PNInMReserved< Idx >::Parse(), payload, and Read().
Referenced by ReadAllIm().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Read I&M9 (reserved).
| slot | Slot number (defaults to 0, the device's DAP). |
| subslot | Subslot number (defaults to 1). |
Implements profinet::rpc::IRPCCon.
Definition at line 1511 of file rpc.cpp.
References profinet::PNInMReserved< Idx >::IDX, profinet::PNInMReserved< Idx >::Parse(), payload, and Read().
Referenced by ReadAllIm().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Read a data record without an established AR.
| api | API number. |
| slot | Slot number. |
| subslot | Subslot number. |
| idx | Record data index to read. |
Implements profinet::rpc::IRPCCon.
Definition at line 1400 of file rpc.cpp.
References profinet::PNIODHeader::api, profinet::PNNRDData::argsMaximumStatus, profinet::PNIODHeader::arUuid, profinet::PNIODHeader::blockHeader, profinet::blockHeaderLength, profinet::PNBlockHeader::blockLength, profinet::PNBlockHeader::blockType, profinet::PNBlockHeader::blockVersionHigh, profinet::PNBlockHeader::blockVersionLow, CreateNrd(), CreateRpc(), profinet::PNIOError::FromArgsStatus(), profinet::PNRPCHeader::IMPLICIT_READ, profinet::PNIODHeader::index, profinet::PNBlockHeader::IODReadRequestHeader, profinet::PNIODHeader::length, profinet::PNIODHeader::padding1, profinet::PNIODHeader::padding2, profinet::PNNRDData::Parse(), profinet::PNIODHeader::Parse(), profinet::PNRPCHeader::payload, profinet::PNNRDData::payload, SendReceive(), profinet::PNIODHeader::sequenceNumber, profinet::PNIODHeader::slot, profinet::PNIODHeader::subslot, profinet::PNIODHeader::targetArUuid, profinet::PNNRDData::ToBytes(), profinet::PNIODHeader::ToBytes(), and profinet::PNBlockHeader::ToBytes().
Referenced by profinet::device::ProfinetDevice::ReadImplicit().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Read and parse the device's ModuleDiffBlock.
Implements profinet::rpc::IRPCCon.
Definition at line 1632 of file rpc.cpp.
References profinet::MODULE_DIFF_BLOCK, profinet::blocks::ParseModuleDiffBlock(), profinet::PNIODHeader::payload, and Read().
Here is the call graph for this function:
|
overridevirtual |
Read and parse the device's PDRealData (physical topology).
Implements profinet::rpc::IRPCCon.
Definition at line 1701 of file rpc.cpp.
References profinet::blocks::ParsePdRealData(), profinet::PNIODHeader::payload, profinet::PD_REAL_DATA, and Read().
Referenced by DiscoverTopology().
Here is the call graph for this function:
Here is the caller graph for this function:| Bytes profinet::rpc::RPCCon::ReadRaw | ( | std::uint16_t | idx, |
| std::uint16_t | slot = 0, |
||
| std::uint16_t | subslot = 1 |
||
| ) |
Read a raw record payload by index (convenience wrapper over Read()).
| idx | Record data index to read. |
| slot | Slot number. |
| subslot | Subslot number. |
Definition at line 1470 of file rpc.cpp.
References profinet::PNIODHeader::payload, and Read().
Here is the call graph for this function:
|
overridevirtual |
Read and parse the device's RealIdentificationData (logical structure).
Implements profinet::rpc::IRPCCon.
Definition at line 1707 of file rpc.cpp.
References profinet::blocks::ParseRealIdentificationData(), profinet::PNIODHeader::payload, Read(), and profinet::REAL_ID_API.
Referenced by DiscoverSlots(), and DiscoverTopology().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Send ReadyForRTClass3 (isochronous real-time readiness).
Implements profinet::rpc::IRPCCon.
Definition at line 1851 of file rpc.cpp.
References profinet::ControlRtClass3Request, profinet::ReadyForRtClass3, and SendControl().
Here is the call graph for this function:
|
private |
Send a CONTROL operation and optionally wait for its response.
| blockType | Control block type. |
| controlCommand | Control command bitmask. |
| waitResponse | Whether to wait for and return the response. |
| subBlocks | Additional blocks to append after the control block. |
Definition at line 1797 of file rpc.cpp.
References profinet::PNNRDData::argsMaximumStatus, profinet::PNIODReleaseBlock::arUuid, arUuid, profinet::PNIODReleaseBlock::blockHeader, profinet::blockHeaderLength, profinet::PNBlockHeader::blockLength, profinet::PNBlockHeader::blockType, profinet::PNBlockHeader::blockVersionHigh, profinet::PNBlockHeader::blockVersionLow, profinet::PNRPCHeader::CONTROL, profinet::PNIODReleaseBlock::controlBlockProperties, profinet::PNIODReleaseBlock::controlCommand, CreateNrd(), CreateRpc(), profinet::PNIOError::FromArgsStatus(), live, profinet::PNIODReleaseBlock::padding1, profinet::PNIODReleaseBlock::padding2, profinet::PNNRDData::Parse(), profinet::PNRPCHeader::payload, profinet::PNNRDData::payload, rpcTransport, SendReceive(), profinet::PNIODReleaseBlock::sessionKey, sessionKey, profinet::PNRPCHeader::ToBytes(), profinet::PNNRDData::ToBytes(), profinet::PNBlockHeader::ToBytes(), and profinet::PNIODReleaseBlock::ToBytes().
Referenced by PrmBegin(), PrmEnd(), and ReadyForRtClass3().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Send an RPC request and synchronously wait for its response.
| request | RPC request packet to transmit. |
| RPCTimeoutError | when no response arrives before the configured timeout. |
| RPCError | when the socket or RPC response is invalid. |
Definition at line 1160 of file rpc.cpp.
References CheckTimeout(), profinet::PNRPCHeader::FAULT, info, profinet::PNRPCHeader::kFixedSize, live, liveMonotonic, profinet::dcp::DCPDeviceDescription::name, profinet::PNRPCHeader::operationNumber, profinet::PNRPCHeader::packetType, profinet::PNRPCHeader::Parse(), profinet::PNRPCHeader::REJECT, profinet::PNRPCHeader::REQUEST, profinet::PNRPCHeader::RESPONSE, rpcTransport, timeout, and profinet::PNRPCHeader::ToBytes().
Referenced by Connect(), Read(), ReadImplicit(), SendControl(), Write(), and WriteMultiple().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
The session key for this connection.
Definition at line 428 of file rpc.h.
References sessionKey.
Referenced by TEST_F(), TEST_F(), profinet::rpc::TEST_F(), and profinet::rpc::TEST_F().
Here is the caller graph for this function:
|
overridevirtual |
Write a data record via slot/subslot/index (AR must be connected).
| api | API number. |
| slot | Slot number. |
| subslot | Subslot number. |
| idx | Record data index to write. |
| data | Record data to write. |
Implements profinet::rpc::IRPCCon.
Definition at line 1434 of file rpc.cpp.
References profinet::PNIODHeader::api, profinet::PNNRDData::argsMaximumStatus, profinet::PNIODHeader::arUuid, arUuid, profinet::PNIODHeader::blockHeader, profinet::blockHeaderLength, profinet::PNBlockHeader::blockLength, profinet::PNBlockHeader::blockType, profinet::PNBlockHeader::blockVersionHigh, profinet::PNBlockHeader::blockVersionLow, CheckTimeout(), CreateNrd(), CreateRpc(), profinet::PNIOError::FromArgsStatus(), profinet::PNIODHeader::index, profinet::IoDataWriteRequest, profinet::PNIODHeader::length, profinet::PNIODHeader::padding1, profinet::PNIODHeader::padding2, profinet::PNNRDData::Parse(), profinet::PNRPCHeader::payload, profinet::PNIODHeader::payload, SendReceive(), profinet::PNIODHeader::sequenceNumber, profinet::PNIODHeader::slot, profinet::PNIODHeader::subslot, profinet::PNIODHeader::targetArUuid, profinet::PNNRDData::ToBytes(), profinet::PNIODHeader::ToBytes(), profinet::PNBlockHeader::ToBytes(), and profinet::PNRPCHeader::WRITE.
Here is the call graph for this function:
|
overridevirtual |
Write multiple records atomically via IODWriteMultipleReq (0xE040).
| writes | The individual write operations to perform. |
Throws PNIOError/RPCError if the overall request fails; individual per-write results are returned rather than thrown.
Implements profinet::rpc::IRPCCon.
Definition at line 1584 of file rpc.cpp.
References profinet::blocks::IODWriteMultipleBuilder::AddWrite(), profinet::PNIODHeader::api, profinet::PNNRDData::argsMaximumStatus, profinet::PNIODHeader::arUuid, arUuid, profinet::PNIODHeader::blockHeader, profinet::blockHeaderLength, profinet::PNBlockHeader::blockLength, profinet::PNBlockHeader::blockType, profinet::PNBlockHeader::blockVersionHigh, profinet::PNBlockHeader::blockVersionLow, profinet::blocks::IODWriteMultipleBuilder::Build(), CheckTimeout(), CreateNrd(), CreateRpc(), profinet::PNIOError::FromArgsStatus(), profinet::PNIODHeader::index, profinet::IoDataWriteRequest, profinet::PNIODHeader::length, profinet::PNIODHeader::padding1, profinet::PNIODHeader::padding2, profinet::PNNRDData::Parse(), profinet::blocks::ParseWriteMultipleResponse(), profinet::PNRPCHeader::payload, profinet::PNNRDData::payload, profinet::PNIODHeader::payload, payload, SendReceive(), profinet::PNIODHeader::sequenceNumber, profinet::PNIODHeader::slot, profinet::PNIODHeader::subslot, profinet::PNIODHeader::targetArUuid, profinet::PNNRDData::ToBytes(), profinet::PNIODHeader::ToBytes(), profinet::PNBlockHeader::ToBytes(), profinet::PNRPCHeader::WRITE, and profinet::blocks::IODWriteMultipleBuilder::writeMultipleIndex.
Here is the call graph for this function:
|
friend |
|
private |
Activity UUID for the current RPC exchange.
Definition at line 546 of file rpc.h.
Referenced by RPCCon(), Connect(), and CreateRpc().
|
private |
Whether an AlarmCR was successfully established.
Definition at line 580 of file rpc.h.
Referenced by Connect(), and HasAlarmCr().
|
private |
Controller's own local alarm reference.
Definition at line 574 of file rpc.h.
Referenced by BuildAlarmCrBlock(), and LocalAlarmRef().
|
private |
AR UUID for this connection.
Definition at line 543 of file rpc.h.
Referenced by RPCCon(), ApplicationReady(), ArUuid(), Connect(), Disconnect(), Read(), SendControl(), Write(), and WriteMultiple().
|
private |
|
private |
Definition at line 606 of file rpc.h.
Referenced by ApplicationReady(), and Close().
|
private |
|
private |
Device's local alarm reference, if an AlarmCR was established.
Definition at line 577 of file rpc.h.
Referenced by Connect(), and DeviceAlarmRef().
|
private |
DCP-discovered description of the target device.
Definition at line 534 of file rpc.h.
Referenced by RPCCon(), Info(), and SendReceive().
|
private |
|
private |
|
private |
Interface UUID for the current RPC exchange.
Definition at line 549 of file rpc.h.
Referenced by RPCCon(), and CreateRpc().
|
private |
Asio execution context used by the RPC transport.
Definition at line 603 of file rpc.h.
Referenced by RPCCon(), and EpmLookup().
|
private |
|
private |
Whether the AR is currently established.
Definition at line 558 of file rpc.h.
Referenced by ApplicationReady(), CheckTimeout(), Connect(), Disconnect(), IsConnected(), SendControl(), and SendReceive().
|
private |
Timestamp of the last successful RPC exchange, for CONNECTION_TIMEOUT tracking.
Definition at line 564 of file rpc.h.
Referenced by ApplicationReady(), CheckTimeout(), and SendReceive().
|
private |
|
private |
|
private |
|
private |
Whether timeout has occured and reconnection is needed.
Definition at line 561 of file rpc.h.
Referenced by CheckTimeout(), and Connect().
|
private |
The target device's object UUID.
Definition at line 555 of file rpc.h.
Referenced by RPCCon(), and CreateRpc().
|
private |
|
private |
|
private |
Definition at line 605 of file rpc.h.
Referenced by Close(), Disconnect(), SendControl(), and SendReceive().
|
private |
Monotonically increasing RPC sequence number.
Definition at line 583 of file rpc.h.
Referenced by CreateRpc().
|
private |
Session key for this connection.
Definition at line 570 of file rpc.h.
Referenced by ApplicationReady(), Connect(), Disconnect(), SendControl(), and SessionKey().
|
private |
|
private |
Default RPC response timeout in seconds.
Definition at line 537 of file rpc.h.
Referenced by SendReceive().