Wed, 25 Nov 2015 22:49:35 +0100
Brewco first phase development configuration structure.
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /***************************************************************************** |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | * Copyright (C) 2015 |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * Michiel Broek <mbroek at mbse dot eu> |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * This file is part of the mbsePi-apps |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * This is free software; you can redistribute it and/or modify it |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * under the terms of the GNU General Public License as published by the |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * Free Software Foundation; either version 2, or (at your option) any |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * later version. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * mbsePi-apps is distributed in the hope that it will be useful, but |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | * General Public License for more details. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | * along with ThermFerm; see the file COPYING. If not, write to the Free |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | *****************************************************************************/ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | #include "rdconfig.h" |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | #include "brewco.h" |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | #include "futil.h" |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | #include "xutil.h" |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
28 | int debug = TRUE; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | sys_config Config; /* System configuration */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | #define MY_ENCODING "utf-8" |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | const char TEMPSTATE[3][8] = { "OK", "MISSING", "ERROR" }; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
34 | const char DEVTYPE[8][6] = { "NA", "W1", "GPIO", "RC433", "DHT", "I2C", "SPI", "SIM" }; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
35 | const char DEVPRESENT[4][6] = { "UNDEF", "NO", "YES", "ERROR" }; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
36 | const char DEVDIR[7][11] = { "UNDEF", "IN_BIN", "OUT_BIN", "IN_ANALOG", "OUT_ANALOG", "OUT_PWM", "INTERN" }; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
37 | const char PIDMODE[3][5] = { "NONE", "AUTO", "BOO" }; |
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
|
38 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
39 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
40 | 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
|
41 | { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
42 | units_list *unit; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
43 | devices_list *device; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
44 | #ifdef USE_SIMULATOR |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
45 | simulator_list *simulator; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
46 | #endif |
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
|
47 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
49 | 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
|
50 | 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
|
51 | |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
52 | 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
|
53 | Config.tempFormat = 'C'; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
54 | if (Config.temp_address) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
55 | free(Config.temp_address); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
56 | if (Config.hum_address) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
57 | free(Config.hum_address); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
58 | Config.temp_address = Config.hum_address = NULL; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
59 | Config.temp_value = 20000; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
60 | Config.temp_state = Config.hum_state = 1; // missing |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
61 | Config.hum_value = 50000; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
62 | Config.lcd_cols = 20; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
63 | 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
|
64 | |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
65 | for (unit = Config.units; unit; unit = unit->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
66 | if (unit->uuid) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
67 | free(unit->uuid); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
68 | if (unit->name) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
69 | free(unit->name); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
70 | if (unit->hlt_sensor_address) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
71 | free(unit->hlt_sensor_address); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
72 | if (unit->mlt_sensor_address) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
73 | free(unit->mlt_sensor_address); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
74 | if (unit->hlt_heater_address) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
75 | free(unit->hlt_heater_address); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
76 | if (unit->mlt_heater_address) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
77 | free(unit->mlt_heater_address); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
78 | if (unit->mlt_pump_address) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
79 | free(unit->mlt_pump_address); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
80 | free(unit); |
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 | Config.units = NULL; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
83 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
84 | for (device = Config.devices; device; device = device->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
85 | if (device->uuid) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
86 | free(device->uuid); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
87 | if (device->address) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
88 | free(device->address); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
89 | if (device->description) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
90 | free(device->description); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
91 | if (device->comment) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
92 | free(device->comment); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
93 | free(device); |
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 | Config.devices = NULL; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
96 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
97 | #ifdef USE_SIMULATOR |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
98 | for (simulator = Config.simulators; simulator; simulator = simulator->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
99 | if (simulator->uuid) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
100 | free(simulator->uuid); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
101 | if (simulator->name) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
102 | free(simulator->name); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
103 | free(simulator); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
104 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
105 | Config.simulators = 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
|
106 | #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
|
107 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
112 | 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
|
113 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
114 | 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
|
115 | 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
|
116 | 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
|
117 | 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
|
118 | xmlBufferPtr buf; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
119 | units_list *unit; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
120 | devices_list *device; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
121 | #ifdef USE_SIMULATOR |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
122 | simulator_list *simulator; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
123 | #endif |
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
|
124 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
125 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
127 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
129 | 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
|
130 | 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
|
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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
135 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
137 | 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
|
138 | 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
|
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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
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 = 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
|
145 | 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
|
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 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
|
151 | * 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
|
152 | * 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
|
153 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
155 | 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
|
156 | 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
|
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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
161 | * 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
|
162 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
164 | 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
|
165 | 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
|
166 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
169 | * 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
|
170 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
171 | 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
|
172 | 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
|
173 | 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
|
174 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
176 | 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
|
177 | 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
|
178 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
179 | 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
|
180 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
181 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
182 | } |
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
|
183 | 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
|
184 | 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
|
185 | 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
|
186 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
187 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_ADDRESS", "%s", Config.temp_address)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
188 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
189 | return 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
|
190 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
191 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_STATE", "%d", Config.temp_state)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
192 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
193 | return 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
|
194 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
195 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_VALUE", "%d", Config.temp_value)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
196 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
197 | return 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
|
198 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
199 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HUM_ADDRESS", "%s", Config.hum_address)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
200 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
201 | return 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
|
202 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
203 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HUM_STATE", "%d", Config.hum_state)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
204 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
205 | return 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
|
206 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
207 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HUM_VALUE", "%d", Config.hum_value)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
208 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
209 | return 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
|
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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
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 = 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
|
216 | 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
|
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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
221 | * 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
|
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 | 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
|
224 | 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
|
225 | 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
|
226 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
228 | 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
|
229 | 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
|
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 | 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
|
232 | 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
|
233 | 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
|
234 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
236 | 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
|
237 | 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
|
238 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
239 | 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
|
240 | 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
|
241 | 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
|
242 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
243 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
244 | * 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
|
245 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
246 | 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
|
247 | 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
|
248 | 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
|
249 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
250 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
251 | * 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
|
252 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
253 | 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
|
254 | 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
|
255 | 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
|
256 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
257 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
258 | /* |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
259 | * Brewsystems |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
260 | */ |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
261 | if (Config.units) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
262 | if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "BREWSYSTEMS")) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
263 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
264 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
265 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
266 | for (unit = Config.units; unit; unit = unit->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
267 | /* |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
268 | * 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
|
269 | * are written to a state file. |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
270 | */ |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
271 | if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "BREWSYSTEM")) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
272 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
273 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
274 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
275 | 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
|
276 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
277 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
278 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
279 | 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
|
280 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
281 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
282 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
283 | 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
|
284 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
285 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
286 | } |
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 | if (unit->hlt_sensor_address) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
289 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_SENSOR_ADDRESS", "%s", unit->hlt_sensor_address)) < 0)) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
290 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
291 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
292 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
293 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_SENSOR_STATE", "%d", unit->hlt_sensor_state)) < 0)) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
294 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
295 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
296 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
297 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_SENSOR_VALUE", "%d", unit->hlt_sensor_value)) < 0)) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
298 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
299 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
300 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
301 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
302 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
303 | if (unit->hlt_heater_address) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
304 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_ADDRESS", "%s", unit->hlt_heater_address)) < 0)) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
305 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
306 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
307 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
308 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_STATE", "%d", unit->hlt_heater_state)) < 0)) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
309 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
310 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
311 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
312 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_DELAY", "%d", unit->hlt_heater_delay)) < 0)) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
313 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
314 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
315 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
316 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
317 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
318 | if (unit->mlt_sensor_address) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
319 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_SENSOR_ADDRESS", "%s", unit->mlt_sensor_address)) < 0)) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
320 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
321 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
322 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
323 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_SENSOR_STATE", "%d", unit->mlt_sensor_state)) < 0)) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
324 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
325 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
326 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
327 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_SENSOR_VALUE", "%d", unit->mlt_sensor_value)) < 0)) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
328 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
329 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
330 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
331 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
332 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
333 | if (unit->mlt_heater_address) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
334 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_ADDRESS", "%s", unit->mlt_heater_address)) < 0)) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
335 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
336 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
337 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
338 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_STATE", "%d", unit->mlt_heater_state)) < 0)) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
339 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
340 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
341 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
342 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_DELAY", "%d", unit->mlt_heater_delay)) < 0)) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
343 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
344 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
345 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
346 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
347 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
348 | if (unit->mlt_pump_address) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
349 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_PUMP_ADDRESS", "%s", unit->mlt_pump_address)) < 0)) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
350 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
351 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
352 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
353 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_PUMP_STATE", "%d", unit->mlt_pump_state)) < 0)) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
354 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
355 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
356 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
357 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_PUMP_DELAY", "%d", unit->mlt_pump_delay)) < 0)) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
358 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
359 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
360 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
361 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
362 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
363 | if (unit->PID_hlt) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
364 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_IMAX", "%.2f", unit->PID_hlt->iMax)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
365 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
366 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
367 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
368 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_IGAIN", "%.2f", unit->PID_hlt->iGain)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
369 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
370 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
371 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
372 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_PGAIN", "%.2f", unit->PID_hlt->pGain)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
373 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
374 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
375 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
376 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_DGAIN", "%.2f", unit->PID_hlt->dGain)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
377 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
378 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
379 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
380 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_INPUT", "%.2f", unit->PID_hlt->Input)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
381 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
382 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
383 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
384 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_ERR", "%.2f", unit->PID_hlt->Err)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
385 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
386 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
387 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
388 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_ERRLAST", "%.2f", unit->PID_hlt->ErrLast)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
389 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
390 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
391 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
392 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_ISTATE", "%.2f", unit->PID_hlt->iState)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
393 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
394 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
395 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
396 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_SETP", "%.2f", unit->PID_hlt->SetP)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
397 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
398 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
399 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
400 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_OUTP", "%.2f", unit->PID_hlt->OutP)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
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 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
404 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_MODE", "%s", PIDMODE[unit->PID_hlt->Mode])) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
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 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
408 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_TYPE", "HEAT")) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
409 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
410 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
411 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
412 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
413 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
414 | if (unit->PID_mlt) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
415 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_IMAX", "%.2f", unit->PID_mlt->iMax)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
416 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
417 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
418 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
419 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_IGAIN", "%.2f", unit->PID_mlt->iGain)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
420 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
421 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
422 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
423 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_PGAIN", "%.2f", unit->PID_mlt->pGain)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
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 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
427 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_DGAIN", "%.2f", unit->PID_mlt->dGain)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
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 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
431 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_INPUT", "%.2f", unit->PID_mlt->Input)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
432 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
433 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
434 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
435 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_ERR", "%.2f", unit->PID_mlt->Err)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
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 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_ERRLAST", "%.2f", unit->PID_mlt->ErrLast)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
440 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
441 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
442 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
443 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_ISTATE", "%.2f", unit->PID_mlt->iState)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
444 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
445 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
446 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
447 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_SETP", "%.2f", unit->PID_mlt->SetP)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
448 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
449 | return 1; |
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 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_OUTP", "%.2f", unit->PID_mlt->OutP)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
452 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
453 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
454 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
455 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_MODE", "%s", PIDMODE[unit->PID_mlt->Mode])) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
456 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
457 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
458 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
459 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_TYPE", "HEAT")) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
460 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
461 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
462 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
463 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
464 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
465 | if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
466 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
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 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
470 | if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
471 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
472 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
473 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
474 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
475 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
476 | if (Config.devices) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
477 | if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "DEVICES")) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
478 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
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 | #ifdef HAVE_WIRINGPI_H |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
482 | piLock(LOCK_DEVICES); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
483 | #endif |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
484 | for (device = Config.devices; device; device = device->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
485 | if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "DEVICE")) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
486 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
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 "VERSION", "%d", device->version)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
490 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
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 "UUID", "%s", device->uuid)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
494 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
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 "TYPE", "%s", DEVTYPE[device->type])) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
498 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
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 "DIRECTION", "%s", DEVDIR[device->direction])) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
502 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
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 "VALUE", "%d", device->value)) < 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 "OFFSET", "%d", device->offset)) < 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 "PRESENT", "%s", DEVPRESENT[device->present])) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
514 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
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 "ADDRESS", "%s", device->address)) < 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 = 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
|
522 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
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 | 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
|
526 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
527 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
528 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
529 | 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
|
530 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
531 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
532 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
533 | 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
|
534 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
535 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
536 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
537 | 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
|
538 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
539 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
540 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
541 | 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
|
542 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
543 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
544 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
545 | if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
546 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
547 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
548 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
549 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
550 | #ifdef HAVE_WIRINGPI_H |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
551 | piUnlock(LOCK_DEVICES); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
552 | #endif |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
553 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
554 | if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
555 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
556 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
557 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
558 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
559 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
560 | #ifdef USE_SIMULATOR |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
561 | if (Config.simulators) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
562 | if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "SIMULATORS")) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
563 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
564 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
565 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
566 | for (simulator = Config.simulators; simulator; simulator = simulator->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
567 | if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "SIMULATOR")) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
568 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
569 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
570 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
571 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "VERSION", "%d", simulator->version)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
572 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
573 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
574 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
575 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", simulator->uuid)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
576 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
577 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
578 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
579 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", simulator->name)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
580 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
581 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
582 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
583 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
584 | if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
585 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
586 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
587 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
588 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
589 | if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
590 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
591 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
592 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
593 | } |
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
|
594 | #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
|
595 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
596 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
597 | * 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
|
598 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
599 | 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
|
600 | 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
|
601 | 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
|
602 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
607 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
609 | 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
|
610 | } 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
|
611 | 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
|
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 | 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
|
614 | 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
|
615 | 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
|
616 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
618 | 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
|
619 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
621 | 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
|
622 | 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
|
623 | 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
|
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 | 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
|
626 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
628 | 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
|
629 | 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
|
630 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 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
|
632 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
633 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
634 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
635 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
637 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | int rc; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
639 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | rc = do_wrconfig(); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
641 | 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
|
642 | 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
|
643 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
644 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
645 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
646 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
647 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
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 | 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
|
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 | 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
|
653 | 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
|
654 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
656 | 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
|
657 | 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
|
658 | 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
|
659 | 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
|
660 | 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
|
661 | 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
|
662 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 *)"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
|
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_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
|
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 *)"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
|
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, "%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
|
672 | 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
|
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 | 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
|
676 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
677 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
678 | 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
|
679 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
680 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
681 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
682 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
684 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
686 | 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
|
687 | 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
|
688 | 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
|
689 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
690 | 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
|
691 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
693 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
694 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
695 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
696 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
697 | /* |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
698 | * Parse a brewsystem |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
699 | */ |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
700 | int parseBrewsystem(xmlDocPtr doc, xmlNodePtr cur) |
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 | xmlChar *key; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
703 | int i, ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
704 | float val; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
705 | units_list *unit, *tmp; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
706 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
707 | unit = (units_list *)malloc(sizeof(units_list)); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
708 | unit->next = NULL; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
709 | unit->version = 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
710 | unit->uuid = unit->name = unit->hlt_sensor_address = unit->hlt_heater_address = unit->mlt_sensor_address = \ |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
711 | unit->mlt_heater_address = unit->mlt_pump_address = NULL; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
712 | unit->hlt_sensor_state = unit->mlt_sensor_state = 1; // missing |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
713 | unit->hlt_heater_state = unit->mlt_heater_state = unit->mlt_pump_state = 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
714 | unit->hlt_heater_delay = unit->mlt_heater_delay = unit->mlt_pump_delay = 20; /* 5 minutes delay */ |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
715 | 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
|
716 | unit->PID_mlt = (pid_var *)malloc(sizeof(pid_var)); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
717 | InitPID(unit->PID_hlt); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
718 | InitPID(unit->PID_mlt); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
719 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
720 | cur = cur->xmlChildrenNode; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
721 | while (cur != NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
722 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
723 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
724 | if (xmlStrcmp(key, (const xmlChar *)"1")) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
725 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
726 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
727 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
728 | unit->version = 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
729 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
730 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
731 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
732 | unit->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
733 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
734 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
735 | unit->name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
736 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
737 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
738 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_SENSOR_ADDRESS"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
739 | unit->hlt_sensor_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
740 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
741 | 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
|
742 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
743 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
744 | unit->hlt_sensor_state = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
745 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
746 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
747 | 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
|
748 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
749 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
750 | unit->hlt_sensor_value = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
751 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
752 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
753 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_ADDRESS"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
754 | unit->hlt_heater_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
755 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
756 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_DELAY"))) { |
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 (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
759 | unit->hlt_heater_delay = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
760 | xmlFree(key); |
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 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
763 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_SENSOR_ADDRESS"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
764 | unit->mlt_sensor_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
765 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
766 | 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
|
767 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
768 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
769 | unit->mlt_sensor_state = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
770 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
771 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
772 | 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
|
773 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
774 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
775 | unit->mlt_sensor_value = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
776 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
777 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
778 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_ADDRESS"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
779 | unit->mlt_heater_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
780 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
781 | 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
|
782 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
783 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
784 | unit->mlt_heater_delay = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
785 | xmlFree(key); |
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 *)"MLT_PUMP_ADDRESS"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
788 | unit->mlt_pump_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
789 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
790 | 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
|
791 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
792 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
793 | unit->mlt_pump_delay = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
794 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
795 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
796 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
797 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_IMAX"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
798 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
799 | if (sscanf((const char *)key, "%f", &val) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
800 | unit->PID_hlt->iMax = val; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
801 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
802 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
803 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_IGAIN"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
804 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
805 | if (sscanf((const char *)key, "%f", &val) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
806 | unit->PID_hlt->iGain = val; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
807 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
808 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
809 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_PGAIN"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
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, "%f", &val) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
812 | unit->PID_hlt->pGain = val; |
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 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_DGAIN"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
816 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
817 | if (sscanf((const char *)key, "%f", &val) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
818 | unit->PID_hlt->dGain = val; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
819 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
820 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
821 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_INPUT"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
822 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
823 | if (sscanf((const char *)key, "%f", &val) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
824 | unit->PID_hlt->Input = val; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
825 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
826 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
827 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_ERR"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
828 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
829 | if (sscanf((const char *)key, "%f", &val) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
830 | unit->PID_hlt->Err = val; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
831 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
832 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
833 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_ERRLAST"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
834 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
835 | if (sscanf((const char *)key, "%f", &val) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
836 | unit->PID_hlt->ErrLast = val; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
837 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
838 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
839 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_ISTATE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
840 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
841 | if (sscanf((const char *)key, "%f", &val) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
842 | unit->PID_hlt->iState = val; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
843 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
844 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
845 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_SETP"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
846 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
847 | if (sscanf((const char *)key, "%f", &val) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
848 | unit->PID_hlt->SetP = val; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
849 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
850 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
851 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_OUTP"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
852 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
853 | if (sscanf((const char *)key, "%f", &val) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
854 | unit->PID_hlt->OutP = val; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
855 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
856 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
857 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_MODE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
858 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
859 | for (i = 0; i < 3; i++) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
860 | if (! xmlStrcmp(key, (const xmlChar *)PIDMODE[i])) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
861 | unit->PID_hlt->Mode = i; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
862 | break; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
863 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
864 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
865 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
866 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
867 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
868 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_IMAX"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
869 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
870 | if (sscanf((const char *)key, "%f", &val) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
871 | unit->PID_mlt->iMax = val; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
872 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
873 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
874 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_IGAIN"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
875 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
876 | if (sscanf((const char *)key, "%f", &val) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
877 | unit->PID_mlt->iGain = val; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
878 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
879 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
880 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_PGAIN"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
881 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
882 | if (sscanf((const char *)key, "%f", &val) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
883 | unit->PID_mlt->pGain = val; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
884 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
885 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
886 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_DGAIN"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
887 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
888 | if (sscanf((const char *)key, "%f", &val) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
889 | unit->PID_mlt->dGain = val; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
890 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
891 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
892 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_INPUT"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
893 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
894 | if (sscanf((const char *)key, "%f", &val) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
895 | unit->PID_mlt->Input = val; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
896 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
897 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
898 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_ERR"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
899 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
900 | if (sscanf((const char *)key, "%f", &val) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
901 | unit->PID_mlt->Err = val; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
902 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
903 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
904 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_ERRLAST"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
905 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
906 | if (sscanf((const char *)key, "%f", &val) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
907 | unit->PID_mlt->ErrLast = val; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
908 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
909 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
910 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_ISTATE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
911 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
912 | if (sscanf((const char *)key, "%f", &val) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
913 | unit->PID_mlt->iState = val; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
914 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
915 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
916 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_SETP"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
917 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
918 | if (sscanf((const char *)key, "%f", &val) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
919 | unit->PID_mlt->SetP = val; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
920 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
921 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
922 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_OUTP"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
923 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
924 | if (sscanf((const char *)key, "%f", &val) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
925 | unit->PID_mlt->OutP = val; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
926 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
927 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
928 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_MODE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
929 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
930 | for (i = 0; i < 3; i++) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
931 | if (! xmlStrcmp(key, (const xmlChar *)PIDMODE[i])) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
932 | unit->PID_mlt->Mode = i; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
933 | break; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
934 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
935 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
936 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
937 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
938 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
939 | cur = cur->next; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
940 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
941 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
942 | if (Config.units == NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
943 | Config.units = unit; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
944 | } else { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
945 | for (tmp = Config.units; tmp; tmp = tmp->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
946 | if (tmp->next == NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
947 | tmp->next = unit; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
948 | break; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
949 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
950 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
951 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
952 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
953 | return 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
954 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
955 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
956 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
957 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
958 | int parseBrewsystems(xmlDocPtr doc, xmlNodePtr cur) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
959 | { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
960 | cur = cur->xmlChildrenNode; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
961 | while (cur != NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
962 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"BREWSYSTEM"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
963 | parseBrewsystem(doc, cur); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
964 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
965 | cur = cur->next; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
966 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
967 | return 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
968 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
969 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
970 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
971 | int parseDevice(xmlDocPtr doc, xmlNodePtr cur) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
972 | { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
973 | xmlChar *key; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
974 | devices_list *device, *tmp; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
975 | int i, ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
976 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
977 | device = (devices_list *)malloc(sizeof(devices_list)); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
978 | device->next = NULL; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
979 | device->version = 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
980 | 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
|
981 | 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
|
982 | device->gpiopin = -1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
983 | device->timestamp = (time_t)0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
984 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
985 | cur = cur->xmlChildrenNode; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
986 | while (cur != NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
987 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
988 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
989 | if (xmlStrcmp(key, (const xmlChar *)"1")) { |
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 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
992 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
993 | device->version = 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
994 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
995 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
996 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
997 | device->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
998 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
999 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"TYPE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1000 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1001 | for (i = 0; i < 8; i++) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1002 | if (! xmlStrcmp(key, (const xmlChar *)DEVTYPE[i])) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1003 | device->type = i; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1004 | break; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1005 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1006 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1007 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1008 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1009 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"DIRECTION"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1010 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1011 | for (i = 0; i < 7; i++) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1012 | if (! xmlStrcmp(key, (const xmlChar *)DEVDIR[i])) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1013 | device->direction = i; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1014 | break; |
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 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1017 | xmlFree(key); |
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 ((!xmlStrcmp(cur->name, (const xmlChar *)"VALUE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1020 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1021 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1022 | device->value = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1023 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1024 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1025 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"OFFSET"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1026 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1027 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1028 | device->offset = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1029 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1030 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1031 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1032 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1033 | for (i = 0; i < 4; i++) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1034 | if (! xmlStrcmp(key, (const xmlChar *)DEVPRESENT[i])) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1035 | device->present = i; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1036 | break; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1037 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1038 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1039 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1040 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1041 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"ADDRESS"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1042 | device->address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
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 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"SUBDEVICE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1045 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1046 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1047 | device->subdevice = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1048 | xmlFree(key); |
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 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"GPIOPIN"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1051 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1052 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1053 | device->gpiopin = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1054 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1055 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1056 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"DESCRIPTION"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1057 | device->description = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1058 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1059 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"INUSE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1060 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1061 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1062 | device->inuse = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1063 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1064 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1065 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"COMMENT"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1066 | device->comment = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1067 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1068 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"TIMESTAMP"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1069 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1070 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1071 | device->timestamp = (time_t)ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1072 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1073 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1074 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1075 | cur = cur->next; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1076 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1077 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1078 | if (Config.devices == NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1079 | Config.devices = device; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1080 | } else { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1081 | for (tmp = Config.devices; tmp; tmp = tmp->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1082 | if (tmp->next == NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1083 | tmp->next = device; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1084 | break; |
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 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1087 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1088 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1089 | return 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1090 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1091 | |
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 | int parseDevices(xmlDocPtr doc, xmlNodePtr cur) |
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 | cur = cur->xmlChildrenNode; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1097 | while (cur != NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1098 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"DEVICE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1099 | parseDevice(doc, cur); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1100 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1101 | cur = cur->next; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1102 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1103 | return 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1104 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1105 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1106 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1107 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1108 | #ifdef USE_SIMULATOR |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1109 | int parseSimulator(xmlDocPtr doc, xmlNodePtr cur) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1110 | { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1111 | xmlChar *key; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1112 | simulator_list *simulator, *tmp; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1113 | int ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1114 | float fval; |
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 | simulator = (simulator_list *)malloc(sizeof(simulator_list)); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1117 | simulator->next = NULL; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1118 | simulator->version = 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1119 | simulator->uuid = simulator->name = NULL; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1120 | simulator->room_temperature = simulator->hlt_heater_temp = simulator->mlt_heater_temp = simulator->s_hlt_temp = simulator->s_mlt_temp = 20.0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1121 | simulator->hlt_heater_temp = simulator->hlt_heater_size = simulator->mlt_heater_temp = simulator->mlt_heater_size = 0.0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1122 | simulator->hlt_heater_time = simulator->mlt_heater_time = simulator->hlt_heater_state = simulator->mlt_heater_state = 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1123 | simulator->s_hlt_temp = simulator->s_mlt_temp = 0.0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1124 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1125 | cur = cur->xmlChildrenNode; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1126 | while (cur != NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1127 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) { |
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 (xmlStrcmp(key, (const xmlChar *)"1")) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1130 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1131 | return 1; |
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 | simulator->version = 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1134 | xmlFree(key); |
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 *)"UUID"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1137 | simulator->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1138 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1139 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1140 | simulator->name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
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 *)"ROOM_TEMPERATURE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1143 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1144 | if (sscanf((const char *)key, "%f", &fval) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1145 | simulator->room_temperature = fval; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1146 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1147 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1148 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_TEMPERATURE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1149 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1150 | if (sscanf((const char *)key, "%f", &fval) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1151 | simulator->hlt_temperature = fval; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1152 | xmlFree(key); |
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 | 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
|
1155 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1156 | if (sscanf((const char *)key, "%f", &fval) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1157 | simulator->hlt_heater_temp = fval; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1158 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1159 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1160 | 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
|
1161 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1162 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1163 | simulator->hlt_heater_time = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1164 | xmlFree(key); |
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 | 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
|
1167 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1168 | if (sscanf((const char *)key, "%f", &fval) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1169 | simulator->hlt_heater_size = fval; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1170 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1171 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1172 | 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
|
1173 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1174 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1175 | simulator->hlt_heater_state = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1176 | xmlFree(key); |
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 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_TEMPERATURE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1179 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1180 | if (sscanf((const char *)key, "%f", &fval) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1181 | simulator->mlt_temperature = fval; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1182 | xmlFree(key); |
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 | 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
|
1185 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1186 | if (sscanf((const char *)key, "%f", &fval) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1187 | simulator->mlt_heater_temp = fval; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1188 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1189 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1190 | 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
|
1191 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1192 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1193 | simulator->mlt_heater_time = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1194 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1195 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1196 | 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
|
1197 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1198 | if (sscanf((const char *)key, "%f", &fval) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1199 | simulator->mlt_heater_size = fval; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1200 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1201 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1202 | 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
|
1203 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1204 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1205 | simulator->mlt_heater_state = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1206 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1207 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1208 | 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
|
1209 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1210 | if (sscanf((const char *)key, "%f", &fval) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1211 | simulator->s_hlt_temp = fval; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1212 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1213 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1214 | 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
|
1215 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1216 | if (sscanf((const char *)key, "%f", &fval) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1217 | simulator->s_mlt_temp = fval; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1218 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1219 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1220 | cur = cur->next; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1221 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1222 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1223 | if (Config.simulators == NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1224 | Config.simulators = simulator; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1225 | } else { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1226 | for (tmp = Config.simulators; tmp; tmp = tmp->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1227 | if (tmp->next == NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1228 | tmp->next = simulator; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1229 | break; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1230 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1231 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1232 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1233 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1234 | return 0; |
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 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1237 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1238 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1239 | int parseSimulators(xmlDocPtr doc, xmlNodePtr cur) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1240 | { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1241 | cur = cur->xmlChildrenNode; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1242 | while (cur != NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1243 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"SIMULATOR"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1244 | parseSimulator(doc, cur); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1245 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1246 | cur = cur->next; |
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 | return 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1249 | } |
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
|
1250 | #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
|
1251 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1252 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1253 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1254 | 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
|
1255 | { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1256 | 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
|
1257 | 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
|
1258 | 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
|
1259 | 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
|
1260 | 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
|
1261 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1262 | 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
|
1263 | 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
|
1264 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1265 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1266 | * 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
|
1267 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1268 | 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
|
1269 | 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
|
1270 | } 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
|
1271 | 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
|
1272 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1273 | 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
|
1274 | 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
|
1275 | 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
|
1276 | 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
|
1277 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1278 | * 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
|
1279 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1280 | 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
|
1281 | 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
|
1282 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1283 | 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
|
1284 | 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
|
1285 | 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
|
1286 | 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
|
1287 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1288 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
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 | 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
|
1292 | 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
|
1293 | 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
|
1294 | 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
|
1295 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1296 | 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
|
1297 | 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
|
1298 | 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
|
1299 | 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
|
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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
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 | 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
|
1306 | 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
|
1307 | 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
|
1308 | 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
|
1309 | 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
|
1310 | 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
|
1311 | 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
|
1312 | return 1; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1313 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1314 | 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
|
1315 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
1317 | 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
|
1318 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1319 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"LISTEN_PORT"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1320 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1321 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1322 | Config.my_port = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1323 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1324 | } |
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
|
1325 | 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
|
1326 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1327 | 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
|
1328 | xmlFree(key); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1329 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1330 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"TEMP_ADDRESS"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1331 | Config.temp_address = (char *)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
|
1332 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1333 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HUM_ADDRESS"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1334 | Config.hum_address = (char *)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
|
1335 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
1337 | 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
|
1338 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1339 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"BREWSYSTEMS"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1340 | parseBrewsystems(doc, cur); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1341 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1342 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"DEVICES"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1343 | parseDevices(doc, cur); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1344 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1345 | #ifdef USE_SIMULATOR |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1346 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"SIMULATORS"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1347 | parseSimulators(doc, cur); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1348 | } |
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
|
1349 | #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
|
1350 | 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
|
1351 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
1353 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
1355 | 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
|
1356 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1357 | 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
|
1358 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1359 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1360 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1361 |