Thu, 10 Dec 2015 17:31:45 +0100
Changed device outputs and status leds.
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 | } |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
554 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_TIME", "%d", Config.simulator->hlt_heater_time)) < 0) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
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 | } |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
558 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_SIZE", "%f", Config.simulator->hlt_heater_size)) < 0) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
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 | } |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
575 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_TIME", "%d", Config.simulator->mlt_heater_time)) < 0) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
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 | } |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
579 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_SIZE", "%f", Config.simulator->mlt_heater_size)) < 0) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
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 | |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
588 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_HLT_TEMP", "%f", Config.simulator->s_hlt_temp)) < 0) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
589 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
590 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
591 | } |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
592 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_MLT_TEMP", "%f", Config.simulator->s_mlt_temp)) < 0) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
593 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
594 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
595 | } |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
596 | |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
597 | if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
598 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
599 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
600 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
601 | } |
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
|
602 | #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
|
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 | * 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
|
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 ((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
|
608 | 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
|
609 | 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
|
610 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
612 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
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 (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
|
617 | 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
|
618 | } 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
|
619 | 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
|
620 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
622 | 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
|
623 | 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
|
624 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
626 | 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
|
627 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
629 | 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
|
630 | 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
|
631 | 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
|
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 | 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
|
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 | 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
|
636 | 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
|
637 | 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
|
638 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 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
|
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 | 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
|
645 | { |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
646 | 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
|
647 | 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
|
648 | 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
|
649 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
655 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
657 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
659 | 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
|
660 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
662 | 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
|
663 | 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
|
664 | 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
|
665 | 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
|
666 | 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
|
667 | 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
|
668 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
669 | 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
|
670 | 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
|
671 | 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
|
672 | 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
|
673 | 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
|
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 | 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
|
676 | 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
|
677 | 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
|
678 | 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
|
679 | 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
|
680 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
681 | 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
|
682 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
685 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
686 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
690 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
691 | 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
|
692 | 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
|
693 | 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
|
694 | 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
|
695 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
696 | 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
|
697 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
698 | 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
|
699 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
700 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
701 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
702 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
703 | /* |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
704 | * Parse a brewsystem |
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 | int parseBrewsystem(xmlDocPtr doc, xmlNodePtr cur) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
707 | { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
708 | xmlChar *key; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
709 | int i, ival; |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
710 | 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
|
711 | float fval; |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
712 | double kpval, kival, kdval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
713 | units_list *unit, *tmp; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
714 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
715 | unit = (units_list *)malloc(sizeof(units_list)); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
716 | unit->next = NULL; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
717 | unit->version = 1; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
718 | unit->uuid = unit->name = NULL; |
441 | 719 | unit->number = 0; |
720 | unit->active = 0; | |
449 | 721 | unit->hlt_sensor.uuid = xstrcpy((char *)"00000000-0000-0000-0000-000000000000"); |
722 | unit->hlt_sensor.state = 0; | |
723 | unit->hlt_sensor.value = 0; | |
724 | unit->mlt_sensor.uuid = xstrcpy((char *)"00000000-0000-0000-0000-000000000000"); | |
725 | unit->mlt_sensor.state = 0; | |
726 | unit->mlt_sensor.value = 0; | |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
727 | 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
|
728 | unit->hlt_heater.value = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
729 | unit->hlt_heater.delay = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
730 | 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
|
731 | unit->mlt_heater.value = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
732 | unit->mlt_heater.delay = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
733 | 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
|
734 | unit->mlt_pump.value = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
735 | unit->mlt_pump.delay = 0; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
736 | unit->hlt_heater_mltfirst = 0; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
737 | unit->pump_cycle = 7; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
738 | unit->pump_rest = 2; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
739 | unit->pump_premash = 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
740 | unit->pump_onmash = 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
741 | unit->pump_mashout = 0; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
742 | 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
|
743 | unit->pump_stop = 90.0; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
744 | unit->skip_add = 0; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
745 | unit->skip_remove = 0; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
746 | unit->skip_iodine = 0; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
747 | unit->iodine_time = 90; |
441 | 748 | unit->whirlpool = 1; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
749 | 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
|
750 | 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
|
751 | 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
|
752 | 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
|
753 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
754 | cur = cur->xmlChildrenNode; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
755 | while (cur != NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
756 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
757 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
758 | if (xmlStrcmp(key, (const xmlChar *)"1")) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
759 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
760 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
761 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
762 | unit->version = 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
763 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
764 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
765 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
766 | unit->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
767 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
768 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
769 | unit->name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
770 | } |
441 | 771 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUMBER"))) { |
772 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); | |
773 | if (sscanf((const char *)key, "%d", &ival) == 1) | |
774 | unit->number = ival; | |
775 | xmlFree(key); | |
776 | } | |
777 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"ACTIVE"))) { | |
778 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); | |
779 | if (sscanf((const char *)key, "%d", &ival) == 1) | |
780 | unit->active = ival; | |
781 | xmlFree(key); | |
782 | } | |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
783 | |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
784 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_SENSOR_UUID"))) { |
449 | 785 | 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
|
786 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
787 | 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
|
788 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
789 | if (sscanf((const char *)key, "%d", &ival) == 1) |
449 | 790 | unit->hlt_sensor.state = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
791 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
792 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
793 | 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
|
794 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
795 | if (sscanf((const char *)key, "%d", &ival) == 1) |
449 | 796 | unit->hlt_sensor.value = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
797 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
798 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
799 | |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
800 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_UUID"))) { |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
801 | 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
|
802 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
803 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_VALUE"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
804 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
805 | if (sscanf((const char *)key, "%d", &ival) == 1) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
806 | unit->hlt_heater.value = ival; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
807 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
808 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
809 | 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
|
810 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
811 | if (sscanf((const char *)key, "%d", &ival) == 1) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
812 | unit->hlt_heater.delay = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
813 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
814 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
815 | |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
816 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_MLTFIRST"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
817 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
818 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
819 | unit->hlt_heater_mltfirst = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
820 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
821 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
822 | |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
823 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_SENSOR_UUID"))) { |
449 | 824 | 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
|
825 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
826 | 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
|
827 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
828 | if (sscanf((const char *)key, "%d", &ival) == 1) |
449 | 829 | unit->mlt_sensor.state = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
830 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
831 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
832 | 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
|
833 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
834 | if (sscanf((const char *)key, "%d", &ival) == 1) |
449 | 835 | unit->mlt_sensor.value = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
836 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
837 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
838 | |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
839 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_UUID"))) { |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
840 | 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
|
841 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
842 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_VALUE"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
843 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
844 | if (sscanf((const char *)key, "%d", &ival) == 1) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
845 | unit->mlt_heater.value = ival; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
846 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
847 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
848 | 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
|
849 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
850 | if (sscanf((const char *)key, "%d", &ival) == 1) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
851 | unit->mlt_heater.delay = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
852 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
853 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
854 | |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
855 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_PUMP_UUID"))) { |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
856 | 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
|
857 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
858 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_PUMP_VALUE"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
859 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
860 | if (sscanf((const char *)key, "%d", &ival) == 1) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
861 | unit->mlt_pump.value = ival; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
862 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
863 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
864 | 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
|
865 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
866 | if (sscanf((const char *)key, "%d", &ival) == 1) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
867 | unit->mlt_pump.delay = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
868 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
869 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
870 | |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
871 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_CYCLE"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
872 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
873 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
874 | unit->pump_cycle = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
875 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
876 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
877 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_REST"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
878 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
879 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
880 | unit->pump_rest = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
881 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
882 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
883 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_PREMASH"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
884 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
885 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
886 | unit->pump_premash = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
887 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
888 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
889 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_ONMASH"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
890 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
891 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
892 | unit->pump_onmash = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
893 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
894 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
895 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_MASHOUT "))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
896 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
897 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
898 | unit->pump_mashout = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
899 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
900 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
901 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_ONBOIL"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
902 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
903 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
904 | unit->pump_onboil = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
905 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
906 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
907 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_STOP"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
908 | 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
|
909 | 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
|
910 | unit->pump_stop = fval; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
911 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
912 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
913 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"SKIP_ADD"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
914 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
915 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
916 | unit->skip_add = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
917 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
918 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
919 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"SKIP_REMOVE"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
920 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
921 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
922 | unit->skip_remove = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
923 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
924 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
925 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"SKIP_IODINE"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
926 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
927 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
928 | unit->skip_iodine = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
929 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
930 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
931 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"IODINE_TIME"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
932 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
933 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
934 | unit->iodine_time = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
935 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
936 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
937 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"WHIRLPOOL"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
938 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
939 | for (i = 0; i < 2; i++) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
940 | if (! xmlStrcmp(key, (const xmlChar *)WHIRLPOOL_TYPE[i])) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
941 | unit->whirlpool = i; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
942 | break; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
943 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
944 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
945 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
946 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
947 | |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
948 | 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
|
949 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
950 | sscanf((const char *)key, "%lf", &kpval); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
951 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
952 | } |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
953 | 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
|
954 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
955 | sscanf((const char *)key, "%lf", &kival); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
956 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
957 | } |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
958 | 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
|
959 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
960 | sscanf((const char *)key, "%lf", &kdval); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
961 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
962 | } |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
963 | 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
|
964 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
965 | if (sscanf((const char *)key, "%ld", &lval) == 1) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
966 | PID_setSampleTime(unit->PID_hlt, lval); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
967 | PID_setTunings(unit->PID_hlt, kpval, kival, kdval); |
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 | xmlFree(key); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
970 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
971 | 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
|
972 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
973 | for (i = 0; i < 2; i++) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
974 | if (! xmlStrcmp(key, (const xmlChar *)PIDDIRECTION[i])) { |
448 | 975 | PID_setDirection(unit->PID_hlt, i); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
976 | break; |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
977 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
978 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
979 | xmlFree(key); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
980 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
981 | |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
982 | 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
|
983 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
984 | sscanf((const char *)key, "%lf", &kpval); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
985 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
986 | } |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
987 | 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
|
988 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
989 | sscanf((const char *)key, "%lf", &kival); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
990 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
991 | } |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
992 | 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
|
993 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
994 | sscanf((const char *)key, "%lf", &kdval); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
995 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
996 | } |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
997 | 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
|
998 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
999 | if (sscanf((const char *)key, "%ld", &lval) == 1) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
1000 | PID_setSampleTime(unit->PID_mlt, lval); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
1001 | PID_setTunings(unit->PID_mlt, kpval, kival, kdval); |
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 | xmlFree(key); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
1004 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
1005 | 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
|
1006 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
1007 | for (i = 0; i < 2; i++) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
1008 | if (! xmlStrcmp(key, (const xmlChar *)PIDDIRECTION[i])) { |
448 | 1009 | PID_setDirection(unit->PID_mlt, i); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
1010 | break; |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
1011 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
1012 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
1013 | xmlFree(key); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
1014 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1015 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1016 | cur = cur->next; |
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 | if (Config.units == NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1020 | Config.units = unit; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1021 | } else { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1022 | for (tmp = Config.units; tmp; tmp = tmp->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1023 | if (tmp->next == NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1024 | tmp->next = unit; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1025 | break; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1026 | } |
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 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1029 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1030 | return 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1031 | } |
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 | |
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 | int parseBrewsystems(xmlDocPtr doc, xmlNodePtr cur) |
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 | cur = cur->xmlChildrenNode; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1038 | while (cur != NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1039 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"BREWSYSTEM"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1040 | parseBrewsystem(doc, cur); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1041 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1042 | cur = cur->next; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1043 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1044 | return 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1045 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1046 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1047 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1048 | int parseDevice(xmlDocPtr doc, xmlNodePtr cur) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1049 | { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1050 | xmlChar *key; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1051 | devices_list *device, *tmp; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1052 | int i, ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1053 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1054 | device = (devices_list *)malloc(sizeof(devices_list)); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1055 | device->next = NULL; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1056 | device->version = 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1057 | 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
|
1058 | 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
|
1059 | device->gpiopin = -1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1060 | device->timestamp = (time_t)0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1061 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1062 | cur = cur->xmlChildrenNode; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1063 | while (cur != NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1064 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1065 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1066 | if (xmlStrcmp(key, (const xmlChar *)"1")) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1067 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1068 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1069 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1070 | device->version = 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1071 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1072 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1073 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1074 | device->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1075 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1076 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"TYPE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1077 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1078 | for (i = 0; i < 8; i++) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1079 | if (! xmlStrcmp(key, (const xmlChar *)DEVTYPE[i])) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1080 | device->type = i; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1081 | break; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1082 | } |
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 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1085 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1086 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"DIRECTION"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1087 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1088 | for (i = 0; i < 7; i++) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1089 | if (! xmlStrcmp(key, (const xmlChar *)DEVDIR[i])) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1090 | device->direction = i; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1091 | break; |
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 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1094 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1095 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1096 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"VALUE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1097 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1098 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1099 | device->value = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1100 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1101 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1102 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"OFFSET"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1103 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1104 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1105 | device->offset = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1106 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1107 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1108 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1109 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1110 | for (i = 0; i < 4; i++) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1111 | if (! xmlStrcmp(key, (const xmlChar *)DEVPRESENT[i])) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1112 | device->present = i; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1113 | break; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1114 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1115 | } |
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 *)"ADDRESS"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1119 | device->address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1120 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1121 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"SUBDEVICE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1122 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1123 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1124 | device->subdevice = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1125 | xmlFree(key); |
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 *)"GPIOPIN"))) { |
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->gpiopin = 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 *)"DESCRIPTION"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1134 | device->description = (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 *)"INUSE"))) { |
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->inuse = 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 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"COMMENT"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1143 | device->comment = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
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 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"TIMESTAMP"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1146 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1147 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1148 | device->timestamp = (time_t)ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1149 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1150 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1151 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1152 | cur = cur->next; |
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 | if (Config.devices == NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1156 | Config.devices = device; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1157 | } else { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1158 | for (tmp = Config.devices; tmp; tmp = tmp->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1159 | if (tmp->next == NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1160 | tmp->next = device; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1161 | break; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1162 | } |
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 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1165 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1166 | return 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1167 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1168 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1169 | |
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 | int parseDevices(xmlDocPtr doc, xmlNodePtr cur) |
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 | cur = cur->xmlChildrenNode; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1174 | while (cur != NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1175 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"DEVICE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1176 | parseDevice(doc, cur); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1177 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1178 | cur = cur->next; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1179 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1180 | return 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1181 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1182 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1183 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1184 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1185 | #ifdef USE_SIMULATOR |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1186 | int parseSimulator(xmlDocPtr doc, xmlNodePtr cur) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1187 | { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1188 | xmlChar *key; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1189 | int ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1190 | float fval; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1191 | |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1192 | /* |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1193 | * First time, allocate memory and set defaults. |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1194 | */ |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1195 | if (! Config.simulator) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1196 | Config.simulator = (simulator_var *)malloc(sizeof(simulator_var)); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1197 | Config.simulator->room_temperature = Config.simulator->hlt_temperature = Config.simulator->hlt_heater_temp = \ |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1198 | Config.simulator->mlt_temperature = Config.simulator->mlt_heater_temp = \ |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1199 | Config.simulator->s_hlt_temp = Config.simulator->s_mlt_temp = 0.0; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1200 | Config.simulator->hlt_heater_size = Config.simulator->mlt_heater_size = 0.0; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1201 | Config.simulator->hlt_heater_time = Config.simulator->mlt_heater_time = Config.simulator->hlt_heater_state = Config.simulator->mlt_heater_state = 0; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1202 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1203 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1204 | cur = cur->xmlChildrenNode; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1205 | while (cur != NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1206 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOM_TEMPERATURE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1207 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1208 | if (sscanf((const char *)key, "%f", &fval) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1209 | Config.simulator->room_temperature = fval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1210 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1211 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1212 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_TEMPERATURE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1213 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1214 | if (sscanf((const char *)key, "%f", &fval) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1215 | Config.simulator->hlt_temperature = fval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1216 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1217 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1218 | 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
|
1219 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1220 | if (sscanf((const char *)key, "%f", &fval) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1221 | Config.simulator->hlt_heater_temp = fval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1222 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1223 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1224 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_TIME"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1225 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1226 | if (sscanf((const char *)key, "%d", &ival) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1227 | Config.simulator->hlt_heater_time = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1228 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1229 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1230 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_SIZE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1231 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1232 | if (sscanf((const char *)key, "%f", &fval) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1233 | Config.simulator->hlt_heater_size = fval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1234 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1235 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1236 | 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
|
1237 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1238 | if (sscanf((const char *)key, "%d", &ival) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1239 | Config.simulator->hlt_heater_state = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1240 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1241 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1242 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_TEMPERATURE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1243 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1244 | if (sscanf((const char *)key, "%f", &fval) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1245 | Config.simulator->mlt_temperature = fval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1246 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1247 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1248 | 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
|
1249 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1250 | if (sscanf((const char *)key, "%f", &fval) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1251 | Config.simulator->mlt_heater_temp = fval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1252 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1253 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1254 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_TIME"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1255 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1256 | if (sscanf((const char *)key, "%d", &ival) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1257 | Config.simulator->mlt_heater_time = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1258 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1259 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1260 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_SIZE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1261 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1262 | if (sscanf((const char *)key, "%f", &fval) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1263 | Config.simulator->mlt_heater_size = fval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1264 | xmlFree(key); |
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 | 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
|
1267 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1268 | if (sscanf((const char *)key, "%d", &ival) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1269 | Config.simulator->mlt_heater_state = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1270 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1271 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1272 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"S_HLT_TEMP"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1273 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1274 | if (sscanf((const char *)key, "%f", &fval) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1275 | Config.simulator->s_hlt_temp = fval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1276 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1277 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1278 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"S_MLT_TEMP"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1279 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1280 | if (sscanf((const char *)key, "%f", &fval) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1281 | Config.simulator->s_mlt_temp = fval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1282 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1283 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1284 | cur = cur->next; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1285 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1286 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1287 | return 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1288 | } |
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
|
1289 | #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
|
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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
1294 | { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1295 | 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
|
1296 | 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
|
1297 | 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
|
1298 | 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
|
1299 | 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
|
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 | 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
|
1302 | 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
|
1303 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
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 | 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
|
1308 | 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
|
1309 | } 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
|
1310 | 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
|
1311 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
1313 | 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
|
1314 | 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
|
1315 | 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
|
1316 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
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 | 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
|
1320 | 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
|
1321 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
1323 | 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
|
1324 | 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
|
1325 | 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
|
1326 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
1329 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
1331 | 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
|
1332 | 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
|
1333 | 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
|
1334 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
1336 | 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
|
1337 | 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
|
1338 | 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
|
1339 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1340 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1341 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1342 | * 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
|
1343 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
1345 | 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
|
1346 | 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
|
1347 | 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
|
1348 | 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
|
1349 | 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
|
1350 | 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
|
1351 | 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
|
1352 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1353 | 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
|
1354 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1355 | 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
|
1356 | 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
|
1357 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1358 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"LISTEN_PORT"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1359 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1360 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1361 | Config.my_port = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1362 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1363 | } |
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
|
1364 | 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
|
1365 | 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
|
1366 | 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
|
1367 | 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
|
1368 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1369 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOMTEMP_UUID"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1370 | if (Config.roomtemp == NULL) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1371 | Config.roomtemp = (sensor_var *)malloc(sizeof(sensor_var)); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1372 | Config.roomtemp->uuid[0] = '\0'; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1373 | Config.roomtemp->state = 1; // missing |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1374 | Config.roomtemp->value = 0; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1375 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1376 | 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
|
1377 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1378 | 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
|
1379 | 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
|
1380 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1381 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"BREWSYSTEMS"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1382 | parseBrewsystems(doc, cur); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1383 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1384 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"DEVICES"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1385 | parseDevices(doc, cur); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1386 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1387 | #ifdef USE_SIMULATOR |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1388 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"SIMULATOR"))) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1389 | parseSimulator(doc, cur); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1390 | } |
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
|
1391 | #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
|
1392 | 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
|
1393 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
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 | 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
|
1397 | 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
|
1398 | |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1399 | #ifdef USE_SIMULATOR |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1400 | /* |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1401 | * 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
|
1402 | */ |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1403 | if (! Config.simulator) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1404 | Config.simulator = (simulator_var *)malloc(sizeof(simulator_var)); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1405 | syslog(LOG_NOTICE, "rdconfig() init a new simulator"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1406 | Config.simulator->room_temperature = Config.simulator->hlt_temperature = Config.simulator->hlt_heater_temp = \ |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1407 | Config.simulator->mlt_temperature = Config.simulator->mlt_heater_temp = \ |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1408 | Config.simulator->s_hlt_temp = Config.simulator->s_mlt_temp = 20.0; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1409 | Config.simulator->hlt_heater_size = Config.simulator->mlt_heater_size = 0.0; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1410 | Config.simulator->hlt_heater_time = Config.simulator->mlt_heater_time = Config.simulator->hlt_heater_state = Config.simulator->mlt_heater_state = 0; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1411 | } |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1412 | #endif |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1413 | |
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
|
1414 | 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
|
1415 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1416 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1417 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1418 |