File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
plant-care/sensors/include/sensors Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 5
5
#ifndef SOLID_MOISTURESENSOR_H
6
6
#define SOLID_MOISTURESENSOR_H
7
7
8
+ #include < chrono>
9
+ #include < mutex>
10
+ #include < set>
11
+
12
+ #include " caretaker/PlantCaretaker.h"
13
+
14
+ namespace sensor
15
+ {
16
+ class MoistureSensor
17
+ {
18
+ const std::chrono::seconds sleepTime;
19
+ std::mutex &mtx;
20
+ std::set<caretaker::PlantCareTaker *> careTakers;
21
+
22
+ const int min = 0 ;
23
+ const int max = 10 ;
24
+ const int threshold = 3 ;
25
+
26
+ public:
27
+ MoistureSensor (const std::chrono::seconds, std::mutex &mtx);
28
+ void subscribe (caretaker::PlantCareTaker &);
29
+ operator ()();
30
+
31
+ private:
32
+ bool isAirTooDry ();
33
+ bool isSoilTooDry ();
34
+ int getAirMoisture ();
35
+ int getAirSoilMoisture ();
36
+ };
37
+ }
38
+
39
+
8
40
#endif // SOLID_MOISTURESENSOR_H
You can’t perform that action at this time.
0 commit comments