-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgardener.h
61 lines (52 loc) · 1.7 KB
/
gardener.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
61
/**
* @brief Declares gardener controller.
*/
#ifndef GARDENER_H
#define GARDENER_H
#include "iconfig.h"
#include "igardener.h"
#include "ipump.h"
#include "itimer.h"
namespace gardener
{
/**
* @brief Gardener controller.
*/
class Gardener : public IGardener
{
public:
/**
* @brief Initializes a new instance of the @ref Gardener class.
*
* @param [in,out] config Gardener configuration manager.
* @param [in,out] pump Gardener watering pump.
* @param [in,out] timer Timer for resting/watering.
*/
Gardener(
IConfig &config,
IPump &pump,
ITimer &timer);
virtual void transition(void);
virtual void execute(void);
private:
enum state
{
IDLE, /**< Start state */
START_WAIT, /**< Reload wait timer */
WAIT, /**< Waiting to water */
START_RAMP_UP, /**< Request watering pump speed */
RAMP_UP, /**< Changing to watering pump speed */
START_WATER, /**< Reload watering timer */
WATER, /**< Watering */
START_RAMP_DOWN, /**< Request waiting pump speed */
RAMP_DOWN, /**< Changing to waiting pump speed */
};
static const int waitSpeed;
static const int waterSpeed;
IConfig &config;
IPump &pump;
ITimer &timer;
state currentState;
};
}
#endif /* GARDENER_H */