-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbindicator.h
More file actions
43 lines (38 loc) · 1.31 KB
/
bindicator.h
File metadata and controls
43 lines (38 loc) · 1.31 KB
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
#pragma once
#include <Arduino.h>
#include "tasks.h"
#include "bindicator_state.h"
#include "error_type.h"
enum class CollectionState {
NO_COLLECTION,
RECYCLING_DUE,
RUBBISH_DUE
};
class Bindicator {
public:
static void handleButtonPress();
static bool shouldCheckCalendar();
static void updateFromCalendar(CollectionState collectionState);
static void initializeFromStorage();
static void setErrorState(ErrorType errorType);
static bool isInErrorState();
static bool isBinTakenOut();
static void enterSetupMode();
static void exitSetupMode();
static bool isInSetupMode();
static void clearErrorState();
static void markBinNotTakenOut();
private:
static BindicatorState state;
static time_t completedTime;
static CollectionState lastCollectionState;
static const int RESET_HOUR = 3;
static const unsigned long ERROR_RETRY_INTERVAL_MS = 300000;
static unsigned long lastErrorTime;
static void transitionTo(BindicatorState newState);
static void sendStateCommand(BindicatorState state);
static void persistState();
static bool isAfterResetTime();
static void sendCommand(Command cmd);
static bool shouldRetryAfterError();
};