forked from sfeakes/AqualinkD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aqualink.h
99 lines (83 loc) · 1.91 KB
/
aqualink.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
#ifndef AQUALINK_H_
#define AQUALINK_H_
#include <pthread.h>
#include <stdbool.h>
#include "aq_serial.h"
#include "aq_programmer.h"
#define TIME_CHECK_INTERVAL 3600
//#define TIME_CHECK_INTERVAL 600
#define ACCEPTABLE_TIME_DIFF 120
#define MAX_ZERO_READ_BEFORE_RECONNECT 500
#define TOTAL_BUTTONS 12
#define TEMP_UNKNOWN -999
#define DATE_STRING_LEN 30
enum {
FAHRENHEIT,
CELSIUS,
UNKNOWN
};
typedef struct aqualinkkey
{
//int number;
//aqledstate *state;
aqled *led;
char *label;
char *name;
unsigned char code;
int dz_idx;
} aqkey;
//typedef struct ProgramThread ProgramThread; // Definition is later
struct programmingthread {
pthread_t *thread_id;
pthread_mutex_t thread_mutex;
pthread_cond_t thread_cond;
program_type ptype;
//void *thread_args;
};
typedef enum action_type {
NO_ACTION = -1,
POOL_HTR_SETOINT,
SPA_HTR_SETOINT,
FREEZE_SETPOINT,
SWG_SETPOINT
} action_type;
struct action {
action_type type;
time_t requested;
int value;
//char value[10];
};
struct aqualinkdata
{
//char crap[AQ_MSGLEN];
char version[AQ_MSGLEN];
char date[AQ_MSGLEN];
char time[AQ_MSGLEN];
//char datestr[DATE_STRING_LEN];
char last_message[AQ_MSGLONGLEN+1]; // NSF just temp for PDA crap
//char *last_message; // Be careful using this, can get core dumps.
char last_display_message[AQ_MSGLONGLEN+1];
//bool display_last_message;
unsigned char raw_status[AQ_PSTLEN];
aqled aqualinkleds[TOTAL_LEDS];
aqkey aqbuttons[TOTAL_BUTTONS];
int air_temp;
int pool_temp;
int spa_temp;
int temp_units;
int battery;
//int freeze_protection;
int frz_protect_set_point;
int pool_htr_set_point;
int spa_htr_set_point;
//unsigned char aq_command;
struct programmingthread active_thread;
struct action unactioned;
int swg_percent;
int swg_ppm;
unsigned char ar_swg_status;
int swg_delayed_percent;
bool simulate_panel;
//bool ar_swg_connected;
};
#endif