-
Notifications
You must be signed in to change notification settings - Fork 0
/
EnvironmentMonitor_types.h
104 lines (94 loc) · 2.12 KB
/
EnvironmentMonitor_types.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/**
* @file EnvironmentMonitor_types.h
* @copyright 2015 Bernd Wachter
* @author Bernd Wachter <[email protected]>
* @date 2015
*/
#ifndef _ENVIRONMENTMONITOR_TYPES_H
#define _ENVIRONMENTMONITOR_TYPES_H
#if ENVIRONMENTMONITOR_SENSOR_BMP085 > 0
typedef struct {
#if ENVIRONMENTMONITOR_SENSOR_IDENTIFIER > 0
char type = 'b';
#endif
float temperature = 0;
float pressure = 0;
} _bmp085;
#endif
#if ENVIRONMENTMONITOR_SENSOR_BME280 > 0
typedef struct {
#if ENVIRONMENTMONITOR_SENSOR_IDENTIFIER > 0
char type = 'b';
#endif
float temperature = 0;
float pressure = 0;
float humidity = 0;
} _bme280;
#endif
#if ENVIRONMENTMONITOR_SENSOR_MCP9808 > 0
typedef struct {
#if ENVIRONMENTMONITOR_SENSOR_IDENTIFIER > 0
char type = 'm';
#endif
float temperature = 0;
} _mcp9808;
#endif
#if ENVIRONMENTMONITOR_SENSOR_DHT22 > 0
typedef struct {
#if ENVIRONMENTMONITOR_SENSOR_IDENTIFIER > 0
char type = 'd';
#endif
float temperature = 0;
float humidity = 0;
} _dht22;
#endif
#if ENVIRONMENTMONITOR_SENSOR_RAIN > 0
typedef struct {
#if ENVIRONMENTMONITOR_SENSOR_IDENTIFIER > 0
char type = 'r';
#endif
uint32_t rain = 0;
} _rain;
#endif
typedef struct {
#if ENVIRONMENTMONITOR_SENSOR_BMP085 > 0
_bmp085 bmp085;
#endif
#if ENVIRONMENTMONITOR_SENSOR_BME280 > 0
_bme280 bme280;
#endif
#if ENVIRONMENTMONITOR_SENSOR_MCP9808 > 0
_mcp9808 mcp9808;
#endif
#if ENVIRONMENTMONITOR_SENSOR_DHT22 > 0
_dht22 dht22;
#endif
#if ENVIRONMENTMONITOR_SENSOR_RAIN > 0
_rain rain;
#endif
#if ENVIRONMENT_HISTORY_LENGTH > 1
int32_t id = 0; // send id and id of last measurement so that server can detect missing data
int32_t prev_id = 0;
#endif
} measurement;
struct {
#if ENVIRONMENTMONITOR_SENSOR_BMP085 > 0
bool bmp085 = false;
#endif
#if ENVIRONMENTMONITOR_SENSOR_BME280 > 0
bool bme280 = false;
#endif
#if ENVIRONMENTMONITOR_SENSOR_MCP9808 > 0
bool mcp9808 = false;
#endif
bool dht22 = false;
} sensors;
/*
struct {
configuration config;
int measurement_size = sizeof(measurement);
// sensors
//measurement m[ENVIRONMENTMONITOR_HISTORY_LENGTH];
} transmission;
*/
#endif