PLCnext API Documentation
20.3.1.28622
|
Access class for the alarm server component. More...
#include <AlarmAccess.hpp>
Public Member Functions | |
AlarmAccess (const AlarmAccess &arg)=delete | |
AlarmAccess & | operator= (const AlarmAccess &arg)=delete |
int32 | Init (String alarmClientId) |
Initialize the class. More... | |
void | Dispose () |
Diposes all resources of this instance. | |
int32 | AddAlarm (AlarmState &alarmState) |
Announce a new alarm to the server (used for browsing in OPC UA). More... | |
int32 | NewAlarmState (AlarmState &alarmState) |
Inform the AlarmServer about a new alarm state (comming alarms, going alarms / changes to sub states). More... | |
int32 | Acknowledge (const String &alarmId) |
A client can ask for acknowledgement of an alarm instance (if supported by an alarm). More... | |
int32 | Confirm (const String &alarmId) |
int32 | SubscribeAddAlarm (std::function< void(const AlarmState &alarmState)> handler) |
A client can subscribe to AddAlarm calls (used e.g. by the OPC-UA Server to show the alarms in the address space). More... | |
int32 | SubscribeNewAlarmState (std::function< void(const AlarmState &alarmState)> handler) |
A client can subscribe to NewAlarmState calls to track the state of alarms. More... | |
int32 | SubscribeAcknowledge (std::function< void(const String &alarmId, const String &comment, const String &language, const String &user)> handler) |
An alarm source the supports acknowledgeble alarms should subscribe to acknowledge request by a client. More... | |
int32 | SubscribeConfirm (std::function< void(const String &alarmId, const String &comment, const String &language, const String &user)> handler) |
An alarm source the supports confirmable alarms should subscribe to confirm request by a client. More... | |
Access class for the alarm server component.
Instances of this class can be used to connect alarm sources and alarm clients with the alarm server.
The alarm server routes the calls between the instances of the AlarmAccess instances (also cross process) in an asynchronous manner.
The calls the AlarmAccess are non blocking calls and can be called in a realtime process.
Note: The callback functions are executed in a different thread. Thread safety is task of the client code.
Error handling is done via return codes instead of exceptions so that it can safely be used within the realtime app.
Example of subscribing to messages:
A client can ask for acknowledgement of an alarm instance (if supported by an alarm).
int32 Arp::System::NmPayload::Alarms::AlarmAccess::AddAlarm | ( | AlarmState & | alarmState | ) |
Announce a new alarm to the server (used for browsing in OPC UA).
The following fileds are used:
A client can ask for confirmation of an alarm instance (if supported by an alarm).
Initialize the class.
Note: This class need to be initialized during startup of the Component.
alarmClientId | must be a unique name of this AlarmAccess instance within the PLCnext instance. |
int32 Arp::System::NmPayload::Alarms::AlarmAccess::NewAlarmState | ( | AlarmState & | alarmState | ) |
Inform the AlarmServer about a new alarm state (comming alarms, going alarms / changes to sub states).
An alarm source can inform about state changes of its alarms. Only the source should call this methods for its alarms.
int32 Arp::System::NmPayload::Alarms::AlarmAccess::SubscribeAcknowledge | ( | std::function< void(const String &alarmId, const String &comment, const String &language, const String &user)> | handler | ) |
An alarm source the supports acknowledgeble alarms should subscribe to acknowledge request by a client.
This method can only be used during startup of the Component.
As a result to a call of the handler function the alarm source might change the state of the alarm and call NewAlarmState agein.
Note: The provided handler function is called by a different thread!
Note: comment, language and user is not supported in this version.
int32 Arp::System::NmPayload::Alarms::AlarmAccess::SubscribeAddAlarm | ( | std::function< void(const AlarmState &alarmState)> | handler | ) |
A client can subscribe to AddAlarm calls (used e.g. by the OPC-UA Server to show the alarms in the address space).
This method can only be used during startup of the Component.
Note: The provided handler function is called by a different thread!
int32 Arp::System::NmPayload::Alarms::AlarmAccess::SubscribeConfirm | ( | std::function< void(const String &alarmId, const String &comment, const String &language, const String &user)> | handler | ) |
An alarm source the supports confirmable alarms should subscribe to confirm request by a client.
This method can only be used during startup of the Component.
As a result to a call of the handler function the alarm source might change the state of the alarm and call NewAlarmState agein.
Note: The provided handler function is called by a different thread!
Note: comment, language and user is not supported in this version.
int32 Arp::System::NmPayload::Alarms::AlarmAccess::SubscribeNewAlarmState | ( | std::function< void(const AlarmState &alarmState)> | handler | ) |
A client can subscribe to NewAlarmState calls to track the state of alarms.
This method can only be used during startup of the Component.
Note: The provided handler function is called by a different thread!