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.
 
DcpIpBlockInfo ipBlockInfo = DcpIpBlockInfo::NotSet
 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::uint16_t vendorId = 0
 The PROFINET vendor ID.
 
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::uint16_t deviceId = 0
 The PROFINET device 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< BlockKey > supportedOptions
 List of (option, suboption) blocks the device supports.
 
std::vector< DCPDHCPBlock > dhcpBlocks
 Parsed DHCP blocks from the response, if any.
 
DcpDeviceInitiative deviceInitiative = DcpDeviceInitiative::NoHello
 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.

Definition at line 267 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 603 of file dcp.cpp.

References profinet::ByteAt(), profinet::DecodeBytes(), profinet::dcp::DecodeDeviceRole(), profinet::wire::Reader::Fixed(), profinet::dcp::HasConflict(), profinet::dcp::IsDhcp(), profinet::Mac2String(), profinet::dcp::MakeBlockKey(), option, profinet::wire::Reader::Skip(), profinet::String2Ip(), suboption, profinet::wire::Reader::U16(), and profinet::wire::Reader::U8().

+ 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 357 of file dcp.h.

References deviceId.

Referenced by profinet::device::ProfinetDevice::GetInfo(), profinet::dcp::TEST(), and profinet::dcp::TEST().

+ 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.

Definition at line 751 of file dcp.cpp.

References profinet::DeviceId, profinet::dcp::GetBlockName(), profinet::dcp::GetDeviceInitiativeName(), profinet::dcp::GetIPBlockInfoName(), profinet::Hex4(), option, suboption, 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 350 of file dcp.h.

References vendorId.

Referenced by profinet::device::ProfinetDevice::GetInfo(), profinet::dcp::TEST(), and profinet::dcp::TEST().

+ 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 746 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 330 of file dcp.h.

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

◆ deviceHigh

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

High byte of the PROFINET device ID.

Definition at line 315 of file dcp.h.

Referenced by profinet::rpc::RPCCon::RPCCon().

◆ deviceId

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

The PROFINET device ID.

Definition at line 312 of file dcp.h.

Referenced by DeviceId().

◆ deviceInitiative

DcpDeviceInitiative profinet::dcp::DCPDeviceDescription::deviceInitiative = DcpDeviceInitiative::NoHello

Raw device-initiative value (see DeviceInitiative).

Definition at line 340 of file dcp.h.

Referenced by profinet::dcp::TEST(), and profinet::dcp::TEST().

◆ deviceInstance

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

Device instance (high, low) pair.

Definition at line 327 of file dcp.h.

Referenced by profinet::dcp::TEST(), and profinet::dcp::TEST().

◆ deviceLow

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

Low byte of the PROFINET device ID.

Definition at line 318 of file dcp.h.

Referenced by profinet::rpc::RPCCon::RPCCon().

◆ deviceRole

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

Raw device role bitmask.

Definition at line 321 of file dcp.h.

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

◆ deviceRoles

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

Decoded device role names (see DecodeDeviceRole()).

Definition at line 324 of file dcp.h.

Referenced by profinet::device::ProfinetDevice::GetInfo(), profinet::dcp::TEST(), and profinet::dcp::TEST().

◆ deviceType

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

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

Definition at line 279 of file dcp.h.

Referenced by profinet::device::ProfinetDevice::GetInfo(), profinet::dcp::TEST(), and profinet::dcp::TEST().

◆ dhcpBlocks

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

Parsed DHCP blocks from the response, if any.

Definition at line 336 of file dcp.h.

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

◆ gateway

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

IPv4 default gateway, or "0.0.0.0" if unset.

Definition at line 291 of file dcp.h.

Referenced by profinet::device::ProfinetDevice::GetInfo(), profinet::dcp::TEST(), profinet::dcp::TEST(), profinet::dcp::TEST(), and profinet::dcp::TEST().

◆ ip

◆ ipBlockInfo

DcpIpBlockInfo profinet::dcp::DCPDeviceDescription::ipBlockInfo = DcpIpBlockInfo::NotSet

IP block info flags (see IPBlockInfo).

Definition at line 294 of file dcp.h.

Referenced by profinet::dcp::TEST(), profinet::dcp::TEST(), and profinet::dcp::TEST().

◆ ipConflict

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

Whether an IP address conflict was detected.

Definition at line 297 of file dcp.h.

Referenced by profinet::dcp::TEST(), and profinet::dcp::TEST().

◆ ipSetByDhcp

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

Whether the IP address was assigned via DHCP.

Definition at line 300 of file dcp.h.

Referenced by profinet::dcp::TEST(), and profinet::dcp::TEST().

◆ issuesHello

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

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

Definition at line 343 of file dcp.h.

Referenced by profinet::dcp::TEST(), and profinet::dcp::TEST().

◆ 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 288 of file dcp.h.

Referenced by profinet::device::ProfinetDevice::GetInfo(), profinet::dcp::TEST(), profinet::dcp::TEST(), profinet::dcp::TEST(), and profinet::dcp::TEST().

◆ 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 346 of file dcp.h.

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

◆ supportedOptions

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

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

Definition at line 333 of file dcp.h.

Referenced by profinet::dcp::TEST(), and profinet::dcp::TEST().

◆ vendorHigh

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

High byte of the PROFINET vendor ID.

Definition at line 306 of file dcp.h.

Referenced by profinet::rpc::RPCCon::RPCCon().

◆ vendorId

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

The PROFINET vendor ID.

Definition at line 303 of file dcp.h.

Referenced by VendorId().

◆ vendorLow

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

Low byte of the PROFINET vendor ID.

Definition at line 309 of file dcp.h.

Referenced by profinet::rpc::RPCCon::RPCCon().


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