PLCnext API Documentation 25.0.2.69
PlcState.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/System/Core/Enum.hxx"
9
10namespace Arp { namespace Plc { namespace Commons { namespace Domain
11{
12
13enum class PlcState : uint32
14{
18 None = 0,
22 Ready = 1,
26 Stop = 2,
30 Running = 3,
34 Halt = 4,
38 StateMask = 0x3F,
42 FlagsMask = ~StateMask,
46 Warning = (1 << 6),
50 Error = (1 << 7),
55 SuspendedBySwitch = (1 << 8),
59 Suspended = (1 << 8),
63 FatalError = (1 << 9),
68 SuspendedBySystemWatchdog = (1 << 10),
72 Blocked = (1 << 10),
76 SystemError = (1 << 11),
80 Loading = (1 << 12),
84 Starting = (1 << 13),
88 Stopping = (1 << 14),
92 Resetting = (1 << 15),
96 Changing = (1 << 16),
100 Hot = (1 << 17),
104 Forcing = (1 << 18),
108 Debugging = (1 << 19),
112 Warm = (1 << 20),
116 StartingDelayed = (1 << 21),
121 DcgFailed = (1 << 29),
126 DcgNotPossible = (1 << 30),
131 DcgRealTimeViolation = (1U << 31),
137 ClearMask = StateMask | Hot | Warm | Changing | Forcing | Debugging,
142 RemainingMask = StateMask | Hot | Warm | Forcing | Debugging | Warning | Error | FatalError,
143};
144
146// global stream operators of enum PlcState for logging and parsing
147ARP_CXX_SYMBOL_EXPORT std::ostream& operator<<(std::ostream& os, PlcState value);
148ARP_CXX_SYMBOL_EXPORT std::istream& operator>>(std::istream& is, PlcState& value);
149
151// global logical operators of enum PlcState
152constexpr PlcState operator&(PlcState lhs, PlcState rhs)
153{
154 using U = std::underlying_type<PlcState>::type;
155 return static_cast<PlcState>(static_cast<U>(lhs) & static_cast<U>(rhs));
156}
157
158constexpr PlcState operator|(PlcState lhs, PlcState rhs)
159{
160 using U = std::underlying_type<PlcState>::type;
161 return static_cast<PlcState>(static_cast<U>(lhs) | static_cast<U>(rhs));
162}
163
164constexpr PlcState& operator&=(PlcState& lhs, PlcState rhs)
165{
166 lhs = lhs & rhs;
167 return lhs;
168}
169
170constexpr PlcState& operator|=(PlcState& lhs, PlcState rhs)
171{
172 lhs = lhs | rhs;
173 return lhs;
174}
175
176constexpr PlcState operator~(PlcState arg)
177{
178 using U = std::underlying_type<PlcState>::type;
179 return static_cast<PlcState>(~static_cast<U>(arg));
180}
181
182}}}} // end of namespace Arp::Plc::Commons::Domain
183
185// template specialization of PlcState formatter
186template<> struct fmt::formatter<Arp::Plc::Commons::Domain::PlcState>: public fmt::ostream_formatter {};
std::uint32_t uint32
The Arp unsigned integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:33
PlcState
Definition: PlcState.hpp:14
@ RemainingMask
This mask defines all states which should not be cleared before any PLC operation....
@ Warm
The PLC is stopped in warm state, that is the retain data has been restored.
@ SuspendedBySystemWatchdog
Deprecated since 2022.0! Please use <cref name="Blocked"> instead. This error bit is set,...
@ StartingDelayed
The PLC is about to start, but due to component conditions the PLC start has to be delayed.
@ Hot
The PLC is stopped in hot state, that is all data still remains.
@ Halt
The PLC is halted for debug purpose.
@ Blocked
This error bit is set, if the PLC could not be loaded because it was prevented by a component.
@ SuspendedBySwitch
Deprecated since 2022.0! Please use <cref name="Suspended"> instead. This error bit is set,...
@ Forcing
The PLC is in force mode. One or more variables are forced by the GDS.
@ Changing
The PLC is changing a configuration, this implies, that the state Running is set.
@ Suspended
This error bit is set, if the PLC could not be started because it was prevented by a component.
@ DcgNotPossible
This error bit is set, if the PLC tries to perform a change operation, but it is not possible.
@ DcgRealTimeViolation
This error bit is set, if the PLC tries to perform a change operation, but it is not possible in real...
@ ClearMask
This mask defines all states which should be cleared before any PLC operation.
@ DcgFailed
This error bit is set, if the PLC tried to perform a change operation, but an error occurred.
@ Debugging
The PLC is in debug mode. One or more breakpoints are set.
@ FatalError
An unspecified fatal error or exception occurs, and the PLC is in state error.
Root namespace for the PLCnext API