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

Parsed PROFINET device information from a DCP response. More...

#include <dcp.h>

+ Collaboration diagram for profinet::dcp::DCPDeviceDescription:

Public Member Functions

 DCPDeviceDescription (const MacAddress &mac, const std::map< BlockKey, std::vector< std::uint8_t > > &blocks)
 Build a description from a device's MAC and its parsed DCP blocks.
 
std::uint16_t VendorId () const
 Combine VendorHigh/VendorLow into a 16-bit vendor ID.
 
std::uint16_t DeviceId () const
 Combine DeviceHigh/DeviceLow into a 16-bit device ID.
 
std::string VendorName () const
 Look up the vendor name for this device's vendor ID.
 
std::string ToString () const
 Multi-line human-readable summary of this device.
 

Public Attributes

std::string mac
 Device's MAC address, formatted as a string.
 
std::string deviceType
 Device type string (e.g. model name).
 
std::string name
 Station name.
 
std::string ip = "0.0.0.0"
 IPv4 address, or "0.0.0.0" if unset.
 
std::string netmask = "0.0.0.0"
 IPv4 subnet mask, or "0.0.0.0" if unset.
 
std::string gateway = "0.0.0.0"
 IPv4 default gateway, or "0.0.0.0" if unset.
 
std::uint16_t ipBlockInfo = 0
 Raw IP block info flags (see IPBlockInfo).
 
bool ipConflict = false
 Whether an IP address conflict was detected.
 
bool ipSetByDhcp = false
 Whether the IP address was assigned via DHCP.
 
std::uint8_t vendorHigh = 0
 High byte of the PROFINET vendor ID.
 
std::uint8_t vendorLow = 0
 Low byte of the PROFINET vendor ID.
 
std::uint8_t deviceHigh = 0
 High byte of the PROFINET device ID.
 
std::uint8_t deviceLow = 0
 Low byte of the PROFINET device ID.
 
std::uint8_t deviceRole = 0
 Raw device role bitmask.
 
std::vector< std::string > deviceRoles
 Decoded device role names (see DecodeDeviceRole()).
 
std::pair< std::uint8_t, std::uint8_t > deviceInstance {0, 0}
 Device instance (high, low) pair.
 
std::string aliasName
 Device alias name, if set.
 
std::vector< BlockKeysupportedOptions
 List of (option, suboption) blocks the device supports.
 
std::vector< DCPDHCPBlockdhcpBlocks
 Parsed DHCP blocks from the response, if any.
 
std::uint16_t deviceInitiative = 0
 Raw device-initiative value (see DeviceInitiative).
 
bool issuesHello = false
 Whether the device issues a DCP-Hello after power-on.
 
std::map< BlockKey, std::vector< std::uint8_t > > rawBlocks
 Any parsed blocks not covered by the named fields above.
 

Detailed Description

Parsed PROFINET device information from a DCP response.

Mirrors dcp.py's DCPDeviceDescription.

Definition at line 425 of file dcp.h.

Constructor & Destructor Documentation

◆ DCPDeviceDescription()

profinet::dcp::DCPDeviceDescription::DCPDeviceDescription ( const MacAddress mac,
const std::map< BlockKey, std::vector< std::uint8_t > > &  blocks 
)

Build a description from a device's MAC and its parsed DCP blocks.

Parameters
macSource MAC address the response came from.
blocksParsed (option,suboption) -> payload blocks from the response.

Definition at line 493 of file dcp.cpp.

References profinet::dcp::DCP_OPTION_DEVICE, profinet::dcp::DCP_OPTION_DEVICE_INITIATIVE, profinet::dcp::DCP_OPTION_DHCP, profinet::dcp::DCP_SUBOPTION_DEVICE_ALIAS, profinet::dcp::DCP_SUBOPTION_DEVICE_INITIATIVE, profinet::dcp::DCP_SUBOPTION_DEVICE_INSTANCE, profinet::DecodeBytes(), profinet::dcp::DecodeDeviceRole(), profinet::Mac2String(), and profinet::String2Ip().

+ Here is the call graph for this function:

Member Function Documentation

◆ DeviceId()

std::uint16_t profinet::dcp::DCPDeviceDescription::DeviceId ( ) const
inline

Combine DeviceHigh/DeviceLow into a 16-bit device ID.

Returns
The 16-bit PROFINET device ID.

Definition at line 508 of file dcp.h.

References deviceHigh, deviceLow, and profinet::OneOctetShift.

Referenced by profinet::device::ProfinetDevice::GetInfo().

+ Here is the caller graph for this function:

◆ ToString()

std::string profinet::dcp::DCPDeviceDescription::ToString ( ) const

Multi-line human-readable summary of this device.

Returns
A formatted summary string, mirroring Python's str.

Definition at line 626 of file dcp.cpp.

References profinet::dcp::GetBlockName(), profinet::Hex4(), and profinet::ToHex().

Referenced by profinet::device::ProfinetDevice::Discover().

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

◆ VendorId()

std::uint16_t profinet::dcp::DCPDeviceDescription::VendorId ( ) const
inline

Combine VendorHigh/VendorLow into a 16-bit vendor ID.

Returns
The 16-bit PROFINET vendor ID.

Definition at line 501 of file dcp.h.

References profinet::OneOctetShift, vendorHigh, and vendorLow.

Referenced by profinet::device::ProfinetDevice::GetInfo().

+ Here is the caller graph for this function:

◆ VendorName()

std::string profinet::dcp::DCPDeviceDescription::VendorName ( ) const

Look up the vendor name for this device's vendor ID.

Returns
The vendor name (see GetVendorName()).

Definition at line 621 of file dcp.cpp.

References profinet::GetVendorName().

Referenced by profinet::device::ProfinetDevice::GetInfo().

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

Member Data Documentation

◆ aliasName

std::string profinet::dcp::DCPDeviceDescription::aliasName

Device alias name, if set.

Definition at line 482 of file dcp.h.

◆ deviceHigh

std::uint8_t profinet::dcp::DCPDeviceDescription::deviceHigh = 0

High byte of the PROFINET device ID.

Definition at line 467 of file dcp.h.

Referenced by profinet::rpc::RPCCon::RPCCon(), and DeviceId().

◆ deviceInitiative

std::uint16_t profinet::dcp::DCPDeviceDescription::deviceInitiative = 0

Raw device-initiative value (see DeviceInitiative).

Definition at line 491 of file dcp.h.

◆ deviceInstance

std::pair<std::uint8_t, std::uint8_t> profinet::dcp::DCPDeviceDescription::deviceInstance {0, 0}

Device instance (high, low) pair.

Definition at line 479 of file dcp.h.

◆ deviceLow

std::uint8_t profinet::dcp::DCPDeviceDescription::deviceLow = 0

Low byte of the PROFINET device ID.

Definition at line 470 of file dcp.h.

Referenced by profinet::rpc::RPCCon::RPCCon(), and DeviceId().

◆ deviceRole

std::uint8_t profinet::dcp::DCPDeviceDescription::deviceRole = 0

Raw device role bitmask.

Definition at line 473 of file dcp.h.

◆ deviceRoles

std::vector<std::string> profinet::dcp::DCPDeviceDescription::deviceRoles

Decoded device role names (see DecodeDeviceRole()).

Definition at line 476 of file dcp.h.

Referenced by profinet::device::ProfinetDevice::GetInfo().

◆ deviceType

std::string profinet::dcp::DCPDeviceDescription::deviceType

Device type string (e.g. model name).

Definition at line 437 of file dcp.h.

Referenced by profinet::device::ProfinetDevice::GetInfo().

◆ dhcpBlocks

std::vector<DCPDHCPBlock> profinet::dcp::DCPDeviceDescription::dhcpBlocks

Parsed DHCP blocks from the response, if any.

Definition at line 488 of file dcp.h.

◆ gateway

std::string profinet::dcp::DCPDeviceDescription::gateway = "0.0.0.0"

IPv4 default gateway, or "0.0.0.0" if unset.

Definition at line 449 of file dcp.h.

Referenced by profinet::device::ProfinetDevice::GetInfo().

◆ ip

std::string profinet::dcp::DCPDeviceDescription::ip = "0.0.0.0"

◆ ipBlockInfo

std::uint16_t profinet::dcp::DCPDeviceDescription::ipBlockInfo = 0

Raw IP block info flags (see IPBlockInfo).

Definition at line 452 of file dcp.h.

◆ ipConflict

bool profinet::dcp::DCPDeviceDescription::ipConflict = false

Whether an IP address conflict was detected.

Definition at line 455 of file dcp.h.

◆ ipSetByDhcp

bool profinet::dcp::DCPDeviceDescription::ipSetByDhcp = false

Whether the IP address was assigned via DHCP.

Definition at line 458 of file dcp.h.

◆ issuesHello

bool profinet::dcp::DCPDeviceDescription::issuesHello = false

Whether the device issues a DCP-Hello after power-on.

Definition at line 494 of file dcp.h.

◆ mac

std::string profinet::dcp::DCPDeviceDescription::mac

◆ name

◆ netmask

std::string profinet::dcp::DCPDeviceDescription::netmask = "0.0.0.0"

IPv4 subnet mask, or "0.0.0.0" if unset.

Definition at line 446 of file dcp.h.

Referenced by profinet::device::ProfinetDevice::GetInfo().

◆ rawBlocks

std::map<BlockKey, std::vector<std::uint8_t> > profinet::dcp::DCPDeviceDescription::rawBlocks

Any parsed blocks not covered by the named fields above.

Definition at line 497 of file dcp.h.

◆ supportedOptions

std::vector<BlockKey> profinet::dcp::DCPDeviceDescription::supportedOptions

List of (option, suboption) blocks the device supports.

Definition at line 485 of file dcp.h.

◆ vendorHigh

std::uint8_t profinet::dcp::DCPDeviceDescription::vendorHigh = 0

High byte of the PROFINET vendor ID.

Definition at line 461 of file dcp.h.

Referenced by profinet::rpc::RPCCon::RPCCon(), and VendorId().

◆ vendorLow

std::uint8_t profinet::dcp::DCPDeviceDescription::vendorLow = 0

Low byte of the PROFINET vendor ID.

Definition at line 464 of file dcp.h.

Referenced by profinet::rpc::RPCCon::RPCCon(), and VendorId().


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