![]() |
AlarmNotifications
PANDA Slow Control Alarm Daemon
|
Configuration of the AlarmNotifications application. More...
#include <alarmconfiguration.h>
Public Member Functions | |
AlarmConfiguration (const AlarmConfiguration &other)=delete | |
Copy constructor (deleted) More... | |
AlarmConfiguration (AlarmConfiguration &&other)=delete | |
Move constructor (C++11, deleted) More... | |
~AlarmConfiguration () | |
Destructor. More... | |
AlarmConfiguration & | operator= (const AlarmConfiguration &other)=delete |
Copy assignment (deleted) More... | |
AlarmConfiguration & | operator= (AlarmConfiguration &&other)=delete |
Move assignment (C++11, deleted) More... | |
const std::string & | getConfigFileLocation () const noexcept |
Query config file location. More... | |
void | ReReadConfiguration () |
Read configuration again from disk. More... | |
void | WriteConfiguration () |
Write configuration to disk. More... | |
std::string | getActiveMQURI () const noexcept |
ActiveMQ connection URI. More... | |
void | setActiveMQURI (const std::string &newSetting) |
Change ActiveMQ connection URI. More... | |
std::string | getActiveMQUsername () const noexcept |
ActiveMQ connection username. More... | |
void | setActiveMQUsername (const std::string &newSetting) |
Change ActiveMQ connection username. More... | |
std::string | getActiveMQPassword () const noexcept |
ActiveMQ connection password. More... | |
void | setActiveMQPassword (const std::string &newSetting) |
Change ActiveMQ connection password. More... | |
std::string | getActiveMQTopicName () const noexcept |
JMS topic used by the CSS Alarm Server. More... | |
void | setActiveMQTopicName (const std::string &newSetting) |
Change JMS topic used by the CSS Alarm Server. More... | |
unsigned int | getLaboratoryNotificationTimeout () const noexcept |
Timeout for starting alarm notification in the laboratory. More... | |
void | setLaboratoryNotificationTimeout (const unsigned int newSetting) |
Change the timeout for starting alarm notification in the laboratory. More... | |
unsigned int | getDesktopNotificationTimeout () const noexcept |
Timeout for sending a desktop notification. More... | |
void | setDesktopNotificationTimeout (const unsigned int newSetting) |
Change the timeout for sending a desktop notification. More... | |
unsigned int | getEMailNotificationTimeout () const noexcept |
Timeout for sending an e-mail notification. More... | |
void | setEMailNotificationTimeout (const unsigned int newSetting) |
Change the timeout for sending an e-mail notification. More... | |
std::string | getEMailNotificationFrom () const noexcept |
Sender address for alarm e-mail notifications. More... | |
void | setEMailNotificationFrom (const std::string &newSetting) |
Change the Sender address for alarm e-mail notifications. More... | |
std::string | getEMailNotificationTo () const noexcept |
Recipient address for alarm e-mail notifications. More... | |
void | setEMailNotificationTo (const std::string &newSetting) |
Change the recipient address for alarm e-mail notifications. More... | |
std::string | getEMailNotificationServerName () const noexcept |
Name of the SMTP server. More... | |
void | setEMailNotificationServerName (const std::string &newSetting) |
Change the name of the STMP server. More... | |
unsigned int | getEMailNotificationServerPort () const noexcept |
Port of SMTP server. More... | |
void | setEMailNotificationServerPort (const unsigned int newSetting) |
Change the port of SMTP server. More... | |
std::string | getFlashLightRelaisDeviceNode () const noexcept |
Device node of the USB relais for the alarm flash light. More... | |
void | setFlashLightRelaisDevideNode (const std::string &newSetting) |
Change the device node of the USB relais for the alarm flash light. More... | |
KSharedConfigPtr | internal () |
INTERNAL METHOD: Shared pointer to KConfig instance. More... | |
KConfigSkeleton * | internal_skel () |
INTERNAL METHOD: Skeleton of the configuration. More... | |
Static Public Member Functions | |
static AlarmConfiguration & | instance () noexcept |
Get singleton instance. More... | |
Private Member Functions | |
AlarmConfiguration () | |
Constructor. More... | |
void | CreateActiveMQConnectivitySettings () |
Create ActiveMQ connectivity settings. More... | |
Static Private Member Functions | |
static std::string | CreateConfigFileLocation () |
Establish location of the configuration file. More... | |
Private Attributes | |
const std::string | _configfilelocation |
Path to the configuration file. More... | |
KSharedConfigPtr | _backend |
KConfig backend. More... | |
KConfigSkeleton | _skeleton |
KConfig skeleton. More... | |
QString | _activemquri |
ActiveMQ URI. More... | |
QString | _activemqusername |
ActiveMQ username. More... | |
QString | _activemqpassword |
ActiveMQ password. More... | |
QString | _activemqtopicname |
JMS topic name used by CSS Alarm Server. More... | |
unsigned int | _laboratorynotificationtimeout |
Timeout for starting alarm notification in the laboratory. More... | |
unsigned int | _desktopnotificationtimeout |
Timeout for sending a desktop notification. More... | |
unsigned int | _emailnotificationtimeout |
Timeout for sending an e-mail notification. More... | |
QString | _emailnotificationfrom |
Sender address for alarm e-mail notifications. More... | |
QString | _emailnotificationto |
Recipient address for alarm e-mail notifications. More... | |
QString | _emailnotificationservername |
Name of the SMTP server. More... | |
unsigned int | _emailnotificationserverport |
Port of SMTP server. More... | |
QString | _flashlightrelaisdevicenode |
Device node of the USB relais for the alarm flash light. More... | |
KConfigSkeleton::ItemString * | _activemquriitem |
KConfig item for _activemquri setting. More... | |
KConfigSkeleton::ItemString * | _activemqusernameitem |
KConfig item for _activemqusername setting. More... | |
KConfigSkeleton::ItemString * | _activemqpassworditem |
KConfig item for _activemqpassword setting. More... | |
KConfigSkeleton::ItemString * | _activemqtopicnameitem |
KConfig item for _activemqtopicname setting. More... | |
KConfigSkeleton::ItemUInt * | _laboratorynotificationtimeoutitem |
KConfig item for _laboratorynotificationtimeout setting. More... | |
KConfigSkeleton::ItemUInt * | _desktopnotificationtimeoutitem |
KConfig item for _desktopnotificationtimeout setting. More... | |
KConfigSkeleton::ItemUInt * | _emailnotificationtimeoutitem |
KConfig item for _emailnotificationtimeout setting. More... | |
KConfigSkeleton::ItemString * | _emailnotificationfromitem |
KConfig item for _emailnotificationfrom setting. More... | |
KConfigSkeleton::ItemString * | _emailnotificationtoitem |
KConfig item for _emailnotificationto setting. More... | |
KConfigSkeleton::ItemString * | _emailnotificationservernameitem |
KConfig item for _emailnotificationservername setting. More... | |
KConfigSkeleton::ItemUInt * | _emailnotificationserverportitem |
KConfig item for _emailnotificationserverport setting. More... | |
KConfigSkeleton::ItemString * | _flashlightrelaisdevicenodeitem |
KConfig item for _flashlightrelaisdevicenode setting. More... | |
Configuration of the AlarmNotifications application.
This singleton class uses the KConfig framework to read and write the configuration of the AlarmNotifications. Every configuration item has a read and a write method whose names begin with "get" and "set" respectively. To write a changed configuration to disk, the WriteConfiguration() method has to be called. To update the configuration in the memory after it was changed on disk by another instance, the ReReadConfiguration() method must be used.
The KConfig framework also provides the KConfigDialog class, which is used to create the ConfigScreen. It uses the methods internal() and internal_skel(), which are not part of the public API. According to the principles of object-oriented programming, the KConfig framework can be exchanged without affecting the public API of the AlarmConfiguration, i.e. only the ConfigScreen would be affected of such a change.
Definition at line 58 of file alarmconfiguration.h.
|
private |
Constructor.
Creates all required KConfig items, reads and parses the configuration file to make the data available for use by other parts of the application.
Definition at line 64 of file alarmconfiguration.cpp.
|
delete |
Copy constructor (deleted)
This class cannot be copied.
other | Another instance of AlarmConfiguration |
|
delete |
Move constructor (C++11, deleted)
This class cannot be moved.
other | Another instance of AlarmConfiguration |
AlarmConfiguration::~AlarmConfiguration | ( | ) |
Destructor.
Flushed all remaining configuration changes to disk and frees the resources.
Definition at line 72 of file alarmconfiguration.cpp.
|
private |
Create ActiveMQ connectivity settings.
Creates the KConfig item for the setting regarding the connection to the Apache ActiveMQ message broker used by the CSS Alarm Server.
Definition at line 95 of file alarmconfiguration.cpp.
|
staticprivate |
Establish location of the configuration file.
A default location for the configuration file can be given at compile time via the CONFIGFILELOCATION macro. This can be overriden at runtime by setting the environment variable ALARMNOTIFICATIONSCONFIG to the full path of the file.
If the path within CONFIGFILELOCATION contains the tilde ("~") which represents the home directory under Linux and the environment variable HOME is set, the tilde will be replaced with the path in HOME.
Definition at line 244 of file alarmconfiguration.cpp.
|
noexcept |
ActiveMQ connection password.
Used by CMSClient to connect to the Apache ActiveMQ message broker.
This method cannot throw exceptions.
Definition at line 134 of file alarmconfiguration.cpp.
|
noexcept |
JMS topic used by the CSS Alarm Server.
Used by CMSClient to receive messages sent by the CSS Alarm Server
This method cannot throw exceptions.
Definition at line 144 of file alarmconfiguration.cpp.
|
noexcept |
ActiveMQ connection URI.
Used by CMSClient to connect to the Apache ActiveMQ message broker.
This method cannot throw exceptions.
Definition at line 114 of file alarmconfiguration.cpp.
|
noexcept |
ActiveMQ connection username.
Used by CMSClient to connect to the Apache ActiveMQ message broker.
This method cannot throw exceptions.
Definition at line 124 of file alarmconfiguration.cpp.
|
noexcept |
Query config file location.
Get the location of the configuration file used by this instance of AlarmConfiguration. The location cannot be changed during use of this class but it is established only once at instanciation.
Definition at line 77 of file alarmconfiguration.cpp.
|
noexcept |
Timeout for sending a desktop notification.
If an alarm lasts for longer than this value in seconds, a dekstop notification will send to alert the user at his office PC. A value of 0 disables this type of notification.
This method cannot throw exceptions.
Definition at line 164 of file alarmconfiguration.cpp.
|
noexcept |
Sender address for alarm e-mail notifications.
This e-mail address will be used as the sender's address when an alarm e-mail notification is sent.
This method cannot throw exceptions.
Definition at line 184 of file alarmconfiguration.cpp.
|
noexcept |
Name of the SMTP server.
The DNS name or IP address of the SMTP server used to send the e-mail notifications,
This method cannot throw exceptions.
Definition at line 204 of file alarmconfiguration.cpp.
|
noexcept |
Port of SMTP server.
Numeric port number of the SMTP daemon on the server used to send the e-mail notifications.
This method cannot throw exceptions.
Definition at line 214 of file alarmconfiguration.cpp.
|
noexcept |
Timeout for sending an e-mail notification.
If an alarm lasts for longer than this value in seconds, an e-mail will be send to a specific mailing list. A value of 0 disables this type of notification.
This method cannot throw exceptions.
Definition at line 174 of file alarmconfiguration.cpp.
|
noexcept |
Recipient address for alarm e-mail notifications.
This e-mail address will be used as the recipient's address when an alarm e-mail notification is sent.
This method cannot throw exceptions.
Definition at line 194 of file alarmconfiguration.cpp.
|
noexcept |
Device node of the USB relais for the alarm flash light.
The relais controlled via this device node is used in the class FlashLight to operate a red flashing light that notifies staff in the lab about an alarm.
This method cannot throw exceptions.
Definition at line 224 of file alarmconfiguration.cpp.
|
noexcept |
Timeout for starting alarm notification in the laboratory.
If an alarm lasts for longer than this value in seconds, a notification in the laboratory itself will be activated. A value of 0 disables this type of notification.
This method cannot throw exceptions.
Definition at line 154 of file alarmconfiguration.cpp.
|
staticnoexcept |
Get singleton instance.
This static method returns a reference (not a pointer!) to the singleton instance of AlarmConfiguration. On the first call to instance(), this singleton instance will be created and the constructor will be called. If an exception occurs in the constructor, instance() will call ExceptionHandler() to print an error message and then terminate the application.
Definition at line 44 of file alarmconfiguration.cpp.
KSharedConfigPtr AlarmConfiguration::internal | ( | ) |
INTERNAL METHOD: Shared pointer to KConfig instance.
THIS METHOD IS NOT PART OF THE PUBLIC API!!
Provides shared access to the KConfig instance managing this configuration. Used to connect the KConfigDialog to this configuration.
Definition at line 234 of file alarmconfiguration.cpp.
KConfigSkeleton * AlarmConfiguration::internal_skel | ( | ) |
INTERNAL METHOD: Skeleton of the configuration.
THIS METHOD IS NOT PART OF THE PUBLIC API!!
Provides access to the skeleton object that outlines all possible configuration parameters and their default values.
Definition at line 239 of file alarmconfiguration.cpp.
|
delete |
Copy assignment (deleted)
This class cannot be copied.
other | Another instance of AlarmConfiguration |
|
delete |
Move assignment (C++11, deleted)
This class cannot be moved.
other | Another instance of AlarmConfiguration |
void AlarmConfiguration::ReReadConfiguration | ( | ) |
Read configuration again from disk.
Reads and parses the configuration file again and updates the variables inside AlarmConfiguration accordingly. Changes applied to the AlarmConfiguration that have not been written to disk are discarded,
Definition at line 82 of file alarmconfiguration.cpp.
void AlarmConfiguration::setActiveMQPassword | ( | const std::string & | newSetting | ) |
Change ActiveMQ connection password.
Used by CMSClient to connect to the Apache ActiveMQ message broker.
newSetting | New configuration value |
Definition at line 139 of file alarmconfiguration.cpp.
void AlarmConfiguration::setActiveMQTopicName | ( | const std::string & | newSetting | ) |
Change JMS topic used by the CSS Alarm Server.
Used by CMSClient to receive messages sent by the CSS Alarm Server
newSetting | New configuration value |
Definition at line 149 of file alarmconfiguration.cpp.
void AlarmConfiguration::setActiveMQURI | ( | const std::string & | newSetting | ) |
Change ActiveMQ connection URI.
Used by CMSClient to connect to the Apache ActiveMQ message broker.
newSetting | New configuration value |
Definition at line 119 of file alarmconfiguration.cpp.
void AlarmConfiguration::setActiveMQUsername | ( | const std::string & | newSetting | ) |
Change ActiveMQ connection username.
Used by CMSClient to connect to the Apache ActiveMQ message broker.
newSetting | New configuration value |
Definition at line 129 of file alarmconfiguration.cpp.
void AlarmConfiguration::setDesktopNotificationTimeout | ( | const unsigned int | newSetting | ) |
Change the timeout for sending a desktop notification.
If an alarm lasts for longer than this value in seconds, a dekstop notification will send to alert the user at his office PC. A value of 0 disables this type of notification.
newSetting | New configuration value |
Definition at line 169 of file alarmconfiguration.cpp.
void AlarmConfiguration::setEMailNotificationFrom | ( | const std::string & | newSetting | ) |
Change the Sender address for alarm e-mail notifications.
This e-mail address will be used as the sender's address when an alarm e-mail notification is sent.
newSetting | New configuration value |
Definition at line 189 of file alarmconfiguration.cpp.
void AlarmConfiguration::setEMailNotificationServerName | ( | const std::string & | newSetting | ) |
Change the name of the STMP server.
The DNS name or IP address of the SMTP server used to send the e-mail notifications,
newSetting | New configuration value |
Definition at line 209 of file alarmconfiguration.cpp.
void AlarmConfiguration::setEMailNotificationServerPort | ( | const unsigned int | newSetting | ) |
Change the port of SMTP server.
Numeric port number of the SMTP daemon on the server used to send the e-mail notifications.
newSetting | New configuration value |
Definition at line 219 of file alarmconfiguration.cpp.
void AlarmConfiguration::setEMailNotificationTimeout | ( | const unsigned int | newSetting | ) |
Change the timeout for sending an e-mail notification.
If an alarm lasts for longer than this value in seconds, an e-mail will be send to a specific mailing list. A value of 0 disables this type of notification.
newSetting | New configuration value |
Definition at line 179 of file alarmconfiguration.cpp.
void AlarmConfiguration::setEMailNotificationTo | ( | const std::string & | newSetting | ) |
Change the recipient address for alarm e-mail notifications.
This e-mail address will be used as the recipient's address when an alarm e-mail notification is sent.
newSetting | New configuration value |
Definition at line 199 of file alarmconfiguration.cpp.
void AlarmConfiguration::setFlashLightRelaisDevideNode | ( | const std::string & | newSetting | ) |
Change the device node of the USB relais for the alarm flash light.
The relais controlled via this device node is used in the class FlashLight to operate a red flashing light that notifies staff in the lab about an alarm.
newSetting | New configuration value |
Definition at line 229 of file alarmconfiguration.cpp.
void AlarmConfiguration::setLaboratoryNotificationTimeout | ( | const unsigned int | newSetting | ) |
Change the timeout for starting alarm notification in the laboratory.
If an alarm lasts for longer than this value in seconds, a notification in the laboratory itself will be activated. A value of 0 disables this type of notification.
newSetting | New configuration value |
Definition at line 159 of file alarmconfiguration.cpp.
void AlarmConfiguration::WriteConfiguration | ( | ) |
Write configuration to disk.
Changes in the settings of this AlarmConfiguration instance are written to the configuration file on disk. If another user also changed the file since it was last loaded into this instance, but the local and remote changes concern different settings, the other user's changes are not overwritten. If both changes concern the same setting, the last saving process wins.
Definition at line 89 of file alarmconfiguration.cpp.
|
private |
ActiveMQ password.
Used by CMSClient to connect to the Apache ActiveMQ message broker.
The current setting will be saved here by the KConfig framework.
Definition at line 102 of file alarmconfiguration.h.
|
private |
KConfig item for _activemqpassword setting.
KConfig subclass to represent one setting in the configuration file. It reads the configuration from the file, stores it in the aforementioned variable and is also used to correctly change the setting within the KConfig framework.
Definition at line 174 of file alarmconfiguration.h.
|
private |
JMS topic name used by CSS Alarm Server.
The name of the topic on the Apache ActiveMQ message broker that is used by the CSS Alarm Server to announce changes in the alarm status of PVs.
Definition at line 108 of file alarmconfiguration.h.
|
private |
KConfig item for _activemqtopicname setting.
KConfig subclass to represent one setting in the configuration file. It reads the configuration from the file, stores it in the aforementioned variable and is also used to correctly change the setting within the KConfig framework.
Definition at line 180 of file alarmconfiguration.h.
|
private |
ActiveMQ URI.
A URI containing protocol, hostname/address and port to connect to the Apache ActiveMQ message broker.
The current setting will be saved here by the KConfig framework.
Definition at line 86 of file alarmconfiguration.h.
|
private |
KConfig item for _activemquri setting.
KConfig subclass to represent one setting in the configuration file. It reads the configuration from the file, stores it in the aforementioned variable and is also used to correctly change the setting within the KConfig framework.
Definition at line 162 of file alarmconfiguration.h.
|
private |
ActiveMQ username.
Used by CMSClient to connect to the Apache ActiveMQ message broker.
The current setting will be saved here by the KConfig framework.
Definition at line 94 of file alarmconfiguration.h.
|
private |
KConfig item for _activemqusername setting.
KConfig subclass to represent one setting in the configuration file. It reads the configuration from the file, stores it in the aforementioned variable and is also used to correctly change the setting within the KConfig framework.
Definition at line 168 of file alarmconfiguration.h.
|
private |
KConfig backend.
Shared pointer to the KConfig backend used by this class to manage all the configuration options.
Definition at line 72 of file alarmconfiguration.h.
|
private |
Path to the configuration file.
Established upon construction by CreateConfigFileLocation().
Definition at line 66 of file alarmconfiguration.h.
|
private |
Timeout for sending a desktop notification.
If an alarm lasts for longer than this value in seconds, a dekstop notification will send to alert the user at his office PC.
Definition at line 120 of file alarmconfiguration.h.
|
private |
KConfig item for _desktopnotificationtimeout setting.
KConfig subclass to represent one setting in the configuration file. It reads the configuration from the file, stores it in the aforementioned variable and is also used to correctly change the setting within the KConfig framework.
Definition at line 192 of file alarmconfiguration.h.
|
private |
Sender address for alarm e-mail notifications.
This e-mail address will be used as the sender's address when an alarm e-mail notification is sent.
Definition at line 132 of file alarmconfiguration.h.
|
private |
KConfig item for _emailnotificationfrom setting.
KConfig subclass to represent one setting in the configuration file. It reads the configuration from the file, stores it in the aforementioned variable and is also used to correctly change the setting within the KConfig framework.
Definition at line 204 of file alarmconfiguration.h.
|
private |
Name of the SMTP server.
DNS name or IP address of the SMTP server used to send the e-mail notifications.
Definition at line 144 of file alarmconfiguration.h.
|
private |
KConfig item for _emailnotificationservername setting.
KConfig subclass to represent one setting in the configuration file. It reads the configuration from the file, stores it in the aforementioned variable and is also used to correctly change the setting within the KConfig framework.
Definition at line 216 of file alarmconfiguration.h.
|
private |
Port of SMTP server.
Numeric port number of the SMTP daemon on the server used to send the e-mail notifications.
Definition at line 150 of file alarmconfiguration.h.
|
private |
KConfig item for _emailnotificationserverport setting.
KConfig subclass to represent one setting in the configuration file. It reads the configuration from the file, stores it in the aforementioned variable and is also used to correctly change the setting within the KConfig framework.
Definition at line 222 of file alarmconfiguration.h.
|
private |
Timeout for sending an e-mail notification.
If an alarm lasts for longer than this value in seconds, an e-mail will be send to a specific mailing list.
Definition at line 126 of file alarmconfiguration.h.
|
private |
KConfig item for _emailnotificationtimeout setting.
KConfig subclass to represent one setting in the configuration file. It reads the configuration from the file, stores it in the aforementioned variable and is also used to correctly change the setting within the KConfig framework.
Definition at line 198 of file alarmconfiguration.h.
|
private |
Recipient address for alarm e-mail notifications.
This e-mail address will be used as the recipient's address when an alarm e-mail notification is sent.
Definition at line 138 of file alarmconfiguration.h.
|
private |
KConfig item for _emailnotificationto setting.
KConfig subclass to represent one setting in the configuration file. It reads the configuration from the file, stores it in the aforementioned variable and is also used to correctly change the setting within the KConfig framework.
Definition at line 210 of file alarmconfiguration.h.
|
private |
Device node of the USB relais for the alarm flash light.
The relais controlled via this device node is used in the class FlashLight to operate a red flashing light that notifies staff in the lab about an alarm.
Definition at line 156 of file alarmconfiguration.h.
|
private |
KConfig item for _flashlightrelaisdevicenode setting.
KConfig subclass to represent one setting in the configuration file. It reads the configuration from the file, stores it in the aforementioned variable and is also used to correctly change the setting within the KConfig framework.
Definition at line 228 of file alarmconfiguration.h.
|
private |
Timeout for starting alarm notification in the laboratory.
If an alarm lasts for longer than this value in seconds, a notification in the laboratory itself will be activated.
Definition at line 114 of file alarmconfiguration.h.
|
private |
KConfig item for _laboratorynotificationtimeout setting.
KConfig subclass to represent one setting in the configuration file. It reads the configuration from the file, stores it in the aforementioned variable and is also used to correctly change the setting within the KConfig framework.
Definition at line 186 of file alarmconfiguration.h.
|
private |
KConfig skeleton.
The skeleton class keeps the information about all established configuration options and their memory locations.
Definition at line 78 of file alarmconfiguration.h.