PLCnext API Documentation 25.0.2.69
|
Access class for the alarm server component. More...
#include <AlarmAccess.hpp>
Public Types | |
using | Mutex = Arp::System::Commons::Threading::Mutex |
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 | AcknowledgeWithComment (const String &alarmId, const String &comment="", const String &language="", const String &user="") |
A client can ask for acknowledgement of an alarm instance (if supported by an alarm). More... | |
int32 | Confirm (const String &alarmId) |
int32 | ConfirmWithComment (const String &alarmId, const String &comment="", const String &language="", const String &user="") |
int32 | AddComment (const String &alarmId, const String &comment, const String &language="", const String &user="") |
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 that 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 that supports confirmable alarms should subscribe to confirm request by a client. More... | |
int32 | SubscribeAddComment (std::function< void(const String &alarmId, const String &comment, const String &language, const String &user)> handler) |
An alarm source that supports acknowledgeble or confirmable alarms should subscribe to add comment 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:
int32 Arp::System::NmPayload::Alarms::AlarmAccess::Acknowledge | ( | const String & | alarmId | ) |
A client can ask for acknowledgement of an alarm instance (if supported by an alarm).
alarmId | unique Id of the alarm as specified during NewAlarmState. |
int32 Arp::System::NmPayload::Alarms::AlarmAccess::AcknowledgeWithComment | ( | const String & | alarmId, |
const String & | comment = "" , |
||
const String & | language = "" , |
||
const String & | user = "" |
||
) |
A client can ask for acknowledgement of an alarm instance (if supported by an alarm).
alarmId | unique Id of the alarm as specified during NewAlarmState. |
comment | optional user comment for the acknowledgement. |
language | optional language of the user comment. |
user | optional user that provided the comment. |
int32 Arp::System::NmPayload::Alarms::AlarmAccess::AddAlarm | ( | AlarmState & | alarmState | ) |
Announce a new alarm to the server (used for browsing in OPC UA).
alarmState | alarm structure with fields for the alarm. The following fileds are used:
|
int32 Arp::System::NmPayload::Alarms::AlarmAccess::AddComment | ( | const String & | alarmId, |
const String & | comment, | ||
const String & | language = "" , |
||
const String & | user = "" |
||
) |
A client can add a comment to an alarm instance (if supported by an alarm).
alarmId | unique Id of the alarm as specified during NewAlarmState. |
comment | user comment for the acknowledgement / confirmation. |
language | optional language of the user comment. |
user | optional user that provided the comment. |
int32 Arp::System::NmPayload::Alarms::AlarmAccess::Confirm | ( | const String & | alarmId | ) |
A client can ask for confirmation of an alarm instance (if supported by an alarm).
alarmId | unique Id of the alarm as specified during NewAlarmState. |
int32 Arp::System::NmPayload::Alarms::AlarmAccess::ConfirmWithComment | ( | const String & | alarmId, |
const String & | comment = "" , |
||
const String & | language = "" , |
||
const String & | user = "" |
||
) |
A client can ask for confirmation of an alarm instance (if supported by an alarm).
alarmId | unique Id of the alarm as specified during NewAlarmState. |
comment | optional user comment for the confirmation. |
language | optional language of the user comment. |
user | optional user that provided the comment. |
int32 Arp::System::NmPayload::Alarms::AlarmAccess::Init | ( | String | alarmClientId | ) |
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.
alarmState | alarm structure with fields for the updated state of the alarm. |
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 that 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!
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::SubscribeAddComment | ( | std::function< void(const String &alarmId, const String &comment, const String &language, const String &user)> | handler | ) |
An alarm source that supports acknowledgeble or confirmable alarms should subscribe to add comment 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!
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 that 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!
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!