forked from Andrew-van-Campen/pi-12
-
Notifications
You must be signed in to change notification settings - Fork 0
/
global.h
43 lines (39 loc) · 1.6 KB
/
global.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
//This file includes variables that need to be accessed by all project files.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
//Maximum number of measurements
#define num 10
struct measurement
{
int ENABLED; //Boolean indicating whether sensor is enabled or not
char *NAME; //Name of measurement
char *COMMAND; //Measurement command to send
int MEASUREMENT; //Which measurement to use if multiple measurements are returned
char *INTERVAL; //Time interval to take measurements at
time_t interval; //Same as above, but in seconds
char *START; //Start time which interval is measured from
time_t start; //Same as above, but in seconds
char *value; //Most recent measured value; 20 characters
int flag; //Flag marking measurement that needs to be taken
};
//Array to store measurement settings
struct measurement *MEAS;
//Most recent SDI-12 command response; 100 characters
char *response;
//Data settings
char *site_name; //Name of site; 20 characters
char *data_path; //Filepath to store data; 30 characters
//Serial port settings
char *port_name; //Filepath to serial port; 12 characters
int baud_rate; //Baud rate
char *serial_format; //Specifies data bits, parity, and stop bits; 3 characters
char *prepend; //String to prepend to output; 20 characters
char *append; //String to append to output; 20 characters
int skip; //Number of input characters to skip
//Variables to store current time
time_t current_time;
struct tm *time_info;
//Path to store settings file.
char *settings_filepath;