#include <AlarmSource.h>
Public Member Functions | |
virtual | ~AlarmSource () |
virtual void | raiseAlarm (std::string faultFamily, std::string faultMember, int faultCode)=0 |
virtual void | raiseAlarm (std::string faultFamily, std::string faultMember, int faultCode, Properties properties)=0 |
virtual void | clearAlarm (std::string faultFamily, std::string faultMember, int faultCode)=0 |
virtual void | setAlarm (std::string faultFamily, std::string faultMember, int faultCode, Properties alarmProps, bool active)=0 |
virtual void | setAlarm (std::string faultFamily, std::string faultMember, int faultCode, bool active)=0 |
virtual void | terminateAllAlarms ()=0 |
virtual void | queueAlarms (ACS::TimeInterval time)=0 |
virtual void | queueAlarms ()=0 |
virtual void | flushAlarms ()=0 |
virtual void | disableAlarms ()=0 |
virtual void | enableAlarms ()=0 |
virtual void | start ()=0 |
virtual void | tearDown ()=0 |
The AlarmSource interface offers a set of useful methods to handle alarms from a source.
This class, on one side, allows the sending of alarms with a shorter syntax compared to the original API and, on the other side, offers some common functionalities useful while sending alarms in ACS.
This class implements a guard in the sense that a active (terminated) alarm is not sent to the alarm service if it has been already activated (terminated).
AlarmSource allows to queue the alarms instead of sending them immediately by calling queueAlarms(...)
. To stop queuing the alarms and send them to the alarm service the method flushAlarms()
must be executed. The queuing of the alarms has the advantage that if an alarm is activated and then deactivated during the queuing time, it is not sent to the alarm service. This functionalities can be useful for example when starting up a piece of software connected to an hardware device. In that case it is quite common that before initialization some of the values returned by the device are wrong and can trigger the sending of alarms that will be cleared only when the device is fully operative. With the queuing the operator does not receive this kind of (false) alarms. It is left to developer the responsibility to enable/disable the queuing at the right moment.
If queueAlarms(long, TimeUnit) is called twice, the new time interval is used to flush the queue and the old one is discarded.
Alarm sending can be inhibited by calling disableAlarms(): all the alarm events submitted after calling this method are discarded. To revert just call enableAlarms(). The inhibition of the alarms does not interfere with the queuing: alarms queued before inhibit alarms remain queued and will be sent when flushing.
Life cycle: start() must be called before using methods of this class. tearDown() must be called when finished using this class.
virtual acsalarm::AlarmSource::~AlarmSource | ( | ) | [inline, virtual] |
Destructor
virtual void acsalarm::AlarmSource::clearAlarm | ( | std::string | faultFamily, | |
std::string | faultMember, | |||
int | faultCode | |||
) | [pure virtual] |
Clear the alarm with the passed triplet.
If the alarm is already terminated, it is not sent again to the alarm service.
faultFamily | The FaultFamily | |
faultMember | The FaultMember | |
faultCode | The FaultCode |
virtual void acsalarm::AlarmSource::disableAlarms | ( | ) | [pure virtual] |
Disable the sending of alarms.
When the alarms are disabled, all the alarms submitted with raise, clear and set are discarded. This means that those alarms are immediately discarded. They are not queued, and will never arrive at the alarm service.
virtual void acsalarm::AlarmSource::enableAlarms | ( | ) | [pure virtual] |
Enable the sending of alarms.
Better just "This method reverts the effect of a previous call to disableAlarms(), so that alarms will get processed again.
Alarms are enabled by default.
virtual void acsalarm::AlarmSource::flushAlarms | ( | ) | [pure virtual] |
Flush the alarms queued and stop queuing.
virtual void acsalarm::AlarmSource::queueAlarms | ( | ) | [pure virtual] |
Start queuing the alarms.
The alarms are queued until flushAlarms()
is executed.
The purpose of the queuing is to avoid alarms flickering for example during the initialization phase of a device where spurious states could trigger the event of false alarms.
virtual void acsalarm::AlarmSource::queueAlarms | ( | ACS::TimeInterval | time | ) | [pure virtual] |
Start queuing the alarms.
The alarms are flushed when the passed time expires or flush gets called.
The purpose of the queuing is to avoid alarms flickering for example during the initialization phase of a device where spurious states could trigger the event of false alarms
time | The time to queue alarms in 100ns unit |
virtual void acsalarm::AlarmSource::raiseAlarm | ( | std::string | faultFamily, | |
std::string | faultMember, | |||
int | faultCode, | |||
Properties | properties | |||
) | [pure virtual] |
Raise an alarm with the given triplet and a set of properties.
If the alarm is already active, it is not sent again to the alarm service.
faultFamily | The FaultFamily | |
faultMember | The FaultMember | |
faultCode | The FaultCode | |
properties | The user properties. It can be null or empty. |
virtual void acsalarm::AlarmSource::raiseAlarm | ( | std::string | faultFamily, | |
std::string | faultMember, | |||
int | faultCode | |||
) | [pure virtual] |
Raise an alarm with the given triplet.
If the alarm is already active, it is not sent again to the alarm service.
faultFamily | The FaultFamily | |
faultMember | The FaultMember | |
faultCode | The FaultCode |
virtual void acsalarm::AlarmSource::setAlarm | ( | std::string | faultFamily, | |
std::string | faultMember, | |||
int | faultCode, | |||
Properties | alarmProps, | |||
bool | active | |||
) | [pure virtual] |
Send the alarm with the passed triplet and properties to the alarm service. The state activate/terminate of the alarm depends on the passed boolean.
This method is the most complete way to send an alarm.
If the alarm is already active, it is not sent again to the alarm service. If the alarm is already terminated, it is not sent again to the alarm service.
faultFamily | The FaultFamily | |
faultMember | The FaultMember | |
faultCode | The FaultCode | |
alarmProps | The user properties. It can be null or empty. | |
active | if true the alarm is activated otherwise it is terminated. |
virtual void acsalarm::AlarmSource::setAlarm | ( | std::string | faultFamily, | |
std::string | faultMember, | |||
int | faultCode, | |||
bool | active | |||
) | [pure virtual] |
Send the alarm with the passed triplet to the alarm service. The state activate/terminate of the alarm depends on the passed boolean.
This method is the most complete way to send an alarm.
If the alarm is already active, it is not sent again to the alarm service. If the alarm is already terminated, it is not sent again to the alarm service.
faultFamily | The FaultFamily | |
faultMember | The FaultMember | |
faultCode | The FaultCode | |
active | if true the alarm is activated otherwise it is terminated. |
virtual void acsalarm::AlarmSource::start | ( | ) | [pure virtual] |
Life-cycle: this method must be called before using this class.
virtual void acsalarm::AlarmSource::tearDown | ( | ) | [pure virtual] |
Life-cycle: tearDown must be called when terminated using this class
virtual void acsalarm::AlarmSource::terminateAllAlarms | ( | ) | [pure virtual] |
Terminate all the active alarms.