AlarmNotifications
PANDA Slow Control Alarm Daemon
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Static Public Member Functions | Private Member Functions | List of all members
AlarmNotifications::EMailSender Class Reference

Send alarm notifications via e-mail. More...

#include <emailsender.h>

Public Member Functions

 ~EMailSender ()
 Destructor. More...
 
 EMailSender (const EMailSender &other)=delete
 Copy constructor (deleted) More...
 
 EMailSender (EMailSender &&other)=delete
 Move constructor (C++11, deleted) More...
 
EMailSenderoperator= (const EMailSender &other)=delete
 Copy assignment (deleted) More...
 
EMailSenderoperator= (EMailSender &&other)=delete
 Move assignment (C++11, deleted) More...
 

Static Public Member Functions

static EMailSenderinstance () noexcept
 Get singleton instance. More...
 
static void sendAlarmNotification (const std::vector< AlarmStatusEntry > alarms) noexcept
 Send an alarm notification via e-mail. More...
 

Private Member Functions

 EMailSender ()
 Constructor. More...
 
void sendAlarmNotification_internal (const std::vector< AlarmStatusEntry > alarms)
 Compose and send the e-mail notification. More...
 
QString composeMessageText (const std::vector< AlarmStatusEntry > &alarms)
 Compose message text. More...
 

Detailed Description

Send alarm notifications via e-mail.

This class encapsulates the code that produces an e-mail notification that can be sent to a mailing list to inform the staff about an alarm that occured while nobody was in the laboratory.

The actual SMTP client work is done by the classes of the SmtpClient-for-Qt project, The code has been written by "bluetiger9" on GitHub and is available here: https://www.github.com/bluetiger9/SmtpClient-for-Qt. It is licensed unter the GNU Lesser General Public License, version 2.1.

The task of this class is to compose the message text and instruct the SmtpClient properly to have the e-mail sent. The parameters for the connection to the SMTP server are read from the AlarmConfiguration class.

Definition at line 57 of file emailsender.h.

Constructor & Destructor Documentation

EMailSender::EMailSender ( )
private

Constructor.

Has nothing to do here, actually...

Definition at line 68 of file emailsender.cpp.

EMailSender::~EMailSender ( )

Destructor.

Has nothing to do here, actually...

Definition at line 73 of file emailsender.cpp.

AlarmNotifications::EMailSender::EMailSender ( const EMailSender other)
delete

Copy constructor (deleted)

This class cannot be copied.

Parameters
otherAnother instance of EMailSender
AlarmNotifications::EMailSender::EMailSender ( EMailSender &&  other)
delete

Move constructor (C++11, deleted)

This class cannot be moved.

Parameters
otherAnother instance of EMailSender

Member Function Documentation

QString EMailSender::composeMessageText ( const std::vector< AlarmStatusEntry > &  alarms)
private

Compose message text.

This method creates the text to be put into the body of the alarm notification e-mail.

Parameters
alarmsAlarm to be listed in the e-mail
Returns
Message body text as QString

Definition at line 123 of file emailsender.cpp.

EMailSender & EMailSender::instance ( )
staticnoexcept

Get singleton instance.

Returns a reference (not a pointer) to the single global instance of this class.

Returns
Reference to singleton instance

Definition at line 47 of file emailsender.cpp.

EMailSender& AlarmNotifications::EMailSender::operator= ( const EMailSender other)
delete

Copy assignment (deleted)

This class cannot be copied.

Parameters
otherAnother instance of EMailSender
Returns
Nothing (deleted)
EMailSender& AlarmNotifications::EMailSender::operator= ( EMailSender &&  other)
delete

Move assignment (C++11, deleted)

This class cannot be moved.

Parameters
otherAnother instance of EMailSender
Returns
Nothing (deleted)
void EMailSender::sendAlarmNotification ( const std::vector< AlarmStatusEntry alarms)
staticnoexcept

Send an alarm notification via e-mail.

This static method gets a reference to the global instance of EMailSender and invokes sendAlarmNotification_internal() to send an e-mail to tell the staff about the alarms.

Parameters
alarmsAlarms to be listed in the e-mail
Returns
Nothing

Definition at line 53 of file emailsender.cpp.

void EMailSender::sendAlarmNotification_internal ( const std::vector< AlarmStatusEntry alarms)
private

Compose and send the e-mail notification.

This method is invoked by sendAlarmNotification() and does the actual work. It reads the necessary configuration parameters, creates a connection to the SMTP server, assembles the e-mail message and sends it.

Parameters
alarmsAlarms to be listed in the e-mail
Returns
Nothing

Definition at line 78 of file emailsender.cpp.


The documentation for this class was generated from the following files: