Sat, 12 Dec 2015 19:31:35 +0100
Most parts of the simulator are working, needs some tuning.
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" |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
25 | #include "util.h" |
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
|
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" }; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
37 | const char WHIRLPOOL_TYPE[3][5] = { "OFF", "COLD", "HOT" }; |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
38 | const char PIDDIRECTION[2][8] = { "DIRECT", "REVERSE" }; |
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
39 | const char PIDMODE[2][10] = { "MANUAL", "AUTOMATIC" }; |
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
|
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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
43 | { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
44 | units_list *unit; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
45 | 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
|
46 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
48 | 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
|
49 | 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
|
50 | |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
51 | 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
|
52 | Config.tempFormat = 'C'; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
53 | if (Config.roomtemp) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
54 | free(Config.roomtemp); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
55 | Config.roomtemp = NULL; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
56 | Config.lcd_cols = 20; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
57 | 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
|
58 | |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
59 | for (unit = Config.units; unit; unit = unit->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
60 | if (unit->uuid) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
61 | free(unit->uuid); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
62 | if (unit->name) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
63 | free(unit->name); |
449 | 64 | if (unit->hlt_sensor.uuid) |
65 | free(unit->hlt_sensor.uuid); | |
66 | if (unit->mlt_sensor.uuid) | |
67 | free(unit->mlt_sensor.uuid); | |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
68 | if (unit->hlt_heater.uuid) |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
69 | free(unit->hlt_heater.uuid); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
70 | if (unit->mlt_heater.uuid) |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
71 | free(unit->mlt_heater.uuid); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
72 | if (unit->mlt_pump.uuid) |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
73 | free(unit->mlt_pump.uuid); |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
74 | if (unit->PID_hlt) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
75 | free(unit->PID_hlt); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
76 | if (unit->PID_mlt) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
77 | free(unit->PID_mlt); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
78 | free(unit); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
79 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
80 | Config.units = NULL; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
81 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
82 | for (device = Config.devices; device; device = device->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
83 | if (device->uuid) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
84 | free(device->uuid); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
85 | if (device->address) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
86 | free(device->address); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
87 | if (device->description) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
88 | free(device->description); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
89 | if (device->comment) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
90 | free(device->comment); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
91 | free(device); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
92 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
93 | Config.devices = NULL; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
94 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
95 | #ifdef USE_SIMULATOR |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
96 | if (Config.simulator) |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
97 | free(Config.simulator); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
98 | 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
|
99 | #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
|
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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
106 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
108 | 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
|
109 | 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
|
110 | 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
|
111 | xmlBufferPtr buf; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
112 | units_list *unit; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
113 | 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
|
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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
117 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
119 | 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
|
120 | 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
|
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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
125 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
127 | 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
|
128 | 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
|
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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
133 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
135 | 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
|
136 | 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
|
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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
141 | * 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
|
142 | * 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
|
143 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
145 | 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
|
146 | 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
|
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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
151 | * 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
|
152 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
154 | 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
|
155 | 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
|
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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
160 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
162 | 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
|
163 | 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
|
164 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
166 | 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
|
167 | 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
|
168 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
169 | 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
|
170 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
171 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
172 | } |
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
|
173 | 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
|
174 | 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
|
175 | 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
|
176 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
177 | if (Config.roomtemp) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
178 | 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
|
179 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
180 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
181 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
182 | 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
|
183 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
184 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
185 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
186 | 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
|
187 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
188 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
189 | } |
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
|
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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
194 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
196 | 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
|
197 | 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
|
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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
201 | * 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
|
202 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
204 | 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
|
205 | 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
|
206 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
208 | 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
|
209 | 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
|
210 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
212 | 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
|
213 | 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
|
214 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
216 | 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
|
217 | 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
|
218 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
220 | 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
|
221 | 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
|
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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
225 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
227 | 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
|
228 | 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
|
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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
232 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
234 | 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
|
235 | 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
|
236 | } |
434
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 | /* |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
239 | * Brewsystems |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
240 | */ |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
241 | if (Config.units) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
242 | if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "BREWSYSTEMS")) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
243 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
244 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
245 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
246 | for (unit = Config.units; unit; unit = unit->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
247 | /* |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
248 | * 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
|
249 | * are written to a state file. |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
250 | */ |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
251 | if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "BREWSYSTEM")) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
252 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
253 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
254 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
255 | 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
|
256 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
257 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
258 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
259 | 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
|
260 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
261 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
262 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
263 | 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
|
264 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
265 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
266 | } |
441 | 267 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NUMBER", "%d", unit->number)) < 0)) { |
268 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); | |
269 | return 1; | |
270 | } | |
271 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ACTIVE", "%d", unit->active)) < 0)) { | |
272 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); | |
273 | return 1; | |
274 | } | |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
275 | |
449 | 276 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_SENSOR_UUID", "%s", unit->hlt_sensor.uuid)) < 0)) { |
277 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); | |
278 | return 1; | |
279 | } | |
280 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_SENSOR_STATE", "%d", unit->hlt_sensor.state)) < 0)) { | |
281 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); | |
282 | return 1; | |
283 | } | |
284 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_SENSOR_VALUE", "%d", unit->hlt_sensor.value)) < 0)) { | |
285 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); | |
286 | return 1; | |
434
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 | |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
289 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_UUID", "%s", unit->hlt_heater.uuid)) < 0)) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
290 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
291 | return 1; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
292 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
293 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_VALUE", "%d", unit->hlt_heater.value)) < 0)) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
294 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
295 | return 1; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
296 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
297 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_DELAY", "%d", unit->hlt_heater.delay)) < 0)) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
298 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
299 | return 1; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
300 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
301 | |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
302 | 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
|
303 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
304 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
305 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
306 | |
449 | 307 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_SENSOR_UUID", "%s", unit->mlt_sensor.uuid)) < 0)) { |
308 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); | |
309 | return 1; | |
310 | } | |
311 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_SENSOR_STATE", "%d", unit->mlt_sensor.state)) < 0)) { | |
312 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); | |
313 | return 1; | |
314 | } | |
315 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_SENSOR_VALUE", "%d", unit->mlt_sensor.value)) < 0)) { | |
316 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); | |
317 | return 1; | |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
318 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
319 | |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
320 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_UUID", "%s", unit->mlt_heater.uuid)) < 0)) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
321 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
322 | return 1; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
323 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
324 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_VALUE", "%d", unit->mlt_heater.value)) < 0)) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
325 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
326 | return 1; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
327 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
328 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_DELAY", "%d", unit->mlt_heater.delay)) < 0)) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
329 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
330 | return 1; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
331 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
332 | |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
333 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_PUMP_UUID", "%s", unit->mlt_pump.uuid)) < 0)) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
334 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
335 | return 1; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
336 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
337 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_PUMP_VALUE", "%d", unit->mlt_pump.value)) < 0)) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
338 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
339 | return 1; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
340 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
341 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_PUMP_DELAY", "%d", unit->mlt_pump.delay)) < 0)) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
342 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
343 | return 1; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
344 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
345 | |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
346 | 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
|
347 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
348 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
349 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
350 | 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
|
351 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
352 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
353 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
354 | 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
|
355 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
356 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
357 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
358 | 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
|
359 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
360 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
361 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
362 | 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
|
363 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
364 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
365 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
366 | 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
|
367 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
368 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
369 | } |
445
3ec477cda546
Changed internal storage of temperatures to float. Added 2 prompts. Added editors for float and integer values. Added most of brewunit edit functions.
Michiel Broek <mbroek@mbse.eu>
parents:
441
diff
changeset
|
370 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_STOP", "%.3f", unit->pump_stop)) < 0)) { |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
371 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
372 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
373 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
374 | 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
|
375 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
376 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
377 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
378 | 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
|
379 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
380 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
381 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
382 | 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
|
383 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
384 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
385 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
386 | 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
|
387 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
388 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
389 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
390 | 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
|
391 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
392 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
393 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
394 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
395 | if (unit->PID_hlt) { |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
396 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_KP", "%.2lf", unit->PID_hlt->dispKp)) < 0) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
397 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
398 | return 1; |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
399 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
400 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_KI", "%.2lf", unit->PID_hlt->dispKi)) < 0) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
401 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
402 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
403 | } |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
404 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_KD", "%.2lf", unit->PID_hlt->dispKd)) < 0) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
405 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
406 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
407 | } |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
408 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_SAMPLETIIME", "%ld", unit->PID_hlt->SampleTime)) < 0) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
409 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
410 | return 1; |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
411 | } |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
412 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_DIRECTION", "%s", PIDDIRECTION[unit->PID_hlt->Direction])) < 0) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
413 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
414 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
415 | } |
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 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
418 | if (unit->PID_mlt) { |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
419 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_KP", "%.2lf", unit->PID_mlt->dispKp)) < 0) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
420 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
421 | return 1; |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
422 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
423 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_KI", "%.2lf", unit->PID_mlt->dispKi)) < 0) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
424 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
425 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
426 | } |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
427 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_KD", "%.2lf", unit->PID_mlt->dispKd)) < 0) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
428 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
429 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
430 | } |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
431 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_SAMPLETIIME", "%ld", unit->PID_mlt->SampleTime)) < 0) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
432 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
433 | return 1; |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
434 | } |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
435 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_DIRECTION", "%s", PIDDIRECTION[unit->PID_mlt->Direction])) < 0) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
436 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
437 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
438 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
439 | } |
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 = xmlTextWriterEndElement(writer)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
442 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
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 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
446 | if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
447 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
448 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
449 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
450 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
451 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
452 | if (Config.devices) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
453 | if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "DEVICES")) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
454 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
455 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
456 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
457 | #ifdef HAVE_WIRINGPI_H |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
458 | piLock(LOCK_DEVICES); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
459 | #endif |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
460 | for (device = Config.devices; device; device = device->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
461 | if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "DEVICE")) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
462 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
463 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
464 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
465 | 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
|
466 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
467 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
468 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
469 | 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
|
470 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
471 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
472 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
473 | 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
|
474 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
475 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
476 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
477 | 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
|
478 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
479 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
480 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
481 | 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
|
482 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
483 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
484 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
485 | 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
|
486 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
487 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
488 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
489 | 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
|
490 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
491 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
492 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
493 | 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
|
494 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
495 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
496 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
497 | 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
|
498 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
499 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
500 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
501 | 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
|
502 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
503 | return 1; |
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 | 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
|
506 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
507 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
508 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
509 | 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
|
510 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
511 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
512 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
513 | 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
|
514 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
515 | return 1; |
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 ((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
|
518 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
519 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
520 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
521 | if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
522 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
523 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
524 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
525 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
526 | #ifdef HAVE_WIRINGPI_H |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
527 | piUnlock(LOCK_DEVICES); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
528 | #endif |
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 = xmlTextWriterEndElement(writer)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
531 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
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 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
535 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
536 | #ifdef USE_SIMULATOR |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
537 | if (Config.simulator) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
538 | if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "SIMULATOR")) < 0) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
539 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
540 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
541 | } |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
542 | 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
|
543 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
434
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 | } |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
546 | 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
|
547 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
548 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
549 | } |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
550 | 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
|
551 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
552 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
553 | } |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
554 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_VOLUME", "%d", Config.simulator->hlt_heater_volume)) < 0) { |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
555 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
556 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
557 | } |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
558 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_POWER", "%d", Config.simulator->hlt_heater_power)) < 0) { |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
559 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
560 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
561 | } |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
562 | 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
|
563 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
564 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
565 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
566 | |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
567 | 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
|
568 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
569 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
570 | } |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
571 | 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
|
572 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
573 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
574 | } |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
575 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_VOLUME", "%d", Config.simulator->mlt_heater_volume)) < 0) { |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
576 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
577 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
578 | } |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
579 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_POWER", "%d", Config.simulator->mlt_heater_power)) < 0) { |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
580 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
581 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
582 | } |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
583 | 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
|
584 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
585 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
586 | } |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
587 | |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
588 | if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
589 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
590 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
591 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
592 | } |
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
|
593 | #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
|
594 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
595 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
596 | * 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
|
597 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
598 | 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
|
599 | 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
|
600 | 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
|
601 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
602 | 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
|
603 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
604 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
605 | * 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
|
606 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
607 | 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
|
608 | 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
|
609 | } 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
|
610 | 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
|
611 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
612 | 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
|
613 | 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
|
614 | 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
|
615 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
616 | 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
|
617 | 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
|
618 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
619 | 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
|
620 | 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
|
621 | 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
|
622 | 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
|
623 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
624 | 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
|
625 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
626 | 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
|
627 | 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
|
628 | 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
|
629 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
630 | 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
|
631 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
632 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
633 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
634 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
635 | 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
|
636 | { |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
637 | int rc = do_wrconfig(); |
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
|
638 | 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
|
639 | 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
|
640 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
641 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
642 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
643 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
644 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
645 | * 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
|
646 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
647 | 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
|
648 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
649 | 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
|
650 | 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
|
651 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
652 | 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
|
653 | 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
|
654 | 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
|
655 | 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
|
656 | 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
|
657 | 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
|
658 | 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
|
659 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
660 | 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
|
661 | 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
|
662 | 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
|
663 | 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
|
664 | 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
|
665 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
666 | 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
|
667 | 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
|
668 | 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
|
669 | 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
|
670 | 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
|
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 | 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
|
673 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
676 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
681 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
683 | 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
|
684 | 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
|
685 | 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
|
686 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
688 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
690 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
691 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
692 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
693 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
694 | /* |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
695 | * Parse a brewsystem |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
696 | */ |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
697 | int parseBrewsystem(xmlDocPtr doc, xmlNodePtr cur) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
698 | { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
699 | xmlChar *key; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
700 | int i, ival; |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
701 | long lval; |
445
3ec477cda546
Changed internal storage of temperatures to float. Added 2 prompts. Added editors for float and integer values. Added most of brewunit edit functions.
Michiel Broek <mbroek@mbse.eu>
parents:
441
diff
changeset
|
702 | float fval; |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
703 | double kpval, kival, kdval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
704 | units_list *unit, *tmp; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
705 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
706 | unit = (units_list *)malloc(sizeof(units_list)); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
707 | unit->next = NULL; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
708 | unit->version = 1; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
709 | unit->uuid = unit->name = NULL; |
441 | 710 | unit->number = 0; |
711 | unit->active = 0; | |
449 | 712 | unit->hlt_sensor.uuid = xstrcpy((char *)"00000000-0000-0000-0000-000000000000"); |
713 | unit->hlt_sensor.state = 0; | |
714 | unit->hlt_sensor.value = 0; | |
715 | unit->mlt_sensor.uuid = xstrcpy((char *)"00000000-0000-0000-0000-000000000000"); | |
716 | unit->mlt_sensor.state = 0; | |
717 | unit->mlt_sensor.value = 0; | |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
718 | unit->hlt_heater.uuid = xstrcpy((char *)"00000000-0000-0000-0000-000000000000"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
719 | unit->hlt_heater.value = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
720 | unit->hlt_heater.delay = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
721 | unit->mlt_heater.uuid = xstrcpy((char *)"00000000-0000-0000-0000-000000000000"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
722 | unit->mlt_heater.value = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
723 | unit->mlt_heater.delay = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
724 | unit->mlt_pump.uuid = xstrcpy((char *)"00000000-0000-0000-0000-000000000000"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
725 | unit->mlt_pump.value = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
726 | unit->mlt_pump.delay = 0; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
727 | unit->hlt_heater_mltfirst = 0; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
728 | unit->pump_cycle = 7; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
729 | unit->pump_rest = 2; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
730 | unit->pump_premash = 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
731 | unit->pump_onmash = 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
732 | unit->pump_mashout = 0; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
733 | unit->pump_onboil = 0; |
445
3ec477cda546
Changed internal storage of temperatures to float. Added 2 prompts. Added editors for float and integer values. Added most of brewunit edit functions.
Michiel Broek <mbroek@mbse.eu>
parents:
441
diff
changeset
|
734 | unit->pump_stop = 90.0; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
735 | unit->skip_add = 0; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
736 | unit->skip_remove = 0; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
737 | unit->skip_iodine = 0; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
738 | unit->iodine_time = 90; |
441 | 739 | unit->whirlpool = 1; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
740 | 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
|
741 | unit->PID_mlt = (pid_var *)malloc(sizeof(pid_var)); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
742 | PID_init(unit->PID_hlt, NULL, NULL, NULL, 2, 5, 1, P_DIRECT); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
743 | PID_init(unit->PID_mlt, NULL, NULL, NULL, 2, 5, 1, P_DIRECT); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
744 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
745 | cur = cur->xmlChildrenNode; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
746 | while (cur != NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
747 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
748 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
749 | if (xmlStrcmp(key, (const xmlChar *)"1")) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
750 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
751 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
752 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
753 | unit->version = 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
754 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
755 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
756 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
757 | unit->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
758 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
759 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
760 | unit->name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
761 | } |
441 | 762 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUMBER"))) { |
763 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); | |
764 | if (sscanf((const char *)key, "%d", &ival) == 1) | |
765 | unit->number = ival; | |
766 | xmlFree(key); | |
767 | } | |
768 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"ACTIVE"))) { | |
769 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); | |
770 | if (sscanf((const char *)key, "%d", &ival) == 1) | |
771 | unit->active = ival; | |
772 | xmlFree(key); | |
773 | } | |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
774 | |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
775 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_SENSOR_UUID"))) { |
449 | 776 | unit->hlt_sensor.uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
777 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
778 | 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
|
779 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
780 | if (sscanf((const char *)key, "%d", &ival) == 1) |
449 | 781 | unit->hlt_sensor.state = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
782 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
783 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
784 | 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
|
785 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
786 | if (sscanf((const char *)key, "%d", &ival) == 1) |
449 | 787 | unit->hlt_sensor.value = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
788 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
789 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
790 | |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
791 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_UUID"))) { |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
792 | unit->hlt_heater.uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
793 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
794 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_VALUE"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
795 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
796 | if (sscanf((const char *)key, "%d", &ival) == 1) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
797 | unit->hlt_heater.value = ival; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
798 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
799 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
800 | 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
|
801 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
802 | if (sscanf((const char *)key, "%d", &ival) == 1) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
803 | unit->hlt_heater.delay = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
804 | xmlFree(key); |
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 | |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
807 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_MLTFIRST"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
808 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
809 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
810 | unit->hlt_heater_mltfirst = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
811 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
812 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
813 | |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
814 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_SENSOR_UUID"))) { |
449 | 815 | unit->mlt_sensor.uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
434
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 *)"MLT_SENSOR_STATE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
818 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
819 | if (sscanf((const char *)key, "%d", &ival) == 1) |
449 | 820 | unit->mlt_sensor.state = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
821 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
822 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
823 | 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
|
824 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
825 | if (sscanf((const char *)key, "%d", &ival) == 1) |
449 | 826 | unit->mlt_sensor.value = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
827 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
828 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
829 | |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
830 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_UUID"))) { |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
831 | unit->mlt_heater.uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
832 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
833 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_VALUE"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
834 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
835 | if (sscanf((const char *)key, "%d", &ival) == 1) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
836 | unit->mlt_heater.value = ival; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
837 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
838 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
839 | 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
|
840 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
841 | if (sscanf((const char *)key, "%d", &ival) == 1) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
842 | unit->mlt_heater.delay = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
843 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
844 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
845 | |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
846 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_PUMP_UUID"))) { |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
847 | unit->mlt_pump.uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
848 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
849 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_PUMP_VALUE"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
850 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
851 | if (sscanf((const char *)key, "%d", &ival) == 1) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
852 | unit->mlt_pump.value = ival; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
853 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
854 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
855 | 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
|
856 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
857 | if (sscanf((const char *)key, "%d", &ival) == 1) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
858 | unit->mlt_pump.delay = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
859 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
860 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
861 | |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
862 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_CYCLE"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
863 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
864 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
865 | unit->pump_cycle = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
866 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
867 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
868 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_REST"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
869 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
870 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
871 | unit->pump_rest = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
872 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
873 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
874 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_PREMASH"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
875 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
876 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
877 | unit->pump_premash = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
878 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
879 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
880 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_ONMASH"))) { |
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->pump_onmash = 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 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_MASHOUT "))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
887 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
888 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
889 | unit->pump_mashout = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
890 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
891 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
892 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_ONBOIL"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
893 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
894 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
895 | unit->pump_onboil = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
896 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
897 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
898 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_STOP"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
899 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
445
3ec477cda546
Changed internal storage of temperatures to float. Added 2 prompts. Added editors for float and integer values. Added most of brewunit edit functions.
Michiel Broek <mbroek@mbse.eu>
parents:
441
diff
changeset
|
900 | if (sscanf((const char *)key, "%f", &fval) == 1) |
3ec477cda546
Changed internal storage of temperatures to float. Added 2 prompts. Added editors for float and integer values. Added most of brewunit edit functions.
Michiel Broek <mbroek@mbse.eu>
parents:
441
diff
changeset
|
901 | unit->pump_stop = fval; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
902 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
903 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
904 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"SKIP_ADD"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
905 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
906 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
907 | unit->skip_add = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
908 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
909 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
910 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"SKIP_REMOVE"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
911 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
912 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
913 | unit->skip_remove = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
914 | xmlFree(key); |
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 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"SKIP_IODINE"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
917 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
918 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
919 | unit->skip_iodine = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
920 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
921 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
922 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"IODINE_TIME"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
923 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
924 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
925 | unit->iodine_time = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
926 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
927 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
928 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"WHIRLPOOL"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
929 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
930 | for (i = 0; i < 2; i++) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
931 | if (! xmlStrcmp(key, (const xmlChar *)WHIRLPOOL_TYPE[i])) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
932 | unit->whirlpool = i; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
933 | break; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
934 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
935 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
936 | xmlFree(key); |
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 | |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
939 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_KP"))) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
940 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
941 | sscanf((const char *)key, "%lf", &kpval); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
942 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
943 | } |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
944 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_KI"))) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
945 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
946 | sscanf((const char *)key, "%lf", &kival); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
947 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
948 | } |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
949 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_KD"))) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
950 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
951 | sscanf((const char *)key, "%lf", &kdval); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
952 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
953 | } |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
954 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_SAMPLETIME"))) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
955 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
956 | if (sscanf((const char *)key, "%ld", &lval) == 1) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
957 | PID_setSampleTime(unit->PID_hlt, lval); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
958 | PID_setTunings(unit->PID_hlt, kpval, kival, kdval); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
959 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
960 | xmlFree(key); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
961 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
962 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_DIRECTION"))) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
963 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
964 | for (i = 0; i < 2; i++) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
965 | if (! xmlStrcmp(key, (const xmlChar *)PIDDIRECTION[i])) { |
448 | 966 | PID_setDirection(unit->PID_hlt, i); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
967 | break; |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
968 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
969 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
970 | xmlFree(key); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
971 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
972 | |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
973 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_KP"))) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
974 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
975 | sscanf((const char *)key, "%lf", &kpval); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
976 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
977 | } |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
978 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_KI"))) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
979 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
980 | sscanf((const char *)key, "%lf", &kival); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
981 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
982 | } |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
983 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_KD"))) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
984 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
985 | sscanf((const char *)key, "%lf", &kdval); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
986 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
987 | } |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
988 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_SAMPLETIME"))) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
989 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
990 | if (sscanf((const char *)key, "%ld", &lval) == 1) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
991 | PID_setSampleTime(unit->PID_mlt, lval); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
992 | PID_setTunings(unit->PID_mlt, kpval, kival, kdval); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
993 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
994 | xmlFree(key); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
995 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
996 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_DIRECTION"))) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
997 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
998 | for (i = 0; i < 2; i++) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
999 | if (! xmlStrcmp(key, (const xmlChar *)PIDDIRECTION[i])) { |
448 | 1000 | PID_setDirection(unit->PID_mlt, i); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
1001 | break; |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
1002 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
1003 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
1004 | xmlFree(key); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
1005 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1006 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1007 | cur = cur->next; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1008 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1009 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1010 | if (Config.units == NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1011 | Config.units = unit; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1012 | } else { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1013 | for (tmp = Config.units; tmp; tmp = tmp->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1014 | if (tmp->next == NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1015 | tmp->next = unit; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1016 | break; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1017 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1018 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1019 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1020 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1021 | return 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1022 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1023 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1024 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1025 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1026 | int parseBrewsystems(xmlDocPtr doc, xmlNodePtr cur) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1027 | { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1028 | cur = cur->xmlChildrenNode; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1029 | while (cur != NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1030 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"BREWSYSTEM"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1031 | parseBrewsystem(doc, cur); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1032 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1033 | cur = cur->next; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1034 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1035 | return 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1036 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1037 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1038 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1039 | int parseDevice(xmlDocPtr doc, xmlNodePtr cur) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1040 | { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1041 | xmlChar *key; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1042 | devices_list *device, *tmp; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1043 | int i, ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1044 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1045 | device = (devices_list *)malloc(sizeof(devices_list)); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1046 | device->next = NULL; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1047 | device->version = 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1048 | 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
|
1049 | 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
|
1050 | device->gpiopin = -1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1051 | device->timestamp = (time_t)0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1052 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1053 | cur = cur->xmlChildrenNode; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1054 | while (cur != NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1055 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1056 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1057 | if (xmlStrcmp(key, (const xmlChar *)"1")) { |
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 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1060 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1061 | device->version = 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1062 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1063 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1064 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1065 | device->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1066 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1067 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"TYPE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1068 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1069 | for (i = 0; i < 8; i++) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1070 | if (! xmlStrcmp(key, (const xmlChar *)DEVTYPE[i])) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1071 | device->type = i; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1072 | break; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1073 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1074 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1075 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1076 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1077 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"DIRECTION"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1078 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1079 | for (i = 0; i < 7; i++) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1080 | if (! xmlStrcmp(key, (const xmlChar *)DEVDIR[i])) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1081 | device->direction = i; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1082 | break; |
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 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1085 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1086 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1087 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"VALUE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1088 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1089 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1090 | device->value = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1091 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1092 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1093 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"OFFSET"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1094 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1095 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1096 | device->offset = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1097 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1098 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1099 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1100 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1101 | for (i = 0; i < 4; i++) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1102 | if (! xmlStrcmp(key, (const xmlChar *)DEVPRESENT[i])) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1103 | device->present = i; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1104 | break; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1105 | } |
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 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1108 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1109 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"ADDRESS"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1110 | device->address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1111 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1112 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"SUBDEVICE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1113 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1114 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1115 | device->subdevice = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1116 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1117 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1118 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"GPIOPIN"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1119 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1120 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1121 | device->gpiopin = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1122 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1123 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1124 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"DESCRIPTION"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1125 | device->description = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1126 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1127 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"INUSE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1128 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1129 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1130 | device->inuse = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1131 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1132 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1133 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"COMMENT"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1134 | device->comment = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1135 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1136 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"TIMESTAMP"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1137 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1138 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1139 | device->timestamp = (time_t)ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1140 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1141 | } |
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 | cur = cur->next; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1144 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1145 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1146 | if (Config.devices == NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1147 | Config.devices = device; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1148 | } else { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1149 | for (tmp = Config.devices; tmp; tmp = tmp->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1150 | if (tmp->next == NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1151 | tmp->next = device; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1152 | break; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1153 | } |
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 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1156 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1157 | return 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1158 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1159 | |
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 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1162 | int parseDevices(xmlDocPtr doc, xmlNodePtr cur) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1163 | { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1164 | cur = cur->xmlChildrenNode; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1165 | while (cur != NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1166 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"DEVICE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1167 | parseDevice(doc, cur); |
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 | cur = cur->next; |
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 | return 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1172 | } |
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 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1176 | #ifdef USE_SIMULATOR |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1177 | int parseSimulator(xmlDocPtr doc, xmlNodePtr cur) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1178 | { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1179 | xmlChar *key; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1180 | int ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1181 | float fval; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1182 | |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1183 | /* |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1184 | * First time, allocate memory and set defaults. |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1185 | */ |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1186 | if (! Config.simulator) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1187 | Config.simulator = (simulator_var *)malloc(sizeof(simulator_var)); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1188 | Config.simulator->room_temperature = Config.simulator->hlt_temperature = Config.simulator->hlt_heater_temp = \ |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1189 | Config.simulator->mlt_temperature = Config.simulator->mlt_heater_temp = 20.0; |
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1190 | Config.simulator->hlt_heater_volume = Config.simulator->mlt_heater_volume = 20; |
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1191 | Config.simulator->hlt_heater_power = Config.simulator->mlt_heater_power = 2000; |
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1192 | Config.simulator->hlt_heater_state = Config.simulator->mlt_heater_state = 0; |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1193 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1194 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1195 | cur = cur->xmlChildrenNode; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1196 | while (cur != NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1197 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOM_TEMPERATURE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1198 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1199 | if (sscanf((const char *)key, "%f", &fval) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1200 | Config.simulator->room_temperature = fval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1201 | xmlFree(key); |
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 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_TEMPERATURE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1204 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1205 | if (sscanf((const char *)key, "%f", &fval) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1206 | Config.simulator->hlt_temperature = fval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1207 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1208 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1209 | 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
|
1210 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1211 | if (sscanf((const char *)key, "%f", &fval) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1212 | Config.simulator->hlt_heater_temp = fval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1213 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1214 | } |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1215 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_VOLUME"))) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1216 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1217 | if (sscanf((const char *)key, "%d", &ival) == 1) |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1218 | Config.simulator->hlt_heater_volume = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1219 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1220 | } |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1221 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_POWER"))) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1222 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1223 | if (sscanf((const char *)key, "%d", &ival) == 1) |
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1224 | Config.simulator->hlt_heater_power = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1225 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1226 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1227 | 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
|
1228 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1229 | if (sscanf((const char *)key, "%d", &ival) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1230 | Config.simulator->hlt_heater_state = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1231 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1232 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1233 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_TEMPERATURE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1234 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1235 | if (sscanf((const char *)key, "%f", &fval) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1236 | Config.simulator->mlt_temperature = fval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1237 | xmlFree(key); |
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 | 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
|
1240 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1241 | if (sscanf((const char *)key, "%f", &fval) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1242 | Config.simulator->mlt_heater_temp = fval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1243 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1244 | } |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1245 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_VOLUME"))) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1246 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1247 | if (sscanf((const char *)key, "%d", &ival) == 1) |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1248 | Config.simulator->mlt_heater_volume = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1249 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1250 | } |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1251 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_POWER"))) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1252 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1253 | if (sscanf((const char *)key, "%d", &ival) == 1) |
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1254 | Config.simulator->mlt_heater_power = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1255 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1256 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1257 | 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
|
1258 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1259 | if (sscanf((const char *)key, "%d", &ival) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1260 | Config.simulator->mlt_heater_state = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1261 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1262 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1263 | cur = cur->next; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1264 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1265 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1266 | return 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1267 | } |
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
|
1268 | #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
|
1269 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1270 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1271 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1272 | 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
|
1273 | { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1274 | 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
|
1275 | 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
|
1276 | 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
|
1277 | 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
|
1278 | 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
|
1279 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1280 | 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
|
1281 | 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
|
1282 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1283 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1284 | * 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
|
1285 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1286 | 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
|
1287 | 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
|
1288 | } 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
|
1289 | 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
|
1290 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1291 | 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
|
1292 | 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
|
1293 | 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
|
1294 | 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
|
1295 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1296 | * 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
|
1297 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1298 | 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
|
1299 | 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
|
1300 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1301 | 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
|
1302 | 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
|
1303 | 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
|
1304 | 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
|
1305 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1306 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1307 | 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
|
1308 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1309 | 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
|
1310 | 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
|
1311 | 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
|
1312 | 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
|
1313 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1314 | 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
|
1315 | 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
|
1316 | 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
|
1317 | 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
|
1318 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1319 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1320 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1321 | * 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
|
1322 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1323 | 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
|
1324 | 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
|
1325 | 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
|
1326 | 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
|
1327 | 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
|
1328 | 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
|
1329 | 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
|
1330 | 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
|
1331 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1332 | 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
|
1333 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1334 | 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
|
1335 | 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
|
1336 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1337 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"LISTEN_PORT"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1338 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1339 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1340 | Config.my_port = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1341 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1342 | } |
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
|
1343 | 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
|
1344 | 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
|
1345 | 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
|
1346 | 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
|
1347 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1348 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOMTEMP_UUID"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1349 | if (Config.roomtemp == NULL) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1350 | Config.roomtemp = (sensor_var *)malloc(sizeof(sensor_var)); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1351 | Config.roomtemp->uuid[0] = '\0'; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1352 | Config.roomtemp->state = 1; // missing |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1353 | Config.roomtemp->value = 0; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1354 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1355 | 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
|
1356 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1357 | 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
|
1358 | 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
|
1359 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1360 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"BREWSYSTEMS"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1361 | parseBrewsystems(doc, cur); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1362 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1363 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"DEVICES"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1364 | parseDevices(doc, cur); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1365 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1366 | #ifdef USE_SIMULATOR |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1367 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"SIMULATOR"))) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1368 | parseSimulator(doc, cur); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1369 | } |
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
|
1370 | #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
|
1371 | 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
|
1372 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1373 | 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
|
1374 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1375 | 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
|
1376 | 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
|
1377 | |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1378 | #ifdef USE_SIMULATOR |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1379 | /* |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1380 | * 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
|
1381 | */ |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1382 | if (! Config.simulator) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1383 | Config.simulator = (simulator_var *)malloc(sizeof(simulator_var)); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1384 | syslog(LOG_NOTICE, "rdconfig() init a new simulator"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1385 | Config.simulator->room_temperature = Config.simulator->hlt_temperature = Config.simulator->hlt_heater_temp = \ |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1386 | Config.simulator->mlt_temperature = Config.simulator->mlt_heater_temp = 20.0; |
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1387 | Config.simulator->hlt_heater_volume = Config.simulator->mlt_heater_volume = 20; |
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1388 | Config.simulator->hlt_heater_power = Config.simulator->mlt_heater_power = 2000; |
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1389 | Config.simulator->hlt_heater_state = Config.simulator->mlt_heater_state = 0; |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1390 | } |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1391 | #endif |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1392 | |
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
|
1393 | 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
|
1394 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1395 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1396 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1397 |