-
Notifications
You must be signed in to change notification settings - Fork 1
/
SystemState.hpp
44 lines (37 loc) · 1.09 KB
/
SystemState.hpp
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
/*
Regatta Starter System State
This class is used to keep coherent the internal state of the system.
The class does not perform any actions with the hardware; it provides
solely a means to track the state machine.
*/
#pragma once
#include "Schedule.hpp"
class SystemState {
public:
SystemState() {
initialize();
};
~SystemState() = default;
void initialize();
void startTimer();
void stopTimer();
long getTimeRemaining_ms() const;
bool isTimerRunning() const;
bool isSoundOn() const;
bool isHornOn() const;
bool isBeepOn() const;
void setHornOn();
void setBeepOn();
void setHornOff();
void setBeepOff();
long getTimeSinceSoundStart() const;
void setSchedule(Schedule& sched);
Schedule* getSchedule();
private:
Schedule* schedule; // countdown timer schedule
bool is_horn_on; // horn to signal to racers
bool is_beep_on; // race committee warning beep
long sound_start_ms; // system time at sound start
bool is_timer_running;
long timer_start_ms; // system time at sequence start
};