-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sensor.h
58 lines (47 loc) · 1.19 KB
/
Sensor.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
#ifndef SENSOR_H
#define SENSOR_H
#if defined(ARDUINO)
#if ARDUINO >= 100
#include <Arduino.h>
#else
#include <wiring.h>
#endif
#endif
#include "AlarmConfig.h"
class Sensor
{
private:
bool power;
bool active;
unsigned long lastActive;
bool wireless;
// Some wireless magnetic sensors have 2 stages with a code for each of them
bool twoStates;
// Wired attributes
uint8_t sensorPin;
// Wireless attributes
String sensorID;
// For sensors having 2nd state to get back to inactive (magnetic door wireless sensors for example)
String sensorInactiveID;
public:
Sensor();
bool isOn();
bool isActive();
void setPower(bool power);
void setActive(bool activeStatus);
void clearSensor();
// Wired methods
void setSensorID(String ID);
void setSensorPin(uint8_t pin);
uint8_t getSensorPin();
// Wireless methods
void setWireless(bool wireless);
bool isWireless();
String getSensorID();
String getTamperID();
void setSensorInactiveID(String ID);
String getSensorInactiveID();
void setTwoStates(bool value);
bool isTwoStates();
};
#endif /* SENSOR_H */