AlarmNotifications::EMailSender Class Reference

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

#include <emailsender.h>

List of all members.

Public Member Functions

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

Static Public Member Functions

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

Private Member Functions

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

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  ) 

Copy constructor (deleted).

This class cannot be copied.

Parameters:
other Another instance of EMailSender
AlarmNotifications::EMailSender::EMailSender ( EMailSender &&  other  ) 

Move constructor (C++11, deleted).

This class cannot be moved.

Parameters:
other Another 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:
alarms Alarm to be listed in the e-mail
Returns:
Message body text as QString

Definition at line 123 of file emailsender.cpp.

EMailSender & EMailSender::instance (  )  [static]

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= ( EMailSender &&  other  ) 

Move assignment (C++11, deleted).

This class cannot be moved.

Parameters:
other Another instance of EMailSender
Returns:
Nothing (deleted)
EMailSender& AlarmNotifications::EMailSender::operator= ( const EMailSender other  ) 

Copy assignment (deleted).

This class cannot be copied.

Parameters:
other Another instance of EMailSender
Returns:
Nothing (deleted)
void EMailSender::sendAlarmNotification ( const std::vector< AlarmStatusEntry >  alarms  )  [static]

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:
alarms Alarms 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:
alarms Alarms 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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on 2 Dec 2014 for AlarmNotifications by  doxygen 1.6.1