-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScheduling.h
60 lines (44 loc) · 1.14 KB
/
Scheduling.h
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
#ifndef SCHEDULING_H
#define SCHEDULING_H
#include "Arduino.h"
#include "DateTime.h"
// Represents a lighting schedule type
enum ScheduleType {
FIXED = 1,
MONTHLY = 2,
};
// Represents a day/night status
enum LightStatus { DAY, NIGHT };
//schedule entry class
struct ScheduleEntry {
Time dayStart;
Time nightStart;
ScheduleEntry(Time, Time);
LightStatus getLightStatus(Time);
void toString(char*);
};
//abstract Schedule class
struct Schedule {
virtual int getScheduleType();
virtual ScheduleEntry* getEntry(Date) = 0;
virtual void toString(char*);
static bool validScheduleType(int i);
};
//fixed schedule implementation
struct FixedSchedule : public Schedule {
ScheduleEntry* entry;
FixedSchedule(ScheduleEntry*);
int getScheduleType();
ScheduleEntry* getEntry(Date);
void toString(char*);
};
//monthly schedule implementation
struct MonthlySchedule : public Schedule {
ScheduleEntry* schedules[12];
MonthlySchedule(ScheduleEntry*[12]);
int getScheduleType();
ScheduleEntry* getEntry(Date);
void toString(char*);
};
//TODO: other schedule implementations
#endif