Sun, 20 Dec 2015 20:37:40 +0100
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /***************************************************************************** |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | * Copyright (C) 2015 |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * Michiel Broek <mbroek at mbse dot eu> |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * This file is part of the mbsePi-apps |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * This is free software; you can redistribute it and/or modify it |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * under the terms of the GNU General Public License as published by the |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * Free Software Foundation; either version 2, or (at your option) any |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * later version. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * mbsePi-apps is distributed in the hope that it will be useful, but |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | * General Public License for more details. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | * along with ThermFerm; see the file COPYING. If not, write to the Free |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | *****************************************************************************/ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | #include "rdconfig.h" |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | #include "brewco.h" |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
25 | #include "util.h" |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | #include "xutil.h" |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
28 | int debug = TRUE; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | sys_config Config; /* System configuration */ |
464
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
30 | extern char *etcpath; |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
31 | |
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
|
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 | #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
|
34 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
35 | const char TEMPSTATE[3][8] = { "OK", "MISSING", "ERROR" }; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
36 | const char DEVTYPE[6][5] = { "NA", "W1", "GPIO", "I2C", "SPI", "SIM" }; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
37 | 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
|
38 | const char DEVDIR[7][11] = { "UNDEF", "IN_BIN", "OUT_BIN", "IN_ANALOG", "OUT_ANALOG", "OUT_PWM", "INTERN" }; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
39 | const char WHIRLPOOL_TYPE[3][5] = { "OFF", "COLD", "HOT" }; |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
40 | const char PIDDIRECTION[2][8] = { "DIRECT", "REVERSE" }; |
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
41 | const char PIDMODE[2][10] = { "MANUAL", "AUTOMATIC" }; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
42 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
43 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
44 | 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
|
45 | { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
46 | units_list *unit; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
47 | devices_list *device; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
48 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
50 | 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
|
51 | 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
|
52 | |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
53 | 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
|
54 | Config.tempFormat = 'C'; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
55 | if (Config.roomtemp) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
56 | free(Config.roomtemp); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
57 | Config.roomtemp = NULL; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
58 | Config.lcd_cols = 20; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
59 | 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
|
60 | |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
61 | for (unit = Config.units; unit; unit = unit->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
62 | if (unit->uuid) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
63 | free(unit->uuid); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
64 | if (unit->name) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
65 | free(unit->name); |
449 | 66 | if (unit->hlt_sensor.uuid) |
67 | free(unit->hlt_sensor.uuid); | |
68 | if (unit->mlt_sensor.uuid) | |
69 | free(unit->mlt_sensor.uuid); | |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
70 | if (unit->hlt_heater.uuid) |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
71 | free(unit->hlt_heater.uuid); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
72 | if (unit->mlt_heater.uuid) |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
73 | free(unit->mlt_heater.uuid); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
74 | if (unit->mlt_pump.uuid) |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
75 | free(unit->mlt_pump.uuid); |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
76 | if (unit->PID_hlt) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
77 | free(unit->PID_hlt); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
78 | if (unit->PID_mlt) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
79 | free(unit->PID_mlt); |
434
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 |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
98 | if (Config.simulator) |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
99 | free(Config.simulator); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
100 | Config.simulator = NULL; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
101 | #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
|
102 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
103 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
104 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
105 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
106 | int 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
|
107 | 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
|
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 | 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
|
110 | 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
|
111 | 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
|
112 | 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
|
113 | xmlBufferPtr buf; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
114 | units_list *unit; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
115 | devices_list *device; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
116 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
117 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
119 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
120 | 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
|
121 | 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
|
122 | 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
|
123 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
124 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 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
|
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 ((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
|
129 | 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
|
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 | * 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
|
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 ((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
|
137 | 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
|
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 | * 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
|
143 | * 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
|
144 | * 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
|
145 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
147 | 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
|
148 | 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
|
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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
151 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
152 | * 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
|
153 | * 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
|
154 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
156 | 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
|
157 | 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
|
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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
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 = 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
|
164 | 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
|
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 | 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
|
168 | 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
|
169 | 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
|
170 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
171 | 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
|
172 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
173 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
174 | } |
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
|
175 | 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
|
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 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
179 | if (Config.roomtemp) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
180 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOMTEMP_UUID", "%s", Config.roomtemp->uuid)) < 0) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
181 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
182 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
183 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
184 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOMTEMP_STATE", "%d", Config.roomtemp->state)) < 0) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
185 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
186 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
187 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
188 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOMTEMP_VALUE", "%d", Config.roomtemp->value)) < 0) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
189 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
190 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
191 | } |
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
|
192 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
193 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
194 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
195 | * 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
|
196 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
197 | 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
|
198 | 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
|
199 | 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
|
200 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
201 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
202 | * 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
|
203 | * 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
|
204 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
205 | 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
|
206 | 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
|
207 | 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
|
208 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
209 | 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
|
210 | 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
|
211 | 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
|
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 | 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
|
214 | 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
|
215 | 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
|
216 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
218 | 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
|
219 | 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
|
220 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
222 | 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
|
223 | 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
|
224 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
225 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
227 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
229 | 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
|
230 | 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
|
231 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
232 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
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 = 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
|
236 | 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
|
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 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
239 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
240 | /* |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
241 | * Brewsystems |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
242 | */ |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
243 | if (Config.units) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
244 | if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "BREWSYSTEMS")) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
245 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
246 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
247 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
248 | for (unit = Config.units; unit; unit = unit->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
249 | /* |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
250 | * 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
|
251 | * are written to a state file. |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
252 | */ |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
253 | if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "BREWSYSTEM")) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
254 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
255 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
256 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
257 | 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
|
258 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
259 | return 1; |
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 ((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
|
262 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
263 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
264 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
265 | 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
|
266 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
267 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
268 | } |
441 | 269 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NUMBER", "%d", unit->number)) < 0)) { |
270 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); | |
271 | return 1; | |
272 | } | |
273 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ACTIVE", "%d", unit->active)) < 0)) { | |
274 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); | |
275 | return 1; | |
276 | } | |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
277 | |
449 | 278 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_SENSOR_UUID", "%s", unit->hlt_sensor.uuid)) < 0)) { |
279 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); | |
280 | return 1; | |
281 | } | |
282 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_SENSOR_STATE", "%d", unit->hlt_sensor.state)) < 0)) { | |
283 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); | |
284 | return 1; | |
285 | } | |
286 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_SENSOR_VALUE", "%d", unit->hlt_sensor.value)) < 0)) { | |
287 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); | |
288 | return 1; | |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
289 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
290 | |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
291 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_UUID", "%s", unit->hlt_heater.uuid)) < 0)) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
292 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
293 | return 1; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
294 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
295 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_VALUE", "%d", unit->hlt_heater.value)) < 0)) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
296 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
297 | return 1; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
298 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
299 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_DELAY", "%d", unit->hlt_heater.delay)) < 0)) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
300 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
301 | return 1; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
302 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
303 | |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
304 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_MLTFIRST", "%d", unit->hlt_heater_mltfirst)) < 0)) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
305 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
306 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
307 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
308 | |
449 | 309 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_SENSOR_UUID", "%s", unit->mlt_sensor.uuid)) < 0)) { |
310 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); | |
311 | return 1; | |
312 | } | |
313 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_SENSOR_STATE", "%d", unit->mlt_sensor.state)) < 0)) { | |
314 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); | |
315 | return 1; | |
316 | } | |
317 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_SENSOR_VALUE", "%d", unit->mlt_sensor.value)) < 0)) { | |
318 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); | |
319 | return 1; | |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
320 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
321 | |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
322 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_UUID", "%s", unit->mlt_heater.uuid)) < 0)) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
323 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
324 | return 1; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
325 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
326 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_VALUE", "%d", unit->mlt_heater.value)) < 0)) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
327 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
328 | return 1; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
329 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
330 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_DELAY", "%d", unit->mlt_heater.delay)) < 0)) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
331 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
332 | return 1; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
333 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
334 | |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
335 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_PUMP_UUID", "%s", unit->mlt_pump.uuid)) < 0)) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
336 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
337 | return 1; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
338 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
339 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_PUMP_VALUE", "%d", unit->mlt_pump.value)) < 0)) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
340 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
341 | return 1; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
342 | } |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
343 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_PUMP_DELAY", "%d", unit->mlt_pump.delay)) < 0)) { |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
344 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
345 | return 1; |
434
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 | |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
348 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_CYCLE", "%d", unit->pump_cycle)) < 0)) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
349 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
350 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
351 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
352 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_REST", "%d", unit->pump_rest)) < 0)) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
353 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
354 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
355 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
356 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_PREMASH", "%d", unit->pump_premash)) < 0)) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
357 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
358 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
359 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
360 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_ONMASH", "%d", unit->pump_onmash)) < 0)) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
361 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
362 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
363 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
364 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_MASHOUT", "%d", unit->pump_mashout)) < 0)) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
365 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
366 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
367 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
368 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_ONBOIL", "%d", unit->pump_onboil)) < 0)) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
369 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
370 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
371 | } |
445
3ec477cda546
Changed internal storage of temperatures to float. Added 2 prompts. Added editors for float and integer values. Added most of brewunit edit functions.
Michiel Broek <mbroek@mbse.eu>
parents:
441
diff
changeset
|
372 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_STOP", "%.3f", unit->pump_stop)) < 0)) { |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
373 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
374 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
375 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
376 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "SKIP_ADD", "%d", unit->skip_add)) < 0)) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
377 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
378 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
379 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
380 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "SKIP_REMOVE", "%d", unit->skip_remove)) < 0)) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
381 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
382 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
383 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
384 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "SKIP_IODINE", "%d", unit->skip_iodine)) < 0)) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
385 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
386 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
387 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
388 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "IODINE_TIME", "%d", unit->iodine_time)) < 0)) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
389 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
390 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
391 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
392 | if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "WHIRLPOOL", "%s", WHIRLPOOL_TYPE[unit->whirlpool])) < 0)) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
393 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
394 | return 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
395 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
396 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
397 | if (unit->PID_hlt) { |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
398 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_KP", "%.2lf", unit->PID_hlt->dispKp)) < 0) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
399 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
400 | return 1; |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
401 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
402 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_KI", "%.2lf", unit->PID_hlt->dispKi)) < 0) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
403 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
404 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
405 | } |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
406 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_KD", "%.2lf", unit->PID_hlt->dispKd)) < 0) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
407 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
408 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
409 | } |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
410 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_SAMPLETIIME", "%ld", unit->PID_hlt->SampleTime)) < 0) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
411 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
412 | return 1; |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
413 | } |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
414 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_DIRECTION", "%s", PIDDIRECTION[unit->PID_hlt->Direction])) < 0) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
415 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
416 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
417 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
418 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
419 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
420 | if (unit->PID_mlt) { |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
421 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_KP", "%.2lf", unit->PID_mlt->dispKp)) < 0) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
422 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
423 | return 1; |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
424 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
425 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_KI", "%.2lf", unit->PID_mlt->dispKi)) < 0) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
426 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
427 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
428 | } |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
429 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_KD", "%.2lf", unit->PID_mlt->dispKd)) < 0) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
430 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
431 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
432 | } |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
433 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_SAMPLETIIME", "%ld", unit->PID_mlt->SampleTime)) < 0) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
434 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
435 | return 1; |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
436 | } |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
437 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_DIRECTION", "%s", PIDDIRECTION[unit->PID_mlt->Direction])) < 0) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
438 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
439 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
440 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
441 | } |
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 = xmlTextWriterEndElement(writer)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
444 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
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 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
448 | if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
449 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
450 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
451 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
452 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
453 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
454 | if (Config.devices) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
455 | if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "DEVICES")) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
456 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
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 | #ifdef HAVE_WIRINGPI_H |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
460 | piLock(LOCK_DEVICES); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
461 | #endif |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
462 | for (device = Config.devices; device; device = device->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
463 | if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "DEVICE")) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
464 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
465 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
466 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
467 | 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
|
468 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
469 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
470 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
471 | 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
|
472 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
473 | return 1; |
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 | 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
|
476 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
477 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
478 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
479 | 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
|
480 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
481 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
482 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
483 | 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
|
484 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
485 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
486 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
487 | 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
|
488 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
489 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
490 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
491 | 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
|
492 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
493 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
494 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
495 | 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
|
496 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
497 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
498 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
499 | 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
|
500 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
501 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
502 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
503 | 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
|
504 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
505 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
506 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
507 | 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
|
508 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
509 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
510 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
511 | if ((rc = 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
|
512 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
513 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
514 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
515 | 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
|
516 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
517 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
518 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
519 | 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
|
520 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
521 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
522 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
523 | if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
524 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
525 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
526 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
527 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
528 | #ifdef HAVE_WIRINGPI_H |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
529 | piUnlock(LOCK_DEVICES); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
530 | #endif |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
531 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
532 | if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
533 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
534 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
535 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
536 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
537 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
538 | #ifdef USE_SIMULATOR |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
539 | if (Config.simulator) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
540 | if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "SIMULATOR")) < 0) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
541 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
542 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
543 | } |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
544 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOM_TEMPERATURE", "%f", Config.simulator->room_temperature)) < 0) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
545 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
546 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
547 | } |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
548 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_TEMPERATURE", "%f", Config.simulator->hlt_temperature)) < 0) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
549 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
550 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
551 | } |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
552 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_TEMP", "%f", Config.simulator->hlt_heater_temp)) < 0) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
553 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
554 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
555 | } |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
556 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_VOLUME", "%d", Config.simulator->hlt_heater_volume)) < 0) { |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
557 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
558 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
559 | } |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
560 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_POWER", "%d", Config.simulator->hlt_heater_power)) < 0) { |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
561 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
562 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
563 | } |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
564 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_STATE", "%d", Config.simulator->hlt_heater_state)) < 0) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
565 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
566 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
567 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
568 | |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
569 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_TEMPERATURE", "%f", Config.simulator->mlt_temperature)) < 0) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
570 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
571 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
572 | } |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
573 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_TEMP", "%f", Config.simulator->mlt_heater_temp)) < 0) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
574 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
575 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
576 | } |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
577 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_VOLUME", "%d", Config.simulator->mlt_heater_volume)) < 0) { |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
578 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
579 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
580 | } |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
581 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_POWER", "%d", Config.simulator->mlt_heater_power)) < 0) { |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
582 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
583 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
584 | } |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
585 | if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_STATE", "%d", Config.simulator->mlt_heater_state)) < 0) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
586 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
587 | return 1; |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
588 | } |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
589 | |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
590 | if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
591 | syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
592 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
593 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
594 | } |
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
|
595 | #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
|
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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
599 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
601 | 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
|
602 | 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
|
603 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
604 | 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
|
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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
608 | */ |
464
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
609 | mypath = xstrcpy(etcpath); |
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
|
610 | 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
|
611 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
612 | 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
|
613 | 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
|
614 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
616 | 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
|
617 | 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
|
618 | 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
|
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 | 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
|
621 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
623 | 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
|
624 | 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
|
625 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
626 | 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
|
627 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
628 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
629 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
630 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
632 | { |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
633 | int rc = do_wrconfig(); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
634 | 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
|
635 | 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
|
636 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
642 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
643 | 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
|
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 | 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
|
646 | 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
|
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 | 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
|
649 | 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
|
650 | 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
|
651 | 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
|
652 | 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
|
653 | 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
|
654 | 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
|
655 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
656 | 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
|
657 | 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
|
658 | 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
|
659 | 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
|
660 | 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
|
661 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
662 | if ((!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
|
663 | 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
|
664 | 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
|
665 | 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
|
666 | 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
|
667 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
669 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
670 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
672 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
673 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
674 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
675 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
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 | 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
|
679 | 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
|
680 | 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
|
681 | 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
|
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 | 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
|
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 | 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
|
686 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
687 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
688 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
689 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
690 | /* |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
691 | * Parse a brewsystem |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
692 | */ |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
693 | int parseBrewsystem(xmlDocPtr doc, xmlNodePtr cur) |
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 | xmlChar *key; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
696 | int i, ival; |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
697 | long lval; |
445
3ec477cda546
Changed internal storage of temperatures to float. Added 2 prompts. Added editors for float and integer values. Added most of brewunit edit functions.
Michiel Broek <mbroek@mbse.eu>
parents:
441
diff
changeset
|
698 | float fval; |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
699 | double kpval, kival, kdval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
700 | units_list *unit, *tmp; |
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 | unit = (units_list *)malloc(sizeof(units_list)); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
703 | unit->next = NULL; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
704 | unit->version = 1; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
705 | unit->uuid = unit->name = NULL; |
441 | 706 | unit->number = 0; |
707 | unit->active = 0; | |
449 | 708 | unit->hlt_sensor.uuid = xstrcpy((char *)"00000000-0000-0000-0000-000000000000"); |
709 | unit->hlt_sensor.state = 0; | |
710 | unit->hlt_sensor.value = 0; | |
711 | unit->mlt_sensor.uuid = xstrcpy((char *)"00000000-0000-0000-0000-000000000000"); | |
712 | unit->mlt_sensor.state = 0; | |
713 | unit->mlt_sensor.value = 0; | |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
714 | unit->hlt_heater.uuid = xstrcpy((char *)"00000000-0000-0000-0000-000000000000"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
715 | unit->hlt_heater.value = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
716 | unit->hlt_heater.delay = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
717 | unit->mlt_heater.uuid = xstrcpy((char *)"00000000-0000-0000-0000-000000000000"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
718 | unit->mlt_heater.value = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
719 | unit->mlt_heater.delay = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
720 | unit->mlt_pump.uuid = xstrcpy((char *)"00000000-0000-0000-0000-000000000000"); |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
721 | unit->mlt_pump.value = 0; |
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
722 | unit->mlt_pump.delay = 0; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
723 | unit->hlt_heater_mltfirst = 0; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
724 | unit->pump_cycle = 7; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
725 | unit->pump_rest = 2; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
726 | unit->pump_premash = 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
727 | unit->pump_onmash = 1; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
728 | unit->pump_mashout = 0; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
729 | unit->pump_onboil = 0; |
445
3ec477cda546
Changed internal storage of temperatures to float. Added 2 prompts. Added editors for float and integer values. Added most of brewunit edit functions.
Michiel Broek <mbroek@mbse.eu>
parents:
441
diff
changeset
|
730 | unit->pump_stop = 90.0; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
731 | unit->skip_add = 0; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
732 | unit->skip_remove = 0; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
733 | unit->skip_iodine = 0; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
734 | unit->iodine_time = 90; |
441 | 735 | unit->whirlpool = 1; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
736 | 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
|
737 | unit->PID_mlt = (pid_var *)malloc(sizeof(pid_var)); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
738 | PID_init(unit->PID_hlt, NULL, NULL, NULL, 2, 5, 1, P_DIRECT); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
739 | PID_init(unit->PID_mlt, NULL, NULL, NULL, 2, 5, 1, P_DIRECT); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
740 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
741 | cur = cur->xmlChildrenNode; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
742 | while (cur != NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
743 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
744 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
745 | if (xmlStrcmp(key, (const xmlChar *)"1")) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
746 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
747 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
748 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
749 | unit->version = 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
750 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
751 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
752 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
753 | unit->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
754 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
755 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
756 | unit->name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
757 | } |
441 | 758 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUMBER"))) { |
759 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); | |
760 | if (sscanf((const char *)key, "%d", &ival) == 1) | |
761 | unit->number = ival; | |
762 | xmlFree(key); | |
763 | } | |
764 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"ACTIVE"))) { | |
765 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); | |
766 | if (sscanf((const char *)key, "%d", &ival) == 1) | |
767 | unit->active = ival; | |
768 | xmlFree(key); | |
769 | } | |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
770 | |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
771 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_SENSOR_UUID"))) { |
449 | 772 | unit->hlt_sensor.uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
773 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
774 | 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
|
775 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
776 | if (sscanf((const char *)key, "%d", &ival) == 1) |
449 | 777 | unit->hlt_sensor.state = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
778 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
779 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
780 | 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
|
781 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
782 | if (sscanf((const char *)key, "%d", &ival) == 1) |
449 | 783 | unit->hlt_sensor.value = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
784 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
785 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
786 | |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
787 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_UUID"))) { |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
788 | unit->hlt_heater.uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
789 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
790 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_VALUE"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
791 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
792 | if (sscanf((const char *)key, "%d", &ival) == 1) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
793 | unit->hlt_heater.value = ival; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
794 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
795 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
796 | 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
|
797 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
798 | if (sscanf((const char *)key, "%d", &ival) == 1) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
799 | unit->hlt_heater.delay = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
800 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
801 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
802 | |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
803 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_MLTFIRST"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
804 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
805 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
806 | unit->hlt_heater_mltfirst = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
807 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
808 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
809 | |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
810 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_SENSOR_UUID"))) { |
449 | 811 | unit->mlt_sensor.uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
812 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
813 | 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
|
814 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
815 | if (sscanf((const char *)key, "%d", &ival) == 1) |
449 | 816 | unit->mlt_sensor.state = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
817 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
818 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
819 | 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
|
820 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
821 | if (sscanf((const char *)key, "%d", &ival) == 1) |
449 | 822 | unit->mlt_sensor.value = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
823 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
824 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
825 | |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
826 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_UUID"))) { |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
827 | unit->mlt_heater.uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
828 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
829 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_VALUE"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
830 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
831 | if (sscanf((const char *)key, "%d", &ival) == 1) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
832 | unit->mlt_heater.value = ival; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
833 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
834 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
835 | 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
|
836 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
837 | if (sscanf((const char *)key, "%d", &ival) == 1) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
838 | unit->mlt_heater.delay = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
839 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
840 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
841 | |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
842 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_PUMP_UUID"))) { |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
843 | unit->mlt_pump.uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
844 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
845 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_PUMP_VALUE"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
846 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
847 | if (sscanf((const char *)key, "%d", &ival) == 1) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
848 | unit->mlt_pump.value = ival; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
849 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
850 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
851 | 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
|
852 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
853 | if (sscanf((const char *)key, "%d", &ival) == 1) |
450
8fe99759c27f
Added selecting output relays.
Michiel Broek <mbroek@mbse.eu>
parents:
449
diff
changeset
|
854 | unit->mlt_pump.delay = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
855 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
856 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
857 | |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
858 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_CYCLE"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
859 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
860 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
861 | unit->pump_cycle = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
862 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
863 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
864 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_REST"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
865 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
866 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
867 | unit->pump_rest = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
868 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
869 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
870 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_PREMASH"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
871 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
872 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
873 | unit->pump_premash = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
874 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
875 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
876 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_ONMASH"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
877 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
878 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
879 | unit->pump_onmash = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
880 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
881 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
882 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_MASHOUT "))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
883 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
884 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
885 | unit->pump_mashout = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
886 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
887 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
888 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_ONBOIL"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
889 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
890 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
891 | unit->pump_onboil = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
892 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
893 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
894 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_STOP"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
895 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
445
3ec477cda546
Changed internal storage of temperatures to float. Added 2 prompts. Added editors for float and integer values. Added most of brewunit edit functions.
Michiel Broek <mbroek@mbse.eu>
parents:
441
diff
changeset
|
896 | if (sscanf((const char *)key, "%f", &fval) == 1) |
3ec477cda546
Changed internal storage of temperatures to float. Added 2 prompts. Added editors for float and integer values. Added most of brewunit edit functions.
Michiel Broek <mbroek@mbse.eu>
parents:
441
diff
changeset
|
897 | unit->pump_stop = fval; |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
898 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
899 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
900 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"SKIP_ADD"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
901 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
902 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
903 | unit->skip_add = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
904 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
905 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
906 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"SKIP_REMOVE"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
907 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
908 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
909 | unit->skip_remove = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
910 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
911 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
912 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"SKIP_IODINE"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
913 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
914 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
915 | unit->skip_iodine = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
916 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
917 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
918 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"IODINE_TIME"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
919 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
920 | if (sscanf((const char *)key, "%d", &ival) == 1) |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
921 | unit->iodine_time = ival; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
922 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
923 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
924 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"WHIRLPOOL"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
925 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
926 | for (i = 0; i < 2; i++) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
927 | if (! xmlStrcmp(key, (const xmlChar *)WHIRLPOOL_TYPE[i])) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
928 | unit->whirlpool = i; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
929 | break; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
930 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
931 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
932 | xmlFree(key); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
933 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
934 | |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
935 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_KP"))) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
936 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
937 | sscanf((const char *)key, "%lf", &kpval); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
938 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
939 | } |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
940 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_KI"))) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
941 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
942 | sscanf((const char *)key, "%lf", &kival); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
943 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
944 | } |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
945 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_KD"))) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
946 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
947 | sscanf((const char *)key, "%lf", &kdval); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
948 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
949 | } |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
950 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_SAMPLETIME"))) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
951 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
952 | if (sscanf((const char *)key, "%ld", &lval) == 1) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
953 | PID_setSampleTime(unit->PID_hlt, lval); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
954 | PID_setTunings(unit->PID_hlt, kpval, kival, kdval); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
955 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
956 | xmlFree(key); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
957 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
958 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_DIRECTION"))) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
959 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
960 | for (i = 0; i < 2; i++) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
961 | if (! xmlStrcmp(key, (const xmlChar *)PIDDIRECTION[i])) { |
448 | 962 | PID_setDirection(unit->PID_hlt, i); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
963 | break; |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
964 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
965 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
966 | xmlFree(key); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
967 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
968 | |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
969 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_KP"))) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
970 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
971 | sscanf((const char *)key, "%lf", &kpval); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
972 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
973 | } |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
974 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_KI"))) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
975 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
976 | sscanf((const char *)key, "%lf", &kival); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
977 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
978 | } |
446
78e9d5234d15
Switched to PID code from Arduino
Michiel Broek <mbroek@mbse.eu>
parents:
445
diff
changeset
|
979 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_KD"))) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
980 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
981 | sscanf((const char *)key, "%lf", &kdval); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
982 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
983 | } |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
984 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_SAMPLETIME"))) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
985 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
986 | if (sscanf((const char *)key, "%ld", &lval) == 1) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
987 | PID_setSampleTime(unit->PID_mlt, lval); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
988 | PID_setTunings(unit->PID_mlt, kpval, kival, kdval); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
989 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
990 | xmlFree(key); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
991 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
992 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_DIRECTION"))) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
993 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
994 | for (i = 0; i < 2; i++) { |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
995 | if (! xmlStrcmp(key, (const xmlChar *)PIDDIRECTION[i])) { |
448 | 996 | PID_setDirection(unit->PID_mlt, i); |
447
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
997 | break; |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
998 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
999 | } |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
1000 | xmlFree(key); |
b48368855ec4
Read/Write PID parameters from configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
446
diff
changeset
|
1001 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1002 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1003 | cur = cur->next; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1004 | } |
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 | if (Config.units == NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1007 | Config.units = unit; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1008 | } else { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1009 | for (tmp = Config.units; tmp; tmp = tmp->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1010 | if (tmp->next == NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1011 | tmp->next = unit; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1012 | break; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1013 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1014 | } |
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 | return 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1018 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1019 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1020 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1021 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1022 | int parseBrewsystems(xmlDocPtr doc, xmlNodePtr cur) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1023 | { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1024 | cur = cur->xmlChildrenNode; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1025 | while (cur != NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1026 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"BREWSYSTEM"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1027 | parseBrewsystem(doc, cur); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1028 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1029 | cur = cur->next; |
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 | return 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1032 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1033 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1034 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1035 | int parseDevice(xmlDocPtr doc, xmlNodePtr cur) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1036 | { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1037 | xmlChar *key; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1038 | devices_list *device, *tmp; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1039 | int i, ival; |
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 | device = (devices_list *)malloc(sizeof(devices_list)); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1042 | device->next = NULL; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1043 | device->version = 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1044 | 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
|
1045 | 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
|
1046 | device->gpiopin = -1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1047 | device->timestamp = (time_t)0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1048 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1049 | cur = cur->xmlChildrenNode; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1050 | while (cur != NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1051 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1052 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1053 | if (xmlStrcmp(key, (const xmlChar *)"1")) { |
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 | return 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1056 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1057 | device->version = 1; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1058 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1059 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1060 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1061 | device->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1062 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1063 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"TYPE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1064 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1065 | for (i = 0; i < 8; i++) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1066 | if (! xmlStrcmp(key, (const xmlChar *)DEVTYPE[i])) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1067 | device->type = i; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1068 | break; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1069 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1070 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1071 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1072 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1073 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"DIRECTION"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1074 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1075 | for (i = 0; i < 7; i++) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1076 | if (! xmlStrcmp(key, (const xmlChar *)DEVDIR[i])) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1077 | device->direction = i; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1078 | break; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1079 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1080 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1081 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1082 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1083 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"VALUE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1084 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1085 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1086 | device->value = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1087 | xmlFree(key); |
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 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"OFFSET"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1090 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1091 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1092 | device->offset = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1093 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1094 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1095 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1096 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1097 | for (i = 0; i < 4; i++) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1098 | if (! xmlStrcmp(key, (const xmlChar *)DEVPRESENT[i])) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1099 | device->present = i; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1100 | break; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1101 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1102 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1103 | xmlFree(key); |
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 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"ADDRESS"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1106 | device->address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1107 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1108 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"SUBDEVICE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1109 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1110 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1111 | device->subdevice = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1112 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1113 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1114 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"GPIOPIN"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1115 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1116 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1117 | device->gpiopin = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1118 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1119 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1120 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"DESCRIPTION"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1121 | device->description = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1122 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1123 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"INUSE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1124 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1125 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1126 | device->inuse = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1127 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1128 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1129 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"COMMENT"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1130 | device->comment = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1131 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1132 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"TIMESTAMP"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1133 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1134 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1135 | device->timestamp = (time_t)ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1136 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1137 | } |
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 | cur = cur->next; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1140 | } |
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 (Config.devices == NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1143 | Config.devices = device; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1144 | } else { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1145 | for (tmp = Config.devices; tmp; tmp = tmp->next) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1146 | if (tmp->next == NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1147 | tmp->next = device; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1148 | break; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1149 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1150 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1151 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1152 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1153 | return 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1154 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1155 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1156 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1157 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1158 | int parseDevices(xmlDocPtr doc, xmlNodePtr cur) |
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 | cur = cur->xmlChildrenNode; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1161 | while (cur != NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1162 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"DEVICE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1163 | parseDevice(doc, cur); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1164 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1165 | cur = cur->next; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1166 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1167 | return 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1168 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1169 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1170 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1171 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1172 | #ifdef USE_SIMULATOR |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1173 | int parseSimulator(xmlDocPtr doc, xmlNodePtr cur) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1174 | { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1175 | xmlChar *key; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1176 | int ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1177 | float fval; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1178 | |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1179 | /* |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1180 | * First time, allocate memory and set defaults. |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1181 | */ |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1182 | if (! Config.simulator) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1183 | Config.simulator = (simulator_var *)malloc(sizeof(simulator_var)); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1184 | Config.simulator->room_temperature = Config.simulator->hlt_temperature = Config.simulator->hlt_heater_temp = \ |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1185 | Config.simulator->mlt_temperature = Config.simulator->mlt_heater_temp = 20.0; |
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1186 | Config.simulator->hlt_heater_volume = Config.simulator->mlt_heater_volume = 20; |
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1187 | Config.simulator->hlt_heater_power = Config.simulator->mlt_heater_power = 2000; |
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1188 | Config.simulator->hlt_heater_state = Config.simulator->mlt_heater_state = 0; |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1189 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1190 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1191 | cur = cur->xmlChildrenNode; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1192 | while (cur != NULL) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1193 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOM_TEMPERATURE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1194 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1195 | if (sscanf((const char *)key, "%f", &fval) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1196 | Config.simulator->room_temperature = fval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1197 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1198 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1199 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_TEMPERATURE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1200 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1201 | if (sscanf((const char *)key, "%f", &fval) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1202 | Config.simulator->hlt_temperature = fval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1203 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1204 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1205 | 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
|
1206 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1207 | if (sscanf((const char *)key, "%f", &fval) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1208 | Config.simulator->hlt_heater_temp = fval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1209 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1210 | } |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1211 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_VOLUME"))) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1212 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1213 | if (sscanf((const char *)key, "%d", &ival) == 1) |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1214 | Config.simulator->hlt_heater_volume = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1215 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1216 | } |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1217 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_POWER"))) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1218 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1219 | if (sscanf((const char *)key, "%d", &ival) == 1) |
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1220 | Config.simulator->hlt_heater_power = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1221 | xmlFree(key); |
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 ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_STATE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1224 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1225 | if (sscanf((const char *)key, "%d", &ival) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1226 | Config.simulator->hlt_heater_state = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1227 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1228 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1229 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_TEMPERATURE"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1230 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1231 | if (sscanf((const char *)key, "%f", &fval) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1232 | Config.simulator->mlt_temperature = fval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1233 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1234 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1235 | 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
|
1236 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1237 | if (sscanf((const char *)key, "%f", &fval) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1238 | Config.simulator->mlt_heater_temp = fval; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1239 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1240 | } |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1241 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_VOLUME"))) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1242 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1243 | if (sscanf((const char *)key, "%d", &ival) == 1) |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1244 | Config.simulator->mlt_heater_volume = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1245 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1246 | } |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1247 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_POWER"))) { |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1248 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1249 | if (sscanf((const char *)key, "%d", &ival) == 1) |
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1250 | Config.simulator->mlt_heater_power = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1251 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1252 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1253 | 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
|
1254 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1255 | if (sscanf((const char *)key, "%d", &ival) == 1) |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1256 | Config.simulator->mlt_heater_state = ival; |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1257 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1258 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1259 | cur = cur->next; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1260 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1261 | |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1262 | return 0; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1263 | } |
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
|
1264 | #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
|
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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
1269 | { |
464
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1270 | int i, ival, rc = 0; |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1271 | char *mypath, *fpath, *tpath; |
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
|
1272 | 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
|
1273 | 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
|
1274 | 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
|
1275 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
1280 | */ |
464
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1281 | mypath = xstrcpy(etcpath); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1282 | mypath = xstrcat(mypath, (char *)"brewco.xml"); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1283 | |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1284 | /* |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1285 | * Make upto 10 backups of the configuration. |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1286 | */ |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1287 | fpath = calloc(1024, sizeof(char)); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1288 | tpath = calloc(1024, sizeof(char)); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1289 | |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1290 | for (i = 9; i > 0; i--) { |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1291 | snprintf(tpath, 1023, "%s.%d", mypath, i+1); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1292 | snprintf(fpath, 1023, "%s.%d", mypath, i); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1293 | if (file_exist(fpath, R_OK) == 0) { |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1294 | unlink(tpath); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1295 | if (file_cp(fpath, tpath)) { |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1296 | syslog(LOG_NOTICE, "rdconfig file_cp(%s, %s): %s", fpath, tpath, strerror(errno)); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1297 | } |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1298 | } |
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
|
1299 | } |
464
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1300 | snprintf(tpath, 1023, "%s.1", mypath); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1301 | snprintf(fpath, 1023, "%s", mypath); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1302 | if (file_exist(fpath, R_OK) == 0) { |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1303 | unlink(tpath); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1304 | if (file_cp(fpath, tpath)) { |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1305 | syslog(LOG_NOTICE, "rdconfig file_cp(%s, %s): %s", fpath, tpath, strerror(errno)); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1306 | } |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1307 | } |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1308 | free(fpath); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1309 | free(tpath); |
4a624c071ca9
Added file copy. Move home directory detection to the main program function. During opening of the main configuration file, backups are made, 10 revisions in total.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
1310 | |
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
|
1311 | 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
|
1312 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
1314 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1315 | syslog(LOG_NOTICE, "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
|
1316 | 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
|
1317 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
1319 | 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
|
1320 | 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
|
1321 | 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
|
1322 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1323 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1324 | 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
|
1325 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
1327 | 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
|
1328 | 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
|
1329 | 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
|
1330 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1331 | 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
|
1332 | 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
|
1333 | 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
|
1334 | 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
|
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 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | * 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
|
1339 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1340 | 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
|
1341 | 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
|
1342 | 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
|
1343 | 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
|
1344 | 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
|
1345 | 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
|
1346 | 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
|
1347 | 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
|
1348 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1349 | xmlFree(key); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1350 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/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 | 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
|
1352 | 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
|
1353 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1354 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"LISTEN_PORT"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1355 | key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1356 | if (sscanf((const char *)key, "%d", &ival) == 1) |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1357 | Config.my_port = ival; |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1358 | xmlFree(key); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1359 | } |
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
|
1360 | 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
|
1361 | 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
|
1362 | 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
|
1363 | 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
|
1364 | } |
435
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1365 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOMTEMP_UUID"))) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1366 | if (Config.roomtemp == NULL) { |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1367 | Config.roomtemp = (sensor_var *)malloc(sizeof(sensor_var)); |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1368 | Config.roomtemp->uuid[0] = '\0'; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1369 | Config.roomtemp->state = 1; // missing |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1370 | Config.roomtemp->value = 0; |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1371 | } |
4b1ed6897d80
More configuration items added.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
1372 | snprintf(Config.roomtemp->uuid, 36, "%s", xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1373 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1374 | 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
|
1375 | 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
|
1376 | } |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1377 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"BREWSYSTEMS"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1378 | parseBrewsystems(doc, cur); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1379 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1380 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"DEVICES"))) { |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1381 | parseDevices(doc, cur); |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1382 | } |
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1383 | #ifdef USE_SIMULATOR |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1384 | if ((!xmlStrcmp(cur->name, (const xmlChar *)"SIMULATOR"))) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1385 | parseSimulator(doc, cur); |
434
eb724767860d
Brewco first phase development configuration structure.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
1386 | } |
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
|
1387 | #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
|
1388 | 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
|
1389 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1390 | 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
|
1391 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1392 | 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
|
1393 | 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
|
1394 | |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1395 | #ifdef USE_SIMULATOR |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1396 | /* |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1397 | * If we didn't find any simulator values, initialize a new simulator. |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1398 | */ |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1399 | if (! Config.simulator) { |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1400 | Config.simulator = (simulator_var *)malloc(sizeof(simulator_var)); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1401 | syslog(LOG_NOTICE, "rdconfig() init a new simulator"); |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1402 | Config.simulator->room_temperature = Config.simulator->hlt_temperature = Config.simulator->hlt_heater_temp = \ |
455
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1403 | Config.simulator->mlt_temperature = Config.simulator->mlt_heater_temp = 20.0; |
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1404 | Config.simulator->hlt_heater_volume = Config.simulator->mlt_heater_volume = 20; |
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1405 | Config.simulator->hlt_heater_power = Config.simulator->mlt_heater_power = 2000; |
f84501d8dd87
Most parts of the simulator are working, needs some tuning.
Michiel Broek <mbroek@mbse.eu>
parents:
450
diff
changeset
|
1406 | Config.simulator->hlt_heater_state = Config.simulator->mlt_heater_state = 0; |
438
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1407 | } |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1408 | #endif |
7d1ec160d751
Added simulator configuration.
Michiel Broek <mbroek@mbse.eu>
parents:
435
diff
changeset
|
1409 | |
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
|
1410 | 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
|
1411 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1412 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1413 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1414 |