|
PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
|
Classes | |
| struct | AllIM |
| All I&M records a device supports, read in one call. More... | |
| struct | BlockHeaderView |
| Generic block header (type + length) used to scan response blocks. More... | |
| struct | ConnectResult |
| Result of a successful RPCCon::Connect() that also established cyclic IO. More... | |
| struct | EPMEndpoint |
| One RPC endpoint advertised by a device's Endpoint Mapper. More... | |
| struct | IndexProbeResult |
| Result of probing one index in EnumerateIndices(). More... | |
| struct | IOCRSetup |
| Configuration for establishing cyclic IO alongside an AR. More... | |
| struct | IOSlot |
| One slot/subslot's expected module configuration and IO data sizes. More... | |
| class | IRPCCon |
| Abstract interface for a PROFINET RPC connection. More... | |
| class | IRpcTransport |
| class | RPCCon |
| Connection to a PROFINET IO-Device: establishes an AR (Application Relationship) and performs acyclic read/write and CONTROL operations. More... | |
| struct | RPCConOptions |
| Configuration options for an RPC connection. More... | |
| class | RpcTransport |
| Synchronous UDP transport used by PROFINET DCE/RPC. More... | |
| struct | WriteItem |
| A single write operation for WriteMultiple(). More... | |
Functions | |
| BlockHeaderView | PeekBlockHeader (const Bytes &data, std::size_t offset) |
| std::string | UuidBytesToString (const std::array< std::uint8_t, uuidLenght > &data) |
| Format a 16-byte DCE/RPC UUID as a canonical string. | |
| std::array< std::uint8_t, uuidLenght > | StringToUuidBytes (const std::string &uuidStr) |
| Parse a canonical UUID string into 16 raw DCE/RPC UUID bytes. | |
| std::vector< EPMEndpoint > | EpmLookup (asio::io_context &ioContext, const std::string &ip, std::uint16_t port=RPC_PORT, double timeoutSec=DEFAULT_TIMEOUT, std::optional< std::string > interfaceFilter=std::nullopt) |
| Query a device's Endpoint Mapper for available RPC endpoints. | |
| dcp::DCPDeviceDescription | GetStationInfo (const EthernetSocket &sock, const MacAddress &src, const std::string &name, int timeoutSec=static_cast< int >(DEFAULT_TIMEOUT *2)) |
| Resolve a device by PROFINET station name via DCP. | |
Variables | |
| constexpr std::uint16_t | RPC_PORT = 0x8894 |
| PROFINET IO RPC port (34964). | |
| constexpr std::uint16_t | RPC_BIND_PORT = 0x8895 |
| PROFINET IO RPC bind port (34965). | |
| const std::string | UUID_NULL = "00000000-0000-0000-0000-000000000000" |
| Null (all-zero) DCE/RPC UUID string. | |
| const std::string | UUID_EPM_V4 = "e1af8308-5d1f-11c9-91a4-08002b14a0fa" |
| Endpoint Mapper interface UUID. | |
| const std::string | UUID_PNIO_DEVICE = "dea00001-6c97-11d1-8271-00a02442df7d" |
| PROFINET IO-Device interface UUID. | |
| const std::string | UUID_PNIO_CONTROLLER = "dea00002-6c97-11d1-8271-00a02442df7d" |
| PROFINET IO-Controller interface UUID. | |
| constexpr std::uint32_t | PNIO_DEVICE_INTERFACE_VERSION = 1 |
| Interface version used for the PNIO device interface. | |
| constexpr std::uint32_t | EPM_LOOKUP = 0x02 |
| EPM operation: Lookup. | |
| constexpr std::uint32_t | EPM_INQUIRY_ALL = 0x00 |
| EPM inquiry type: all interfaces. | |
| constexpr std::uint32_t | EPM_INQUIRY_INTERFACE = 0x01 |
| EPM inquiry type: specific interface. | |
| constexpr double | DEFAULT_TIMEOUT = 5.0 |
| Default RPC response timeout in seconds. | |
| constexpr double | CONNECTION_TIMEOUT = 10.0 |
| Maximum idle time in seconds before an AR is considered to need re-connection. | |
| constexpr std::uint16_t | BLOCK_IOD_CONTROL_PRM_END_REQ = 0x0110 |
| Block type: IODControlReqPrmEnd. | |
| constexpr std::uint16_t | BLOCK_IOD_CONTROL_APP_READY_REQ = 0x0112 |
| Block type: IODControlReqAppReady. | |
| constexpr std::uint16_t | BLOCK_IOD_CONTROL_APP_READY_RES = 0x8112 |
| Block type: IODControlResAppReady. | |
| constexpr std::uint16_t | BLOCK_IOD_CONTROL_RT_CLASS_3_REQ = 0x0117 |
| Block type: IODControlReqRTClass3. | |
| constexpr std::uint16_t | BLOCK_PRM_BEGIN_REQ = 0x0118 |
| Block type: PrmBeginReq. | |
| constexpr std::uint16_t | BLOCK_RELEASE_REQ = 0x0114 |
| Block type: IODReleaseReq. | |
| constexpr std::uint16_t | CONTROL_CMD_PRM_END = 0x0001 |
| Control command bit: PrmEnd. | |
| constexpr std::uint16_t | CONTROL_CMD_APP_READY = 0x0002 |
| Control command bit: ApplicationReady. | |
| constexpr std::uint16_t | CONTROL_CMD_RELEASE = 0x0004 |
| Control command bit: Release. | |
| constexpr std::uint16_t | CONTROL_CMD_DONE = 0x0008 |
| Control command bit: Done. | |
| constexpr std::uint16_t | CONTROL_CMD_READY_FOR_COMPANION = 0x0010 |
| Control command bit: ReadyForCompanion. | |
| constexpr std::uint16_t | CONTROL_CMD_READY_FOR_RT_CLASS_3 = 0x0020 |
| Control command bit: ReadyForRTClass3. | |
| constexpr std::uint16_t | CONTROL_CMD_PRM_BEGIN = 0x0040 |
| Control command bit: PrmBegin. | |
| constexpr std::uint8_t | VERSION_HIGH = 0x01 |
| Version high. | |
| constexpr std::uint8_t | VERSION_LOW = 0x00 |
| Version low. | |
| std::vector< EPMEndpoint > profinet::rpc::EpmLookup | ( | asio::io_context & | ioContext, |
| const std::string & | ip, | ||
| std::uint16_t | port = RPC_PORT, |
||
| double | timeoutSec = DEFAULT_TIMEOUT, |
||
| std::optional< std::string > | interfaceFilter = std::nullopt |
||
| ) |
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. |
Definition at line 389 of file rpc.cpp.
References EPM_INQUIRY_ALL, EPM_INQUIRY_INTERFACE, EPM_LOOKUP, profinet::PNRPCHeader::kFixedSize, profinet::LowByteMask, profinet::OneOctetShift, profinet::rpc::RpcTransport::Open(), profinet::PNRPCHeader::REQUEST, profinet::rpc::RpcTransport::SendReceive(), StringToUuidBytes(), UUID_EPM_V4, UuidBytesToString(), and profinet::uuidLenght.
Referenced by profinet::device::ProfinetDevice::GetInfo().
Here is the call graph for this function:
Here is the caller graph for this function:| dcp::DCPDeviceDescription profinet::rpc::GetStationInfo | ( | const EthernetSocket & | sock, |
| const MacAddress & | src, | ||
| const std::string & | name, | ||
| int | timeoutSec = static_cast<int>(DEFAULT_TIMEOUT * 2) |
||
| ) |
Resolve a device by PROFINET station name via DCP.
| sock | Bound Ethernet socket to send/receive on. |
| src | Source MAC address to send from. |
| name | Station name to resolve. |
| timeoutSec | How long to wait for each discovery attempt. |
Falls back from a filtered Identify request to a broadcast discover + name filter. Throws DCPDeviceNotFoundError if no matching device responds.
Definition at line 588 of file rpc.cpp.
References profinet::dcp::DCPDeviceDescription::name, profinet::PNDCPBlock::NAME_OF_STATION, profinet::dcp::ReadResponse(), profinet::dcp::SendDiscover(), and profinet::dcp::SendRequest().
Referenced by profinet::device::ProfinetDevice::Discover().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Definition at line 53 of file rpc.h.
References profinet::rpc::BlockHeaderView::blockType, and profinet::OneOctetShift.
Referenced by profinet::rpc::RPCCon::ParseAlarmCrResponse(), and profinet::rpc::RPCCon::ParseIocrResponse().
Here is the caller graph for this function:| std::array< std::uint8_t, uuidLenght > profinet::rpc::StringToUuidBytes | ( | const std::string & | uuidStr | ) |
Parse a canonical UUID string into 16 raw DCE/RPC UUID bytes.
| uuidStr | String in "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" form. |
Throws std::invalid_argument on malformed input.
Definition at line 159 of file rpc.cpp.
References profinet::LowByteMask, profinet::OneOctetShift, profinet::ThreeOctetsShift, and profinet::TwoOctetsShift.
Referenced by EpmLookup().
Here is the caller graph for this function:| std::string profinet::rpc::UuidBytesToString | ( | const std::array< std::uint8_t, uuidLenght > & | data | ) |
Format a 16-byte DCE/RPC UUID as a canonical string.
| data | The 16 raw UUID bytes (mixed-endian DCE/RPC format). |
Definition at line 122 of file rpc.cpp.
References profinet::OneOctetShift, profinet::ThreeOctetsShift, profinet::ToHex(), and profinet::TwoOctetsShift.
Referenced by EpmLookup().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlineconstexpr |
Block type: IODControlReqAppReady.
Definition at line 60 of file rpcTypes.h.
Referenced by profinet::rpc::RPCCon::ApplicationReady().
|
inlineconstexpr |
Block type: IODControlResAppReady.
Definition at line 62 of file rpcTypes.h.
|
inlineconstexpr |
Block type: IODControlReqPrmEnd.
Definition at line 58 of file rpcTypes.h.
|
inlineconstexpr |
Block type: IODControlReqRTClass3.
Definition at line 64 of file rpcTypes.h.
|
inlineconstexpr |
Block type: PrmBeginReq.
Definition at line 66 of file rpcTypes.h.
|
inlineconstexpr |
Block type: IODReleaseReq.
Definition at line 68 of file rpcTypes.h.
|
inlineconstexpr |
Maximum idle time in seconds before an AR is considered to need re-connection.
Definition at line 53 of file rpcTypes.h.
Referenced by profinet::rpc::RPCCon::CheckTimeout().
|
inlineconstexpr |
Control command bit: ApplicationReady.
Definition at line 73 of file rpcTypes.h.
|
inlineconstexpr |
Control command bit: Done.
Definition at line 77 of file rpcTypes.h.
|
inlineconstexpr |
Control command bit: PrmBegin.
Definition at line 83 of file rpcTypes.h.
|
inlineconstexpr |
Control command bit: PrmEnd.
Definition at line 71 of file rpcTypes.h.
|
inlineconstexpr |
Control command bit: ReadyForCompanion.
Definition at line 79 of file rpcTypes.h.
|
inlineconstexpr |
Control command bit: ReadyForRTClass3.
Definition at line 81 of file rpcTypes.h.
|
inlineconstexpr |
Control command bit: Release.
Definition at line 75 of file rpcTypes.h.
|
inlineconstexpr |
Default RPC response timeout in seconds.
Definition at line 51 of file rpcTypes.h.
|
inlineconstexpr |
EPM inquiry type: all interfaces.
Definition at line 46 of file rpcTypes.h.
Referenced by EpmLookup().
|
inlineconstexpr |
EPM inquiry type: specific interface.
Definition at line 48 of file rpcTypes.h.
Referenced by EpmLookup().
|
inlineconstexpr |
|
inlineconstexpr |
Interface version used for the PNIO device interface.
Definition at line 41 of file rpcTypes.h.
|
inlineconstexpr |
PROFINET IO RPC bind port (34965).
Definition at line 29 of file rpcTypes.h.
|
inlineconstexpr |
PROFINET IO RPC port (34964).
Definition at line 27 of file rpcTypes.h.
|
inline |
Endpoint Mapper interface UUID.
Definition at line 34 of file rpcTypes.h.
Referenced by EpmLookup(), and profinet::rpc::EPMEndpoint::InterfaceName().
|
inline |
Null (all-zero) DCE/RPC UUID string.
Definition at line 32 of file rpcTypes.h.
|
inline |
PROFINET IO-Controller interface UUID.
Definition at line 38 of file rpcTypes.h.
Referenced by profinet::rpc::EPMEndpoint::InterfaceName().
|
inline |
PROFINET IO-Device interface UUID.
Definition at line 36 of file rpcTypes.h.
Referenced by profinet::rpc::EPMEndpoint::InterfaceName().
|
inlineconstexpr |
Version high.
Definition at line 34 of file rpc.cpp.
Referenced by profinet::rpc::RPCCon::BuildAlarmCrBlock(), profinet::rpc::RPCCon::BuildIocrBlock(), profinet::rpc::RPCCon::Connect(), and profinet::rpc::RPCCon::Read().
|
inlineconstexpr |
Version low.
Definition at line 36 of file rpc.cpp.
Referenced by profinet::rpc::RPCCon::BuildAlarmCrBlock(), profinet::rpc::RPCCon::BuildIocrBlock(), profinet::rpc::RPCCon::Connect(), and profinet::rpc::RPCCon::Read().