36 #include <QtCore/QList>
48 return global_instance;
50 catch ( std::exception& e )
65 : _configfilelocation ( CreateConfigFileLocation() ),
66 _backend ( KSharedConfig::openConfig ( QString::fromUtf8 ( _configfilelocation.c_str() ) , KConfig::SimpleConfig ) ),
67 _skeleton ( _backend )
97 _skeleton.setCurrentGroup ( QString::fromUtf8 (
"ActiveMQConnectivity" ) );
246 const char*
const envvar = getenv (
"ALARMNOTIFICATIONSCONFIG" );
247 if ( envvar ==
nullptr )
248 if ( getenv (
"HOME" ) !=
nullptr )
251 if ( conffile.find (
"~" ) != std::string::npos )
252 conffile.replace ( conffile.find (
"~" ), 1, getenv (
"HOME" ) );
260 return std::string ( envvar );
KConfigSkeleton _skeleton
KConfig skeleton.
std::string getEMailNotificationTo() const noexcept
Recipient address for alarm e-mail notifications.
unsigned int _desktopnotificationtimeout
Timeout for sending a desktop notification.
KConfigSkeleton * internal_skel()
INTERNAL METHOD: Skeleton of the configuration.
QString _emailnotificationservername
Name of the SMTP server.
QString _activemqpassword
ActiveMQ password.
unsigned int getEMailNotificationTimeout() const noexcept
Timeout for sending an e-mail notification.
QString _activemquri
ActiveMQ URI.
unsigned int getEMailNotificationServerPort() const noexcept
Port of SMTP server.
void ReReadConfiguration()
Read configuration again from disk.
KConfigSkeleton::ItemUInt * _emailnotificationserverportitem
KConfig item for _emailnotificationserverport setting.
unsigned int getLaboratoryNotificationTimeout() const noexcept
Timeout for starting alarm notification in the laboratory.
void setActiveMQTopicName(const std::string &newSetting)
Change JMS topic used by the CSS Alarm Server.
void setEMailNotificationTo(const std::string &newSetting)
Change the recipient address for alarm e-mail notifications.
void setFlashLightRelaisDevideNode(const std::string &newSetting)
Change the device node of the USB relais for the alarm flash light.
KConfigSkeleton::ItemString * _activemquriitem
KConfig item for _activemquri setting.
QString _emailnotificationto
Recipient address for alarm e-mail notifications.
QString _flashlightrelaisdevicenode
Device node of the USB relais for the alarm flash light.
std::string getActiveMQUsername() const noexcept
ActiveMQ connection username.
KConfigSkeleton::ItemUInt * _emailnotificationtimeoutitem
KConfig item for _emailnotificationtimeout setting.
QString _activemqtopicname
JMS topic name used by CSS Alarm Server.
KConfigSkeleton::ItemString * _activemqpassworditem
KConfig item for _activemqpassword setting.
void setEMailNotificationServerName(const std::string &newSetting)
Change the name of the STMP server.
AlarmConfiguration()
Constructor.
void WriteConfiguration()
Write configuration to disk.
std::string getEMailNotificationFrom() const noexcept
Sender address for alarm e-mail notifications.
void setEMailNotificationFrom(const std::string &newSetting)
Change the Sender address for alarm e-mail notifications.
void CreateActiveMQConnectivitySettings()
Create ActiveMQ connectivity settings.
std::string getActiveMQTopicName() const noexcept
JMS topic used by the CSS Alarm Server.
KConfigSkeleton::ItemString * _activemqtopicnameitem
KConfig item for _activemqtopicname setting.
void setEMailNotificationTimeout(const unsigned int newSetting)
Change the timeout for sending an e-mail notification.
void setEMailNotificationServerPort(const unsigned int newSetting)
Change the port of SMTP server.
unsigned int _emailnotificationserverport
Port of SMTP server.
const std::string & getConfigFileLocation() const noexcept
Query config file location.
void setLaboratoryNotificationTimeout(const unsigned int newSetting)
Change the timeout for starting alarm notification in the laboratory.
Namespace for Alarm Notifications application.
#define CONFIGFILELOCATION
Default path for the AlarmWatcher configuration file.
Macro for the default path of the configuration file.
KSharedConfigPtr internal()
INTERNAL METHOD: Shared pointer to KConfig instance.
~AlarmConfiguration()
Destructor.
const std::string _configfilelocation
Path to the configuration file.
unsigned int _emailnotificationtimeout
Timeout for sending an e-mail notification.
QString _activemqusername
ActiveMQ username.
KConfigSkeleton::ItemString * _activemqusernameitem
KConfig item for _activemqusername setting.
static std::string CreateConfigFileLocation()
Establish location of the configuration file.
void setActiveMQUsername(const std::string &newSetting)
Change ActiveMQ connection username.
KConfigSkeleton::ItemString * _emailnotificationservernameitem
KConfig item for _emailnotificationservername setting.
void setActiveMQURI(const std::string &newSetting)
Change ActiveMQ connection URI.
std::string getEMailNotificationServerName() const noexcept
Name of the SMTP server.
#define noexcept
Allow using the noexcept keyword with GCC < 4.6.
void ExceptionHandler(std::exception &e, std::string location, const bool quit=false) noexcept
Generic exception handler for known exceptions.
KSharedConfigPtr _backend
KConfig backend.
unsigned int getDesktopNotificationTimeout() const noexcept
Timeout for sending a desktop notification.
void setActiveMQPassword(const std::string &newSetting)
Change ActiveMQ connection password.
KConfigSkeleton::ItemUInt * _laboratorynotificationtimeoutitem
KConfig item for _laboratorynotificationtimeout setting.
Generic functions for exception handling.
void setDesktopNotificationTimeout(const unsigned int newSetting)
Change the timeout for sending a desktop notification.
KConfigSkeleton::ItemUInt * _desktopnotificationtimeoutitem
KConfig item for _desktopnotificationtimeout setting.
std::string getActiveMQPassword() const noexcept
ActiveMQ connection password.
std::string getActiveMQURI() const noexcept
ActiveMQ connection URI.
KConfigSkeleton::ItemString * _emailnotificationfromitem
KConfig item for _emailnotificationfrom setting.
KConfigSkeleton::ItemString * _flashlightrelaisdevicenodeitem
KConfig item for _flashlightrelaisdevicenode setting.
Singleton to read and change the configuration of this application.
QString _emailnotificationfrom
Sender address for alarm e-mail notifications.
static AlarmConfiguration & instance() noexcept
Get singleton instance.
KConfigSkeleton::ItemString * _emailnotificationtoitem
KConfig item for _emailnotificationto setting.
Configuration of the AlarmNotifications application.
std::string getFlashLightRelaisDeviceNode() const noexcept
Device node of the USB relais for the alarm flash light.
unsigned int _laboratorynotificationtimeout
Timeout for starting alarm notification in the laboratory.