forked from sfeakes/AqualinkD
-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.h
152 lines (135 loc) · 4.38 KB
/
config.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#ifndef CONFIG_H_
#define CONFIG_H_
#include "utils.h"
#include "aq_serial.h"
#include "aqualink.h"
//#define DEFAULT_LOG_LEVEL 10
#define DEFAULT_LOG_LEVEL LOG_NOTICE
#define DEFAULT_WEBPORT "6580"
#define DEFAULT_WEBROOT "./"
#define DEFAULT_SERIALPORT "/dev/ttyUSB0"
#define DEFAULT_DEVICE_ID "0x0a"
#define DEFAULT_MQTT_DZ_IN NULL
#define DEFAULT_MQTT_DZ_OUT NULL
#define DEFAULT_HASS_DISCOVER NULL
#define DEFAULT_MQTT_AQ_TP NULL
#define DEFAULT_MQTT_SERVER NULL
#define DEFAULT_MQTT_USER NULL
#define DEFAULT_MQTT_PASSWD NULL
#define DEFAULT_SWG_ZERO_IGNORE_COUNT 0
#define MQTT_ID_LEN 18 // 20 seems to kill mosquitto 1.6
// For aqconfig.read_RS485_devmask
#define READ_RS485_SWG (1 << 0) // 1 SWG
#define READ_RS485_JAN_PUMP (1 << 1) // 2 Jandy Pump
#define READ_RS485_PEN_PUMP (1 << 2) // 4 Pentair Pump
#define READ_RS485_JAN_JXI (1 << 3) // Jandy JX & LXi heater
#define READ_RS485_JAN_LX (1 << 4) // Jandy LX heater
#define READ_RS485_JAN_CHEM (1 << 5) // Jandy Chemical Feeder
struct aqconfig
{
char *config_file;
char *serial_port;
unsigned int log_level;
char *socket_port;
char *web_directory;
unsigned char device_id;
unsigned char rssa_device_id;
int16_t paneltype_mask;
#if defined AQ_ONETOUCH || defined AQ_IAQTOUCH
unsigned char extended_device_id;
bool extended_device_id_programming;
#endif
bool deamonize;
#ifndef AQ_MANAGER // Need to uncomment and clean up referances in future.
char *log_file;
#endif
char *mqtt_dz_sub_topic;
char *mqtt_dz_pub_topic;
char *mqtt_aq_topic;
char *mqtt_hass_discover_topic;
char *mqtt_server;
char *mqtt_user;
char *mqtt_passwd;
char *habridge_server;
char *habridge_user;
char mqtt_ID[MQTT_ID_LEN+1];
int dzidx_air_temp;
int dzidx_pool_water_temp;
int dzidx_spa_water_temp;
int dzidx_swg_percent;
int dzidx_swg_ppm;
int dzidx_swg_status;
float light_programming_mode;
int light_programming_initial_on;
int light_programming_initial_off;
bool override_freeze_protect;
#ifdef AQ_PDA
bool pda_sleep_mode;
bool pda_sleep_with_websock;
#endif
bool convert_mqtt_temp;
bool convert_dz_temp;
bool report_zero_spa_temp;
bool report_zero_pool_temp;
//bool read_all_devices;
//bool read_pentair_packets;
uint8_t read_RS485_devmask;
bool use_panel_aux_labels;
bool force_swg;
bool force_ps_setpoints;
bool force_frzprotect_setpoints;
bool force_chem_feeder;
int swg_zero_ignore;
bool display_warnings_web;
bool log_protocol_packets; // Read & Write as packets
bool log_raw_bytes; // Read as bytes
unsigned char RSSD_LOG_filter;
//bool log_raw_RS_bytes;
/*
#ifdef AQ_RS_EXTRA_OPTS
bool readahead_b4_write;
bool prioritize_ack;
#endif
*/
bool mqtt_timed_update;
bool sync_panel_time;
bool enable_scheduler;
bool ftdi_low_latency;
int frame_delay;
#ifdef AQ_NO_THREAD_NETSERVICE
int rs_poll_speed; // Need to remove
bool thread_netservices; // Need to remove
#endif
};
#ifndef CONFIG_C
extern struct aqconfig _aqconfig_;
#else
struct aqconfig _aqconfig_;
#endif
#define READ_RSDEV_SWG ((_aqconfig_.read_RS485_devmask & READ_RS485_SWG) == READ_RS485_SWG)
#define READ_RSDEV_ePUMP ((_aqconfig_.read_RS485_devmask & READ_RS485_JAN_PUMP) == READ_RS485_JAN_PUMP)
#define READ_RSDEV_vsfPUMP ((_aqconfig_.read_RS485_devmask & READ_RS485_PEN_PUMP) == READ_RS485_PEN_PUMP)
#define READ_RSDEV_JXI ((_aqconfig_.read_RS485_devmask & READ_RS485_JAN_JXI) == READ_RS485_JAN_JXI)
#define READ_RSDEV_LX ((_aqconfig_.read_RS485_devmask & READ_RS485_JAN_LX) == READ_RS485_JAN_LX)
#define READ_RSDEV_CHEM ((_aqconfig_.read_RS485_devmask & READ_RS485_JAN_CHEM) == READ_RS485_JAN_CHEM)
#define isPDA_IAQT (_aqconfig_.device_id == 0x33)
//#define isPDA ((_aqconfig_.paneltype_mask & RSP_PDA) == RSP_PDA)
/*
#ifndef CONFIG_C
#ifdef AQUALINKD_C
extern struct aqconfig _aqconfig_;
#else
extern const struct aqconfig _aqconfig_;
#endif
#endif
*/
void init_parameters (struct aqconfig * parms);
//bool parse_config (struct aqconfig * parms, char *cfgfile);
//void readCfg (struct aqconfig *config_parameters, char *cfgFile);
//void readCfg (struct aqconfig *config_parameters, struct aqualinkdata *aqualink_data, char *cfgFile);
void read_config(struct aqualinkdata *aqdata, char *cfgFile);
void init_config();
bool writeCfg (struct aqualinkdata *aqdata);
bool setConfigValue(struct aqualinkdata *aqdata, char *param, char *value);
char *cleanalloc(char*str);
#endif