PLCnext API Documentation 23.6.0.37
PlcDomainProxy.hpp
1
2//
3// Copyright PHOENIX CONTACT Electronics GmbH
4//
6#pragma once
8#include "Arp/System/Core/event.hxx"
9#include "Arp/System/Core/AppDomainSingleton.hxx"
10#include "Arp/System/Commons/Logging.h"
11#include "Arp/System/Acf/IComponent.hpp"
12#include "Arp/System/Rsc/Services/IRscServiceFactory.hpp"
13#include "Arp/Plc/Commons/Domain/PlcStartKind.hpp"
14
15// forwards
16namespace Arp { namespace Plc { namespace Domain
17{
18class PlcDomainComponent;
19class PlcDomainProxyComponent;
20}}}
21
22namespace Arp { namespace Plc { namespace Commons { namespace Services { namespace Internal
23{
24class IPlcDomainService;
25}}}}} // end of namespace Arp::Plc::Commons::Services::Internal
26
27namespace Arp { namespace System { namespace Watchdog { namespace Services { namespace Internal
28{
29class IWatchdogInfoService;
30}}}}} // end of namespace Arp::Plc::Commons::Services::Internal
31
32namespace Arp { namespace Hardware { namespace DeviceHmi { namespace Services { namespace Internal
33{
34class ISwitchesService;
35}}}}} // end of namespace Arp::Hardware::DeviceHmi::Services::Internal
36
37namespace Arp { namespace Plc { namespace Commons { namespace Domain
38{
39
40using namespace Arp::System::Acf;
41using namespace Arp::System::Rsc::Services;
42using namespace Arp::Plc::Domain;
43using namespace Arp::Plc::Commons::Services::Internal;
44using namespace Arp::System::Watchdog::Services::Internal;
45using namespace Arp::Hardware::DeviceHmi::Services::Internal;
46
47class PlcDomainProxy : public AppDomainSingleton<PlcDomainProxy>, private Loggable<PlcDomainProxy>
48{
49 friend class Arp::Plc::Domain::PlcDomainComponent;
50 friend class Arp::Plc::Domain::PlcDomainProxyComponent;
51
52private: // using/typedefs
53 using IPlcDomainServicePtr = std::shared_ptr<IPlcDomainService>;
54 using IWatchdogInfoServicePtr = std::shared_ptr<IWatchdogInfoService>;
55 using ISwitchesServicePtr = std::shared_ptr<ISwitchesService>;
56
57public: // construction/destruction
59 PlcDomainProxy(void) = default;
61 ~PlcDomainProxy(void) = default;
62
63public: // events
64 event<void> PlcLoading;
65 event<void> PlcLoaded;
66 event<PlcStartKind> PlcStarting;
67 event<void> PlcStarted;
68 event<void> PlcStopping;
69 event<void> PlcStopped;
70 event<bool> PlcUnloading; // bool parameter = 'onError'
71 event<bool> PlcUnloaded; // bool parameter = 'onError'
72 event<void> PlcChanging;
73 event<bool> PlcChanged; // bool parameter = 'success'
74
75public: // properties setter/getter
78 ARP_DEPRECATED("Not required anymore. Moved to PLC manager")
82 ARP_DEPRECATED("Not required anymore. Moved to PLC manager")
83 bool IsPlcSuspendedBySystemWatchdog(bool& warmStartNotPossible, bool& autoRestart);
86 ARP_DEPRECATED("Not required anymore. Moved to PLC manager")
87 bool IsPlcSuspendedBySystemWatchdog(PlcStartKind& startKind);
88
89public: // operations
90 void RegisterComponent(IComponent& component, bool isSystemComponent = false);
91 void RegisterProxyComponent(IComponent& component);
92 void UnregisterComponent(IComponent& component);
93
94private: // methods
95 void PublishComponentService(IComponent& component, const char* serviceName, IRscServiceFactory* pServiceFactory);
96
97private: // methods
98 void SubscribeServices(bool isPlcProcess = false);
99
100private: // deleted methods
101 PlcDomainProxy(const PlcDomainProxy& arg) = default;
102 PlcDomainProxy& operator=(const PlcDomainProxy& arg) = default;
103
104private: // fields
105 IPlcDomainServicePtr plcDomainSerivcePtr;
106 IWatchdogInfoServicePtr watchdogInfoServicePtr;
107 ISwitchesServicePtr switchesServicePtr;
108
109private: // static fields
110 boolean hasStartStopSwitch = false; /* here for binary compatibility */
111
112};
113
115// inline methods of class PlcDomainProxy
116
117}}}} // end of namespace Arp::Plc::Commons::Domain
This class implements the singleton pattern for singletons with process wide scope.
Definition: AppDomainSingleton.hxx:25
Definition: PlcDomainProxy.hpp:48
PlcDomainProxy(void)=default
Constructs an PlcDomainProxy instance.
~PlcDomainProxy(void)=default
Destructs this instance and frees all resources.
bool IsPlcSuspendedBySystemWatchdog(bool &warmStartNotPossible, bool &autoRestart)
Deprecated!
bool IsPlcSuspendedBySwitch(void)
Deprecated!
This is the most important basic interface of the Arp platform. Any component shall implement this in...
Definition: IComponent.hpp:81
Use this class to register and invoke several delegates (function pointer in OOP design).
Definition: event.hxx:193
Namespace for the PLC domain
Definition: PlcDomainProxy.hpp:17
This is the namespace of the Application Component Framework.
Definition: ComponentBase.hpp:13
@ System
System components used by the System, Device, Plc or Io domains.
Namespace for classes and interfaces for the Remote Service Call implementation
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