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

Narrow private-access adapter used only by cyclic controller tests. More...

+ Collaboration diagram for profinet::cyclic::CyclicControllerTestAccess:

Static Public Member Functions

static void SetState (CyclicController &controller, CyclicState value)
 Set the controller state without starting worker threads.
 
static void SetRunning (CyclicController &controller, bool value)
 Set the controller worker running flag.
 
static void SetTxSock (CyclicController &controller, std::unique_ptr< IRawEthernetSocket > txSock)
 Set the controller txSock.
 
static void SetRxSock (CyclicController &controller, std::unique_ptr< IRawEthernetSocket > rxSock)
 Set the controller rxSock.
 
static void Transition (CyclicController &controller, CyclicState value)
 Invoke the private transition implementation.
 
static void TxCycle (CyclicController &controller)
 Invoke one TX cycle synchronously.
 
static void TxLoop (CyclicController &controller)
 Invoke the private TX worker loop synchronously.
 
static void SendOutputFrame (CyclicController &controller, std::optional< std::uint8_t > dataStatusOverride=std::nullopt)
 Invoke output frame generation.
 
static void SendStopFrames (CyclicController &controller)
 Invoke cyclic stop-frame generation.
 
static void ProcessInputFrame (CyclicController &controller, const Bytes &data)
 Invoke input Ethernet-frame processing.
 
static void HandleWatchdogTimeout (CyclicController &controller)
 Invoke watchdog timeout handling.
 
static void RxLoop (CyclicController &controller)
 Invoke the receive loop synchronously.
 
static void TrackCycleCounter (CyclicController &controller, std::uint16_t cycleCounter)
 Invoke cycle-counter tracking.
 
static void SetMaxConsecutiveTimeouts (CyclicController &controller, int value)
 Set the watchdog fault threshold.
 
static void SetIocsGood (CyclicController &controller, bool value)
 Set the IOCS-good bookkeeping state.
 
static void SetAllOutputIocs (CyclicController &controller, std::uint8_t status)
 Set the IOCS value for every configured output object.
 
static bool IocsGood (const CyclicController &controller)
 Read the IOCS-good bookkeeping state.
 
static void SwapOutputBuilder (CyclicController &controller)
 Promote the output write buffer to the send buffer.
 
static std::uint8_t FirstOutputByte (const CyclicController &controller)
 Return the first byte of the output payload.
 
static void SetRxCounterStep (CyclicController &controller, std::uint32_t value)
 Set the RX cycle-counter step.
 
static rt::IODataObject & InputObject (CyclicController &controller, std::size_t index)
 Return an input IO object for malformed-frame setup.
 
static void ResetTxSocket (CyclicController &controller)
 Reset the injected TX socket.
 
static void ResetRxSocket (CyclicController &controller)
 Reset the injected RX socket.
 
static CyclicStats & Stats (CyclicController &controller)
 Return the controller statistics object for targeted setup.
 
static std::uint8_t FirstOutputIocs (const CyclicController &controller)
 Return the IOCS value of the first configured output object.
 

Detailed Description

Narrow private-access adapter used only by cyclic controller tests.

The adapter provides one controlled test seam instead of adding a separate friend declaration for every test fixture.

Definition at line 117 of file test_cyclicMore.cpp.

Member Function Documentation

◆ FirstOutputByte()

static std::uint8_t profinet::cyclic::CyclicControllerTestAccess::FirstOutputByte ( const CyclicController &  controller)
inlinestatic

Return the first byte of the output payload.

Parameters
controllerController under test.
Returns
First output payload byte.

Definition at line 263 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

◆ FirstOutputIocs()

static std::uint8_t profinet::cyclic::CyclicControllerTestAccess::FirstOutputIocs ( const CyclicController &  controller)
inlinestatic

Return the IOCS value of the first configured output object.

Parameters
controllerController under test.
Returns
IOCS value from the promoted send buffer.
Test:
Verifies that the expected IOCS value reaches the send buffer.

Definition at line 311 of file test_cyclicMore.cpp.

References controller, and frame.

Referenced by profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

◆ HandleWatchdogTimeout()

static void profinet::cyclic::CyclicControllerTestAccess::HandleWatchdogTimeout ( CyclicController &  controller)
inlinestatic

Invoke watchdog timeout handling.

Parameters
controllerController under test.

Definition at line 200 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), and profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

◆ InputObject()

static rt::IODataObject & profinet::cyclic::CyclicControllerTestAccess::InputObject ( CyclicController &  controller,
std::size_t  index 
)
inlinestatic

Return an input IO object for malformed-frame setup.

Parameters
controllerController under test.
indexZero-based IO object index.
Returns
Mutable IO object.

Definition at line 280 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), and profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

◆ IocsGood()

static bool profinet::cyclic::CyclicControllerTestAccess::IocsGood ( const CyclicController &  controller)
inlinestatic

Read the IOCS-good bookkeeping state.

Parameters
controllerController under test.
Returns
Whether IOCS is currently considered good.

Definition at line 247 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), and profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

◆ ProcessInputFrame()

static void profinet::cyclic::CyclicControllerTestAccess::ProcessInputFrame ( CyclicController &  controller,
const Bytes &  data 
)
inlinestatic

Invoke input Ethernet-frame processing.

Parameters
controllerController under test.
dataEthernet frame bytes.

Definition at line 193 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::CyclicDataTests::DeliverInput(), profinet::cyclic::CyclicCallbackTests::DeliverInput(), profinet::cyclic::CyclicFrameTests::ProcessCounter(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), and profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

◆ ResetRxSocket()

static void profinet::cyclic::CyclicControllerTestAccess::ResetRxSocket ( CyclicController &  controller)
inlinestatic

Reset the injected RX socket.

Parameters
controllerController under test.

Definition at line 294 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

◆ ResetTxSocket()

static void profinet::cyclic::CyclicControllerTestAccess::ResetTxSocket ( CyclicController &  controller)
inlinestatic

Reset the injected TX socket.

Parameters
controllerController under test.

Definition at line 287 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::TEST_F(), and profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

◆ RxLoop()

static void profinet::cyclic::CyclicControllerTestAccess::RxLoop ( CyclicController &  controller)
inlinestatic

Invoke the receive loop synchronously.

Parameters
controllerController under test.

Definition at line 207 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), and profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

◆ SendOutputFrame()

static void profinet::cyclic::CyclicControllerTestAccess::SendOutputFrame ( CyclicController &  controller,
std::optional< std::uint8_t >  dataStatusOverride = std::nullopt 
)
inlinestatic

Invoke output frame generation.

Parameters
controllerController under test.
dataStatusOverrideOptional DataStatus override.

Definition at line 177 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), and profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

◆ SendStopFrames()

static void profinet::cyclic::CyclicControllerTestAccess::SendStopFrames ( CyclicController &  controller)
inlinestatic

Invoke cyclic stop-frame generation.

Parameters
controllerController under test.

Definition at line 185 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), and profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

◆ SetAllOutputIocs()

static void profinet::cyclic::CyclicControllerTestAccess::SetAllOutputIocs ( CyclicController &  controller,
std::uint8_t  status 
)
inlinestatic

Set the IOCS value for every configured output object.

Parameters
controllerController under test.
statusIOCS value to write.
Test:
Allows the test to reproduce the BAD-IOCS state created by a watchdog fault.

Definition at line 240 of file test_cyclicMore.cpp.

References controller.

◆ SetIocsGood()

static void profinet::cyclic::CyclicControllerTestAccess::SetIocsGood ( CyclicController &  controller,
bool  value 
)
inlinestatic

Set the IOCS-good bookkeeping state.

Parameters
controllerController under test.
valueWhether IOCS is currently considered good.

Definition at line 231 of file test_cyclicMore.cpp.

References controller.

◆ SetMaxConsecutiveTimeouts()

static void profinet::cyclic::CyclicControllerTestAccess::SetMaxConsecutiveTimeouts ( CyclicController &  controller,
int  value 
)
inlinestatic

Set the watchdog fault threshold.

Parameters
controllerController under test.
valueMaximum consecutive watchdog timeouts.

Definition at line 223 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

◆ SetRunning()

static void profinet::cyclic::CyclicControllerTestAccess::SetRunning ( CyclicController &  controller,
bool  value 
)
inlinestatic

Set the controller worker running flag.

Parameters
controllerController under test.
valueNew running flag.

Definition at line 131 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), and profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

◆ SetRxCounterStep()

static void profinet::cyclic::CyclicControllerTestAccess::SetRxCounterStep ( CyclicController &  controller,
std::uint32_t  value 
)
inlinestatic

Set the RX cycle-counter step.

Parameters
controllerController under test.
valueCounter increment.

Definition at line 271 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

◆ SetRxSock()

static void profinet::cyclic::CyclicControllerTestAccess::SetRxSock ( CyclicController &  controller,
std::unique_ptr< IRawEthernetSocket >  rxSock 
)
inlinestatic

Set the controller rxSock.

Parameters
controllerController under test.
rxSockNew rxSock for testing.

Definition at line 147 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::CyclicWatchdogTests::SetUp().

+ Here is the caller graph for this function:

◆ SetState()

static void profinet::cyclic::CyclicControllerTestAccess::SetState ( CyclicController &  controller,
CyclicState  value 
)
inlinestatic

Set the controller state without starting worker threads.

Parameters
controllerController under test.
valueNew controller state.

Definition at line 123 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::CyclicWatchdogTests::SetUp(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), and profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

◆ SetTxSock()

static void profinet::cyclic::CyclicControllerTestAccess::SetTxSock ( CyclicController &  controller,
std::unique_ptr< IRawEthernetSocket >  txSock 
)
inlinestatic

Set the controller txSock.

Parameters
controllerController under test.
txSockNew txSock for testing.

Definition at line 139 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::CyclicTxTests::SetUp(), profinet::cyclic::TEST_F(), and profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

◆ Stats()

static CyclicStats & profinet::cyclic::CyclicControllerTestAccess::Stats ( CyclicController &  controller)
inlinestatic

Return the controller statistics object for targeted setup.

Parameters
controllerController under test.
Returns
Mutable statistics.

Definition at line 302 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::TEST_F(), and profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

◆ SwapOutputBuilder()

static void profinet::cyclic::CyclicControllerTestAccess::SwapOutputBuilder ( CyclicController &  controller)
inlinestatic

Promote the output write buffer to the send buffer.

Parameters
controllerController under test.

Definition at line 255 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::TEST_F(), and profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

◆ TrackCycleCounter()

static void profinet::cyclic::CyclicControllerTestAccess::TrackCycleCounter ( CyclicController &  controller,
std::uint16_t  cycleCounter 
)
inlinestatic

Invoke cycle-counter tracking.

Parameters
controllerController under test.
cycleCounterReceived cycle counter.

Definition at line 215 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

◆ Transition()

static void profinet::cyclic::CyclicControllerTestAccess::Transition ( CyclicController &  controller,
CyclicState  value 
)
inlinestatic

Invoke the private transition implementation.

Parameters
controllerController under test.
valueNew controller state.

Definition at line 155 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::TEST_F(), profinet::cyclic::TEST_F(), and profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

◆ TxCycle()

static void profinet::cyclic::CyclicControllerTestAccess::TxCycle ( CyclicController &  controller)
inlinestatic

Invoke one TX cycle synchronously.

Parameters
controllerController under test.

Definition at line 162 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::TEST_F(), and profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

◆ TxLoop()

static void profinet::cyclic::CyclicControllerTestAccess::TxLoop ( CyclicController &  controller)
inlinestatic

Invoke the private TX worker loop synchronously.

Parameters
controllerController under test.

Definition at line 169 of file test_cyclicMore.cpp.

References controller.

Referenced by profinet::cyclic::TEST_F().

+ Here is the caller graph for this function:

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