PLCnext API Documentation 23.6.0.37
PlcState.hpp
1
2//
3// Copyright PHOENIX CONTACT Electronics GmbH
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 Loading = (1 << 12),
80 Starting = (1 << 13),
84 Stopping = (1 << 14),
88 Resetting = (1 << 15),
92 Changing = (1 << 16),
96 Hot = (1 << 17),
100 Forcing = (1 << 18),
104 Debugging = (1 << 19),
108 Warm = (1 << 20),
112 StartingDelayed = (1 << 21),
117 DcgFailed = (1 << 29),
122 DcgNotPossible = (1 << 30),
127 DcgRealTimeViolation = (1U << 31),
133 ClearMask = StateMask | Hot | Warm | Changing | Forcing | Debugging,
138 RemainingMask = StateMask | Hot | Warm | Forcing | Debugging | Warning | Error | FatalError,
139};
140
142// global stream operators of enum PlcState for logging and parsing
143ARP_CXX_SYMBOL_EXPORT std::ostream& operator<<(std::ostream& os, PlcState value);
144ARP_CXX_SYMBOL_EXPORT std::istream& operator>>(std::istream& is, PlcState& value);
145
147// global logical operators of enum PlcState
148inline constexpr PlcState operator&(PlcState lhs, PlcState rhs)
149{
150 using U = std::underlying_type<PlcState>::type;
151 return static_cast<PlcState>(static_cast<U>(lhs) & static_cast<U>(rhs));
152}
153
154inline constexpr PlcState operator|(PlcState lhs, PlcState rhs)
155{
156 using U = std::underlying_type<PlcState>::type;
157 return static_cast<PlcState>(static_cast<U>(lhs) | static_cast<U>(rhs));
158}
159
160inline PlcState& operator&=(PlcState& lhs, PlcState rhs)
161{
162 lhs = lhs & rhs;
163 return lhs;
164}
165
166inline PlcState& operator|=(PlcState& lhs, PlcState rhs)
167{
168 lhs = lhs | rhs;
169 return lhs;
170}
171
172inline PlcState operator~(PlcState arg)
173{
174 using U = std::underlying_type<PlcState>::type;
175 return static_cast<PlcState>(~static_cast<U>(arg));
176}
177
178}}}} // end of namespace Arp::Plc::Commons::Domain
std::uint32_t uint32
The Arp unsigned integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:36
PlcState
Definition: PlcState.hpp:14
@ RemainingMask
This mask defines all states which should not be cleared before any PLC operation....
@ Loading
The PLC is loading the Plc components.
@ SuspendedBySystemWatchdog
Deprecated since 2022.0! Please use <cref name="Blocked"> instead. This error bit is set,...
@ StateMask
Use this entry to de-mask the raw PLC state value.
@ StartingDelayed
The PLC is about to start, but due to component conditions the PLC start has to be delayed.
@ 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.
@ Stopping
The PLC is stopping the Plc components.
@ FlagsMask
Use this entry to de-mask the flags portion of this PLC state.
@ Resetting
The PLC is resetting the Plc components.
@ 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.
@ Starting
The PLC is starting the Plc components.
@ 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