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

Classes

struct  BlockQualifier
 Block qualifier: whether a Set operation is temporary or permanent. More...
 
class  DCPDeviceDescription
 Parsed PROFINET device information from a DCP response. More...
 
struct  DCPDHCPBlock
 Parsed DHCP block from a DCP response. More...
 
struct  DCPResponseCode
 DCP GET/SET response codes. More...
 
struct  DeviceInitiative
 Device-initiative (Hello-after-power-on) setting values. More...
 
struct  IPBlockInfo
 IP block status flags (IEC 61158-6-10 IPBlockInfo). More...
 
struct  ResetQualifier
 Reset qualifier values for ResetToFactory(). More...
 

Typedefs

using BlockKey = std::pair< std::uint8_t, std::uint8_t >
 (option, suboption) key identifying a DCP block.
 
using ResponseMap = std::map< MacAddress, std::map< BlockKey, std::vector< std::uint8_t > > >
 Result of ReadResponse(): MAC address -> parsed (option,suboption) -> payload blocks.
 

Functions

std::vector< std::string > DecodeDeviceRole (std::uint8_t roleByte)
 Decode a device role bitmask into a list of role names.
 
std::string GetBlockName (std::uint8_t option, std::uint8_t suboption)
 Get the human-readable name for a (option, suboption) DCP block.
 
std::uint8_t ParseSetResponse (const Bytes &data)
 Parses the raw byte response payload received from a SET operation.
 
std::uint8_t RecvSetResponse (const IRawEthernetSocket &sock, const MacAddress &srcMac, int timeoutSec)
 Receive and parse a DCP SET response, filtering out unrelated frames.
 
std::string DcpBlockErrorName (std::uint8_t code)
 Get the human-readable name for a DCP SET block-level error code.
 
Bytes BuildSetParamRequest (const MacAddress &dst, const MacAddress &src, const std::string &param, const std::string &value, bool permanent)
 Build a serialized DCP SET request for a named parameter.
 
Bytes BuildDcpSignalRequest (const MacAddress &dst, const MacAddress &src)
 Build a serialized DCP Signal request.
 
const std::map< std::string, BlockKey > & Params ()
 Table of supported parameter names, mapping to their (option, suboption).
 
std::optional< std::vector< std::uint8_t > > GetParam (const EthernetSocket &sock, const MacAddress &src, const std::string &target, const std::string &param, int timeoutSec=DEFAULT_TIMEOUT)
 Read a named parameter from a device.
 
bool SetParam (const EthernetSocket &sock, const MacAddress &src, const std::string &target, const std::string &param, const std::string &value, int timeoutSec=DEFAULT_TIMEOUT, bool permanent=false)
 Write a named parameter to a device.
 
bool SetIp (const EthernetSocket &sock, const MacAddress &src, const std::string &target, const std::string &ip, const std::string &netmask, const std::string &gateway, bool permanent=false, int timeoutSec=DEFAULT_TIMEOUT)
 Set a device's IP configuration via DCP.
 
void SendDiscover (const EthernetSocket &sock, const MacAddress &src, std::uint16_t responseDelay=DEFAULT_RESPONSE_DELAY_FACTOR)
 Send a DCP Identify multicast request to discover all devices on the segment.
 
void SendRequest (const EthernetSocket &sock, const MacAddress &src, BlockKey blockType, const std::vector< std::uint8_t > &value)
 Send a DCP Identify request filtered to a specific (option, suboption).
 
ResponseMap ReadResponse (const EthernetSocket &sock, const MacAddress &myMac, int timeoutSec=DEFAULT_RESPONSE_TIMEOUT, bool once=false, std::optional< std::uint32_t > expectedXid=std::nullopt)
 Read and parse DCP Identify responses.
 
void SendHello (const EthernetSocket &sock, const MacAddress &src, const std::string &stationName, const std::string &ip="0.0.0.0", const std::string &netmask="0.0.0.0", const std::string &gateway="0.0.0.0", std::pair< std::uint16_t, std::uint16_t > deviceId={0, 0}, std::uint8_t deviceRole=DEVICE_ROLE_IO_DEVICE)
 Send a DCP Hello multicast announcement (device self-announce after power-on).
 
std::vector< DCPDeviceDescriptionReceiveHello (const EthernetSocket &sock, const MacAddress &myMac, int timeoutSec=DEFAULT_HELLO_TIMEOUT, const std::function< void(const DCPDeviceDescription &)> &callback=nullptr)
 Listen for DCP Hello announcements from other devices.
 
bool SignalDevice (const EthernetSocket &sock, const MacAddress &src, const std::string &target, int durationMs=FLASH_DURATION_MS, int timeoutSec=DEFAULT_TIMEOUT)
 Flash a device's identification LEDs.
 
bool ResetToFactory (const EthernetSocket &sock, const MacAddress &src, const std::string &target, std::uint16_t mode=RESET_MODE_COMMUNICATION, int timeoutSec=DEFAULT_TIMEOUT)
 Reset a device to factory defaults.
 
void SendRequest (const EthernetSocket &sock, const MacAddress &src, BlockKey blockType, const Bytes &value)
 Send a DCP Identify request filtered to a specific (option, suboption).
 

Variables

const std::string DCP_MULTICAST_MAC = "01:0e:cf:00:00:00"
 DCP Identify/Get/Set multicast destination MAC.
 
const std::string DCP_HELLO_MULTICAST_MAC = "01:0e:cf:00:00:01"
 DCP Hello multicast destination MAC.
 
constexpr std::uint16_t DCP_IDENTIFY_REQUEST_FRAME_ID = 0xFEFE
 Frame ID for DCP Identify requests.
 
constexpr std::uint16_t DCP_IDENTIFY_RESPONSE_FRAME_ID = 0xFEFF
 Frame ID for DCP Identify responses.
 
constexpr std::uint16_t DCP_GET_SET_FRAME_ID = 0xFEFD
 Frame ID for DCP Get/Set requests and responses.
 
constexpr std::uint16_t DCP_HELLO_FRAME_ID = 0xFEFC
 Frame ID for DCP Hello announcements.
 
constexpr std::uint8_t DCP_SERVICE_ID_GET = 0x03
 DCP service ID: GET.
 
constexpr std::uint8_t DCP_SERVICE_ID_SET = 0x04
 DCP service ID: SET.
 
constexpr std::uint8_t DCP_SERVICE_ID_IDENTIFY = 0x05
 DCP service ID: IDENTIFY.
 
constexpr std::uint8_t DCP_SERVICE_ID_HELLO = 0x06
 DCP service ID: HELLO.
 
constexpr std::uint8_t DCP_SERVICE_TYPE_REQUEST = 0x00
 DCP service type: REQUEST.
 
constexpr std::uint8_t DCP_SERVICE_TYPE_RESPONSE_SUCCESS = 0x01
 DCP service type: RESPONSE (success).
 
constexpr std::uint8_t DCP_SERVICE_TYPE_RESPONSE_UNSUPPORTED = 0x05
 DCP service type: RESPONSE (service unsupported).
 
constexpr std::size_t DCP_MAX_NAME_LENGTH = 240
 Maximum allowed length in bytes for a station name.
 
constexpr std::uint8_t DCP_OPTION_IP = 0x01
 DCP option: IP configuration.
 
constexpr std::uint8_t DCP_OPTION_DEVICE = 0x02
 DCP option: device identification.
 
constexpr std::uint8_t DCP_OPTION_DHCP = 0x03
 DCP option: DHCP.
 
constexpr std::uint8_t DCP_OPTION_RESERVED = 0x04
 DCP option: reserved.
 
constexpr std::uint8_t DCP_OPTION_CONTROL = 0x05
 DCP option: control (start/stop/signal/reset).
 
constexpr std::uint8_t DCP_OPTION_DEVICE_INITIATIVE = 0x06
 DCP option: device-initiative (Hello) configuration.
 
constexpr std::uint8_t DCP_OPTION_NME = 0x07
 DCP option: Network Management (NME).
 
constexpr std::uint8_t DCP_OPTION_ALL = 0xFF
 DCP option wildcard: all options.
 
constexpr std::uint8_t DCP_SUBOPTION_IP_MAC = 0x01
 DCP suboption (IP): MAC address.
 
constexpr std::uint8_t DCP_SUBOPTION_IP_PARAMETER = 0x02
 DCP suboption (IP): IP/netmask/gateway parameter.
 
constexpr std::uint8_t DCP_SUBOPTION_IP_FULL_SUITE = 0x03
 DCP suboption (IP): full IP suite.
 
constexpr std::uint8_t DCP_SUBOPTION_DEVICE_TYPE = 0x01
 DCP suboption (Device): device type string.
 
constexpr std::uint8_t DCP_SUBOPTION_DEVICE_NAME = 0x02
 DCP suboption (Device): station name.
 
constexpr std::uint8_t DCP_SUBOPTION_DEVICE_ID = 0x03
 DCP suboption (Device): vendor/device ID.
 
constexpr std::uint8_t DCP_SUBOPTION_DEVICE_ROLE = 0x04
 DCP suboption (Device): device role bitmask.
 
constexpr std::uint8_t DCP_SUBOPTION_DEVICE_OPTIONS = 0x05
 DCP suboption (Device): supported options list.
 
constexpr std::uint8_t DCP_SUBOPTION_DEVICE_ALIAS = 0x06
 DCP suboption (Device): alias name.
 
constexpr std::uint8_t DCP_SUBOPTION_DEVICE_INSTANCE = 0x07
 DCP suboption (Device): device instance.
 
constexpr std::uint8_t DCP_SUBOPTION_DEVICE_OEM_ID = 0x08
 DCP suboption (Device): OEM vendor/device ID.
 
constexpr std::uint8_t DCP_SUBOPTION_DEVICE_RSI = 0x0A
 DCP suboption (Device): RSI (reverse status indication).
 
constexpr std::uint8_t DCP_SUBOPTION_CONTROL_START = 0x01
 DCP suboption (Control): start.
 
constexpr std::uint8_t DCP_SUBOPTION_CONTROL_STOP = 0x02
 DCP suboption (Control): stop.
 
constexpr std::uint8_t DCP_SUBOPTION_CONTROL_SIGNAL = 0x03
 DCP suboption (Control): signal (flash LEDs).
 
constexpr std::uint8_t DCP_SUBOPTION_CONTROL_RESPONSE = 0x04
 DCP suboption (Control): response.
 
constexpr std::uint8_t DCP_SUBOPTION_CONTROL_RESET_FACTORY = 0x05
 DCP suboption (Control): factory reset.
 
constexpr std::uint8_t DCP_SUBOPTION_CONTROL_RESET_TO_FACTORY = 0x06
 DCP suboption (Control): reset to factory.
 
constexpr std::uint8_t DCP_SUBOPTION_DHCP_HOSTNAME = 0x0C
 DCP suboption (DHCP): hostname option.
 
constexpr std::uint8_t DCP_SUBOPTION_DHCP_VENDOR_SPEC = 0x2B
 DCP suboption (DHCP): vendor-specific option.
 
constexpr std::uint8_t DCP_SUBOPTION_DHCP_SERVER_ID = 0x36
 DCP suboption (DHCP): server identifier option.
 
constexpr std::uint8_t DCP_SUBOPTION_DHCP_PARAM_REQ = 0x37
 DCP suboption (DHCP): parameter request list.
 
constexpr std::uint8_t DCP_SUBOPTION_DHCP_CLASS_ID = 0x3C
 DCP suboption (DHCP): class identifier option.
 
constexpr std::uint8_t DCP_SUBOPTION_DHCP_CLIENT_ID = 0x3D
 DCP suboption (DHCP): client identifier option.
 
constexpr std::uint8_t DCP_SUBOPTION_DHCP_FQDN = 0x51
 DCP suboption (DHCP): fully qualified domain name option.
 
constexpr std::uint8_t DCP_SUBOPTION_DHCP_UUID = 0x61
 DCP suboption (DHCP): client UUID option.
 
constexpr std::uint8_t DCP_SUBOPTION_DHCP_CONTROL = 0xFF
 DCP suboption (DHCP): DHCP control.
 
constexpr std::uint8_t DCP_SUBOPTION_DEVICE_INITIATIVE = 0x01
 DCP suboption (DeviceInitiative): the only suboption.
 
constexpr std::uint8_t DEVICE_ROLE_IO_DEVICE = 0x01
 Device role bit: IO-Device.
 
constexpr std::uint8_t DEVICE_ROLE_IO_CONTROLLER = 0x02
 Device role bit: IO-Controller.
 
constexpr std::uint8_t DEVICE_ROLE_IO_MULTIDEVICE = 0x04
 Device role bit: IO-Multidevice.
 
constexpr std::uint8_t DEVICE_ROLE_PN_SUPERVISOR = 0x08
 Device role bit: PN-Supervisor.
 
constexpr std::uint16_t RESET_MODE_COMMUNICATION = 0x0002
 Reset mode bit: reset communication parameters.
 
constexpr std::uint16_t RESET_MODE_APPLICATION = 0x0004
 Reset mode bit: reset application data.
 
constexpr std::uint16_t RESET_MODE_ENGINEERING = 0x0008
 Reset mode bit: reset engineering parameters.
 
constexpr std::uint16_t RESET_MODE_ALL_DATA = 0x0010
 Reset mode bit: reset all stored data.
 
constexpr std::uint16_t RESET_MODE_DEVICE = 0x0020
 Reset mode bit: reset device.
 
constexpr std::uint16_t RESET_MODE_FACTORY = 0x0040
 Reset mode bit: reset to factory defaults.
 
constexpr std::uint16_t DEFAULT_TIMEOUT = 5
 Default timeout.
 
constexpr std::uint16_t DEFAULT_RESPONSE_TIMEOUT = 20
 Default response timeout. How long to keep listening for responses.
 
constexpr std::uint16_t DEFAULT_HELLO_TIMEOUT = 10
 Default HELLO timeout.
 
constexpr std::uint16_t DEFAULT_RESPONSE_DELAY_FACTOR = 0x0080
 Default dcp response delay factor.
 
constexpr std::uint16_t FLASH_DURATION_MS = 3000
 Default flash duration of the leds.
 
constexpr std::uint8_t DCP_BLOCK_ERROR_OK = 0x00
 DCP SET block-level result: OK.
 
constexpr std::uint8_t DCP_BLOCK_ERROR_OPTION_UNSUPPORTED = 0x01
 DCP SET block-level result: option not supported.
 
constexpr std::uint8_t DCP_BLOCK_ERROR_SUBOPTION_UNSUPPORTED = 0x02
 DCP SET block-level result: suboption not supported.
 
constexpr std::uint8_t DCP_BLOCK_ERROR_SUBOPTION_NOT_SET = 0x03
 DCP SET block-level result: suboption not set.
 
constexpr std::uint8_t DCP_BLOCK_ERROR_RESOURCE = 0x04
 DCP SET block-level result: resource error.
 
constexpr std::uint8_t DCP_BLOCK_ERROR_SET_NOT_POSSIBLE = 0x05
 DCP SET block-level result: set not possible locally.
 
constexpr std::uint8_t DCP_BLOCK_ERROR_IN_OPERATION = 0x06
 DCP SET block-level result: set not possible, device in operation.
 

Typedef Documentation

◆ BlockKey

using profinet::dcp::BlockKey = typedef std::pair<std::uint8_t, std::uint8_t>

(option, suboption) key identifying a DCP block.

Definition at line 421 of file dcp.h.

◆ ResponseMap

using profinet::dcp::ResponseMap = typedef std::map<MacAddress, std::map<BlockKey, std::vector<std::uint8_t> >>

Result of ReadResponse(): MAC address -> parsed (option,suboption) -> payload blocks.

Definition at line 632 of file dcp.h.

Function Documentation

◆ BuildDcpSignalRequest()

Bytes profinet::dcp::BuildDcpSignalRequest ( const MacAddress dst,
const MacAddress src 
)

Build a serialized DCP Signal request.

Creates the complete Ethernet frame used to request the device's identification LEDs to flash once.

The serialized Control/Signal block contains:

Parameters
dstDestination device MAC address.
srcSource/controller MAC address.
Returns
Complete serialized Ethernet frame.

Definition at line 812 of file dcp.cpp.

References BuildDcpSignalRequest(), DCP_GET_SET_FRAME_ID, DCP_OPTION_CONTROL, DCP_SUBOPTION_CONTROL_SIGNAL, profinet::PNDCPHeader::frameId, profinet::PNDCPHeader::length, profinet::PNDCPBlockRequest::length, profinet::PNDCPBlockRequest::option, profinet::PNDCPHeader::payload, profinet::PNDCPBlockRequest::payload, profinet::PNDCPHeader::respDelay, profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, profinet::PNDCPBlockRequest::suboption, profinet::PNDCPBlockRequest::ToBytes(), and profinet::PNDCPHeader::xId.

Referenced by BuildDcpSignalRequest(), and SignalDevice().

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

◆ BuildSetParamRequest()

Bytes profinet::dcp::BuildSetParamRequest ( const MacAddress dst,
const MacAddress src,
const std::string &  param,
const std::string &  value,
bool  permanent 
)

Build a serialized DCP SET request for a named parameter.

Creates the complete Ethernet frame containing a DCP SET request.

For the NameOfStation parameter, the generated block contains the BlockQualifier followed by the station name. Odd-length values receive one zero padding byte on the wire while the DCP BlockLength excludes that alignment byte.

IP configuration requires the binary IP suite representation (IP address + subnet mask + gateway). The string-valued SET API intentionally rejects IP configuration and callers must use SetIp().

Parameters
dstDestination device MAC address.
srcSource/controller MAC address.
paramParameter name, such as "name".
valueParameter value.
permanentWhether the requested value should be stored permanently.
Returns
Complete serialized Ethernet frame.
Exceptions
DCPErrorIf the parameter name is unknown.
ValidationErrorIf the parameter value violates DCP constraints.

Definition at line 756 of file dcp.cpp.

References BuildSetParamRequest(), DCP_GET_SET_FRAME_ID, DCP_MAX_NAME_LENGTH, profinet::PNDCPHeader::frameId, profinet::PNDCPHeader::length, profinet::PNDCPBlockRequest::length, profinet::PNDCPBlockRequest::option, Params(), profinet::PNDCPHeader::payload, profinet::PNDCPBlockRequest::payload, profinet::PNDCPHeader::respDelay, profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, profinet::PNDCPBlockRequest::suboption, profinet::PNDCPBlockRequest::ToBytes(), profinet::ToVec(), and profinet::PNDCPHeader::xId.

Referenced by BuildSetParamRequest(), and SetParam().

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

◆ DcpBlockErrorName()

std::string profinet::dcp::DcpBlockErrorName ( std::uint8_t  code)

Get the human-readable name for a DCP SET block-level error code.

Parameters
codeRaw block error code.
Returns
A description of the error.

Definition at line 430 of file dcp.cpp.

References DcpBlockErrorName(), and profinet::Hex2().

Referenced by DcpBlockErrorName(), ResetToFactory(), SetIp(), SetParam(), and SignalDevice().

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

◆ DecodeDeviceRole()

std::vector< std::string > profinet::dcp::DecodeDeviceRole ( std::uint8_t  roleByte)

Decode a device role bitmask into a list of role names.

Parameters
roleByteRaw device role bitmask byte.
Returns
Human-readable role names (e.g. "IO-Device", "IO-Controller").

Definition at line 146 of file dcp.cpp.

Referenced by profinet::dcp::DCPDeviceDescription::DCPDeviceDescription().

+ Here is the caller graph for this function:

◆ GetBlockName()

std::string profinet::dcp::GetBlockName ( std::uint8_t  option,
std::uint8_t  suboption 
)

Get the human-readable name for a (option, suboption) DCP block.

Parameters
optionDCP option code.
suboptionDCP suboption code.
Returns
A "Option/Suboption" style name, e.g. "IP/MAC".

Definition at line 163 of file dcp.cpp.

References profinet::Hex2().

Referenced by profinet::dcp::DCPDeviceDescription::ToString().

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

◆ GetParam()

std::optional< Bytes > profinet::dcp::GetParam ( const EthernetSocket sock,
const MacAddress src,
const std::string &  target,
const std::string &  param,
int  timeoutSec = DEFAULT_TIMEOUT 
)

Read a named parameter from a device.

Parameters
sockBound Ethernet socket to send/receive on.
srcSource MAC address to send from.
targetDestination device's MAC address, as a string.
paramParameter name ("name" or "ip"); see Params().
timeoutSecHow long to wait for a response.
Returns
The raw parameter value, or std::nullopt if no response was received within the timeout.

Throws DCPError for an unknown parameter name.

Definition at line 880 of file dcp.cpp.

References DCP_GET_SET_FRAME_ID, profinet::PNDCPHeader::frameId, GetParam(), profinet::PNDCPHeader::length, profinet::PNDCPBlockRequest::length, profinet::PNDCPBlockRequest::option, Params(), profinet::PNDCPHeader::payload, ReadResponse(), profinet::PNDCPHeader::respDelay, profinet::EthernetSocket::Send(), profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, profinet::String2Mac(), profinet::PNDCPBlockRequest::suboption, profinet::PNDCPBlockRequest::ToBytes(), and profinet::PNDCPHeader::xId.

Referenced by GetParam().

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

◆ Params()

const std::map< std::string, BlockKey > & profinet::dcp::Params ( )

Table of supported parameter names, mapping to their (option, suboption).

Returns
Reference to the static table, e.g. {"name": {2,2}, "ip": {1,2}}.

Definition at line 480 of file dcp.cpp.

References Params().

Referenced by BuildSetParamRequest(), GetParam(), and Params().

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

◆ ParseSetResponse()

std::uint8_t profinet::dcp::ParseSetResponse ( const Bytes data)

Parses the raw byte response payload received from a SET operation.

Parameters
dataReference to the byte container containing the response payload.
Returns
An 8-bit unsigned integer representing the parsed status code or result.

Parse a DCP SET response and extract the block error code. Throws DCPError on malformed/unexpected frames.

Definition at line 258 of file dcp.cpp.

References DCP_BLOCK_ERROR_OK, DCP_OPTION_CONTROL, DCP_SERVICE_TYPE_RESPONSE_SUCCESS, DCP_SERVICE_TYPE_RESPONSE_UNSUPPORTED, DCP_SUBOPTION_CONTROL_RESPONSE, profinet::Hex2(), profinet::Hex4(), profinet::OneOctetShift, profinet::EthernetHeader::Parse(), profinet::PNDCPHeader::Parse(), profinet::EthernetHeader::payload, profinet::PNDCPHeader::payload, payload, profinet::PROFINET_ETHERTYPE, profinet::PNDCPHeader::serviceType, profinet::EthernetHeader::type, and profinet::VLAN_ETHERTYPE.

Referenced by RecvSetResponse().

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

◆ ReadResponse()

ResponseMap profinet::dcp::ReadResponse ( const EthernetSocket sock,
const MacAddress myMac,
int  timeoutSec = DEFAULT_RESPONSE_TIMEOUT,
bool  once = false,
std::optional< std::uint32_t >  expectedXid = std::nullopt 
)

Read and parse DCP Identify responses.

Parameters
sockBound Ethernet socket to receive on.
myMacThis host's MAC address, used to filter responses addressed to us.
timeoutSecHow long to keep listening for responses.
onceIf true, return after the first response.
expectedXidIf set, only accept responses matching this transaction ID.
Returns
Map of responding devices to their parsed blocks.

Definition at line 1048 of file dcp.cpp.

References profinet::EthernetHeader::dst, profinet::PNDCPHeader::length, profinet::EthernetHeader::payload, profinet::PNDCPHeader::payload, payload, profinet::PROFINET_ETHERTYPE, ReadResponse(), profinet::EthernetSocket::Recv(), profinet::PNDCPHeader::serviceType, profinet::EthernetSocket::SetTimeout(), profinet::EthernetHeader::src, profinet::EthernetHeader::type, profinet::VLAN_ETHERTYPE, and profinet::PNDCPHeader::xId.

Referenced by profinet::device::ProfinetDevice::Discover(), profinet::device::ProfinetDevice::FromIp(), GetParam(), profinet::rpc::GetStationInfo(), ReadResponse(), and profinet::device::Scan().

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

◆ ReceiveHello()

std::vector< DCPDeviceDescription > profinet::dcp::ReceiveHello ( const EthernetSocket sock,
const MacAddress myMac,
int  timeoutSec = DEFAULT_HELLO_TIMEOUT,
const std::function< void(const DCPDeviceDescription &)> &  callback = nullptr 
)

Listen for DCP Hello announcements from other devices.

Parameters
sockBound Ethernet socket to receive on.
myMacThis host's MAC address (currently unused for filtering; Hello is multicast).
timeoutSecHow long to keep listening.
callbackOptional callback invoked for each device as it's discovered.
Returns
All devices whose Hello announcements were received.

Definition at line 1214 of file dcp.cpp.

References profinet::EthernetHeader::payload, profinet::PNDCPHeader::payload, payload, profinet::PROFINET_ETHERTYPE, ReceiveHello(), profinet::EthernetSocket::Recv(), profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, profinet::EthernetSocket::SetTimeout(), profinet::EthernetHeader::src, profinet::EthernetHeader::type, and profinet::VLAN_ETHERTYPE.

Referenced by ReceiveHello().

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

◆ RecvSetResponse()

std::uint8_t profinet::dcp::RecvSetResponse ( const IRawEthernetSocket sock,
const MacAddress srcMac,
int  timeoutSec 
)

Receive and parse a DCP SET response, filtering out unrelated frames.

Parameters
sockRaw Ethernet socket used to receive frames.
srcMacDestination MAC address expected in the received response.
timeoutSecMaximum time in seconds to wait for a valid response.
Returns
DCP block error code.
Exceptions
DCPTimeoutErrorIf no valid DCP SET response is received before the timeout.
DCPErrorIf a matching frame contains an invalid DCP SET response.

Definition at line 195 of file dcp.cpp.

References profinet::EthernetHeader::dst, profinet::OneOctetShift, profinet::EthernetHeader::Parse(), ParseSetResponse(), profinet::EthernetHeader::payload, payload, profinet::PROFINET_ETHERTYPE, profinet::IRawEthernetSocket::Recv(), profinet::IRawEthernetSocket::SetTimeout(), profinet::EthernetHeader::type, and profinet::VLAN_ETHERTYPE.

Referenced by ResetToFactory(), SetIp(), SetParam(), and SignalDevice().

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

◆ ResetToFactory()

bool profinet::dcp::ResetToFactory ( const EthernetSocket sock,
const MacAddress src,
const std::string &  target,
std::uint16_t  mode = RESET_MODE_COMMUNICATION,
int  timeoutSec = DEFAULT_TIMEOUT 
)

Reset a device to factory defaults.

Parameters
sockBound Ethernet socket to send/receive on.
srcSource MAC address to send from.
targetDestination device's MAC address, as a string.
modeReset mode bitmask (see RESET_MODE_* constants).
timeoutSecHow long to wait for a response.
Returns
True on success, false on timeout.

WARNING: destructive. This erases device configuration.

Definition at line 1328 of file dcp.cpp.

References DCP_BLOCK_ERROR_OK, DCP_GET_SET_FRAME_ID, DCP_OPTION_CONTROL, DCP_SUBOPTION_CONTROL_RESET_TO_FACTORY, DcpBlockErrorName(), profinet::PNDCPHeader::frameId, profinet::PNDCPHeader::length, profinet::PNDCPBlockRequest::length, profinet::PNDCPBlockRequest::option, profinet::PNDCPHeader::payload, profinet::PNDCPBlockRequest::payload, RecvSetResponse(), ResetToFactory(), profinet::PNDCPHeader::respDelay, profinet::EthernetSocket::Send(), profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, profinet::String2Mac(), profinet::PNDCPBlockRequest::suboption, profinet::PNDCPBlockRequest::ToBytes(), and profinet::PNDCPHeader::xId.

Referenced by ResetToFactory().

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

◆ SendDiscover()

void profinet::dcp::SendDiscover ( const EthernetSocket sock,
const MacAddress src,
std::uint16_t  responseDelay = DEFAULT_RESPONSE_DELAY_FACTOR 
)

Send a DCP Identify multicast request to discover all devices on the segment.

Parameters
sockBound Ethernet socket to send on.
srcSource MAC address to send from.
responseDelayResponse delay factor controlling how devices stagger their replies.

Definition at line 1003 of file dcp.cpp.

References DCP_IDENTIFY_REQUEST_FRAME_ID, DCP_MULTICAST_MAC, profinet::PNDCPHeader::frameId, profinet::PNDCPHeader::length, profinet::PNDCPBlockRequest::length, profinet::PNDCPBlockRequest::option, profinet::PNDCPHeader::payload, profinet::PNDCPHeader::respDelay, profinet::EthernetSocket::Send(), SendDiscover(), profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, profinet::String2Mac(), profinet::PNDCPBlockRequest::suboption, profinet::PNDCPBlockRequest::ToBytes(), and profinet::PNDCPHeader::xId.

Referenced by profinet::device::ProfinetDevice::Discover(), profinet::device::ProfinetDevice::FromIp(), profinet::rpc::GetStationInfo(), profinet::device::Scan(), and SendDiscover().

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

◆ SendHello()

void profinet::dcp::SendHello ( const EthernetSocket sock,
const MacAddress src,
const std::string &  stationName,
const std::string &  ip = "0.0.0.0",
const std::string &  netmask = "0.0.0.0",
const std::string &  gateway = "0.0.0.0",
std::pair< std::uint16_t, std::uint16_t >  deviceId = {0, 0},
std::uint8_t  deviceRole = DEVICE_ROLE_IO_DEVICE 
)

Send a DCP Hello multicast announcement (device self-announce after power-on).

Parameters
sockBound Ethernet socket to send on.
srcSource MAC address to send from.
stationNameStation name to announce.
ipIPv4 address to announce.
netmaskIPv4 subnet mask to announce.
gatewayIPv4 default gateway to announce.
deviceId(vendor_id, device_id) pair to announce.
deviceRoleDevice role bitmask to announce.

Definition at line 1135 of file dcp.cpp.

References DCP_HELLO_FRAME_ID, DCP_HELLO_MULTICAST_MAC, DCP_OPTION_DEVICE, DCP_OPTION_DEVICE_INITIATIVE, DCP_OPTION_IP, DCP_SUBOPTION_DEVICE_ID, DCP_SUBOPTION_DEVICE_INITIATIVE, DCP_SUBOPTION_DEVICE_NAME, DCP_SUBOPTION_DEVICE_ROLE, DCP_SUBOPTION_IP_PARAMETER, profinet::PNDCPHeader::frameId, profinet::Ip2String(), profinet::PNDCPHeader::length, profinet::PNDCPBlockRequest::length, profinet::PNDCPBlockRequest::option, profinet::PNDCPHeader::payload, profinet::PNDCPBlockRequest::payload, profinet::PNDCPHeader::respDelay, profinet::EthernetSocket::Send(), SendHello(), profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, profinet::String2Mac(), profinet::PNDCPBlockRequest::suboption, profinet::PNDCPBlockRequest::ToBytes(), profinet::ToVec(), and profinet::PNDCPHeader::xId.

Referenced by SendHello().

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

◆ SendRequest() [1/2]

void profinet::dcp::SendRequest ( const EthernetSocket sock,
const MacAddress src,
BlockKey  blockType,
const std::vector< std::uint8_t > &  value 
)

Send a DCP Identify request filtered to a specific (option, suboption).

Parameters
sockBound Ethernet socket to send on.
srcSource MAC address to send from.
blockType(option, suboption) pair to filter by.
valueFilter value to match.

Definition at line 1025 of file dcp.cpp.

References DCP_IDENTIFY_REQUEST_FRAME_ID, DCP_MULTICAST_MAC, profinet::PNDCPHeader::frameId, profinet::PNDCPHeader::length, profinet::PNDCPBlockRequest::length, profinet::PNDCPBlockRequest::option, profinet::PNDCPHeader::payload, profinet::PNDCPBlockRequest::payload, profinet::PNDCPHeader::respDelay, profinet::EthernetSocket::Send(), SendRequest(), profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, profinet::String2Mac(), profinet::PNDCPBlockRequest::suboption, profinet::PNDCPBlockRequest::ToBytes(), and profinet::PNDCPHeader::xId.

Referenced by profinet::rpc::GetStationInfo(), and SendRequest().

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

◆ SendRequest() [2/2]

void profinet::dcp::SendRequest ( const EthernetSocket sock,
const MacAddress src,
BlockKey  blockType,
const std::vector< std::uint8_t > &  value 
)

Send a DCP Identify request filtered to a specific (option, suboption).

Parameters
sockBound Ethernet socket to send on.
srcSource MAC address to send from.
blockType(option, suboption) pair to filter by.
valueFilter value to match.

Definition at line 1025 of file dcp.cpp.

References DCP_IDENTIFY_REQUEST_FRAME_ID, DCP_MULTICAST_MAC, profinet::PNDCPHeader::frameId, profinet::PNDCPHeader::length, profinet::PNDCPBlockRequest::length, profinet::PNDCPBlockRequest::option, profinet::PNDCPHeader::payload, profinet::PNDCPBlockRequest::payload, profinet::PNDCPHeader::respDelay, profinet::EthernetSocket::Send(), SendRequest(), profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, profinet::String2Mac(), profinet::PNDCPBlockRequest::suboption, profinet::PNDCPBlockRequest::ToBytes(), and profinet::PNDCPHeader::xId.

Referenced by profinet::rpc::GetStationInfo(), and SendRequest().

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

◆ SetIp()

bool profinet::dcp::SetIp ( const EthernetSocket sock,
const MacAddress src,
const std::string &  target,
const std::string &  ip,
const std::string &  netmask,
const std::string &  gateway,
bool  permanent = false,
int  timeoutSec = DEFAULT_TIMEOUT 
)

Set a device's IP configuration via DCP.

Parameters
sockBound Ethernet socket to send/receive on.
srcSource MAC address to send from.
targetDestination device's MAC address, as a string.
ipNew IPv4 address.
netmaskNew IPv4 subnet mask.
gatewayNew IPv4 default gateway.
permanentWhether the change should persist across power cycles.
timeoutSecHow long to wait for a response.
Returns
True on success, false on timeout.

Definition at line 950 of file dcp.cpp.

References DCP_BLOCK_ERROR_OK, DCP_GET_SET_FRAME_ID, DcpBlockErrorName(), profinet::PNDCPHeader::frameId, profinet::Ip2String(), profinet::PNDCPHeader::length, profinet::PNDCPBlockRequest::length, profinet::PNDCPBlockRequest::option, profinet::PNDCPHeader::payload, profinet::PNDCPBlockRequest::payload, RecvSetResponse(), profinet::PNDCPHeader::respDelay, profinet::EthernetSocket::Send(), profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, SetIp(), profinet::String2Mac(), profinet::PNDCPBlockRequest::suboption, profinet::PNDCPBlockRequest::ToBytes(), and profinet::PNDCPHeader::xId.

Referenced by SetIp().

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

◆ SetParam()

bool profinet::dcp::SetParam ( const EthernetSocket sock,
const MacAddress src,
const std::string &  target,
const std::string &  param,
const std::string &  value,
int  timeoutSec = DEFAULT_TIMEOUT,
bool  permanent = false 
)

Write a named parameter to a device.

Parameters
sockBound Ethernet socket to send/receive on.
srcSource MAC address to send from.
targetDestination device's MAC address, as a string.
paramParameter name ("name" or "ip"); see Params().
valueNew value to write.
timeoutSecHow long to wait for a response.
permanentIf true, request permanent storage (survives power cycle); default writes a temporary value
Returns
True on success, false on timeout.

Throws DCPError on an unknown parameter, or if the device rejects the value; throws ValidationError if a station name exceeds DCP_MAX_NAME_LENGTH.

Definition at line 922 of file dcp.cpp.

References BuildSetParamRequest(), DCP_BLOCK_ERROR_OK, DcpBlockErrorName(), RecvSetResponse(), profinet::EthernetSocket::Send(), SetParam(), and profinet::String2Mac().

Referenced by SetParam().

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

◆ SignalDevice()

bool profinet::dcp::SignalDevice ( const EthernetSocket sock,
const MacAddress src,
const std::string &  target,
int  durationMs = FLASH_DURATION_MS,
int  timeoutSec = DEFAULT_TIMEOUT 
)

Flash a device's identification LEDs.

Parameters
sockBound Ethernet socket to send/receive on.
srcSource MAC address to send from.
targetDestination device's MAC address, as a string.
durationMsHow long the device should flash its LEDs, in milliseconds.
timeoutSecHow long to wait for a response. – Ignored; the spec defines only "flash once" and the device controls the blink pattern. Kept for API compatibility
Returns
True on success, false on timeout.

Definition at line 1307 of file dcp.cpp.

References BuildDcpSignalRequest(), DCP_BLOCK_ERROR_OK, DcpBlockErrorName(), RecvSetResponse(), profinet::EthernetSocket::Send(), SignalDevice(), and profinet::String2Mac().

Referenced by SignalDevice().

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

Variable Documentation

◆ DCP_BLOCK_ERROR_IN_OPERATION

constexpr std::uint8_t profinet::dcp::DCP_BLOCK_ERROR_IN_OPERATION = 0x06
inlineconstexpr

DCP SET block-level result: set not possible, device in operation.

Definition at line 378 of file dcp.h.

◆ DCP_BLOCK_ERROR_OK

constexpr std::uint8_t profinet::dcp::DCP_BLOCK_ERROR_OK = 0x00
inlineconstexpr

DCP SET block-level result: OK.

Definition at line 366 of file dcp.h.

Referenced by ParseSetResponse(), ResetToFactory(), SetIp(), SetParam(), and SignalDevice().

◆ DCP_BLOCK_ERROR_OPTION_UNSUPPORTED

constexpr std::uint8_t profinet::dcp::DCP_BLOCK_ERROR_OPTION_UNSUPPORTED = 0x01
inlineconstexpr

DCP SET block-level result: option not supported.

Definition at line 368 of file dcp.h.

◆ DCP_BLOCK_ERROR_RESOURCE

constexpr std::uint8_t profinet::dcp::DCP_BLOCK_ERROR_RESOURCE = 0x04
inlineconstexpr

DCP SET block-level result: resource error.

Definition at line 374 of file dcp.h.

◆ DCP_BLOCK_ERROR_SET_NOT_POSSIBLE

constexpr std::uint8_t profinet::dcp::DCP_BLOCK_ERROR_SET_NOT_POSSIBLE = 0x05
inlineconstexpr

DCP SET block-level result: set not possible locally.

Definition at line 376 of file dcp.h.

◆ DCP_BLOCK_ERROR_SUBOPTION_NOT_SET

constexpr std::uint8_t profinet::dcp::DCP_BLOCK_ERROR_SUBOPTION_NOT_SET = 0x03
inlineconstexpr

DCP SET block-level result: suboption not set.

Definition at line 372 of file dcp.h.

◆ DCP_BLOCK_ERROR_SUBOPTION_UNSUPPORTED

constexpr std::uint8_t profinet::dcp::DCP_BLOCK_ERROR_SUBOPTION_UNSUPPORTED = 0x02
inlineconstexpr

DCP SET block-level result: suboption not supported.

Definition at line 370 of file dcp.h.

◆ DCP_GET_SET_FRAME_ID

constexpr std::uint16_t profinet::dcp::DCP_GET_SET_FRAME_ID = 0xFEFD
inlineconstexpr

Frame ID for DCP Get/Set requests and responses.

Definition at line 64 of file dcp.h.

Referenced by BuildDcpSignalRequest(), BuildSetParamRequest(), GetParam(), ResetToFactory(), and SetIp().

◆ DCP_HELLO_FRAME_ID

constexpr std::uint16_t profinet::dcp::DCP_HELLO_FRAME_ID = 0xFEFC
inlineconstexpr

Frame ID for DCP Hello announcements.

Definition at line 66 of file dcp.h.

Referenced by SendHello().

◆ DCP_HELLO_MULTICAST_MAC

const std::string profinet::dcp::DCP_HELLO_MULTICAST_MAC = "01:0e:cf:00:00:01"
inline

DCP Hello multicast destination MAC.

Definition at line 57 of file dcp.h.

Referenced by SendHello().

◆ DCP_IDENTIFY_REQUEST_FRAME_ID

constexpr std::uint16_t profinet::dcp::DCP_IDENTIFY_REQUEST_FRAME_ID = 0xFEFE
inlineconstexpr

Frame ID for DCP Identify requests.

Definition at line 60 of file dcp.h.

Referenced by SendDiscover(), and SendRequest().

◆ DCP_IDENTIFY_RESPONSE_FRAME_ID

constexpr std::uint16_t profinet::dcp::DCP_IDENTIFY_RESPONSE_FRAME_ID = 0xFEFF
inlineconstexpr

Frame ID for DCP Identify responses.

Definition at line 62 of file dcp.h.

◆ DCP_MAX_NAME_LENGTH

constexpr std::size_t profinet::dcp::DCP_MAX_NAME_LENGTH = 240
inlineconstexpr

Maximum allowed length in bytes for a station name.

Definition at line 85 of file dcp.h.

Referenced by BuildSetParamRequest().

◆ DCP_MULTICAST_MAC

const std::string profinet::dcp::DCP_MULTICAST_MAC = "01:0e:cf:00:00:00"
inline

DCP Identify/Get/Set multicast destination MAC.

Definition at line 55 of file dcp.h.

Referenced by SendDiscover(), and SendRequest().

◆ DCP_OPTION_ALL

constexpr std::uint8_t profinet::dcp::DCP_OPTION_ALL = 0xFF
inlineconstexpr

DCP option wildcard: all options.

Definition at line 102 of file dcp.h.

◆ DCP_OPTION_CONTROL

constexpr std::uint8_t profinet::dcp::DCP_OPTION_CONTROL = 0x05
inlineconstexpr

DCP option: control (start/stop/signal/reset).

Definition at line 96 of file dcp.h.

Referenced by BuildDcpSignalRequest(), ParseSetResponse(), and ResetToFactory().

◆ DCP_OPTION_DEVICE

constexpr std::uint8_t profinet::dcp::DCP_OPTION_DEVICE = 0x02
inlineconstexpr

DCP option: device identification.

Definition at line 90 of file dcp.h.

Referenced by profinet::dcp::DCPDeviceDescription::DCPDeviceDescription(), and SendHello().

◆ DCP_OPTION_DEVICE_INITIATIVE

constexpr std::uint8_t profinet::dcp::DCP_OPTION_DEVICE_INITIATIVE = 0x06
inlineconstexpr

DCP option: device-initiative (Hello) configuration.

Definition at line 98 of file dcp.h.

Referenced by profinet::dcp::DCPDeviceDescription::DCPDeviceDescription(), and SendHello().

◆ DCP_OPTION_DHCP

constexpr std::uint8_t profinet::dcp::DCP_OPTION_DHCP = 0x03
inlineconstexpr

DCP option: DHCP.

Definition at line 92 of file dcp.h.

Referenced by profinet::dcp::DCPDeviceDescription::DCPDeviceDescription(), and profinet::dcp::DCPDHCPBlock::Parse().

◆ DCP_OPTION_IP

constexpr std::uint8_t profinet::dcp::DCP_OPTION_IP = 0x01
inlineconstexpr

DCP option: IP configuration.

Definition at line 88 of file dcp.h.

Referenced by SendHello().

◆ DCP_OPTION_NME

constexpr std::uint8_t profinet::dcp::DCP_OPTION_NME = 0x07
inlineconstexpr

DCP option: Network Management (NME).

Definition at line 100 of file dcp.h.

◆ DCP_OPTION_RESERVED

constexpr std::uint8_t profinet::dcp::DCP_OPTION_RESERVED = 0x04
inlineconstexpr

DCP option: reserved.

Definition at line 94 of file dcp.h.

◆ DCP_SERVICE_ID_GET

constexpr std::uint8_t profinet::dcp::DCP_SERVICE_ID_GET = 0x03
inlineconstexpr

DCP service ID: GET.

Definition at line 69 of file dcp.h.

◆ DCP_SERVICE_ID_HELLO

constexpr std::uint8_t profinet::dcp::DCP_SERVICE_ID_HELLO = 0x06
inlineconstexpr

DCP service ID: HELLO.

Definition at line 75 of file dcp.h.

◆ DCP_SERVICE_ID_IDENTIFY

constexpr std::uint8_t profinet::dcp::DCP_SERVICE_ID_IDENTIFY = 0x05
inlineconstexpr

DCP service ID: IDENTIFY.

Definition at line 73 of file dcp.h.

◆ DCP_SERVICE_ID_SET

constexpr std::uint8_t profinet::dcp::DCP_SERVICE_ID_SET = 0x04
inlineconstexpr

DCP service ID: SET.

Definition at line 71 of file dcp.h.

◆ DCP_SERVICE_TYPE_REQUEST

constexpr std::uint8_t profinet::dcp::DCP_SERVICE_TYPE_REQUEST = 0x00
inlineconstexpr

DCP service type: REQUEST.

Definition at line 78 of file dcp.h.

◆ DCP_SERVICE_TYPE_RESPONSE_SUCCESS

constexpr std::uint8_t profinet::dcp::DCP_SERVICE_TYPE_RESPONSE_SUCCESS = 0x01
inlineconstexpr

DCP service type: RESPONSE (success).

Definition at line 80 of file dcp.h.

Referenced by ParseSetResponse().

◆ DCP_SERVICE_TYPE_RESPONSE_UNSUPPORTED

constexpr std::uint8_t profinet::dcp::DCP_SERVICE_TYPE_RESPONSE_UNSUPPORTED = 0x05
inlineconstexpr

DCP service type: RESPONSE (service unsupported).

Definition at line 82 of file dcp.h.

Referenced by ParseSetResponse().

◆ DCP_SUBOPTION_CONTROL_RESET_FACTORY

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_CONTROL_RESET_FACTORY = 0x05
inlineconstexpr

DCP suboption (Control): factory reset.

Definition at line 139 of file dcp.h.

◆ DCP_SUBOPTION_CONTROL_RESET_TO_FACTORY

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_CONTROL_RESET_TO_FACTORY = 0x06
inlineconstexpr

DCP suboption (Control): reset to factory.

Definition at line 141 of file dcp.h.

Referenced by ResetToFactory().

◆ DCP_SUBOPTION_CONTROL_RESPONSE

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_CONTROL_RESPONSE = 0x04
inlineconstexpr

DCP suboption (Control): response.

Definition at line 137 of file dcp.h.

Referenced by ParseSetResponse().

◆ DCP_SUBOPTION_CONTROL_SIGNAL

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_CONTROL_SIGNAL = 0x03
inlineconstexpr

DCP suboption (Control): signal (flash LEDs).

Definition at line 135 of file dcp.h.

Referenced by BuildDcpSignalRequest().

◆ DCP_SUBOPTION_CONTROL_START

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_CONTROL_START = 0x01
inlineconstexpr

DCP suboption (Control): start.

Definition at line 131 of file dcp.h.

◆ DCP_SUBOPTION_CONTROL_STOP

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_CONTROL_STOP = 0x02
inlineconstexpr

DCP suboption (Control): stop.

Definition at line 133 of file dcp.h.

◆ DCP_SUBOPTION_DEVICE_ALIAS

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_DEVICE_ALIAS = 0x06
inlineconstexpr

DCP suboption (Device): alias name.

Definition at line 122 of file dcp.h.

Referenced by profinet::dcp::DCPDeviceDescription::DCPDeviceDescription().

◆ DCP_SUBOPTION_DEVICE_ID

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_DEVICE_ID = 0x03
inlineconstexpr

DCP suboption (Device): vendor/device ID.

Definition at line 116 of file dcp.h.

Referenced by SendHello().

◆ DCP_SUBOPTION_DEVICE_INITIATIVE

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_DEVICE_INITIATIVE = 0x01
inlineconstexpr

DCP suboption (DeviceInitiative): the only suboption.

Definition at line 163 of file dcp.h.

Referenced by profinet::dcp::DCPDeviceDescription::DCPDeviceDescription(), and SendHello().

◆ DCP_SUBOPTION_DEVICE_INSTANCE

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_DEVICE_INSTANCE = 0x07
inlineconstexpr

DCP suboption (Device): device instance.

Definition at line 124 of file dcp.h.

Referenced by profinet::dcp::DCPDeviceDescription::DCPDeviceDescription().

◆ DCP_SUBOPTION_DEVICE_NAME

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_DEVICE_NAME = 0x02
inlineconstexpr

DCP suboption (Device): station name.

Definition at line 114 of file dcp.h.

Referenced by SendHello().

◆ DCP_SUBOPTION_DEVICE_OEM_ID

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_DEVICE_OEM_ID = 0x08
inlineconstexpr

DCP suboption (Device): OEM vendor/device ID.

Definition at line 126 of file dcp.h.

◆ DCP_SUBOPTION_DEVICE_OPTIONS

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_DEVICE_OPTIONS = 0x05
inlineconstexpr

DCP suboption (Device): supported options list.

Definition at line 120 of file dcp.h.

◆ DCP_SUBOPTION_DEVICE_ROLE

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_DEVICE_ROLE = 0x04
inlineconstexpr

DCP suboption (Device): device role bitmask.

Definition at line 118 of file dcp.h.

Referenced by SendHello().

◆ DCP_SUBOPTION_DEVICE_RSI

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_DEVICE_RSI = 0x0A
inlineconstexpr

DCP suboption (Device): RSI (reverse status indication).

Definition at line 128 of file dcp.h.

◆ DCP_SUBOPTION_DEVICE_TYPE

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_DEVICE_TYPE = 0x01
inlineconstexpr

DCP suboption (Device): device type string.

Definition at line 112 of file dcp.h.

◆ DCP_SUBOPTION_DHCP_CLASS_ID

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_DHCP_CLASS_ID = 0x3C
inlineconstexpr

DCP suboption (DHCP): class identifier option.

Definition at line 152 of file dcp.h.

◆ DCP_SUBOPTION_DHCP_CLIENT_ID

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_DHCP_CLIENT_ID = 0x3D
inlineconstexpr

DCP suboption (DHCP): client identifier option.

Definition at line 154 of file dcp.h.

Referenced by profinet::dcp::DCPDHCPBlock::Parse().

◆ DCP_SUBOPTION_DHCP_CONTROL

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_DHCP_CONTROL = 0xFF
inlineconstexpr

DCP suboption (DHCP): DHCP control.

Definition at line 160 of file dcp.h.

◆ DCP_SUBOPTION_DHCP_FQDN

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_DHCP_FQDN = 0x51
inlineconstexpr

DCP suboption (DHCP): fully qualified domain name option.

Definition at line 156 of file dcp.h.

Referenced by profinet::dcp::DCPDHCPBlock::Parse().

◆ DCP_SUBOPTION_DHCP_HOSTNAME

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_DHCP_HOSTNAME = 0x0C
inlineconstexpr

DCP suboption (DHCP): hostname option.

Definition at line 144 of file dcp.h.

Referenced by profinet::dcp::DCPDHCPBlock::Parse().

◆ DCP_SUBOPTION_DHCP_PARAM_REQ

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_DHCP_PARAM_REQ = 0x37
inlineconstexpr

DCP suboption (DHCP): parameter request list.

Definition at line 150 of file dcp.h.

◆ DCP_SUBOPTION_DHCP_SERVER_ID

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_DHCP_SERVER_ID = 0x36
inlineconstexpr

DCP suboption (DHCP): server identifier option.

Definition at line 148 of file dcp.h.

◆ DCP_SUBOPTION_DHCP_UUID

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_DHCP_UUID = 0x61
inlineconstexpr

DCP suboption (DHCP): client UUID option.

Definition at line 158 of file dcp.h.

Referenced by profinet::dcp::DCPDHCPBlock::Parse().

◆ DCP_SUBOPTION_DHCP_VENDOR_SPEC

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_DHCP_VENDOR_SPEC = 0x2B
inlineconstexpr

DCP suboption (DHCP): vendor-specific option.

Definition at line 146 of file dcp.h.

Referenced by profinet::dcp::DCPDHCPBlock::Parse().

◆ DCP_SUBOPTION_IP_FULL_SUITE

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_IP_FULL_SUITE = 0x03
inlineconstexpr

DCP suboption (IP): full IP suite.

Definition at line 109 of file dcp.h.

◆ DCP_SUBOPTION_IP_MAC

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_IP_MAC = 0x01
inlineconstexpr

DCP suboption (IP): MAC address.

Definition at line 105 of file dcp.h.

◆ DCP_SUBOPTION_IP_PARAMETER

constexpr std::uint8_t profinet::dcp::DCP_SUBOPTION_IP_PARAMETER = 0x02
inlineconstexpr

DCP suboption (IP): IP/netmask/gateway parameter.

Definition at line 107 of file dcp.h.

Referenced by SendHello().

◆ DEFAULT_HELLO_TIMEOUT

constexpr std::uint16_t profinet::dcp::DEFAULT_HELLO_TIMEOUT = 10
inlineconstexpr

Default HELLO timeout.

Definition at line 192 of file dcp.h.

◆ DEFAULT_RESPONSE_DELAY_FACTOR

constexpr std::uint16_t profinet::dcp::DEFAULT_RESPONSE_DELAY_FACTOR = 0x0080
inlineconstexpr

Default dcp response delay factor.

Definition at line 194 of file dcp.h.

◆ DEFAULT_RESPONSE_TIMEOUT

constexpr std::uint16_t profinet::dcp::DEFAULT_RESPONSE_TIMEOUT = 20
inlineconstexpr

Default response timeout. How long to keep listening for responses.

Definition at line 190 of file dcp.h.

◆ DEFAULT_TIMEOUT

constexpr std::uint16_t profinet::dcp::DEFAULT_TIMEOUT = 5
inlineconstexpr

Default timeout.

Definition at line 188 of file dcp.h.

◆ DEVICE_ROLE_IO_CONTROLLER

constexpr std::uint8_t profinet::dcp::DEVICE_ROLE_IO_CONTROLLER = 0x02
inlineconstexpr

Device role bit: IO-Controller.

Definition at line 168 of file dcp.h.

◆ DEVICE_ROLE_IO_DEVICE

constexpr std::uint8_t profinet::dcp::DEVICE_ROLE_IO_DEVICE = 0x01
inlineconstexpr

Device role bit: IO-Device.

Definition at line 166 of file dcp.h.

◆ DEVICE_ROLE_IO_MULTIDEVICE

constexpr std::uint8_t profinet::dcp::DEVICE_ROLE_IO_MULTIDEVICE = 0x04
inlineconstexpr

Device role bit: IO-Multidevice.

Definition at line 170 of file dcp.h.

◆ DEVICE_ROLE_PN_SUPERVISOR

constexpr std::uint8_t profinet::dcp::DEVICE_ROLE_PN_SUPERVISOR = 0x08
inlineconstexpr

Device role bit: PN-Supervisor.

Definition at line 172 of file dcp.h.

◆ FLASH_DURATION_MS

constexpr std::uint16_t profinet::dcp::FLASH_DURATION_MS = 3000
inlineconstexpr

Default flash duration of the leds.

Definition at line 196 of file dcp.h.

◆ RESET_MODE_ALL_DATA

constexpr std::uint16_t profinet::dcp::RESET_MODE_ALL_DATA = 0x0010
inlineconstexpr

Reset mode bit: reset all stored data.

Definition at line 181 of file dcp.h.

◆ RESET_MODE_APPLICATION

constexpr std::uint16_t profinet::dcp::RESET_MODE_APPLICATION = 0x0004
inlineconstexpr

Reset mode bit: reset application data.

Definition at line 177 of file dcp.h.

◆ RESET_MODE_COMMUNICATION

constexpr std::uint16_t profinet::dcp::RESET_MODE_COMMUNICATION = 0x0002
inlineconstexpr

Reset mode bit: reset communication parameters.

Definition at line 175 of file dcp.h.

◆ RESET_MODE_DEVICE

constexpr std::uint16_t profinet::dcp::RESET_MODE_DEVICE = 0x0020
inlineconstexpr

Reset mode bit: reset device.

Definition at line 183 of file dcp.h.

◆ RESET_MODE_ENGINEERING

constexpr std::uint16_t profinet::dcp::RESET_MODE_ENGINEERING = 0x0008
inlineconstexpr

Reset mode bit: reset engineering parameters.

Definition at line 179 of file dcp.h.

◆ RESET_MODE_FACTORY

constexpr std::uint16_t profinet::dcp::RESET_MODE_FACTORY = 0x0040
inlineconstexpr

Reset mode bit: reset to factory defaults.

Definition at line 185 of file dcp.h.