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

Abstract interface for controlling cyclic PROFINET communication. More...

#include <cyclic.h>

+ Inheritance diagram for profinet::cyclic::ICyclicController:
+ Collaboration diagram for profinet::cyclic::ICyclicController:

Public Member Functions

virtual ~ICyclicController ()=default
 Virtual destructor.
 
virtual void Start (std::unique_ptr< IRawEthernetSocket > tx=nullptr, std::unique_ptr< IRawEthernetSocket > rx=nullptr)=0
 Starts cyclic PROFINET communication.
 
virtual void Stop ()=0
 Stops cyclic PROFINET communication.
 
virtual bool IsRunning () const =0
 Whether the controller is actively exchanging cyclic data.
 
virtual CyclicState State () const =0
 The controller's current lifecycle state.
 
virtual void SetOutputData (int slot, int subslot, const Bytes &data)=0
 Set complete process output data for one slot/subslot.
 
virtual Bytes GetOutputData (int slot, int subslot) const =0
 Read the currently configured output data for one slot/subslot.
 
virtual std::optional< Bytes > GetInputData (int slot, int subslot, bool allowBad=false) const =0
 Get the latest valid input process data.
 

Detailed Description

Abstract interface for controlling cyclic PROFINET communication.

Defines the lifecycle operations required by higher-level components to start and stop cyclic PROFINET communication. The interface separates device-level lifecycle management from the concrete cyclic controller implementation, allowing components such as ProfinetDevice to be unit tested without starting actual cyclic Ethernet communication.

Implementations are responsible for managing the underlying cyclic communication resources and maintaining the appropriate controller state between Start() and Stop() calls.

Definition at line 171 of file cyclic.h.

Constructor & Destructor Documentation

◆ ~ICyclicController()

virtual profinet::cyclic::ICyclicController::~ICyclicController ( )
virtualdefault

Virtual destructor.

Ensures that derived cyclic controller implementations can be destroyed safely through an ICyclicController pointer.

Member Function Documentation

◆ GetInputData()

virtual std::optional< Bytes > profinet::cyclic::ICyclicController::GetInputData ( int  slot,
int  subslot,
bool  allowBad = false 
) const
pure virtual

Get the latest valid input process data.

Parameters
slotSlot number.
subslotSubslot number.
allowBadReturn data even when IOPS is BAD.
Returns
Latest input data, or std::nullopt when unavailable.

Implemented in profinet::cyclic::CyclicController.

◆ GetOutputData()

virtual Bytes profinet::cyclic::ICyclicController::GetOutputData ( int  slot,
int  subslot 
) const
pure virtual

Read the currently configured output data for one slot/subslot.

Parameters
slotSlot number.
subslotSubslot number.
Returns
Current process-data object.

Implemented in profinet::cyclic::CyclicController.

◆ IsRunning()

virtual bool profinet::cyclic::ICyclicController::IsRunning ( ) const
pure virtual

Whether the controller is actively exchanging cyclic data.

Returns
True if controller is running.

Implemented in profinet::cyclic::CyclicController.

◆ SetOutputData()

virtual void profinet::cyclic::ICyclicController::SetOutputData ( int  slot,
int  subslot,
const Bytes &  data 
)
pure virtual

Set complete process output data for one slot/subslot.

Parameters
slotSlot number.
subslotSubslot number.
dataComplete process-data object.

Implemented in profinet::cyclic::CyclicController.

◆ Start()

virtual void profinet::cyclic::ICyclicController::Start ( std::unique_ptr< IRawEthernetSocket >  tx = nullptr,
std::unique_ptr< IRawEthernetSocket >  rx = nullptr 
)
pure virtual

Starts cyclic PROFINET communication.

Starts the cyclic communication process and enables transmission and reception of cyclic IO data according to the configured IOCR parameters.

Exceptions
std::exceptionDerived implementations may throw when cyclic communication cannot be started.

Implemented in profinet::cyclic::CyclicController.

◆ State()

virtual CyclicState profinet::cyclic::ICyclicController::State ( ) const
pure virtual

The controller's current lifecycle state.

Returns
The current CyclicState.

Implemented in profinet::cyclic::CyclicController.

◆ Stop()

virtual void profinet::cyclic::ICyclicController::Stop ( )
pure virtual

Stops cyclic PROFINET communication.

Stops cyclic communication and releases or disables the resources associated with cyclic IO data exchange. Implementations should leave the controller in a state in which it can be safely destroyed or started again, where supported.

Note
The concrete implementation determines whether calling Stop() when cyclic communication is already stopped is a no-op or results in an error.

Implemented in profinet::cyclic::CyclicController.


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