-
Notifications
You must be signed in to change notification settings - Fork 0
/
DHT11Result.java
41 lines (36 loc) · 1.16 KB
/
DHT11Result.java
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
public class DHT11Result {
// DHT11 sensor result returned by DHT11.read() method
public static final int ERR_NO_ERROR = 0;
public static final int ERR_MISSING_DATA = 1;
public static final int ERR_CRC = 2;
private int errorCode = ERR_NO_ERROR;
private double temperature;
private double humidity;
private int listElements; // for debug
private int detectedBits; // for debug
DHT11Result(int errorCode, double temperature, double humidity, int listElements, int detectedBits) {
this.errorCode = errorCode;
this.temperature = temperature;
this.humidity = humidity;
this.listElements = listElements;
this.detectedBits = detectedBits;
}
public boolean isValid() {
return errorCode == ERR_NO_ERROR;
}
public int getErrorCode() {
return errorCode;
}
public double getTemperature() {
return temperature;
}
public double getHumidity() {
return humidity;
}
double getListElements() {
return listElements;
}
double getDetectedBits() {
return detectedBits;
}
}