|
PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
|
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< BlockKey > | supportedOptions |
| List of (option, suboption) blocks the device supports. | |
| std::vector< DCPDHCPBlock > | dhcpBlocks |
| 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. | |
Parsed PROFINET device information from a DCP response.
Mirrors dcp.py's 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.
| mac | Source MAC address the response came from. |
| blocks | Parsed (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:
|
inline |
Combine DeviceHigh/DeviceLow into a 16-bit 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:| std::string profinet::dcp::DCPDeviceDescription::ToString | ( | ) | const |
Multi-line human-readable summary of this device.
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:
|
inline |
Combine VendorHigh/VendorLow into a 16-bit 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:| std::string profinet::dcp::DCPDeviceDescription::VendorName | ( | ) | const |
Look up the vendor name for this device's vendor ID.
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:| std::string profinet::dcp::DCPDeviceDescription::aliasName |
| 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().
| std::uint16_t profinet::dcp::DCPDeviceDescription::deviceInitiative = 0 |
Raw device-initiative value (see DeviceInitiative).
| std::pair<std::uint8_t, std::uint8_t> profinet::dcp::DCPDeviceDescription::deviceInstance {0, 0} |
| 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().
| std::uint8_t profinet::dcp::DCPDeviceDescription::deviceRole = 0 |
| 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().
| 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().
| std::vector<DCPDHCPBlock> profinet::dcp::DCPDeviceDescription::dhcpBlocks |
| 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().
| std::string profinet::dcp::DCPDeviceDescription::ip = "0.0.0.0" |
IPv4 address, or "0.0.0.0" if unset.
Definition at line 443 of file dcp.h.
Referenced by profinet::rpc::RPCCon::RPCCon(), profinet::device::ProfinetDevice::FromIp(), profinet::device::ProfinetDevice::GetInfo(), profinet::device::ProfinetDevice::Ip(), and profinet::device::ProfinetDevice::ToString().
| std::uint16_t profinet::dcp::DCPDeviceDescription::ipBlockInfo = 0 |
Raw IP block info flags (see IPBlockInfo).
| bool profinet::dcp::DCPDeviceDescription::ipConflict = false |
| bool profinet::dcp::DCPDeviceDescription::ipSetByDhcp = false |
| bool profinet::dcp::DCPDeviceDescription::issuesHello = false |
| std::string profinet::dcp::DCPDeviceDescription::mac |
Device's MAC address, formatted as a string.
Definition at line 434 of file dcp.h.
Referenced by profinet::device::ProfinetDevice::GetInfo(), profinet::device::ProfinetDevice::Mac(), profinet::device::ProfinetDevice::StartAlarmListener(), and profinet::device::ProfinetDevice::StartCyclic().
| std::string profinet::dcp::DCPDeviceDescription::name |
Station name.
Definition at line 440 of file dcp.h.
Referenced by profinet::device::ProfinetDevice::Connect(), profinet::device::ProfinetDevice::GetInfo(), profinet::rpc::GetStationInfo(), profinet::device::ProfinetDevice::Name(), profinet::rpc::RPCCon::SendReceive(), and profinet::device::ProfinetDevice::ToString().
| 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().
| std::map<BlockKey, std::vector<std::uint8_t> > profinet::dcp::DCPDeviceDescription::rawBlocks |
| std::vector<BlockKey> profinet::dcp::DCPDeviceDescription::supportedOptions |
| 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().
| 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().