PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
Loading...
Searching...
No Matches
cyclic.h File Reference

Declares the PROFINET RTC1 cyclic IO controller and process-data exchange API. More...

#include <atomic>
#include <chrono>
#include <cstdint>
#include <functional>
#include <map>
#include <mutex>
#include <optional>
#include <string>
#include <thread>
#include <utility>
#include "profinet/rt.h"
#include "profinet/util.h"
+ Include dependency graph for cyclic.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  profinet::cyclic::CyclicStats
 Statistics for cyclic communication. More...
 
struct  profinet::cyclic::CyclicStatsSnapshot
 Copyable snapshot of cyclic communication statistics. More...
 
class  profinet::cyclic::ICyclicController
 Abstract interface for controlling cyclic PROFINET communication. More...
 
class  profinet::cyclic::CyclicController
 RT_CLASS_1 cyclic data exchange controller. More...
 

Namespaces

namespace  profinet
 
namespace  profinet::cyclic
 

Enumerations

enum class  profinet::cyclic::CyclicState {
  profinet::cyclic::Idle , profinet::cyclic::Starting , profinet::cyclic::Running , profinet::cyclic::Stopping ,
  profinet::cyclic::Stopped , profinet::cyclic::Fault
}
 Lifecycle state of a CyclicController. More...
 

Functions

std::string profinet::cyclic::ToString (CyclicState state)
 Human-readable name for a CyclicState value.
 

Variables

constexpr int profinet::cyclic::MIN_CYCLE_MS = 8
 Minimum cycle time (ms) considered reliable.
 
constexpr int profinet::cyclic::RECOMMENDED_CYCLE_MS = 32
 Recommended cycle time (ms).
 
constexpr int profinet::cyclic::DEFAULT_MAX_CONSECUTIVE_TIMEOUTS = 3
 Default number of consecutive watchdog timeouts before transitioning to Fault.
 
constexpr int profinet::cyclic::STOP_FRAME_COUNT = 3
 Number of STOP frames sent during a graceful Stop().
 

Detailed Description

Declares the PROFINET RTC1 cyclic IO controller and process-data exchange API.

Provides cyclic transmit and receive handling, IO data access, IO status processing, watchdog monitoring, callbacks, lifecycle state, and statistics.

Manages bidirectional RT_CLASS_1 cyclic IO communication with a device:

  • TX thread sends output data to the device at the configured rate
  • RX thread receives and processes input data from the device
  • Explicit state machine tracks controller lifecycle
  • Double-buffered output (via rt::CyclicDataBuilder) for minimal lock contention
  • Cycle counter tracking detects gaps, duplicates, out-of-order frames
  • Watchdog escalates to FAULT after consecutive timeouts
  • IOCS bytes acknowledge received input data
  • Graceful stop sends STOP frames before closing

Definition in file cyclic.h.