Skip to content

Commit 19e9a54

Browse files
author
sajith
committed
Improved
1 parent 36dce47 commit 19e9a54

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

plant-care/sensors/include/sensors/MoistureSensor.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,36 @@
55
#ifndef SOLID_MOISTURESENSOR_H
66
#define SOLID_MOISTURESENSOR_H
77

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+
840
#endif //SOLID_MOISTURESENSOR_H

0 commit comments

Comments
 (0)