Air Quality Monitor
Portable C application for collecting, storing, and analyzing air quality sensor readings
Loading...
Searching...
No Matches
sensor_utils.c
1
#include "sensor/sensor_utils.h"
2
#include <string.h>
3
4
const
char
*resolve_default_plugin_path(
const
char
*mode) {
5
if
(!mode)
6
return
NULL;
7
#ifdef _WIN32
8
if
(strcmp(mode,
"dht22"
) == 0)
9
return
".\\plugins\\dht22_plugin.dll"
;
10
if
(strcmp(mode,
"bme680"
) == 0)
11
return
".\\plugins\\bme680_plugin.dll"
;
12
if
(strcmp(mode,
"pms5003"
) == 0)
13
return
".\\plugins\\pms5003_plugin.dll"
;
14
if
(strcmp(mode,
"mh-z19"
) == 0 || strcmp(mode,
"mhz19"
) == 0)
15
return
".\\plugins\\mhz19_plugin.dll"
;
16
#elif __APPLE__
17
if
(strcmp(mode,
"dht22"
) == 0)
18
return
"./plugins/dht22_plugin.dylib"
;
19
if
(strcmp(mode,
"bme680"
) == 0)
20
return
"./plugins/bme680_plugin.dylib"
;
21
if
(strcmp(mode,
"pms5003"
) == 0)
22
return
"./plugins/pms5003_plugin.dylib"
;
23
if
(strcmp(mode,
"mh-z19"
) == 0 || strcmp(mode,
"mhz19"
) == 0)
24
return
"./plugins/mhz19_plugin.dylib"
;
25
#else
26
if
(strcmp(mode,
"dht22"
) == 0)
27
return
"./plugins/dht22_plugin.so"
;
28
if
(strcmp(mode,
"bme680"
) == 0)
29
return
"./plugins/bme680_plugin.so"
;
30
if
(strcmp(mode,
"pms5003"
) == 0)
31
return
"./plugins/pms5003_plugin.so"
;
32
if
(strcmp(mode,
"mh-z19"
) == 0 || strcmp(mode,
"mhz19"
) == 0)
33
return
"./plugins/mhz19_plugin.so"
;
34
#endif
35
return
NULL;
36
}
37
38
int
is_valid_sensor_mode(
const
char
*mode) {
39
return
resolve_default_plugin_path(mode) != NULL;
40
}
src
sensor
sensor_utils.c
Generated by
1.9.8