brewco/rdconfig.c

Sat, 28 Nov 2015 20:15:38 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 28 Nov 2015 20:15:38 +0100
changeset 441
bde74a8f2ad7
parent 438
7d1ec160d751
child 445
3ec477cda546
permissions
-rw-r--r--

Added automate state file.

409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * Copyright (C) 2015
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Michiel Broek <mbroek at mbse dot eu>
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * This file is part of the mbsePi-apps
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * This is free software; you can redistribute it and/or modify it
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * under the terms of the GNU General Public License as published by the
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * Free Software Foundation; either version 2, or (at your option) any
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * later version.
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 *
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * mbsePi-apps is distributed in the hope that it will be useful, but
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * General Public License for more details.
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 *
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 *****************************************************************************/
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 #include "rdconfig.h"
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 #include "brewco.h"
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 #include "futil.h"
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 #include "xutil.h"
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
28 int debug = TRUE;
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29 sys_config Config; /* System configuration */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 #define MY_ENCODING "utf-8"
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 const char TEMPSTATE[3][8] = { "OK", "MISSING", "ERROR" };
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
34 const char DEVTYPE[6][5] = { "NA", "W1", "GPIO", "I2C", "SPI", "SIM" };
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
35 const char DEVPRESENT[4][6] = { "UNDEF", "NO", "YES", "ERROR" };
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
36 const char DEVDIR[7][11] = { "UNDEF", "IN_BIN", "OUT_BIN", "IN_ANALOG", "OUT_ANALOG", "OUT_PWM", "INTERN" };
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
37 const char PIDMODE[3][5] = { "NONE", "AUTO", "BOO" };
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
38 const char WHIRLPOOL_TYPE[3][5] = { "OFF", "COLD", "HOT" };
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 void killconfig(void)
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 {
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
43 units_list *unit;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
44 devices_list *device;
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 if (Config.name)
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
47 free(Config.name);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
48 Config.name = NULL;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
50 Config.my_port = 6554;
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51 Config.tempFormat = 'C';
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
52 if (Config.roomtemp)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
53 free(Config.roomtemp);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
54 Config.roomtemp = NULL;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
55 Config.lcd_cols = 20;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
56 Config.lcd_rows = 4;
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
58 for (unit = Config.units; unit; unit = unit->next) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
59 if (unit->uuid)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
60 free(unit->uuid);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
61 if (unit->name)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
62 free(unit->name);
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
63 if (unit->hlt_sensor)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
64 free(unit->hlt_sensor);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
65 if (unit->mlt_sensor)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
66 free(unit->mlt_sensor);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
67 if (unit->hlt_heater)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
68 free(unit->hlt_heater);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
69 if (unit->mlt_heater)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
70 free(unit->mlt_heater);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
71 if (unit->mlt_pump)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
72 free(unit->mlt_pump);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
73 if (unit->PID_hlt)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
74 free(unit->PID_hlt);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
75 if (unit->PID_mlt)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
76 free(unit->PID_mlt);
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
77 free(unit);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
78 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
79 Config.units = NULL;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
80
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
81 for (device = Config.devices; device; device = device->next) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
82 if (device->uuid)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
83 free(device->uuid);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
84 if (device->address)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
85 free(device->address);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
86 if (device->description)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
87 free(device->description);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
88 if (device->comment)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
89 free(device->comment);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
90 free(device);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
91 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
92 Config.devices = NULL;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
93
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
94 #ifdef USE_SIMULATOR
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
95 if (Config.simulator)
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
96 free(Config.simulator);
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
97 Config.simulator = NULL;
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 #endif
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 int do_wrconfig(void);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 int do_wrconfig(void)
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105 {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
106 int rc = 0;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
107 FILE *fp;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108 char *mypath = NULL;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109 xmlTextWriterPtr writer;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 xmlBufferPtr buf;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
111 units_list *unit;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
112 devices_list *device;
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
114 /*
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 * Create a new XML buffer, to which the XML document will be written
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116 */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 if ((buf = xmlBufferCreate()) == NULL) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118 syslog(LOG_NOTICE, "wrconfig: error creating the xml buffer");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
122 /*
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 * Create a new XmlWriter for memory, with no compression.
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 if ((writer = xmlNewTextWriterMemory(buf, 0)) == NULL) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 syslog(LOG_NOTICE, "wrconfig: error creating the xml writer");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 /*
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
131 * Use indentation instead of one long line
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 if ((rc = xmlTextWriterSetIndent(writer, 2)) < 0) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
134 syslog(LOG_NOTICE, "wrconfig: error setting Indent");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
135 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
136 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
137
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
138 /*
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
139 * Start the document with the xml default for the version,
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
140 * encoding ISO 8859-1 and the default for the standalone
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
141 * declaration.
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142 */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
143 if ((rc = xmlTextWriterStartDocument(writer, NULL, MY_ENCODING, NULL)) < 0) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
144 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartDocument");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
145 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
146 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
147
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
148 /*
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
149 * Start an element named "BREWCO". Since thist is the first
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
150 * element, this will be the root element of the document.
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
151 */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
152 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "BREWCO")) < 0) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
153 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
154 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
155 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
156
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
157 /*
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
158 * Add an attribute with name "VERSION" and value "1" to BRWCO.
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
159 */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
160 if ((rc = xmlTextWriterWriteElement(writer, BAD_CAST "VERSION", BAD_CAST "1")) < 0) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
161 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
162 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
163 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
164 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", Config.name)) < 0) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
165 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
166 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
167 }
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
168 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "LISTEN_PORT", "%d", Config.my_port)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
169 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
170 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
171 }
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
172 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMPFORMAT", "%c", Config.tempFormat)) < 0) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
173 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
175 }
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
176 if (Config.roomtemp) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
177 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOMTEMP_UUID", "%s", Config.roomtemp->uuid)) < 0) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
178 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
179 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
180 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
181 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOMTEMP_STATE", "%d", Config.roomtemp->state)) < 0) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
182 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
183 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
184 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
185 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOMTEMP_VALUE", "%d", Config.roomtemp->value)) < 0) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
186 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
187 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
188 }
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
189 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
190
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
191 /*
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
192 * Start an element named "LCDS" as child of BREWCO.
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
193 */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
194 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "LCDS")) < 0) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
195 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
196 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
197 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
198 /*
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
199 * Start one LCD. It is possible to connect 7 LCD displays on the i2c bus.
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
200 * However this program doesn't use more then one yet.
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
201 */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
202 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "LCD")) < 0) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
203 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
204 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
205 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
206 if ((rc = xmlTextWriterWriteElement(writer, BAD_CAST "VERSION", BAD_CAST "1")) < 0) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
207 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
208 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
209 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
210 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ADDRESS", "0x%x", Config.lcd_address)) < 0) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
211 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
212 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
213 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
214 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COLUMNS", "%d", Config.lcd_cols)) < 0) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
215 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
216 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
217 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
218 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROWS", "%d", Config.lcd_rows)) < 0) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
219 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
220 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
221 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
222 /*
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
223 * Close the element named LCD.
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
224 */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
225 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
226 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
227 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
228 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
229 /*
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
230 * Close the element LCDS.
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
231 */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
232 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
233 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
234 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
235 }
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
236
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
237 /*
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
238 * Brewsystems
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
239 */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
240 if (Config.units) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
241 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "BREWSYSTEMS")) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
242 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
243 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
244 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
245 for (unit = Config.units; unit; unit = unit->next) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
246 /*
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
247 * Only configuration items are written, measured values and states
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
248 * are written to a state file.
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
249 */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
250 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "BREWSYSTEM")) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
251 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
252 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
253 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
254 if ((rc = xmlTextWriterWriteElement(writer, BAD_CAST "VERSION", BAD_CAST "1")) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
255 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
256 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
257 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
258 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", unit->uuid)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
259 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
260 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
261 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
262 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", unit->name)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
263 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
264 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
265 }
441
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
266 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NUMBER", "%d", unit->number)) < 0)) {
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
267 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
268 return 1;
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
269 }
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
270 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ACTIVE", "%d", unit->active)) < 0)) {
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
271 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
272 return 1;
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
273 }
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
274
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
275 if (unit->hlt_sensor) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
276 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_SENSOR_UUID", "%s", unit->hlt_sensor->uuid)) < 0)) {
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
277 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
278 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
279 }
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
280 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_SENSOR_STATE", "%d", unit->hlt_sensor->state)) < 0)) {
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
281 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
282 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
283 }
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
284 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_SENSOR_VALUE", "%d", unit->hlt_sensor->value)) < 0)) {
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
285 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
286 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
287 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
288 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
289
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
290 if (unit->hlt_heater) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
291 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_UUID", "%s", unit->hlt_heater->uuid)) < 0)) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
292 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
293 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
294 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
295 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_VALUE", "%d", unit->hlt_heater->value)) < 0)) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
296 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
297 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
298 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
299 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_DELAY", "%d", unit->hlt_heater->delay)) < 0)) {
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
300 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
301 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
302 }
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
303 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
304
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
305 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_MLTFIRST", "%d", unit->hlt_heater_mltfirst)) < 0)) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
306 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
307 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
308 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
309
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
310 if (unit->mlt_sensor) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
311 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_SENSOR_UUID", "%s", unit->mlt_sensor->uuid)) < 0)) {
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
312 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
313 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
314 }
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
315 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_SENSOR_STATE", "%d", unit->mlt_sensor->state)) < 0)) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
316 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
317 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
318 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
319 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_SENSOR_VALUE", "%d", unit->mlt_sensor->value)) < 0)) {
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
320 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
321 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
322 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
323 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
324
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
325 if (unit->mlt_heater) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
326 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_UUID", "%s", unit->mlt_heater->uuid)) < 0)) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
327 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
328 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
329 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
330 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_VALUE", "%d", unit->mlt_heater->value)) < 0)) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
331 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
332 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
333 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
334 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_DELAY", "%d", unit->mlt_heater->delay)) < 0)) {
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
335 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
336 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
337 }
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
338 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
339
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
340 if (unit->mlt_pump) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
341 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_PUMP_UUID", "%s", unit->mlt_pump->uuid)) < 0)) {
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
342 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
343 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
344 }
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
345 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_PUMP_VALUE", "%d", unit->mlt_pump->value)) < 0)) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
346 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
347 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
348 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
349 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_PUMP_DELAY", "%d", unit->mlt_pump->delay)) < 0)) {
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
350 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
351 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
352 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
353 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
354
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
355 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_CYCLE", "%d", unit->pump_cycle)) < 0)) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
356 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
357 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
358 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
359 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_REST", "%d", unit->pump_rest)) < 0)) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
360 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
361 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
362 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
363 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_PREMASH", "%d", unit->pump_premash)) < 0)) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
364 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
365 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
366 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
367 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_ONMASH", "%d", unit->pump_onmash)) < 0)) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
368 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
369 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
370 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
371 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_MASHOUT", "%d", unit->pump_mashout)) < 0)) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
372 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
373 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
374 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
375 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_ONBOIL", "%d", unit->pump_onboil)) < 0)) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
376 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
377 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
378 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
379 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_STOP", "%d", unit->pump_stop)) < 0)) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
380 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
381 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
382 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
383 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "SKIP_ADD", "%d", unit->skip_add)) < 0)) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
384 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
385 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
386 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
387 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "SKIP_REMOVE", "%d", unit->skip_remove)) < 0)) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
388 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
389 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
390 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
391 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "SKIP_IODINE", "%d", unit->skip_iodine)) < 0)) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
392 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
393 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
394 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
395 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "IODINE_TIME", "%d", unit->iodine_time)) < 0)) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
396 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
397 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
398 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
399 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "WHIRLPOOL", "%s", WHIRLPOOL_TYPE[unit->whirlpool])) < 0)) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
400 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
401 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
402 }
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
403
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
404 if (unit->PID_hlt) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
405 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_IMAX", "%.2f", unit->PID_hlt->iMax)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
406 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
407 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
408 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
409 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_IGAIN", "%.2f", unit->PID_hlt->iGain)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
410 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
411 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
412 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
413 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_PGAIN", "%.2f", unit->PID_hlt->pGain)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
414 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
415 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
416 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
417 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_DGAIN", "%.2f", unit->PID_hlt->dGain)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
418 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
419 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
420 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
421 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_INPUT", "%.2f", unit->PID_hlt->Input)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
422 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
423 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
424 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
425 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_ERR", "%.2f", unit->PID_hlt->Err)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
426 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
427 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
428 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
429 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_ERRLAST", "%.2f", unit->PID_hlt->ErrLast)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
430 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
431 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
432 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
433 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_ISTATE", "%.2f", unit->PID_hlt->iState)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
434 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
435 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
436 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
437 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_SETP", "%.2f", unit->PID_hlt->SetP)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
438 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
439 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
440 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
441 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_OUTP", "%.2f", unit->PID_hlt->OutP)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
442 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
443 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
444 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
445 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_MODE", "%s", PIDMODE[unit->PID_hlt->Mode])) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
446 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
447 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
448 }
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
449 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_TIMES", "%d", unit->PID_hlt->Times)) < 0)) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
450 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
451 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
452 }
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
453 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
454
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
455 if (unit->PID_mlt) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
456 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_IMAX", "%.2f", unit->PID_mlt->iMax)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
457 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
458 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
459 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
460 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_IGAIN", "%.2f", unit->PID_mlt->iGain)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
461 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
462 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
463 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
464 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_PGAIN", "%.2f", unit->PID_mlt->pGain)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
465 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
466 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
467 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
468 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_DGAIN", "%.2f", unit->PID_mlt->dGain)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
469 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
470 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
471 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
472 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_INPUT", "%.2f", unit->PID_mlt->Input)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
473 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
474 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
475 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
476 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_ERR", "%.2f", unit->PID_mlt->Err)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
477 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
478 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
479 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
480 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_ERRLAST", "%.2f", unit->PID_mlt->ErrLast)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
481 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
482 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
483 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
484 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_ISTATE", "%.2f", unit->PID_mlt->iState)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
485 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
486 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
487 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
488 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_SETP", "%.2f", unit->PID_mlt->SetP)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
489 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
490 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
491 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
492 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_OUTP", "%.2f", unit->PID_mlt->OutP)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
493 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
494 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
495 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
496 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_MODE", "%s", PIDMODE[unit->PID_mlt->Mode])) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
497 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
498 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
499 }
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
500 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_TIMES", "%d", unit->PID_mlt->Times)) < 0)) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
501 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
502 return 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
503 }
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
504 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
505
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
506 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
507 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
508 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
509 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
510 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
511 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
512 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
513 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
514 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
515 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
516
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
517 if (Config.devices) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
518 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "DEVICES")) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
519 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
520 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
521 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
522 #ifdef HAVE_WIRINGPI_H
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
523 piLock(LOCK_DEVICES);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
524 #endif
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
525 for (device = Config.devices; device; device = device->next) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
526 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "DEVICE")) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
527 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
528 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
529 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
530 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "VERSION", "%d", device->version)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
531 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
532 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
533 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
534 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", device->uuid)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
535 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
536 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
537 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
538 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TYPE", "%s", DEVTYPE[device->type])) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
539 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
540 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
541 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
542 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "DIRECTION", "%s", DEVDIR[device->direction])) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
543 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
544 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
545 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
546 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "VALUE", "%d", device->value)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
547 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
548 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
549 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
550 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "OFFSET", "%d", device->offset)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
551 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
552 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
553 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
554 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PRESENT", "%s", DEVPRESENT[device->present])) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
555 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
556 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
557 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
558 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ADDRESS", "%s", device->address)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
559 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
560 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
561 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
562 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "SUBDEVICE", "%d", device->subdevice)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
563 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
564 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
565 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
566 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "GPIOPIN", "%d", device->gpiopin)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
567 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
568 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
569 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
570 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "DESCRIPTION", "%s", device->description)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
571 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
572 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
573 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
574 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "INUSE", "%d", device->inuse)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
575 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
576 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
577 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
578 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COMMENT", "%s", device->comment)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
579 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
580 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
581 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
582 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TIMESTAMP", "%d", (int)device->timestamp)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
583 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
584 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
585 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
586 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
587 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
588 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
589 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
590 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
591 #ifdef HAVE_WIRINGPI_H
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
592 piUnlock(LOCK_DEVICES);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
593 #endif
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
594
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
595 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
596 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
597 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
598 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
599 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
600
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
601 #ifdef USE_SIMULATOR
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
602 if (Config.simulator) {
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
603 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "SIMULATOR")) < 0) {
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
604 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
605 return 1;
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
606 }
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
607 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOM_TEMPERATURE", "%f", Config.simulator->room_temperature)) < 0) {
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
608 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
609 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
610 }
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
611 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_TEMPERATURE", "%f", Config.simulator->hlt_temperature)) < 0) {
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
612 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
613 return 1;
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
614 }
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
615 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_TEMP", "%f", Config.simulator->hlt_heater_temp)) < 0) {
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
616 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
617 return 1;
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
618 }
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
619 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_TIME", "%d", Config.simulator->hlt_heater_time)) < 0) {
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
620 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
621 return 1;
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
622 }
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
623 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_SIZE", "%f", Config.simulator->hlt_heater_size)) < 0) {
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
624 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
625 return 1;
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
626 }
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
627 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_STATE", "%d", Config.simulator->hlt_heater_state)) < 0) {
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
628 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
629 return 1;
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
630 }
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
631
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
632 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_TEMPERATURE", "%f", Config.simulator->mlt_temperature)) < 0) {
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
633 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
634 return 1;
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
635 }
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
636 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_TEMP", "%f", Config.simulator->mlt_heater_temp)) < 0) {
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
637 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
638 return 1;
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
639 }
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
640 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_TIME", "%d", Config.simulator->mlt_heater_time)) < 0) {
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
641 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
642 return 1;
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
643 }
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
644 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_SIZE", "%f", Config.simulator->mlt_heater_size)) < 0) {
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
645 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
646 return 1;
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
647 }
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
648 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_STATE", "%d", Config.simulator->mlt_heater_state)) < 0) {
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
649 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
650 return 1;
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
651 }
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
652
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
653 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_HLT_TEMP", "%f", Config.simulator->s_hlt_temp)) < 0) {
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
654 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
655 return 1;
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
656 }
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
657 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_MLT_TEMP", "%f", Config.simulator->s_mlt_temp)) < 0) {
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
658 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
659 return 1;
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
660 }
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
661
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
662 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
663 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
664 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
665 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
666 }
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
667 #endif
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
668
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
669 /*
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
670 * All done, close any open elements
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
671 */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
672 if ((rc = xmlTextWriterEndDocument(writer)) < 0) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
673 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndDocument");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
674 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
675 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
676 xmlFreeTextWriter(writer);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
677
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
678 /*
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
679 * Now write the XML configuration
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
680 */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
681 if (getenv((char *)"USER") == NULL) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
682 mypath = xstrcpy((char *)"/root");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
683 } else {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
684 mypath = xstrcpy(getenv((char *)"HOME"));
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
685 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
686 mypath = xstrcat(mypath, (char *)"/.brewco/etc/");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
687 mkdirs(mypath, 0755);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
688 mypath = xstrcat(mypath, (char *)"brewco.xml");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
689
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
690 if (debug)
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
691 fprintf(stdout, "Writing %s\n", mypath);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
692
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
693 if ((fp = fopen(mypath, "w")) == NULL) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
694 syslog(LOG_NOTICE, "could not rewrite %s", mypath);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
695 free(mypath);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
696 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
697 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
698 free(mypath);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
699
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
700 fprintf(fp, "%s", (const char *) buf->content);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
701 fclose(fp);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
702 xmlBufferFree(buf);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
703
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
704 return 0;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
705 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
706
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
707
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
708
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
709 int wrconfig(void)
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
710 {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
711 int rc;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
712
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
713 rc = do_wrconfig();
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
714 syslog(LOG_NOTICE, "Rewritten configuration, rc=%d", rc);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
715 return rc;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
716 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
717
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
718
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
719
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
720 /*
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
721 * Parse one LCD display
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
722 */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
723 int parseLCD(xmlDocPtr doc, xmlNodePtr cur)
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
724 {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
725 xmlChar *key;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
726 int ival;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
727
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
728 cur = cur->xmlChildrenNode;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
729 while (cur != NULL) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
730 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COLUMNS"))) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
731 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
732 if (sscanf((const char *)key, "%d", &ival) == 1)
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
733 Config.lcd_cols = ival;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
734 xmlFree(key);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
735 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
736 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROWS"))) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
737 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
738 if (sscanf((const char *)key, "%d", &ival) == 1)
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
739 Config.lcd_rows = ival;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
740 xmlFree(key);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
741 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
742 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ADDRESS"))) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
743 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
744 if (sscanf((const char *)key, "%x", &ival) == 1)
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
745 Config.lcd_address = ival;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
746 xmlFree(key);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
747 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
748 cur = cur->next;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
749 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
750
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
751 return 0;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
752 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
753
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
754
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
755
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
756 int parseLCDs(xmlDocPtr doc, xmlNodePtr cur)
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
757 {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
758 cur = cur->xmlChildrenNode;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
759 while (cur != NULL) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
760 if ((!xmlStrcmp(cur->name, (const xmlChar *)"LCD"))) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
761 parseLCD(doc, cur);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
762 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
763 cur = cur->next;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
764 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
765 return 0;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
766 }
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
767
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
768
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
769
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
770 /*
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
771 * Parse a brewsystem
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
772 */
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
773 int parseBrewsystem(xmlDocPtr doc, xmlNodePtr cur)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
774 {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
775 xmlChar *key;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
776 int i, ival;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
777 float val;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
778 units_list *unit, *tmp;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
779
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
780 unit = (units_list *)malloc(sizeof(units_list));
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
781 unit->next = NULL;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
782 unit->version = 1;
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
783 unit->uuid = unit->name = NULL;
441
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
784 unit->number = 0;
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
785 unit->active = 0;
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
786 unit->hlt_sensor = unit->mlt_sensor = NULL;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
787 unit->hlt_heater = unit->mlt_heater = unit->mlt_pump = NULL;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
788 unit->hlt_heater_mltfirst = 0;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
789 unit->pump_cycle = 7;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
790 unit->pump_rest = 2;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
791 unit->pump_premash = 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
792 unit->pump_onmash = 1;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
793 unit->pump_mashout = 0;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
794 unit->pump_onboil = 0;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
795 unit->pump_stop = 90;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
796 unit->skip_add = 0;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
797 unit->skip_remove = 0;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
798 unit->skip_iodine = 0;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
799 unit->iodine_time = 90;
441
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
800 unit->whirlpool = 1;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
801 unit->PID_hlt = (pid_var *)malloc(sizeof(pid_var));
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
802 unit->PID_mlt = (pid_var *)malloc(sizeof(pid_var));
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
803 InitPID(unit->PID_hlt);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
804 InitPID(unit->PID_mlt);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
805
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
806 cur = cur->xmlChildrenNode;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
807 while (cur != NULL) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
808 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
809 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
810 if (xmlStrcmp(key, (const xmlChar *)"1")) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
811 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
812 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
813 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
814 unit->version = 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
815 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
816 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
817 if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
818 unit->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
819 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
820 if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
821 unit->name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
822 }
441
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
823 if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUMBER"))) {
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
824 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
825 if (sscanf((const char *)key, "%d", &ival) == 1)
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
826 unit->number = ival;
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
827 xmlFree(key);
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
828 }
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
829 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ACTIVE"))) {
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
830 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
831 if (sscanf((const char *)key, "%d", &ival) == 1)
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
832 unit->active = ival;
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
833 xmlFree(key);
bde74a8f2ad7 Added automate state file.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
834 }
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
835
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
836 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_SENSOR_UUID"))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
837 if (unit->hlt_sensor == NULL) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
838 unit->hlt_sensor = (sensor_var *)malloc(sizeof(sensor_var));
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
839 unit->hlt_sensor->uuid[0] = '\0';
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
840 unit->hlt_sensor->state = 1; // missing
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
841 unit->hlt_sensor->value = 0;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
842 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
843 snprintf(unit->hlt_sensor->uuid, 36, "%s", xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
844 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
845 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_SENSOR_STATE"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
846 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
847 if (sscanf((const char *)key, "%d", &ival) == 1)
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
848 unit->hlt_sensor->state = ival;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
849 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
850 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
851 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_SENSOR_VALUE"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
852 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
853 if (sscanf((const char *)key, "%d", &ival) == 1)
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
854 unit->hlt_sensor->value = ival;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
855 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
856 }
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
857
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
858 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_UUID"))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
859 if (unit->hlt_heater == NULL) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
860 unit->hlt_heater = (switch_var *)malloc(sizeof(switch_var));
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
861 unit->hlt_heater->uuid[0] = '\0';
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
862 unit->hlt_heater->value = 0;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
863 unit->hlt_heater->delay = 1; // 15 seconds
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
864 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
865 snprintf(unit->hlt_heater->uuid, 36, "%s", xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
866 }
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
867 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_VALUE"))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
868 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
869 if (sscanf((const char *)key, "%d", &ival) == 1)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
870 unit->hlt_heater->value = ival;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
871 xmlFree(key);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
872 }
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
873 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_DELAY"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
874 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
875 if (sscanf((const char *)key, "%d", &ival) == 1)
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
876 unit->hlt_heater->delay = ival;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
877 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
878 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
879
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
880 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_MLTFIRST"))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
881 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
882 if (sscanf((const char *)key, "%d", &ival) == 1)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
883 unit->hlt_heater_mltfirst = ival;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
884 xmlFree(key);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
885 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
886
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
887 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_SENSOR_UUID"))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
888 if (unit->mlt_sensor == NULL) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
889 unit->mlt_sensor = (sensor_var *)malloc(sizeof(sensor_var));
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
890 unit->mlt_sensor->uuid[0] = '\0';
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
891 unit->mlt_sensor->state = 1; // missing
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
892 unit->mlt_sensor->value = 0;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
893 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
894 snprintf(unit->mlt_sensor->uuid, 36, "%s", xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
895 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
896 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_SENSOR_STATE"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
897 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
898 if (sscanf((const char *)key, "%d", &ival) == 1)
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
899 unit->mlt_sensor->state = ival;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
900 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
901 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
902 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_SENSOR_VALUE"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
903 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
904 if (sscanf((const char *)key, "%d", &ival) == 1)
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
905 unit->mlt_sensor->value = ival;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
906 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
907 }
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
908
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
909 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_UUID"))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
910 if (unit->mlt_heater == NULL) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
911 unit->mlt_heater = (switch_var *)malloc(sizeof(switch_var));
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
912 unit->mlt_heater->uuid[0] = '\0';
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
913 unit->mlt_heater->value = 0;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
914 unit->mlt_heater->delay = 1; // 15 seconds
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
915 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
916 snprintf(unit->mlt_heater->uuid, 36, "%s", xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
917 }
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
918 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_VALUE"))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
919 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
920 if (sscanf((const char *)key, "%d", &ival) == 1)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
921 unit->mlt_heater->value = ival;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
922 xmlFree(key);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
923 }
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
924 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_DELAY"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
925 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
926 if (sscanf((const char *)key, "%d", &ival) == 1)
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
927 unit->mlt_heater->delay = ival;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
928 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
929 }
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
930
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
931 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_PUMP_UUID"))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
932 if (unit->mlt_pump == NULL) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
933 unit->mlt_pump = (switch_var *)malloc(sizeof(switch_var));
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
934 unit->mlt_pump->uuid[0] = '\0';
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
935 unit->mlt_pump->value = 0;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
936 unit->mlt_pump->delay = 1; // 15 seconds
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
937 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
938 snprintf(unit->mlt_pump->uuid, 36, "%s", xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
939 }
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
940 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_PUMP_VALUE"))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
941 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
942 if (sscanf((const char *)key, "%d", &ival) == 1)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
943 unit->mlt_pump->value = ival;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
944 xmlFree(key);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
945 }
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
946 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_PUMP_DELAY"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
947 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
948 if (sscanf((const char *)key, "%d", &ival) == 1)
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
949 unit->mlt_pump->delay = ival;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
950 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
951 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
952
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
953 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_CYCLE"))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
954 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
955 if (sscanf((const char *)key, "%d", &ival) == 1)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
956 unit->pump_cycle = ival;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
957 xmlFree(key);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
958 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
959 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_REST"))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
960 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
961 if (sscanf((const char *)key, "%d", &ival) == 1)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
962 unit->pump_rest = ival;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
963 xmlFree(key);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
964 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
965 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_PREMASH"))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
966 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
967 if (sscanf((const char *)key, "%d", &ival) == 1)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
968 unit->pump_premash = ival;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
969 xmlFree(key);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
970 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
971 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_ONMASH"))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
972 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
973 if (sscanf((const char *)key, "%d", &ival) == 1)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
974 unit->pump_onmash = ival;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
975 xmlFree(key);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
976 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
977 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_MASHOUT "))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
978 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
979 if (sscanf((const char *)key, "%d", &ival) == 1)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
980 unit->pump_mashout = ival;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
981 xmlFree(key);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
982 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
983 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_ONBOIL"))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
984 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
985 if (sscanf((const char *)key, "%d", &ival) == 1)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
986 unit->pump_onboil = ival;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
987 xmlFree(key);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
988 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
989 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_STOP"))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
990 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
991 if (sscanf((const char *)key, "%d", &ival) == 1)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
992 unit->pump_stop = ival;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
993 xmlFree(key);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
994 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
995 if ((!xmlStrcmp(cur->name, (const xmlChar *)"SKIP_ADD"))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
996 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
997 if (sscanf((const char *)key, "%d", &ival) == 1)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
998 unit->skip_add = ival;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
999 xmlFree(key);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1000 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1001 if ((!xmlStrcmp(cur->name, (const xmlChar *)"SKIP_REMOVE"))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1002 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1003 if (sscanf((const char *)key, "%d", &ival) == 1)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1004 unit->skip_remove = ival;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1005 xmlFree(key);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1006 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1007 if ((!xmlStrcmp(cur->name, (const xmlChar *)"SKIP_IODINE"))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1008 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1009 if (sscanf((const char *)key, "%d", &ival) == 1)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1010 unit->skip_iodine = ival;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1011 xmlFree(key);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1012 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1013 if ((!xmlStrcmp(cur->name, (const xmlChar *)"IODINE_TIME"))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1014 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1015 if (sscanf((const char *)key, "%d", &ival) == 1)
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1016 unit->iodine_time = ival;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1017 xmlFree(key);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1018 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1019 if ((!xmlStrcmp(cur->name, (const xmlChar *)"WHIRLPOOL"))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1020 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1021 for (i = 0; i < 2; i++) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1022 if (! xmlStrcmp(key, (const xmlChar *)WHIRLPOOL_TYPE[i])) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1023 unit->whirlpool = i;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1024 break;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1025 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1026 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1027 xmlFree(key);
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1028 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1029
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1030 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_IMAX"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1031 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1032 if (sscanf((const char *)key, "%f", &val) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1033 unit->PID_hlt->iMax = val;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1034 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1035 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1036 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_IGAIN"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1037 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1038 if (sscanf((const char *)key, "%f", &val) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1039 unit->PID_hlt->iGain = val;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1040 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1041 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1042 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_PGAIN"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1043 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1044 if (sscanf((const char *)key, "%f", &val) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1045 unit->PID_hlt->pGain = val;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1046 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1047 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1048 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_DGAIN"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1049 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1050 if (sscanf((const char *)key, "%f", &val) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1051 unit->PID_hlt->dGain = val;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1052 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1053 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1054 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_INPUT"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1055 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1056 if (sscanf((const char *)key, "%f", &val) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1057 unit->PID_hlt->Input = val;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1058 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1059 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1060 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_ERR"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1061 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1062 if (sscanf((const char *)key, "%f", &val) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1063 unit->PID_hlt->Err = val;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1064 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1065 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1066 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_ERRLAST"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1067 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1068 if (sscanf((const char *)key, "%f", &val) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1069 unit->PID_hlt->ErrLast = val;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1070 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1071 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1072 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_ISTATE"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1073 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1074 if (sscanf((const char *)key, "%f", &val) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1075 unit->PID_hlt->iState = val;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1076 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1077 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1078 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_SETP"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1079 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1080 if (sscanf((const char *)key, "%f", &val) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1081 unit->PID_hlt->SetP = val;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1082 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1083 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1084 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_OUTP"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1085 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1086 if (sscanf((const char *)key, "%f", &val) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1087 unit->PID_hlt->OutP = val;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1088 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1089 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1090 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_MODE"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1091 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1092 for (i = 0; i < 3; i++) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1093 if (! xmlStrcmp(key, (const xmlChar *)PIDMODE[i])) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1094 unit->PID_hlt->Mode = i;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1095 break;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1096 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1097 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1098 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1099 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1100
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1101 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_IMAX"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1102 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1103 if (sscanf((const char *)key, "%f", &val) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1104 unit->PID_mlt->iMax = val;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1105 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1106 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1107 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_IGAIN"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1108 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1109 if (sscanf((const char *)key, "%f", &val) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1110 unit->PID_mlt->iGain = val;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1111 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1112 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1113 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_PGAIN"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1114 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1115 if (sscanf((const char *)key, "%f", &val) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1116 unit->PID_mlt->pGain = val;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1117 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1118 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1119 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_DGAIN"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1120 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1121 if (sscanf((const char *)key, "%f", &val) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1122 unit->PID_mlt->dGain = val;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1123 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1124 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1125 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_INPUT"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1126 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1127 if (sscanf((const char *)key, "%f", &val) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1128 unit->PID_mlt->Input = val;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1129 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1130 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1131 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_ERR"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1132 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1133 if (sscanf((const char *)key, "%f", &val) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1134 unit->PID_mlt->Err = val;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1135 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1136 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1137 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_ERRLAST"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1138 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1139 if (sscanf((const char *)key, "%f", &val) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1140 unit->PID_mlt->ErrLast = val;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1141 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1142 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1143 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_ISTATE"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1144 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1145 if (sscanf((const char *)key, "%f", &val) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1146 unit->PID_mlt->iState = val;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1147 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1148 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1149 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_SETP"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1150 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1151 if (sscanf((const char *)key, "%f", &val) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1152 unit->PID_mlt->SetP = val;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1153 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1154 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1155 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_OUTP"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1156 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1157 if (sscanf((const char *)key, "%f", &val) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1158 unit->PID_mlt->OutP = val;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1159 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1160 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1161 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_MODE"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1162 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1163 for (i = 0; i < 3; i++) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1164 if (! xmlStrcmp(key, (const xmlChar *)PIDMODE[i])) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1165 unit->PID_mlt->Mode = i;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1166 break;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1167 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1168 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1169 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1170 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1171
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1172 cur = cur->next;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1173 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1174
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1175 if (Config.units == NULL) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1176 Config.units = unit;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1177 } else {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1178 for (tmp = Config.units; tmp; tmp = tmp->next) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1179 if (tmp->next == NULL) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1180 tmp->next = unit;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1181 break;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1182 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1183 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1184 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1185
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1186 return 0;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1187 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1188
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1189
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1190
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1191 int parseBrewsystems(xmlDocPtr doc, xmlNodePtr cur)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1192 {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1193 cur = cur->xmlChildrenNode;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1194 while (cur != NULL) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1195 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BREWSYSTEM"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1196 parseBrewsystem(doc, cur);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1197 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1198 cur = cur->next;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1199 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1200 return 0;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1201 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1202
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1203
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1204 int parseDevice(xmlDocPtr doc, xmlNodePtr cur)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1205 {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1206 xmlChar *key;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1207 devices_list *device, *tmp;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1208 int i, ival;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1209
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1210 device = (devices_list *)malloc(sizeof(devices_list));
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1211 device->next = NULL;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1212 device->version = 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1213 device->uuid = device->address = device->description = device->comment = NULL;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1214 device->type = device->direction = device->present = device->subdevice = device->inuse = device->offset = 0;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1215 device->gpiopin = -1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1216 device->timestamp = (time_t)0;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1217
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1218 cur = cur->xmlChildrenNode;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1219 while (cur != NULL) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1220 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1221 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1222 if (xmlStrcmp(key, (const xmlChar *)"1")) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1223 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1224 return 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1225 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1226 device->version = 1;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1227 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1228 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1229 if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1230 device->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1231 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1232 if ((!xmlStrcmp(cur->name, (const xmlChar *)"TYPE"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1233 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1234 for (i = 0; i < 8; i++) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1235 if (! xmlStrcmp(key, (const xmlChar *)DEVTYPE[i])) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1236 device->type = i;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1237 break;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1238 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1239 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1240 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1241 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1242 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DIRECTION"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1243 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1244 for (i = 0; i < 7; i++) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1245 if (! xmlStrcmp(key, (const xmlChar *)DEVDIR[i])) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1246 device->direction = i;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1247 break;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1248 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1249 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1250 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1251 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1252 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VALUE"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1253 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1254 if (sscanf((const char *)key, "%d", &ival) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1255 device->value = ival;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1256 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1257 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1258 if ((!xmlStrcmp(cur->name, (const xmlChar *)"OFFSET"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1259 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1260 if (sscanf((const char *)key, "%d", &ival) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1261 device->offset = ival;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1262 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1263 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1264 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1265 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1266 for (i = 0; i < 4; i++) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1267 if (! xmlStrcmp(key, (const xmlChar *)DEVPRESENT[i])) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1268 device->present = i;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1269 break;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1270 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1271 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1272 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1273 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1274 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ADDRESS"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1275 device->address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1276 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1277 if ((!xmlStrcmp(cur->name, (const xmlChar *)"SUBDEVICE"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1278 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1279 if (sscanf((const char *)key, "%d", &ival) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1280 device->subdevice = ival;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1281 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1282 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1283 if ((!xmlStrcmp(cur->name, (const xmlChar *)"GPIOPIN"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1284 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1285 if (sscanf((const char *)key, "%d", &ival) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1286 device->gpiopin = ival;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1287 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1288 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1289 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DESCRIPTION"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1290 device->description = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1291 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1292 if ((!xmlStrcmp(cur->name, (const xmlChar *)"INUSE"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1293 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1294 if (sscanf((const char *)key, "%d", &ival) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1295 device->inuse = ival;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1296 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1297 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1298 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COMMENT"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1299 device->comment = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1300 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1301 if ((!xmlStrcmp(cur->name, (const xmlChar *)"TIMESTAMP"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1302 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1303 if (sscanf((const char *)key, "%d", &ival) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1304 device->timestamp = (time_t)ival;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1305 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1306 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1307
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1308 cur = cur->next;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1309 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1310
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1311 if (Config.devices == NULL) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1312 Config.devices = device;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1313 } else {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1314 for (tmp = Config.devices; tmp; tmp = tmp->next) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1315 if (tmp->next == NULL) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1316 tmp->next = device;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1317 break;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1318 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1319 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1320 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1321
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1322 return 0;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1323 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1324
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1325
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1326
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1327 int parseDevices(xmlDocPtr doc, xmlNodePtr cur)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1328 {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1329 cur = cur->xmlChildrenNode;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1330 while (cur != NULL) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1331 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DEVICE"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1332 parseDevice(doc, cur);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1333 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1334 cur = cur->next;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1335 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1336 return 0;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1337 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1338
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1339
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1340
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1341 #ifdef USE_SIMULATOR
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1342 int parseSimulator(xmlDocPtr doc, xmlNodePtr cur)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1343 {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1344 xmlChar *key;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1345 int ival;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1346 float fval;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1347
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1348 /*
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1349 * First time, allocate memory and set defaults.
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1350 */
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1351 if (! Config.simulator) {
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1352 Config.simulator = (simulator_var *)malloc(sizeof(simulator_var));
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1353 Config.simulator->room_temperature = Config.simulator->hlt_temperature = Config.simulator->hlt_heater_temp = \
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1354 Config.simulator->mlt_temperature = Config.simulator->mlt_heater_temp = \
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1355 Config.simulator->s_hlt_temp = Config.simulator->s_mlt_temp = 0.0;
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1356 Config.simulator->hlt_heater_size = Config.simulator->mlt_heater_size = 0.0;
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1357 Config.simulator->hlt_heater_time = Config.simulator->mlt_heater_time = Config.simulator->hlt_heater_state = Config.simulator->mlt_heater_state = 0;
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1358 }
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1359
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1360 cur = cur->xmlChildrenNode;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1361 while (cur != NULL) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1362 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOM_TEMPERATURE"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1363 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1364 if (sscanf((const char *)key, "%f", &fval) == 1)
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1365 Config.simulator->room_temperature = fval;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1366 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1367 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1368 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_TEMPERATURE"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1369 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1370 if (sscanf((const char *)key, "%f", &fval) == 1)
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1371 Config.simulator->hlt_temperature = fval;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1372 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1373 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1374 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_TEMP"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1375 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1376 if (sscanf((const char *)key, "%f", &fval) == 1)
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1377 Config.simulator->hlt_heater_temp = fval;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1378 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1379 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1380 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_TIME"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1381 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1382 if (sscanf((const char *)key, "%d", &ival) == 1)
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1383 Config.simulator->hlt_heater_time = ival;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1384 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1385 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1386 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_SIZE"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1387 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1388 if (sscanf((const char *)key, "%f", &fval) == 1)
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1389 Config.simulator->hlt_heater_size = fval;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1390 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1391 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1392 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_STATE"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1393 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1394 if (sscanf((const char *)key, "%d", &ival) == 1)
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1395 Config.simulator->hlt_heater_state = ival;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1396 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1397 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1398 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_TEMPERATURE"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1399 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1400 if (sscanf((const char *)key, "%f", &fval) == 1)
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1401 Config.simulator->mlt_temperature = fval;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1402 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1403 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1404 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_TEMP"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1405 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1406 if (sscanf((const char *)key, "%f", &fval) == 1)
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1407 Config.simulator->mlt_heater_temp = fval;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1408 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1409 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1410 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_TIME"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1411 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1412 if (sscanf((const char *)key, "%d", &ival) == 1)
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1413 Config.simulator->mlt_heater_time = ival;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1414 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1415 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1416 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_SIZE"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1417 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1418 if (sscanf((const char *)key, "%f", &fval) == 1)
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1419 Config.simulator->mlt_heater_size = fval;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1420 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1421 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1422 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_STATE"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1423 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1424 if (sscanf((const char *)key, "%d", &ival) == 1)
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1425 Config.simulator->mlt_heater_state = ival;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1426 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1427 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1428 if ((!xmlStrcmp(cur->name, (const xmlChar *)"S_HLT_TEMP"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1429 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1430 if (sscanf((const char *)key, "%f", &fval) == 1)
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1431 Config.simulator->s_hlt_temp = fval;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1432 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1433 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1434 if ((!xmlStrcmp(cur->name, (const xmlChar *)"S_MLT_TEMP"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1435 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1436 if (sscanf((const char *)key, "%f", &fval) == 1)
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1437 Config.simulator->s_mlt_temp = fval;
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1438 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1439 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1440 cur = cur->next;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1441 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1442
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1443 return 0;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1444 }
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1445 #endif
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1446
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1447
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1448
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1449 int rdconfig(void)
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1450 {
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1451 int ival, rc = 0;
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1452 char *mypath;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1453 xmlDocPtr doc;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1454 xmlNodePtr cur;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1455 xmlChar *key;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1456
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1457 killconfig();
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1458 syslog(LOG_NOTICE, "HOME='%s' USER='%s' LOGNAME='%s'", MBSE_SS(getenv((char *)"HOME")), MBSE_SS(getenv((char *)"USER")), MBSE_SS(getenv((char *)"LOGNAME")));
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1459
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1460 /*
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1461 * Search config file
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1462 */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1463 if (getenv((char *)"USER") == NULL) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1464 mypath = xstrcpy((char *)"/root");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1465 } else {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1466 mypath = xstrcpy(getenv((char *)"HOME"));
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1467 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1468 mypath = xstrcat(mypath, (char *)"/.brewco/etc/");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1469 mkdirs(mypath, 0755);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1470 mypath = xstrcat(mypath, (char *)"brewco.xml");
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1471 if ((doc = xmlParseFile(mypath)) == NULL) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1472 /*
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1473 * No config file, create a fresh one
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1474 */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1475 syslog(LOG_NOTICE, "rdconfig: %s not found, creating", mypath);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1476 wrconfig();
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1477
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1478 if ((doc = xmlParseFile(mypath)) == NULL) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1479 syslog(LOG_NOTICE, "rdconfig: could not create %s", mypath);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1480 free(mypath);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1481 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1482 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1483 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1484 syslog(LOG_NOTICE, "rdconfig: using %s", mypath);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1485
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1486 if ((cur = xmlDocGetRootElement(doc)) == NULL) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1487 syslog(LOG_NOTICE, "XML file %s empty.", mypath);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1488 xmlFreeDoc(doc);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1489 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1490 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1491 if (xmlStrcmp(cur->name, (const xmlChar*)"BREWCO")) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1492 syslog(LOG_NOTICE, "XML file %s is not a valid configuration file.", mypath);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1493 xmlFreeDoc(doc);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1494 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1495 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1496
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1497 /*
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1498 * Parse configuration
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1499 */
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1500 cur = cur->xmlChildrenNode;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1501 while (cur != NULL) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1502 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1503 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1504 if (xmlStrcmp(key, (const xmlChar *)"1")) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1505 xmlFree(key);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1506 syslog(LOG_NOTICE, "XML file %s is not a valid version", mypath);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1507 return 1;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1508 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1509 xmlFree(key);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1510 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1511 if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1512 Config.name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1513 }
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1514 if ((!xmlStrcmp(cur->name, (const xmlChar *)"LISTEN_PORT"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1515 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1516 if (sscanf((const char *)key, "%d", &ival) == 1)
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1517 Config.my_port = ival;
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1518 xmlFree(key);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1519 }
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1520 if ((!xmlStrcmp(cur->name, (const xmlChar *)"TEMPFORMAT"))) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1521 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1522 Config.tempFormat = key[0];
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1523 xmlFree(key);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1524 }
435
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1525 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOMTEMP_UUID"))) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1526 if (Config.roomtemp == NULL) {
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1527 Config.roomtemp = (sensor_var *)malloc(sizeof(sensor_var));
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1528 Config.roomtemp->uuid[0] = '\0';
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1529 Config.roomtemp->state = 1; // missing
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1530 Config.roomtemp->value = 0;
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1531 }
4b1ed6897d80 More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
1532 snprintf(Config.roomtemp->uuid, 36, "%s", xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1533 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1534 if ((!xmlStrcmp(cur->name, (const xmlChar *)"LCDS"))) {
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1535 parseLCDs(doc, cur);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1536 }
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1537 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BREWSYSTEMS"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1538 parseBrewsystems(doc, cur);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1539 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1540 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DEVICES"))) {
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1541 parseDevices(doc, cur);
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1542 }
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1543 #ifdef USE_SIMULATOR
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1544 if ((!xmlStrcmp(cur->name, (const xmlChar *)"SIMULATOR"))) {
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1545 parseSimulator(doc, cur);
434
eb724767860d Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents: 409
diff changeset
1546 }
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1547 #endif
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1548 cur = cur->next;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1549 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1550 xmlFreeDoc(doc);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1551
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1552 free(mypath);
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1553 mypath = NULL;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1554
438
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1555 #ifdef USE_SIMULATOR
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1556 /*
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1557 * If we didn't find any simulator values, initialize a new simulator.
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1558 */
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1559 if (! Config.simulator) {
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1560 Config.simulator = (simulator_var *)malloc(sizeof(simulator_var));
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1561 syslog(LOG_NOTICE, "rdconfig() init a new simulator");
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1562 Config.simulator->room_temperature = Config.simulator->hlt_temperature = Config.simulator->hlt_heater_temp = \
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1563 Config.simulator->mlt_temperature = Config.simulator->mlt_heater_temp = \
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1564 Config.simulator->s_hlt_temp = Config.simulator->s_mlt_temp = 20.0;
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1565 Config.simulator->hlt_heater_size = Config.simulator->mlt_heater_size = 0.0;
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1566 Config.simulator->hlt_heater_time = Config.simulator->mlt_heater_time = Config.simulator->hlt_heater_state = Config.simulator->mlt_heater_state = 0;
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1567 }
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1568 #endif
7d1ec160d751 Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 435
diff changeset
1569
409
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1570 return rc;
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1571 }
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1572
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1573
cdf68044adaf Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1574

mercurial