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

Classes

class  DcpScanner
 Production implementation of IDcpScanner using DCP over Ethernet. More...
 
struct  DeviceInfo
 Complete device information summary. More...
 
class  DeviceInfoTests
 
class  DeviceTest
 
class  IDcpScanner
 Interface for PROFINET DCP device discovery. More...
 
class  MockDcpScanner
 Mock implementation of IDcpScanner used to test ProfinetScanner without performing real DCP network discovery. More...
 
class  MockMacAddressProvider
 Mock implementation of IMacAddressProvider for unit tests. More...
 
class  ParseMacTests
 
class  ProfinetDevice
 High-level PROFINET device interface. More...
 
class  ProfinetDeviceAlarmListenerTests
 
class  ProfinetDeviceAlarmTests
 
class  ProfinetDeviceConnectionLifecycleTests
 
class  ProfinetDeviceDiagnosisTests
 
class  ProfinetDeviceImTests
 
class  ProfinetDeviceInfoTests
 
class  ProfinetDeviceReadWriteTests
 
class  ProfinetDeviceStringTests
 
class  ProfinetScannerTest
 Test fixture for ProfinetScanner. More...
 
class  StartCyclicTests
 
struct  WriteItem
 A single write operation for ProfinetDevice::WriteMultiple(). More...
 

Functions

std::optional< MacAddress > ParseMac (const std::string &macStr)
 Parse a MAC address string in any common separator style.
 
bool IsMacAddress (const std::string &identifier)
 Whether a string parses as a MAC address.
 
std::vector< ProfinetDevice > Scan (const std::string &interface="eth0", double timeoutSec=3.0, std::unique_ptr< IDcpScanner > dcpScanner=nullptr, std::unique_ptr< IMacAddressProvider > macAddressProvider=nullptr)
 Scan the network for PROFINET devices via DCP Identify.
 
std::map< std::string, DeviceInfo > ScanDict (const std::string &interface="eth0", double timeoutSec=3.0, std::unique_ptr< IDcpScanner > dcpScanner=nullptr, std::unique_ptr< IMacAddressProvider > macAddressProvider=nullptr)
 Scan the network and return a name -> DeviceInfo map.
 
 TEST_F (DeviceTest, ParseMacAcceptsColonDashAndDotSeparators)
 
 TEST_F (DeviceTest, ParseMacRejectsNonMacStrings)
 
 TEST_F (DeviceTest, IsMacAddressMatchesParseMac)
 
 TEST_F (DeviceTest, DeviceInfoHelpersReturnEmptyOrZeroWhenIm0Unset)
 
 TEST_F (DeviceTest, DeviceInfoHelpersExtractAndTrimIm0Fields)
 
 TEST_F (DeviceTest, FromDcpInfoConstructsWithoutDiscovery)
 
 TEST_F (DeviceTest, DiscoverWithUnknownMacThrowsDcpDeviceNotFoundError)
 
 TEST (DeviceMoveTests, MoveConstructionDisconnectsSource)
 
 TEST (DeviceMoveTests, MoveAssignmentReleasesDestinationFirst)
 
 TEST (DeviceMoveTests, MovedFromDeviceCanBeDestroyedSafely)
 
 TEST_F (ProfinetScannerTest, ScanPreservesZeroTimeout)
 
 TEST_F (ProfinetScannerTest, ScanPreservesShortTimeout)
 
 TEST_F (ProfinetScannerTest, ScanPreservesLongTimeout)
 
 TEST_F (ProfinetScannerTest, ScanCreatesDeviceForEveryResponse)
 
 TEST_F (ProfinetScannerTest, ScanDictKeepsDuplicateStationNames)
 
 TEST_F (ProfinetScannerTest, ScanDictKeepsEmptyStationNames)
 
 TEST_F (StartCyclicTests, ConnectsWithAlarmCrAndIocrSetup)
 
 TEST_F (StartCyclicTests, StartsRtAfterPrmEndAndApplicationReady)
 
 TEST_F (StartCyclicTests, MissingCyclicResultFailsStartup)
 
 TEST_F (StartCyclicTests, ApplicationReadyFailurePropagates)
 
 TEST_F (StartCyclicTests, ApplicationReadyFailureDoesNotStartRt)
 
 TEST (StartCyclicOrderingTests, StartsRtAfterApplicationReadyWhenDisabled)
 
 TEST (StartCyclicOrderingTests, ApplicationReadyCanBeSkipped)
 
 TEST_F (StartCyclicTests, CommitsConnectedDeviceState)
 
 TEST_F (StartCyclicTests, RequestsAlarmCrConnection)
 
 TEST (StartCyclicArHandlingTests, ReleasesExistingArBeforeNewConnect)
 
 TEST (StartCyclicArHandlingTests, StopsAlarmListenerBeforeReplacingAr)
 
 TEST (StartCyclicRollbackTests, PrmEndFailureRollsBack)
 
 TEST (StartCyclicRollbackTests, MissingCyclicResultRollsBack)
 
 TEST (StartCyclicRollbackTests, ApplicationReadyFailureStopsStartedRt)
 
 TEST (StartCyclicRollbackTests, ReleaseFailureDoesNotMaskOriginalError)
 
 TEST_F (ParseMacTests, ParsesColonSeparatedMac)
 
 TEST_F (ParseMacTests, ParsesDashSeparatedMac)
 
 TEST_F (ParseMacTests, ParsesDotSeparatedMac)
 
 TEST_F (ParseMacTests, RejectsInvalidMac)
 
 TEST_F (ParseMacTests, IsMacAddressAcceptsValidMac)
 
 TEST_F (ParseMacTests, IsMacAddressRejectsInvalidIdentifier)
 
 TEST_F (DeviceInfoTests, SerialNumberReturnsEmptyWhenIm0Missing)
 
 TEST_F (DeviceInfoTests, OrderIdReturnsEmptyWhenIm0Missing)
 
 TEST_F (DeviceInfoTests, HardwareRevisionReturnsZeroWhenIm0Missing)
 
 TEST_F (DeviceInfoTests, SoftwareRevisionReturnsEmptyWhenIm0Missing)
 
 TEST_F (ProfinetDeviceReadWriteTests, ReadReturnsRpcPayload)
 
 TEST_F (ProfinetDeviceReadWriteTests, WriteDelegatesArguments)
 
 TEST_F (ProfinetDeviceReadWriteTests, WriteMultipleMapsItems)
 
 TEST_F (ProfinetDeviceImTests, ReadIm0Delegates)
 
 TEST_F (ProfinetDeviceImTests, ReadIm1Delegates)
 
 TEST_F (ProfinetDeviceImTests, ReadIm2Delegates)
 
 TEST_F (ProfinetDeviceImTests, ReadIm3Delegates)
 
 TEST_F (ProfinetDeviceImTests, ReadIm4Delegates)
 
 TEST_F (ProfinetDeviceImTests, ReadIm5Delegates)
 
 TEST_F (ProfinetDeviceImTests, ReadAllImDelegates)
 
 TEST_F (ProfinetDeviceImTests, WriteIm1BuildsPaddedBlock)
 
 TEST_F (ProfinetDeviceImTests, WriteIm1RejectsFunctionLongerThan32Characters)
 
 TEST_F (ProfinetDeviceImTests, WriteIm1RejectsLocationLongerThan22Characters)
 
 TEST_F (ProfinetDeviceImTests, WriteIm2BuildsPaddedBlock)
 
 TEST_F (ProfinetDeviceImTests, WriteIm2RejectsDateLongerThan16Characters)
 
 TEST_F (ProfinetDeviceImTests, WriteIm3BuildsPaddedBlock)
 
 TEST_F (ProfinetDeviceImTests, WriteIm3RejectsDescriptorLongerThan54Characters)
 
 TEST_F (ProfinetDeviceDiagnosisTests, ReadModuleDiffDelegates)
 
 TEST_F (ProfinetDeviceDiagnosisTests, ReadDiagnosisDelegatesArguments)
 
 TEST_F (ProfinetDeviceDiagnosisTests, ReadAllDiagnosisDelegates)
 
 TEST_F (ProfinetDeviceDiagnosisTests, DiscoverSlotsDelegates)
 
 TEST_F (ProfinetDeviceDiagnosisTests, ReadTopologyDelegates)
 
 TEST_F (ProfinetDeviceAlarmTests, ReturnsNoneOnRpcError)
 
 TEST_F (ProfinetDeviceAlarmTests, ReturnsNoneOnShortPayload)
 
 TEST_F (ProfinetDeviceAlarmTests, ParsesAlarmPayload)
 
 TEST_F (ProfinetDeviceConnectionLifecycleTests, ConnectSuccess)
 
 TEST_F (ProfinetDeviceConnectionLifecycleTests, ConnectFailureIsWrapped)
 
 TEST_F (ProfinetDeviceConnectionLifecycleTests, ConnectIsNoOpWhenAlreadyConnected)
 
 TEST_F (ProfinetDeviceConnectionLifecycleTests, DisconnectClearsConnectionState)
 
 TEST_F (ProfinetDeviceConnectionLifecycleTests, CloseClosesRpc)
 
 TEST_F (ProfinetDeviceConnectionLifecycleTests, DISABLED_CloseStopsAlarmListener)
 
 TEST_F (ProfinetDeviceConnectionLifecycleTests, ReleaseArClearsOnlyCurrentRpc)
 
 TEST_F (ProfinetDeviceConnectionLifecycleTests, ReleaseArSuppressesDisconnectErrors)
 
 TEST_F (ProfinetDeviceAlarmListenerTests, RequiresConnection)
 
 TEST_F (ProfinetDeviceAlarmListenerTests, RequiresAlarmCr)
 
 TEST_F (ProfinetDeviceAlarmListenerTests, StartAndRunningProperty)
 
 TEST_F (ProfinetDeviceAlarmListenerTests, OnAlarmForwardsToRunningListener)
 
 TEST_F (ProfinetDeviceAlarmListenerTests, StopRemovesListener)
 
 TEST_F (ProfinetDeviceAlarmListenerTests, RepeatedStartDoesNotDuplicateCallbackRegistration)
 
 TEST_F (ProfinetDeviceAlarmListenerTests, CallbackAddedBeforeStartIsRegisteredOnce)
 
 TEST_F (ProfinetDeviceAlarmListenerTests, CallbackAddedWhileRunningIsForwardedOnce)
 
 TEST_F (ProfinetDeviceInfoTests, CollectsIm0)
 
 TEST_F (ProfinetDeviceInfoTests, Im0FailureIsTolerated)
 
 TEST_F (ProfinetDeviceInfoTests, IncludesTopologyWhenRequested)
 
 TEST_F (ProfinetDeviceInfoTests, DoesNotReadTopologyByDefault)
 
 TEST_F (ProfinetDeviceStringTests, ToStringShowsDisconnectedState)
 

Function Documentation

◆ IsMacAddress()

bool profinet::device::IsMacAddress ( const std::string &  identifier)

Whether a string parses as a MAC address.

Parameters
identifierString to test.
Returns
True if ParseMac(Identifier) would succeed.

Definition at line 173 of file device.cpp.

References ParseMac().

Referenced by TEST_F(), TEST_F(), and TEST_F().

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

◆ ParseMac()

std::optional< MacAddress > profinet::device::ParseMac ( const std::string &  macStr)

Parse a MAC address string in any common separator style.

Parameters
macStrMAC address as "aa:bb:cc:dd:ee:ff", "aa-bb-cc-dd-ee-ff", or "aa.bb.cc.dd.ee.ff".
Returns
The parsed 6-byte MAC address, or std::nullopt (not a throw) for anything that doesn't parse as exactly 6 hex octets.

Definition at line 57 of file device.cpp.

References profinet::macAddressLength.

Referenced by profinet::device::ProfinetDevice::Discover(), IsMacAddress(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

+ Here is the caller graph for this function:

◆ Scan()

std::vector< ProfinetDevice > profinet::device::Scan ( const std::string &  interface = "eth0",
double  timeoutSec = 3.0,
std::unique_ptr< IDcpScanner >  dcpScanner = nullptr,
std::unique_ptr< IMacAddressProvider >  macAddressProvider = nullptr 
)

Scan the network for PROFINET devices via DCP Identify.

Parameters
interfaceNetwork interface name to use, e.g. "eth0".
timeoutSecHow long to listen for responses.
dcpScannerDCP discovery implementation.
macAddressProviderProvider used to obtain the controller MAC address.
Returns
The discovered devices.

Throws PermissionDeniedError if raw-socket privileges are insufficient.

Definition at line 799 of file device.cpp.

References profinet::Mac.

Referenced by profinet::device::ProfinetScannerTest::ConfigureScanResults(), ScanDict(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

+ Here is the caller graph for this function:

◆ ScanDict()

std::map< std::string, DeviceInfo > profinet::device::ScanDict ( const std::string &  interface = "eth0",
double  timeoutSec = 3.0,
std::unique_ptr< IDcpScanner >  dcpScanner = nullptr,
std::unique_ptr< IMacAddressProvider >  macAddressProvider = nullptr 
)

Scan the network and return a name -> DeviceInfo map.

Parameters
interfaceNetwork interface name to use, e.g. "eth0".
timeoutSecHow long to listen for responses.
dcpScannerDCP discovery implementation.
macAddressProviderProvider used to obtain the controller MAC address.
Returns
DCP-discovered fields keyed by station name; no RPC connection is made, so Im0/Topology/Annotation are left unset.

Definition at line 837 of file device.cpp.

References profinet::device::DeviceInfo::ip, profinet::device::DeviceInfo::mac, profinet::device::DeviceInfo::name, and Scan().

Referenced by TEST_F(), and TEST_F().

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

◆ TEST() [1/11]

profinet::device::TEST ( DeviceMoveTests  ,
MoveAssignmentReleasesDestinationFirst   
)
Test:
Verifies that move assignment closes the destination's existing alarm listener and RPC connection before taking ownership of the source's connection.

Definition at line 164 of file test_device.cpp.

References profinet::device::ProfinetDevice::Connect(), profinet::device::ProfinetDevice::IsConnected(), profinet::dcp::DCPDeviceDescription::name, profinet::Stop, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [2/11]

profinet::device::TEST ( DeviceMoveTests  ,
MoveConstructionDisconnectsSource   
)
Test:
Verifies that move construction transfers the connected state to the destination and leaves the source disconnected.

Definition at line 134 of file test_device.cpp.

References profinet::device::ProfinetDevice::Connect(), profinet::device::ProfinetDevice::IsConnected(), profinet::device::ProfinetDevice::Mac(), profinet::dcp::DCPDeviceDescription::name, profinet::device::ProfinetDevice::Name(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [3/11]

profinet::device::TEST ( DeviceMoveTests  ,
MovedFromDeviceCanBeDestroyedSafely   
)
Test:
Verifies that a moved-from device can be destroyed safely without attempting to access or close resources transferred to the destination.

Definition at line 211 of file test_device.cpp.

References profinet::dcp::DCPDeviceDescription::name, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [4/11]

profinet::device::TEST ( StartCyclicArHandlingTests  ,
ReleasesExistingArBeforeNewConnect   
)
Test:
Verifies that an existing AR is released before a new AR is connected.

Definition at line 296 of file test_deviceStartCyclic.cpp.

◆ TEST() [5/11]

profinet::device::TEST ( StartCyclicArHandlingTests  ,
StopsAlarmListenerBeforeReplacingAr   
)
Test:
Verifies that an alarm listener belonging to an old AR is stopped before the new AR is established.

Definition at line 303 of file test_deviceStartCyclic.cpp.

◆ TEST() [6/11]

profinet::device::TEST ( StartCyclicOrderingTests  ,
ApplicationReadyCanBeSkipped   
)
Test:
Verifies that ApplicationReady can be skipped.

Definition at line 212 of file test_deviceStartCyclic.cpp.

◆ TEST() [7/11]

profinet::device::TEST ( StartCyclicOrderingTests  ,
StartsRtAfterApplicationReadyWhenDisabled   
)
Test:
Verifies that cyclic RT starts after ApplicationReady when RT-before-PrmEnd mode is disabled.

Definition at line 206 of file test_deviceStartCyclic.cpp.

◆ TEST() [8/11]

profinet::device::TEST ( StartCyclicRollbackTests  ,
ApplicationReadyFailureStopsStartedRt   
)
Test:
Verifies that ApplicationReady failure stops cyclic RT that has already been started and releases the connection.

Definition at line 324 of file test_deviceStartCyclic.cpp.

◆ TEST() [9/11]

profinet::device::TEST ( StartCyclicRollbackTests  ,
MissingCyclicResultRollsBack   
)
Test:
Verifies that a Connect result without cyclic IO causes startup failure and closes the RPC connection.

Definition at line 317 of file test_deviceStartCyclic.cpp.

◆ TEST() [10/11]

profinet::device::TEST ( StartCyclicRollbackTests  ,
PrmEndFailureRollsBack   
)
Test:
Verifies that a PrmEnd failure stops already-started cyclic RT, closes the RPC connection, and clears connection state.

Definition at line 310 of file test_deviceStartCyclic.cpp.

◆ TEST() [11/11]

profinet::device::TEST ( StartCyclicRollbackTests  ,
ReleaseFailureDoesNotMaskOriginalError   
)
Test:
Verifies that a failure while releasing the AR does not hide the original startup exception.

Definition at line 331 of file test_deviceStartCyclic.cpp.

◆ TEST_F() [1/76]

profinet::device::TEST_F ( DeviceInfoTests  ,
HardwareRevisionReturnsZeroWhenIm0Missing   
)
Test:
Verifies that HardwareRevision returns zero when IM0 is absent.

Definition at line 143 of file test_deviceWrappers.cpp.

References profinet::device::DeviceInfo::HardwareRevision().

+ Here is the call graph for this function:

◆ TEST_F() [2/76]

profinet::device::TEST_F ( DeviceInfoTests  ,
OrderIdReturnsEmptyWhenIm0Missing   
)
Test:
Verifies that OrderId returns an empty string when IM0 is absent.

Definition at line 135 of file test_deviceWrappers.cpp.

References profinet::device::DeviceInfo::OrderId().

+ Here is the call graph for this function:

◆ TEST_F() [3/76]

profinet::device::TEST_F ( DeviceInfoTests  ,
SerialNumberReturnsEmptyWhenIm0Missing   
)
Test:
Verifies that SerialNumber returns an empty string when IM0 is absent.

Definition at line 127 of file test_deviceWrappers.cpp.

References profinet::device::DeviceInfo::SerialNumber().

+ Here is the call graph for this function:

◆ TEST_F() [4/76]

profinet::device::TEST_F ( DeviceInfoTests  ,
SoftwareRevisionReturnsEmptyWhenIm0Missing   
)
Test:
Verifies that SoftwareRevision returns an empty string when IM0 is absent.

Definition at line 151 of file test_deviceWrappers.cpp.

References profinet::device::DeviceInfo::SoftwareRevision().

+ Here is the call graph for this function:

◆ TEST_F() [5/76]

◆ TEST_F() [6/76]

profinet::device::TEST_F ( DeviceTest  ,
DeviceInfoHelpersReturnEmptyOrZeroWhenIm0Unset   
)
Test:
DeviceInfo helper methods return empty/zero when im0 is unset

Definition at line 65 of file test_device.cpp.

References profinet::device::DeviceInfo::HardwareRevision(), profinet::device::DeviceInfo::OrderId(), profinet::device::DeviceInfo::SerialNumber(), and profinet::device::DeviceInfo::SoftwareRevision().

+ Here is the call graph for this function:

◆ TEST_F() [7/76]

profinet::device::TEST_F ( DeviceTest  ,
DiscoverWithUnknownMacThrowsDcpDeviceNotFoundError   
)
Test:
ProfinetDevice::discover with a MAC identifier that never responds throws DCPDeviceNotFoundError

Definition at line 120 of file test_device.cpp.

References profinet::device::ProfinetDevice::Discover().

+ Here is the call graph for this function:

◆ TEST_F() [8/76]

profinet::device::TEST_F ( DeviceTest  ,
FromDcpInfoConstructsWithoutDiscovery   
)
Test:
ProfinetDevice::from_dcp_info constructs without discovery, starts disconnected

Definition at line 98 of file test_device.cpp.

References profinet::device::ProfinetDevice::FromDcpInfo(), profinet::device::ProfinetDevice::Ip(), profinet::device::ProfinetDevice::IsConnected(), profinet::dcp::DCPDeviceDescription::name, profinet::device::ProfinetDevice::Name(), profinet::String2Mac(), and profinet::device::ProfinetDevice::ToString().

+ Here is the call graph for this function:

◆ TEST_F() [9/76]

profinet::device::TEST_F ( DeviceTest  ,
IsMacAddressMatchesParseMac   
)
Test:
is_mac_address matches parse_mac

Definition at line 58 of file test_device.cpp.

References IsMacAddress().

+ Here is the call graph for this function:

◆ TEST_F() [10/76]

profinet::device::TEST_F ( DeviceTest  ,
ParseMacAcceptsColonDashAndDotSeparators   
)
Test:
parse_mac accepts colon, dash, and dot separators

Definition at line 31 of file test_device.cpp.

References ParseMac().

+ Here is the call graph for this function:

◆ TEST_F() [11/76]

profinet::device::TEST_F ( DeviceTest  ,
ParseMacRejectsNonMacStrings   
)
Test:
parse_mac rejects non-MAC strings

Definition at line 48 of file test_device.cpp.

References ParseMac().

+ Here is the call graph for this function:

◆ TEST_F() [12/76]

profinet::device::TEST_F ( ParseMacTests  ,
IsMacAddressAcceptsValidMac   
)
Test:
Verifies that IsMacAddress identifies valid MAC addresses.

Definition at line 107 of file test_deviceWrappers.cpp.

References IsMacAddress().

+ Here is the call graph for this function:

◆ TEST_F() [13/76]

profinet::device::TEST_F ( ParseMacTests  ,
IsMacAddressRejectsInvalidIdentifier   
)
Test:
Verifies that IsMacAddress rejects invalid identifiers.

Definition at line 113 of file test_deviceWrappers.cpp.

References IsMacAddress().

+ Here is the call graph for this function:

◆ TEST_F() [14/76]

profinet::device::TEST_F ( ParseMacTests  ,
ParsesColonSeparatedMac   
)
Test:
Verifies that a valid colon-separated MAC address is parsed.

Definition at line 74 of file test_deviceWrappers.cpp.

References ParseMac().

+ Here is the call graph for this function:

◆ TEST_F() [15/76]

profinet::device::TEST_F ( ParseMacTests  ,
ParsesDashSeparatedMac   
)
Test:
Verifies that a valid dash-separated MAC address is parsed.

Definition at line 83 of file test_deviceWrappers.cpp.

References ParseMac().

+ Here is the call graph for this function:

◆ TEST_F() [16/76]

profinet::device::TEST_F ( ParseMacTests  ,
ParsesDotSeparatedMac   
)
Test:
Verifies that a valid dot-separated MAC address is parsed.

Definition at line 92 of file test_deviceWrappers.cpp.

References ParseMac().

+ Here is the call graph for this function:

◆ TEST_F() [17/76]

profinet::device::TEST_F ( ParseMacTests  ,
RejectsInvalidMac   
)
Test:
Verifies that an invalid MAC address is rejected.

Definition at line 101 of file test_deviceWrappers.cpp.

References ParseMac().

+ Here is the call graph for this function:

◆ TEST_F() [18/76]

profinet::device::TEST_F ( ProfinetDeviceAlarmListenerTests  ,
CallbackAddedBeforeStartIsRegisteredOnce   
)
Test:
A callback registered before Start is registered exactly once.

Definition at line 854 of file test_deviceWrappers.cpp.

References profinet::Start.

◆ TEST_F() [19/76]

profinet::device::TEST_F ( ProfinetDeviceAlarmListenerTests  ,
CallbackAddedWhileRunningIsForwardedOnce   
)
Test:
A callback added while running is forwarded immediately.

Definition at line 883 of file test_deviceWrappers.cpp.

◆ TEST_F() [20/76]

profinet::device::TEST_F ( ProfinetDeviceAlarmListenerTests  ,
OnAlarmForwardsToRunningListener   
)
Test:
Verifies that OnAlarm forwards callbacks to an existing listener.

Definition at line 800 of file test_deviceWrappers.cpp.

◆ TEST_F() [21/76]

profinet::device::TEST_F ( ProfinetDeviceAlarmListenerTests  ,
RepeatedStartDoesNotDuplicateCallbackRegistration   
)
Test:
Repeated StartAlarmListener does not register callbacks twice.

Definition at line 820 of file test_deviceWrappers.cpp.

References profinet::Start.

◆ TEST_F() [22/76]

profinet::device::TEST_F ( ProfinetDeviceAlarmListenerTests  ,
RequiresAlarmCr   
)
Test:
Verifies that starting the alarm listener requires AlarmCR.

Definition at line 769 of file test_deviceWrappers.cpp.

◆ TEST_F() [23/76]

profinet::device::TEST_F ( ProfinetDeviceAlarmListenerTests  ,
RequiresConnection   
)
Test:
Verifies that starting the alarm listener requires a connection.

Definition at line 763 of file test_deviceWrappers.cpp.

◆ TEST_F() [24/76]

profinet::device::TEST_F ( ProfinetDeviceAlarmListenerTests  ,
StartAndRunningProperty   
)
Test:
Verifies that StartAlarmListener creates and starts the listener.

Definition at line 777 of file test_deviceWrappers.cpp.

References profinet::Start.

◆ TEST_F() [25/76]

profinet::device::TEST_F ( ProfinetDeviceAlarmListenerTests  ,
StopRemovesListener   
)
Test:
Verifies that StopAlarmListener removes the alarm listener.

Definition at line 813 of file test_deviceWrappers.cpp.

◆ TEST_F() [26/76]

profinet::device::TEST_F ( ProfinetDeviceAlarmTests  ,
ParsesAlarmPayload   
)
Test:
Verifies that ReadAlarm parses a valid alarm payload.

Definition at line 599 of file test_deviceWrappers.cpp.

References profinet::PNIODHeader::payload.

◆ TEST_F() [27/76]

profinet::device::TEST_F ( ProfinetDeviceAlarmTests  ,
ReturnsNoneOnRpcError   
)
Test:
Verifies that ReadAlarm returns no value when the RPC operation fails.

Definition at line 578 of file test_deviceWrappers.cpp.

◆ TEST_F() [28/76]

profinet::device::TEST_F ( ProfinetDeviceAlarmTests  ,
ReturnsNoneOnShortPayload   
)
Test:
Verifies that ReadAlarm returns no value for a short payload.

Definition at line 587 of file test_deviceWrappers.cpp.

References profinet::PNIODHeader::payload.

◆ TEST_F() [29/76]

profinet::device::TEST_F ( ProfinetDeviceConnectionLifecycleTests  ,
CloseClosesRpc   
)
Test:
Verifies that Close closes the RPC connection and clears ownership.

Definition at line 698 of file test_deviceWrappers.cpp.

◆ TEST_F() [30/76]

profinet::device::TEST_F ( ProfinetDeviceConnectionLifecycleTests  ,
ConnectFailureIsWrapped   
)
Test:
Verifies that an RPC connection error is converted to RPCConnectionError.

Definition at line 664 of file test_deviceWrappers.cpp.

◆ TEST_F() [31/76]

profinet::device::TEST_F ( ProfinetDeviceConnectionLifecycleTests  ,
ConnectIsNoOpWhenAlreadyConnected   
)
Test:
Verifies that Connect does nothing when already connected.

Definition at line 674 of file test_deviceWrappers.cpp.

◆ TEST_F() [32/76]

profinet::device::TEST_F ( ProfinetDeviceConnectionLifecycleTests  ,
ConnectSuccess   
)
Test:
Verifies that a successful Connect establishes the connection.

Definition at line 654 of file test_deviceWrappers.cpp.

◆ TEST_F() [33/76]

profinet::device::TEST_F ( ProfinetDeviceConnectionLifecycleTests  ,
DISABLED_CloseStopsAlarmListener   
)
Test:
Verifies that Close stops an active alarm listener.

Definition at line 708 of file test_deviceWrappers.cpp.

References profinet::Stop.

◆ TEST_F() [34/76]

profinet::device::TEST_F ( ProfinetDeviceConnectionLifecycleTests  ,
DisconnectClearsConnectionState   
)
Test:
Verifies that Disconnect delegates to RPCCon and clears connection state.

Definition at line 688 of file test_deviceWrappers.cpp.

◆ TEST_F() [35/76]

profinet::device::TEST_F ( ProfinetDeviceConnectionLifecycleTests  ,
ReleaseArClearsOnlyCurrentRpc   
)
Test:
Verifies that ReleaseAr only clears state when releasing the active RPC.

Definition at line 718 of file test_deviceWrappers.cpp.

◆ TEST_F() [36/76]

profinet::device::TEST_F ( ProfinetDeviceConnectionLifecycleTests  ,
ReleaseArSuppressesDisconnectErrors   
)
Test:
Verifies that ReleaseAr suppresses disconnect exceptions.

Definition at line 731 of file test_deviceWrappers.cpp.

◆ TEST_F() [37/76]

profinet::device::TEST_F ( ProfinetDeviceDiagnosisTests  ,
DiscoverSlotsDelegates   
)
Test:
Verifies that DiscoverSlots delegates to RPCCon.

Definition at line 543 of file test_deviceWrappers.cpp.

◆ TEST_F() [38/76]

profinet::device::TEST_F ( ProfinetDeviceDiagnosisTests  ,
ReadAllDiagnosisDelegates   
)
Test:
Verifies that ReadAllDiagnosis delegates to RPCCon.

Definition at line 535 of file test_deviceWrappers.cpp.

◆ TEST_F() [39/76]

profinet::device::TEST_F ( ProfinetDeviceDiagnosisTests  ,
ReadDiagnosisDelegatesArguments   
)
Test:
Verifies that ReadDiagnosis delegates slot, subslot and index.

Definition at line 525 of file test_deviceWrappers.cpp.

◆ TEST_F() [40/76]

profinet::device::TEST_F ( ProfinetDeviceDiagnosisTests  ,
ReadModuleDiffDelegates   
)
Test:
Verifies that ReadModuleDiff delegates to RPCCon.

Definition at line 510 of file test_deviceWrappers.cpp.

References profinet::MODULE_STATE_PROPER_MODULE, profinet::blocks::ParseModuleDiffBlock(), and profinet::SUBMODULE_STATE_OK.

+ Here is the call graph for this function:

◆ TEST_F() [41/76]

profinet::device::TEST_F ( ProfinetDeviceDiagnosisTests  ,
ReadTopologyDelegates   
)
Test:
Verifies that ReadTopology delegates to ReadPdRealData.

Definition at line 551 of file test_deviceWrappers.cpp.

◆ TEST_F() [42/76]

profinet::device::TEST_F ( ProfinetDeviceImTests  ,
ReadAllImDelegates   
)
Test:
Verifies that ReadAllIm delegates to RPCCon.

Definition at line 320 of file test_deviceWrappers.cpp.

◆ TEST_F() [43/76]

profinet::device::TEST_F ( ProfinetDeviceImTests  ,
ReadIm0Delegates   
)
Test:
Verifies that ReadIm0 delegates to RPCCon.

Definition at line 259 of file test_deviceWrappers.cpp.

◆ TEST_F() [44/76]

profinet::device::TEST_F ( ProfinetDeviceImTests  ,
ReadIm1Delegates   
)
Test:
Verifies that ReadIm1 delegates to RPCCon.

Definition at line 269 of file test_deviceWrappers.cpp.

◆ TEST_F() [45/76]

profinet::device::TEST_F ( ProfinetDeviceImTests  ,
ReadIm2Delegates   
)
Test:
Verifies that ReadIm2 delegates to RPCCon.

Definition at line 279 of file test_deviceWrappers.cpp.

◆ TEST_F() [46/76]

profinet::device::TEST_F ( ProfinetDeviceImTests  ,
ReadIm3Delegates   
)
Test:
Verifies that ReadIm3 delegates to RPCCon.

Definition at line 290 of file test_deviceWrappers.cpp.

◆ TEST_F() [47/76]

profinet::device::TEST_F ( ProfinetDeviceImTests  ,
ReadIm4Delegates   
)
Test:
Verifies that ReadIm4 delegates to RPCCon.

Definition at line 300 of file test_deviceWrappers.cpp.

◆ TEST_F() [48/76]

profinet::device::TEST_F ( ProfinetDeviceImTests  ,
ReadIm5Delegates   
)
Test:
Verifies that ReadIm5 delegates to RPCCon.

Definition at line 310 of file test_deviceWrappers.cpp.

◆ TEST_F() [49/76]

profinet::device::TEST_F ( ProfinetDeviceImTests  ,
WriteIm1BuildsPaddedBlock   
)
Test:
Verifies that WriteIm1 creates the expected block header and fields.

Definition at line 330 of file test_deviceWrappers.cpp.

References profinet::IM1, and profinet::wire::Reader::U16().

+ Here is the call graph for this function:

◆ TEST_F() [50/76]

profinet::device::TEST_F ( ProfinetDeviceImTests  ,
WriteIm1RejectsFunctionLongerThan32Characters   
)
Test:
Verifies that WriteIm1 rejects a function longer than 32 characters.

Definition at line 360 of file test_deviceWrappers.cpp.

◆ TEST_F() [51/76]

profinet::device::TEST_F ( ProfinetDeviceImTests  ,
WriteIm1RejectsLocationLongerThan22Characters   
)
Test:
Verifies that WriteIm1 rejects a location longer than 22 characters.

Definition at line 368 of file test_deviceWrappers.cpp.

◆ TEST_F() [52/76]

profinet::device::TEST_F ( ProfinetDeviceImTests  ,
WriteIm2BuildsPaddedBlock   
)
Test:
Verifies that WriteIm2 creates the expected block and padded date.

Definition at line 376 of file test_deviceWrappers.cpp.

References profinet::IM2, and profinet::wire::Reader::U16().

+ Here is the call graph for this function:

◆ TEST_F() [53/76]

profinet::device::TEST_F ( ProfinetDeviceImTests  ,
WriteIm2RejectsDateLongerThan16Characters   
)
Test:
Verifies that WriteIm2 rejects a date longer than 16 characters.

Definition at line 407 of file test_deviceWrappers.cpp.

◆ TEST_F() [54/76]

profinet::device::TEST_F ( ProfinetDeviceImTests  ,
WriteIm3BuildsPaddedBlock   
)
Test:
Verifies that WriteIm3 creates the expected block and padded descriptor.

Definition at line 415 of file test_deviceWrappers.cpp.

References profinet::IM3, and profinet::wire::Reader::U16().

+ Here is the call graph for this function:

◆ TEST_F() [55/76]

profinet::device::TEST_F ( ProfinetDeviceImTests  ,
WriteIm3RejectsDescriptorLongerThan54Characters   
)
Test:
Verifies that WriteIm3 rejects a descriptor longer than 54 characters.

Definition at line 443 of file test_deviceWrappers.cpp.

◆ TEST_F() [56/76]

profinet::device::TEST_F ( ProfinetDeviceInfoTests  ,
CollectsIm0   
)
Test:
Verifies that GetInfo collects IM0 information.

Definition at line 915 of file test_deviceWrappers.cpp.

References profinet::device::DeviceInfo::im0.

◆ TEST_F() [57/76]

profinet::device::TEST_F ( ProfinetDeviceInfoTests  ,
DoesNotReadTopologyByDefault   
)
Test:
Verifies that GetInfo does not request topology by default.

Definition at line 953 of file test_deviceWrappers.cpp.

References profinet::device::DeviceInfo::topology.

◆ TEST_F() [58/76]

profinet::device::TEST_F ( ProfinetDeviceInfoTests  ,
Im0FailureIsTolerated   
)
Test:
Verifies that GetInfo tolerates an IM0 RPC failure.

Definition at line 927 of file test_deviceWrappers.cpp.

References profinet::device::DeviceInfo::im0.

◆ TEST_F() [59/76]

profinet::device::TEST_F ( ProfinetDeviceInfoTests  ,
IncludesTopologyWhenRequested   
)
Test:
Verifies that GetInfo includes topology when requested.

Definition at line 938 of file test_deviceWrappers.cpp.

References profinet::device::DeviceInfo::topology.

◆ TEST_F() [60/76]

profinet::device::TEST_F ( ProfinetDeviceReadWriteTests  ,
ReadReturnsRpcPayload   
)
Test:
Verifies that Read returns the payload returned by RPCCon.

Definition at line 181 of file test_deviceWrappers.cpp.

References profinet::PNIODHeader::payload.

◆ TEST_F() [61/76]

profinet::device::TEST_F ( ProfinetDeviceReadWriteTests  ,
WriteDelegatesArguments   
)
Test:
Verifies that Write delegates slot, subslot, index, API and data.

Definition at line 195 of file test_deviceWrappers.cpp.

◆ TEST_F() [62/76]

profinet::device::TEST_F ( ProfinetDeviceReadWriteTests  ,
WriteMultipleMapsItems   
)
Test:
Verifies that WriteMultiple maps public WriteItem objects to RPC items.

Definition at line 205 of file test_deviceWrappers.cpp.

References profinet::device::WriteItem::slot.

◆ TEST_F() [63/76]

profinet::device::TEST_F ( ProfinetDeviceStringTests  ,
ToStringShowsDisconnectedState   
)
Test:
Verifies that ToString identifies the device as disconnected initially.

Definition at line 971 of file test_deviceWrappers.cpp.

References profinet::device::ProfinetDevice::ToString().

+ Here is the call graph for this function:

◆ TEST_F() [64/76]

profinet::device::TEST_F ( ProfinetScannerTest  ,
ScanCreatesDeviceForEveryResponse   
)
Test:
Verify that Scan creates one ProfinetDevice for every DCP response.

Definition at line 433 of file test_device.cpp.

References Scan().

+ Here is the call graph for this function:

◆ TEST_F() [65/76]

profinet::device::TEST_F ( ProfinetScannerTest  ,
ScanDictKeepsDuplicateStationNames   
)
Test:
Verify that ScanDict keeps devices with duplicate station names.

Definition at line 457 of file test_device.cpp.

References ScanDict().

+ Here is the call graph for this function:

◆ TEST_F() [66/76]

profinet::device::TEST_F ( ProfinetScannerTest  ,
ScanDictKeepsEmptyStationNames   
)
Test:
Verify that ScanDict keeps devices with empty station names.

Definition at line 485 of file test_device.cpp.

References ScanDict().

+ Here is the call graph for this function:

◆ TEST_F() [67/76]

profinet::device::TEST_F ( ProfinetScannerTest  ,
ScanPreservesLongTimeout   
)
Test:
Verify that Scan preserves a long timeout.

Definition at line 397 of file test_device.cpp.

References Scan().

+ Here is the call graph for this function:

◆ TEST_F() [68/76]

profinet::device::TEST_F ( ProfinetScannerTest  ,
ScanPreservesShortTimeout   
)
Test:
Verify that Scan preserves a short fractional timeout.

Definition at line 361 of file test_device.cpp.

References Scan().

+ Here is the call graph for this function:

◆ TEST_F() [69/76]

profinet::device::TEST_F ( ProfinetScannerTest  ,
ScanPreservesZeroTimeout   
)
Test:
Verify that Scan forwards a zero-second timeout unchanged.

Definition at line 329 of file test_device.cpp.

References Scan().

+ Here is the call graph for this function:

◆ TEST_F() [70/76]

profinet::device::TEST_F ( StartCyclicTests  ,
ApplicationReadyFailureDoesNotStartRt   
)
Test:
Verifies that cyclic RT is not started when ApplicationReady fails.

Definition at line 177 of file test_deviceStartCyclic.cpp.

References profinet::ApplicationReady, profinet::rpc::ConnectResult::inputFrameId, profinet::PrmEnd, and profinet::Start.

◆ TEST_F() [71/76]

profinet::device::TEST_F ( StartCyclicTests  ,
ApplicationReadyFailurePropagates   
)
Test:
Verifies that ApplicationReady failure propagates to the caller.

Definition at line 146 of file test_deviceStartCyclic.cpp.

References profinet::ApplicationReady, profinet::rpc::ConnectResult::inputFrameId, profinet::PrmEnd, and profinet::Start.

◆ TEST_F() [72/76]

profinet::device::TEST_F ( StartCyclicTests  ,
CommitsConnectedDeviceState   
)
Test:
Verifies that the RPC and connected state are committed after successful cyclic startup.

Definition at line 219 of file test_deviceStartCyclic.cpp.

References profinet::ApplicationReady, profinet::rpc::ConnectResult::inputFrameId, profinet::PrmEnd, and profinet::Start.

◆ TEST_F() [73/76]

profinet::device::TEST_F ( StartCyclicTests  ,
ConnectsWithAlarmCrAndIocrSetup   
)
Test:
Verifies that StartCyclic establishes an AlarmCR-enabled AR using the supplied IOCR configuration.

Definition at line 82 of file test_deviceStartCyclic.cpp.

◆ TEST_F() [74/76]

profinet::device::TEST_F ( StartCyclicTests  ,
MissingCyclicResultFailsStartup   
)
Test:
Verifies that startup fails when the RPC connection does not establish cyclic IO.

Definition at line 131 of file test_deviceStartCyclic.cpp.

◆ TEST_F() [75/76]

profinet::device::TEST_F ( StartCyclicTests  ,
RequestsAlarmCrConnection   
)
Test:
Verifies that cyclic startup requests an AlarmCR connection.

Definition at line 253 of file test_deviceStartCyclic.cpp.

References profinet::ApplicationReady, profinet::rpc::ConnectResult::inputFrameId, profinet::PrmEnd, and profinet::Start.

◆ TEST_F() [76/76]

profinet::device::TEST_F ( StartCyclicTests  ,
StartsRtAfterPrmEndAndApplicationReady   
)
Test:
Verifies that cyclic RT starts after PrmEnd and ApplicationReady.

Definition at line 99 of file test_deviceStartCyclic.cpp.

References profinet::ApplicationReady, controller, profinet::rpc::ConnectResult::inputFrameId, profinet::PrmEnd, and profinet::Start.