-
Notifications
You must be signed in to change notification settings - Fork 3
/
SWG_device.h
54 lines (44 loc) · 1.28 KB
/
SWG_device.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
#ifndef SWG_DEVICE_H_
#define SWG_DEVICE_H_
#include <stdbool.h>
#ifndef SWG_DEVICE_C_
const extern struct apdata _apdata_;
#endif
#define DISMSGLEN 30
// connected, receiving ACK
// status, status from RS485 (on & generating are same status)
// Percent > 0 & status = 0 to generating.
// Percent = 0 & status = 0x00 change status to 0xFF (off)
struct apdata
{
int PPM;
int Percent;
int Ph;
int ORP;
int last_generating_percent;
int default_percent;
int ph_setpoint;
int acl_setpoint;
//bool generating;
bool boost;
unsigned char status;
//unsigned char last_status_published;
bool connected;
char *cache_file;
bool changed;
char display_message[DISMSGLEN+1]; // Need to move this to a generic data, not device data
};
//bool set_SWG_percent(int percent);
void init_swg_device(bool forceConnection);
void set_swg_uptodate();
int prepare_swg_message(unsigned char *packet_buffer, int packet_length);
void action_swg_message(unsigned char *packet_buffer, int packet_length);
void set_swg_req_percent(char *sval, bool f2c);
void set_swg_percent(int percent);
void set_swg_boost(bool val);
void set_swg_on(bool val);
bool action_boost_request(char *value);
void write_swg_cache();
void read_swg_cache();
void set_display_message(char *msg);
#endif