PLCnext API Documentation 25.0.2.69
PlcDomainProxy.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/System/Core/event.hxx"
9#include "Arp/System/Commons/Logging.h"
10#include "Arp/System/Acf/IComponent.hpp"
11#include "Arp/Plc/Domain/Commons/PlcStartKind.hpp"
12
13// forwards
14namespace Arp { namespace Plc { namespace Domain
15{
16class PlcDomainComponent;
17class PlcDomainProxyComponent;
18}}}
19
20// forwards
21namespace Arp::Base::Rsc::Commons::Services
22{
24}
25
26namespace Arp { namespace Plc { namespace Commons { namespace Services { namespace Internal
27{
28class IPlcDomainService;
29}}}}} // end of namespace Arp::Plc::Commons::Services::Internal
30
31namespace Arp { namespace System { namespace Monitoring { namespace Services { namespace Internal
32{
33class IWatchdogInfoService;
34}}}}} // end of namespace Arp::System::Monitoring::Services::Internal
35
36namespace Arp { namespace Hardware { namespace DeviceHmi { namespace Services { namespace Internal
37{
38class ISwitchesService;
39}}}}} // end of namespace Arp::Hardware::DeviceHmi::Services::Internal
40
41namespace Arp { namespace Plc { namespace Commons { namespace Domain
42{
43
44using namespace Arp::System::Acf;
45using namespace Arp::Plc::Domain;
46using namespace Arp::Base::Rsc::Commons::Services;
47using namespace Arp::Plc::Commons::Services::Internal;
48using namespace Arp::System::Monitoring::Services::Internal;
49using namespace Arp::Hardware::DeviceHmi::Services::Internal;
50
51class PlcDomainProxy : private Loggable<PlcDomainProxy>
52{
53 friend class Arp::Plc::Domain::PlcDomainComponent;
54 friend class Arp::Plc::Domain::PlcDomainProxyComponent;
55
56public: // usings
58 using InstancePtr = std::unique_ptr<Instance>;
60
61private: // using/typedefs
62 using IPlcDomainServicePtr = std::shared_ptr<IPlcDomainService>;
63 using IWatchdogInfoServicePtr = std::shared_ptr<IWatchdogInfoService>;
64 using ISwitchesServicePtr = std::shared_ptr<ISwitchesService>;
65
66public: // construction/destruction
68 PlcDomainProxy(void) = default;
69
70public: // static singleton operations
71 static Instance& CreateInstance(void);
72 static bool IsCreated(void);
73 static void DisposeInstance(void);
74 static Instance& GetInstance(void);
75
76public: // events
77 event<void> PlcLoading;
78 event<void> PlcLoaded;
79 event<PlcStartKind> PlcStarting;
80 event<void> PlcStarted;
81 event<void> PlcStopping;
82 event<void> PlcStopped;
83 event<bool> PlcUnloading; // bool parameter = 'onError'
84 event<bool> PlcUnloaded; // bool parameter = 'onError'
85 event<void> PlcChanging;
86 event<bool> PlcChanged; // bool parameter = 'success'
87
88public: // properties setter/getter
91 ARP_DEPRECATED("Not required anymore. Moved to PLC manager")
92 bool IsPlcSuspendedBySwitch(void);
95 ARP_DEPRECATED("Not required anymore. Moved to PLC manager")
96 bool IsPlcSuspendedBySystemWatchdog(bool& warmStartNotPossible, bool& autoRestart);
99 ARP_DEPRECATED("Not required anymore. Moved to PLC manager")
101
102public: // operations
103 void RegisterComponent(IComponent& component, bool isSystemComponent = false);
104 void RegisterProxyComponent(IComponent& component);
105 void UnregisterComponent(IComponent& component);
106
107private: // methods
108 void PublishComponentService(IComponent& component, const char* serviceName, IRscServiceFactory* pServiceFactory);
109
110private: // methods
111 void SubscribeServices(bool isPlcProcess = false);
112
113private: // fields
114 IPlcDomainServicePtr plcDomainSerivcePtr;
115 IWatchdogInfoServicePtr watchdogInfoServicePtr;
116 ISwitchesServicePtr switchesServicePtr;
117
118private: // static fields
119 static InstancePtr instancePtr;
120 boolean hasStartStopSwitch = false; /* here for binary compatibility */
121};
122
124// inline methods of class PlcDomainProxy
125
126}}}} // end of namespace Arp::Plc::Commons::Domain
This is the most important basic interface of the Arp platform. Any component shall implement this in...
Definition: IComponent.hpp:79
Use this class to register and invoke several delegates (function pointer in OOP design).
Definition: event.hxx:32
Interface for service factory classes to create instances of the service implementation,...
Definition: IRscServiceFactory.hpp:26
Definition: PlcDomainProxy.hpp:52
PlcDomainProxy(void)=default
Constructs an PlcDomainProxy instance.
bool IsPlcSuspendedBySystemWatchdog(bool &warmStartNotPossible, bool &autoRestart)
Deprecated!
Definition: PlcDomainProxy.cpp:130
bool IsPlcSuspendedBySwitch(void)
Deprecated!
Definition: PlcDomainProxy.cpp:101
Derive from this class to inherit logging functionality.
Definition: Loggable.hxx:28
PlcStartKind
Determines which kind of start operation is initiated using PlcManager::StartPlc(PlcStartKind startKi...
Definition: PlcStartKind.hpp:18
Namespace for the PLC domain
Definition: PlcDomainProxy.hpp:15
This is the namespace of the Application Component Framework.
Definition: ComponentBase.hpp:72
Root namespace for the PLCnext API
class ARP_DEPRECATED("Use Arp::Enum<T> instead.") EnumStrings
Deprecated! The class implements an adapter for enums to define the string literals of the enum entri...
Definition: EnumStrings.hxx:38