forked from Ken98045/On-Guard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AreaNotificationOption.cs
110 lines (95 loc) · 3.44 KB
/
AreaNotificationOption.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
using System;
using System.Collections.Generic;
using SAAI.Properties;
namespace SAAI
{
/// <summary>
/// A class to hold email addresses and the notification options for
/// each email address. In the future the notification options may be
/// related to the Area of Interest rather than the email address.
/// </summary>
[Serializable]
public class EmailOptions
{
public bool Active { get; set; } // Currently does nothing - may be used to turn on/off email activations
public string EmailAddress { get; set; }
public int NumberOfImages { get; set; }
public bool AllTheTime { get; set; }
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
public bool[] DaysOfWeek;
public int SizeDownToPercent { get; set; } // Reduce the sizeof any images
public EmailCooldown CoolDown { get; set; }
public EmailOptions(string emailAddress, int coolDown)
{
EmailAddress = emailAddress;
CoolDown = new EmailCooldown(coolDown);
StartTime = new DateTime(2020, 1, 1, 0, 0, 0); // the value is a place holder so the first occurs
EndTime = new DateTime(2020, 1, 1, 0, 0, 0); // the value is a place holder so the first occurs.
DaysOfWeek = new bool[7];
SizeDownToPercent = 100;
}
public EmailOptions()
{
EmailAddress = string.Empty;
CoolDown = new EmailCooldown(1);
StartTime = new DateTime(2020, 1, 1, 0, 0, 0); // the value is a place holder so the first occurs
EndTime = new DateTime(2020, 1, 1, 0, 0, 0); // the value is a place holder so the first occurs
DaysOfWeek = new bool[7];
SizeDownToPercent = 100;
}
}
/// <summary>
/// Url options just keeps the url and a flage whether the URL is "active"
/// Right now URLs can be active or inactive.
/// </summary>
[Serializable]
public class UrlOptions
{
public string Url { get; set; }
public int WaitTime { get; set; }
public Guid ID { get; set; }
public int BIFlags { get; set; }
public UrlCooldown CoolDown { get; set; }
public UrlOptions(string url, int waitTime, int coolDown, int biFlags)
{
ID = Guid.NewGuid();
Url = url;
CoolDown = new UrlCooldown(coolDown);
WaitTime = waitTime;
BIFlags = biFlags;
}
}
/// <summary>
/// AreaNotificationOption holds lists of both
/// URL and Email options for an Area of Interest
/// </summary>
[Serializable]
public class AreaNotificationOption
{
public List<UrlOptions> Urls { get; }
public List<string> Email { get; }
public bool UseMQTT { get; set; }
[field: NonSerializedAttribute()]
public MQTTCoolDown mqttCooldown {get; set;}
public string NoMotionUrlNotify { get; set; }
public bool NoMotionMQTTNotify { get; set; }
public Guid ID { get; }
public AreaNotificationOption()
{
Urls = new List<UrlOptions>();
Email = new List<string>();
UseMQTT = false;
NoMotionMQTTNotify = false;
mqttCooldown = new MQTTCoolDown(Settings.Default.MQTTCoolDown);
}
public AreaNotificationOption(AreaNotificationOption src)
{
Urls = new List<UrlOptions>(src.Urls);
Email = new List<string>(src.Email);
UseMQTT = src.UseMQTT;
NoMotionMQTTNotify = src.NoMotionMQTTNotify;
mqttCooldown = new MQTTCoolDown(src.mqttCooldown.CooldownTime);
}
}
}