-
Notifications
You must be signed in to change notification settings - Fork 1
/
PressureSensor.h
53 lines (41 loc) · 1.06 KB
/
PressureSensor.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
/**
* @file PressureSensor.h
* @Author BeeeOn team
* @date
* @brief
*/
#ifndef PRESSURESENSOR_H
#define PRESSURESENSOR_H
extern bool quit_global_flag;
#include <ctime>
#include <iostream>
#include <memory>
#include <string>
#include <cstdlib>
#include <unistd.h>
#include <Poco/AutoPtr.h>
#include <Poco/Logger.h>
#include <Poco/Runnable.h>
#include <Poco/Util/IniFileConfiguration.h>
#include "device_table.h"
#include "ModuleADT.h"
#include "utils.h"
#define PRESSURE_SENSOR_PATH "/sys/devices/platform/soc@01c00000/1c2b400.i2c/i2c-2/2-0077/pressure0_input"
class Aggregator;
class PressureSensor : public ModuleADT {
private:
unsigned int wake_up_time;
unsigned int wake_up_counter;
bool send_wake_up_flag;
float pressureValue;
long long int getEUI(std::string adapter_id);
bool createMsg();
bool refreshValue();
void setNewRefresh(int refresh);
void threadFunction() override;
bool obtainRefreshTime();
public:
PressureSensor(IOTMessage _msg, std::shared_ptr<Aggregator> _agg);
void parseCmdFromServer(const Command& cmd) override;
};
#endif