Go to the documentation of this file.
6 String HTML_Notification_BOOTING(
const EmailSender& emailSender);
7 String HTML_Notification_DAILY_OVERVIEW(
const EmailSender& emailSender);
8 String HTML_Notification_LEAK_DETECTED(
const EmailSender& emailSender);
9 String HTML_Notification_VALVE_STATE(
const EmailSender& emailSender);
10 String HTML_Notification_RESET(
const EmailSender& emailSender);
11 String HTML_Notification_ALARM(
const EmailSender& emailSender);
12 String HTML_Notification_CHANGED_SETTINGS(
const EmailSender& emailSender);
13 String HTML_Notification_APPLIED_NEW_SETTING(
const EmailSender& emailSender);
14 String HTML_ReceiverEmailAddress(
const EmailSender& emailSender);
15 String HTML_Notification_BYPASS(
const EmailSender& emailSender);
27 if (Ethernet.hardwareStatus() == EthernetNoHardware) {
29 Serial.println(
"Ethernet shield was not found");
34 if (Ethernet.linkStatus() == LinkOFF) {
36 Serial.println(
"Ethernet cable is not connected.");
48 if (Ethernet.linkStatus() != LinkON) {
98 Serial.println(
"connected to the SMTPServer");
99 else Serial.println(
"connection to the SMTPServer failed");
109 Serial.println(
"Sending hello");
117 Serial.println(
"Sending auth login");
119 client.println(
"auth login");
125 Serial.println((
"Sending User"));
133 Serial.println(F(
"Sending Password"));
141 Serial.println(
"Sending From");
149 Serial.println(
"Sending To");
157 Serial.println(
"Sending DATA");
165 Serial.println(
"Sending email");
170 client.println(
"Subject: " + subject);
178 Serial.println(
"Sending QUIT");
187 Serial.println(
"disconnected");
197 while (!
client.available()) {
201 if (loopCount > 10000) {
204 Serial.println(
"\r\nTimeout");
210 while (
client.available()) {
213 Serial.write(thisByte);
216 if (respCode >=
'4') {
226 client.println(F(
"QUIT"));
227 while (!
client.available()) {
230 if (loopCount > 10000) {
233 Serial.println(
"\r\nTimeout");
238 while (
client.available()) {
240 Serial.write(thisByte);
244 Serial.println(
"disconnected");
266 return fce->second(*
this);
269 String HTML_Notification_BOOTING(
const EmailSender& emailSender) {
271 return it->second ==
true ?
"checked" :
"";
274 String HTML_Notification_DAILY_OVERVIEW(
const EmailSender& emailSender) {
276 return it->second ==
true ?
"checked" :
"";
279 String HTML_Notification_LEAK_DETECTED(
const EmailSender& emailSender) {
281 return it->second ==
true ?
"checked" :
"";
284 String HTML_Notification_VALVE_STATE(
const EmailSender& emailSender) {
286 return it->second ==
true ?
"checked" :
"";
289 String HTML_Notification_RESET(
const EmailSender& emailSender) {
291 return it->second ==
true ?
"checked" :
"";
294 String HTML_Notification_ALARM(
const EmailSender& emailSender) {
296 return it->second ==
true ?
"checked" :
"";
299 String HTML_Notification_CHANGED_SETTINGS(
const EmailSender& emailSender) {
301 return it->second ==
true ?
"checked" :
"";
304 String HTML_Notification_APPLIED_NEW_SETTING(
const EmailSender& emailSender) {
306 return it->second ==
true ?
"checked" :
"";
309 String HTML_Notification_BYPASS(
const EmailSender& emailSender) {
311 return it->second ==
true ?
"checked" :
"";
314 String HTML_ReceiverEmailAddress(
const EmailSender& emailSender) {
@ CHANGED_SETTINGS
when the user changes settings
const String getHTMLData(const int id) const
Since this class is registered as a source of data for the HTML content, it needs return the appropri...
static EmailSender * instance
the instance of EmailSender
friend String HTML_Notification_APPLIED_NEW_SETTING(const EmailSender &emailSender)
Associated function for returing the state of the 'applied settings' notification.
@ BYPASS
when a bypass changes
friend String HTML_Notification_BYPASS(const EmailSender &emailSender)
Associated function for returing the state of the 'bypass state' notification.
String getFormatOfSettingsToSave()
Returns settings.
#define SS_SD_CARD
SD card pin (arduino documentation)
String receiverEmailAddress
the default user's email address
std::map< Type, bool > enabled
map holding info about each time of e-mail - whether it's enabled or not
Type
different types of e-mail that can be sent to the user
void enableNotification(Type type, bool state)
Enables/disables the particular type of e-mail notification.
@ BOOTING
when the system boots up
friend String HTML_Notification_VALVE_STATE(const EmailSender &emailSender)
Associated function for returing the state of the 'valve state' notification.
void setReceiverEmailAddress(String email)
Changes the user's e-mail address.
friend String HTML_Notification_BOOTING(const EmailSender &emailSender)
Associated function for returing the state of the 'bootup' notification.
@ LEAK_DETECTED
when a leak has been detected
static const String UNDEFINED_DATA
string "UNDEFINED"
void efail()
Closes the ethernet client after the connection has failed.
EthernetClient client
EthernetClient used to connect to the smt2go server.
byte mac[6]
mac address of the ethernet shield
friend String HTML_ReceiverEmailAddress(const EmailSender &emailSender)
Associated function for returing the user's e-mail address.
byte sendEmail(String subject, String data)
Sends an e-mail off to the smtp2go server.
#define SS_ETHERNET
etherent pin (arduino documentation)
friend String HTML_Notification_CHANGED_SETTINGS(const EmailSender &emailSender)
Associated function for returing the state of the 'changed settings' notification.
@ VALVE_STATE
when the state of the valve has changed
@ RESET
when the device resets
@ APPLIED_NEW_SETTING
when the new settings are applied
byte eRcv()
Reads data using the ethernet client comming from the smtp2go server.
friend String HTML_Notification_ALARM(const EmailSender &emailSender)
Associated function for returing the state of the 'home alarm state' notification.
#define SMTPServerAddress
friend String HTML_Notification_DAILY_OVERVIEW(const EmailSender &emailSender)
Associated function for returing the state of the 'daily overview' notification.
EmailSender()
Constructor of the class.
@ DAILY_OVERVIEW
daily overview about the system
friend String HTML_Notification_LEAK_DETECTED(const EmailSender &emailSender)
Associated function for returing the state of the 'leak detected' notification.
int setEthernet()
Initializes the ethernet shield.
friend String HTML_Notification_RESET(const EmailSender &emailSender)
Associated function for returing the state of the 'system reset' notification.
@ ALARM
when the state of the home alarm changes
std::map< int, String(*)(const EmailSender &leaksController)> htmlData
A map of different values (keys) and their associated functions which returns the appropriate values.
static EmailSender * getInstance()
Returns the instance of the class.