thermferm/rdconfig.c

Sat, 30 Apr 2016 21:06:20 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 30 Apr 2016 21:06:20 +0200
changeset 497
18ace27338e5
parent 492
750f2468dec5
child 500
5aa914eb644e
permissions
-rw-r--r--

Compiles mosquitto code if library is found on the system. Bumped to version 0.5.4

51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
497
18ace27338e5 Compiles mosquitto code if library is found on the system. Bumped to version 0.5.4
Michiel Broek <mbroek@mbse.eu>
parents: 492
diff changeset
2 * Copyright (C) 2014-2016
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Michiel Broek <mbroek at mbse dot eu>
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * This file is part of the mbsePi-apps
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * This is free software; you can redistribute it and/or modify it
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * under the terms of the GNU General Public License as published by the
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * Free Software Foundation; either version 2, or (at your option) any
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * later version.
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 *
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * mbsePi-apps is distributed in the hope that it will be useful, but
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * General Public License for more details.
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 *
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
213
2317b8d644fa Code cleanup, streamlined error messages.
Michiel Broek <mbroek@mbse.eu>
parents: 209
diff changeset
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 *****************************************************************************/
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
106
1bd9a16f5061 Added .h files
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
23 #include "rdconfig.h"
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 #include "thermferm.h"
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
25 #include "pid.h"
106
1bd9a16f5061 Added .h files
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
26 #include "futil.h"
1bd9a16f5061 Added .h files
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
27 #include "xutil.h"
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
29 int debug = FALSE;
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 sys_config Config; /* System configuration */
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
32 #define MY_ENCODING "utf-8"
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33
101
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
34 const char TEMPSTATE[3][8] = { "OK", "MISSING", "ERROR" };
90
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
35 const char UNITMODE[5][8] = { "OFF", "NONE", "FRIDGE", "BEER", "PROFILE" };
217
2922d439ff63 Added profile state ABORT
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
36 const char PROFSTATE[5][6] = { "OFF", "PAUSE", "RUN", "DONE", "ABORT" };
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
37 const char DEVTYPE[8][6] = { "NA", "W1", "GPIO", "RC433", "DHT", "I2C", "SPI", "SIM" };
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
38 const char DEVPRESENT[4][6] = { "UNDEF", "NO", "YES", "ERROR" };
162
6fc9e3f7962f Added Raspberry GPIO devices
Michiel Broek <mbroek@mbse.eu>
parents: 161
diff changeset
39 const char DEVDIR[7][11] = { "UNDEF", "IN_BIN", "OUT_BIN", "IN_ANALOG", "OUT_ANALOG", "OUT_PWM", "INTERN" };
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
40 const char PIDMODE[3][5] = { "NONE", "AUTO", "BOO" };
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43 void killconfig(void)
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44 {
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
45 units_list *tmp2;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
46 profiles_list *tmp3;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
47 prof_step *tmp4;
161
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
48 devices_list *device;
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
49 #ifdef USE_SIMULATOR
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
50 simulator_list *simulator;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
51 #endif
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53 if (Config.name)
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54 free(Config.name);
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 Config.name = NULL;
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57 Config.my_port = 6554;
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
58 Config.tempFormat = 'C';
206
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
59 if (Config.temp_address)
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
60 free(Config.temp_address);
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
61 if (Config.hum_address)
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
62 free(Config.hum_address);
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
63 Config.temp_address = Config.hum_address = NULL;
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
64 Config.temp_value = 20000;
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
65 Config.temp_state = Config.hum_state = 1; // missing
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
66 Config.hum_value = 50000;
497
18ace27338e5 Compiles mosquitto code if library is found on the system. Bumped to version 0.5.4
Michiel Broek <mbroek@mbse.eu>
parents: 492
diff changeset
67 #ifdef HAVE_MOSQUITTO_H
18ace27338e5 Compiles mosquitto code if library is found on the system. Bumped to version 0.5.4
Michiel Broek <mbroek@mbse.eu>
parents: 492
diff changeset
68 if (Config.mosq_host)
18ace27338e5 Compiles mosquitto code if library is found on the system. Bumped to version 0.5.4
Michiel Broek <mbroek@mbse.eu>
parents: 492
diff changeset
69 free(Config.mosq_host);
18ace27338e5 Compiles mosquitto code if library is found on the system. Bumped to version 0.5.4
Michiel Broek <mbroek@mbse.eu>
parents: 492
diff changeset
70 Config.mosq_host = NULL;
18ace27338e5 Compiles mosquitto code if library is found on the system. Bumped to version 0.5.4
Michiel Broek <mbroek@mbse.eu>
parents: 492
diff changeset
71 Config.mosq_port = 1883;
18ace27338e5 Compiles mosquitto code if library is found on the system. Bumped to version 0.5.4
Michiel Broek <mbroek@mbse.eu>
parents: 492
diff changeset
72 #endif
18ace27338e5 Compiles mosquitto code if library is found on the system. Bumped to version 0.5.4
Michiel Broek <mbroek@mbse.eu>
parents: 492
diff changeset
73
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
74 for (tmp2 = Config.units; tmp2; tmp2 = tmp2->next) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
75 if (tmp2->uuid)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
76 free(tmp2->uuid);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
77 if (tmp2->name)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
78 free(tmp2->name);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
79 if (tmp2->air_address)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
80 free(tmp2->air_address);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
81 if (tmp2->beer_address)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
82 free(tmp2->beer_address);
175
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
83 if (tmp2->heater_address)
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
84 free(tmp2->heater_address);
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
85 if (tmp2->cooler_address)
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
86 free(tmp2->cooler_address);
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
87 if (tmp2->fan_address)
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
88 free(tmp2->fan_address);
306
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
89 if (tmp2->light_address)
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
90 free(tmp2->light_address);
175
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
91 if (tmp2->door_address)
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
92 free(tmp2->door_address);
306
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
93 if (tmp2->psu_address)
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
94 free(tmp2->psu_address);
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
95 if (tmp2->profile)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
96 free(tmp2->profile);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
97 free(tmp2);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
98 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
99 Config.units = NULL;
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
101 for (tmp3 = Config.profiles; tmp3; tmp3 = tmp3->next) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
102 if (tmp3->uuid)
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
103 free(tmp3->uuid);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
104 if (tmp3->name)
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
105 free(tmp3->name);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
106 if (tmp3->steps) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
107 for (tmp4 = tmp3->steps; tmp4; tmp4 = tmp4->next) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
108 free(tmp4);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
109 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
110 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
111 free(tmp3);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
112 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
113 Config.profiles = NULL;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
114
161
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
115 for (device = Config.devices; device; device = device->next) {
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
116 if (device->uuid)
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
117 free(device->uuid);
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
118 if (device->address)
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
119 free(device->address);
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
120 if (device->description)
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
121 free(device->description);
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
122 if (device->comment)
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
123 free(device->comment);
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
124 free(device);
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
125 }
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
126 Config.devices = NULL;
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
127
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
128 #ifdef USE_SIMULATOR
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
129 for (simulator = Config.simulators; simulator; simulator = simulator->next) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
130 if (simulator->uuid)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
131 free(simulator->uuid);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
132 if (simulator->name)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
133 free(simulator->name);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
134 free(simulator);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
135 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
136 Config.simulators = NULL;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
137 #endif
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
138
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
139 Config.lcd_cols = 16;
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
140 Config.lcd_rows = 2;
53
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
141 }
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
142
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
143
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
144
166
c31ea86fec43 Forgot some close functions so tha program ran out of file descriptors. Better loggin for writing the configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 165
diff changeset
145 int do_wrconfig(void);
c31ea86fec43 Forgot some close functions so tha program ran out of file descriptors. Better loggin for writing the configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 165
diff changeset
146 int do_wrconfig(void)
53
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
147 {
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
148 int rc = 0;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
149 FILE *fp;
370
843dc511c877 Fixed memory leak in wrconfig
Michiel Broek <mbroek@mbse.eu>
parents: 363
diff changeset
150 char *mypath = NULL;
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
151 xmlTextWriterPtr writer;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
152 xmlBufferPtr buf;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
153 units_list *tmp3;
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
154 profiles_list *tmp4;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
155 prof_step *tmp5;
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
156 devices_list *device;
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
157 #ifdef USE_SIMULATOR
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
158 simulator_list *simulator;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
159 #endif
53
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
160
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
161 /*
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
162 * Create a new XML buffer, to which the XML document will be written
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
163 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
164 if ((buf = xmlBufferCreate()) == NULL) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
165 syslog(LOG_NOTICE, "wrconfig: error creating the xml buffer");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
166 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
167 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
168
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
169 /*
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
170 * Create a new XmlWriter for memory, with no compression.
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
171 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
172 if ((writer = xmlNewTextWriterMemory(buf, 0)) == NULL) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
173 syslog(LOG_NOTICE, "wrconfig: error creating the xml writer");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
174 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
175 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
176
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
177 /*
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
178 * Use indentation instead of one long line
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
179 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
180 if ((rc = xmlTextWriterSetIndent(writer, 2)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
181 syslog(LOG_NOTICE, "wrconfig: error setting Indent");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
182 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
183 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
184
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
185 /*
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
186 * Start the document with the xml default for the version,
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
187 * encoding ISO 8859-1 and the default for the standalone
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
188 * declaration.
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
189 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
190 if ((rc = xmlTextWriterStartDocument(writer, NULL, MY_ENCODING, NULL)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
191 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartDocument");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
192 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
193 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
194
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
195 /*
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
196 * Start an element named "THERMFERM". Since thist is the first
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
197 * element, this will be the root element of the document.
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
198 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
199 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "THERMFERM")) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
200 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
201 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
202 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
203
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
204 /*
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
205 * Add an attribute with name "VERSION" and value "1" to THERMFERM.
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
206 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
207 if ((rc = xmlTextWriterWriteElement(writer, BAD_CAST "VERSION", BAD_CAST "1")) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
208 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
209 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
210 }
286
674efa17be1d The global system name was not saved or restored from the configuration file.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
211 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", Config.name)) < 0) {
674efa17be1d The global system name was not saved or restored from the configuration file.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
212 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
674efa17be1d The global system name was not saved or restored from the configuration file.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
213 return 1;
674efa17be1d The global system name was not saved or restored from the configuration file.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
214 }
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
215 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "LISTEN_PORT", "%d", Config.my_port)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
216 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
217 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
218 }
77
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
219 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMPFORMAT", "%c", Config.tempFormat)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
220 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
77
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
221 return 1;
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
222 }
206
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
223 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_ADDRESS", "%s", Config.temp_address)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
224 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
206
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
225 return 1;
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
226 }
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
227 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_STATE", "%d", Config.temp_state)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
228 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
206
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
229 return 1;
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
230 }
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
231 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_VALUE", "%d", Config.temp_value)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
232 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
206
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
233 return 1;
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
234 }
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
235 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HUM_ADDRESS", "%s", Config.hum_address)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
236 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
206
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
237 return 1;
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
238 }
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
239 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HUM_STATE", "%d", Config.hum_state)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
240 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
206
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
241 return 1;
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
242 }
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
243 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HUM_VALUE", "%d", Config.hum_value)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
244 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
206
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
245 return 1;
95
2c28afc329a5 Removed old brewPi settings
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
246 }
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
247
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
248 /*
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
249 * Start an element named "LCDS" as child of THERMFERM.
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
250 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
251 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "LCDS")) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
252 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
253 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
254 }
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
255 /*
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
256 * Start one LCD. It is possible to connect 7 LCD displays on the i2c bus.
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
257 * However this program doesn't use more then one yet.
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
258 */
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
259 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "LCD")) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
260 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
261 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
262 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
263 if ((rc = xmlTextWriterWriteElement(writer, BAD_CAST "VERSION", BAD_CAST "1")) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
264 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
265 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
266 }
78
c49ab5179bf3 Added lcd i2c address to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 77
diff changeset
267 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ADDRESS", "0x%x", Config.lcd_address)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
268 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
78
c49ab5179bf3 Added lcd i2c address to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 77
diff changeset
269 return 1;
c49ab5179bf3 Added lcd i2c address to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 77
diff changeset
270 }
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
271 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COLUMNS", "%d", Config.lcd_cols)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
272 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
273 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
274 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
275 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROWS", "%d", Config.lcd_rows)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
276 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
277 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
278 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
279 /*
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
280 * Close the element named LCD.
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
281 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
282 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
283 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
284 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
285 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
286 /*
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
287 * Close the element LCDS.
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
288 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
289 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
290 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
291 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
292 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
293
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
294 /*
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
295 * Fermenter units
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
296 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
297 if (Config.units) {
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
298 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "FERMENTERS")) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
299 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
300 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
301 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
302 for (tmp3 = Config.units; tmp3; tmp3 = tmp3->next) {
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
303 /*
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
304 * Only configuration items are written, measured values and states
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
305 * are written to a state file.
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
306 */
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
307 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "UNIT")) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
308 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
309 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
310 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
311 if ((rc = xmlTextWriterWriteElement(writer, BAD_CAST "VERSION", BAD_CAST "1")) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
312 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
313 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
314 }
77
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
315 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", tmp3->uuid)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
316 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
317 return 1;
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
318 }
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
319 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", tmp3->name)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
320 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
321 return 1;
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
322 }
77
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
323 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "VOLUME", "%.1f", tmp3->volume)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
324 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
325 return 1;
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
326 }
101
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
327 if (tmp3->air_address) {
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
328 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_ADDRESS", "%s", tmp3->air_address)) < 0)) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
329 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
101
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
330 return 1;
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
331 }
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
332 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_STATE", "%d", tmp3->air_state)) < 0)) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
333 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
101
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
334 return 1;
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
335 }
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
336 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_TEMPERATURE", "%d", tmp3->air_temperature)) < 0)) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
337 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
101
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
338 return 1;
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
339 }
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
340 }
101
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
341 if (tmp3->beer_address) {
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
342 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_ADDRESS", "%s", tmp3->beer_address)) < 0)) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
343 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
101
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
344 return 1;
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
345 }
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
346 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_STATE", "%d", tmp3->beer_state)) < 0)) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
347 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
101
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
348 return 1;
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
349 }
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
350 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_TEMPERATURE", "%d", tmp3->beer_temperature)) < 0)) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
351 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
101
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
352 return 1;
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
353 }
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
354 }
175
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
355 if (tmp3->heater_address) {
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
356 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_ADDRESS", "%s", tmp3->heater_address)) < 0)) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
357 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
175
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
358 return 1;
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
359 }
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
360 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_STATE", "%d", tmp3->heater_state)) < 0)) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
361 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
175
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
362 return 1;
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
363 }
270
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
364 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_DELAY", "%d", tmp3->heater_delay)) < 0)) {
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
365 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
366 return 1;
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
367 }
293
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
368 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_USAGE", "%d", tmp3->heater_usage)) < 0)) {
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
369 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
370 return 1;
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
371 }
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
372 }
175
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
373 if (tmp3->cooler_address) {
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
374 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_ADDRESS", "%s", tmp3->cooler_address)) < 0)) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
375 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
175
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
376 return 1;
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
377 }
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
378 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_STATE", "%d", tmp3->cooler_state)) < 0)) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
379 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
175
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
380 return 1;
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
381 }
270
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
382 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_DELAY", "%d", tmp3->cooler_delay)) < 0)) {
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
383 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
384 return 1;
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
385 }
293
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
386 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_USAGE", "%d", tmp3->cooler_usage)) < 0)) {
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
387 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
388 return 1;
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
389 }
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
390 }
175
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
391 if (tmp3->fan_address) {
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
392 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_ADDRESS", "%s", tmp3->fan_address)) < 0)) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
393 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
175
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
394 return 1;
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
395 }
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
396 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_STATE", "%d", tmp3->fan_state)) < 0)) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
397 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
175
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
398 return 1;
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
399 }
270
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
400 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_DELAY", "%d", tmp3->fan_delay)) < 0)) {
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
401 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
402 return 1;
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
403 }
293
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
404 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_USAGE", "%d", tmp3->fan_usage)) < 0)) {
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
405 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
406 return 1;
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
407 }
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
408 }
306
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
409 if (tmp3->light_address) {
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
410 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_ADDRESS", "%s", tmp3->light_address)) < 0)) {
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
411 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
412 return 1;
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
413 }
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
414 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_STATE", "%d", tmp3->light_state)) < 0)) {
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
415 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
416 return 1;
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
417 }
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
418 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_DELAY", "%d", tmp3->light_delay)) < 0)) {
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
419 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
420 return 1;
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
421 }
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
422 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_USAGE", "%d", tmp3->light_usage)) < 0)) {
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
423 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
424 return 1;
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
425 }
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
426 }
175
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
427 if (tmp3->door_address) {
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
428 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "DOOR_ADDRESS", "%s", tmp3->door_address)) < 0)) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
429 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
430 return 1;
175
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
431 }
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
432 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "DOOR_STATE", "%d", tmp3->door_state)) < 0)) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
433 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
434 return 1;
175
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
435 }
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
436 }
306
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
437 if (tmp3->psu_address) {
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
438 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PSU_ADDRESS", "%s", tmp3->psu_address)) < 0)) {
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
439 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
440 return 1;
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
441 }
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
442 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PSU_STATE", "%d", tmp3->psu_state)) < 0)) {
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
443 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
444 return 1;
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
445 }
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
446 }
77
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
447 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MODE", "%s", UNITMODE[tmp3->mode] )) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
448 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
449 return 1;
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
450 }
77
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
451 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_SET", "%.1f", tmp3->beer_set)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
452 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
453 return 1;
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
454 }
77
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
455 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIDGE_SET", "%.1f", tmp3->fridge_set)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
456 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
457 return 1;
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
458 }
77
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
459 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_SET_MIN", "%.1f", tmp3->temp_set_min)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
460 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
461 return 1;
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
462 }
77
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
463 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_SET_MAX", "%.1f", tmp3->temp_set_max)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
464 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
465 return 1;
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
466 }
77
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
467 if (tmp3->profile) {
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
468 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROFILE", "%s", tmp3->profile)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
469 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
470 return 1;
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
471 }
90
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
472 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_STARTED", "%d", (unsigned int)tmp3->prof_started)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
473 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
90
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
474 return 1;
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
475 }
194
9eaaba49450f Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
476 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_PAUSED", "%d", (unsigned int)tmp3->prof_paused)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
477 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
194
9eaaba49450f Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
478 return 1;
9eaaba49450f Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
479 }
90
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
480 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_STATE", "%s", PROFSTATE[tmp3->prof_state] )) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
481 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
482 return 1;
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
483 }
289
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
484 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_PEAK_ABS", "%.3f", tmp3->prof_peak_abs)) < 0) {
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
485 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
486 return 1;
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
487 }
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
488 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_PEAK_REL", "%.3f", tmp3->prof_peak_rel)) < 0) {
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
489 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
490 return 1;
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
491 }
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
492 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_PRIMARY_DONE", "%d", (unsigned int)tmp3->prof_primary_done)) < 0) {
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
493 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
494 return 1;
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
495 }
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
496 }
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
497 if (tmp3->PID_cool) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
498 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_IMAX", "%.2f", tmp3->PID_cool->iMax)) < 0) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
499 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
500 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
501 }
492
750f2468dec5 Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents: 418
diff changeset
502 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_IGAIN", "%.3f", tmp3->PID_cool->iGain)) < 0) {
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
503 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
504 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
505 }
492
750f2468dec5 Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents: 418
diff changeset
506 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_PGAIN", "%.3f", tmp3->PID_cool->pGain)) < 0) {
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
507 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
508 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
509 }
492
750f2468dec5 Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents: 418
diff changeset
510 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_DGAIN", "%.3f", tmp3->PID_cool->dGain)) < 0) {
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
511 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
512 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
513 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
514 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_IDLERANGE", "%.2f", tmp3->PID_cool->idleRange)) < 0) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
515 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
516 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
517 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
518 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_INPUT", "%.2f", tmp3->PID_cool->Input)) < 0) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
519 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
520 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
521 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
522 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_ERR", "%.2f", tmp3->PID_cool->Err)) < 0) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
523 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
524 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
525 }
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
526 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_ISTATE", "%.2f", tmp3->PID_cool->iState)) < 0) {
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
527 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
528 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
529 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
530 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_SETP", "%.2f", tmp3->PID_cool->SetP)) < 0) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
531 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
532 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
533 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
534 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_OUTP", "%.2f", tmp3->PID_cool->OutP)) < 0) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
535 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
536 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
537 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
538 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_MODE", "%s", PIDMODE[tmp3->PID_cool->Mode])) < 0) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
539 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
540 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
541 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
542 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_TYPE", "COOL")) < 0) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
543 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
544 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
545 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
546 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
547 if (tmp3->PID_heat) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
548 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_IMAX", "%.2f", tmp3->PID_heat->iMax)) < 0) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
549 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
550 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
551 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
552 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_IDLERANGE", "%.2f", tmp3->PID_heat->idleRange)) < 0) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
553 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
554 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
555 }
492
750f2468dec5 Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents: 418
diff changeset
556 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_IGAIN", "%.3f", tmp3->PID_heat->iGain)) < 0) {
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
557 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
558 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
559 }
492
750f2468dec5 Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents: 418
diff changeset
560 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_PGAIN", "%.3f", tmp3->PID_heat->pGain)) < 0) {
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
561 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
562 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
563 }
492
750f2468dec5 Changed PID code. PID parameters are now stored 3 digits instead of 2 behind the decimal point. Prevent extreme heating or cooling in Beer mode. Heat and Cool lockdown now allows the lagest value to win instead of zero them both. PID output treshold from 2% to 50%.
Michiel Broek <mbroek@mbse.eu>
parents: 418
diff changeset
564 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_DGAIN", "%.3f", tmp3->PID_heat->dGain)) < 0) {
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
565 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
566 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
567 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
568 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_INPUT", "%.2f", tmp3->PID_heat->Input)) < 0) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
569 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
570 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
571 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
572 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_ERR", "%.2f", tmp3->PID_heat->Err)) < 0) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
573 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
574 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
575 }
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
576 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_ISTATE", "%.2f", tmp3->PID_heat->iState)) < 0) {
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
577 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
578 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
579 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
580 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_SETP", "%.2f", tmp3->PID_heat->SetP)) < 0) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
581 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
582 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
583 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
584 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_OUTP", "%.2f", tmp3->PID_heat->OutP)) < 0) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
585 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
586 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
587 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
588 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_MODE", "%s", PIDMODE[tmp3->PID_heat->Mode])) < 0) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
589 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
590 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
591 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
592 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_TYPE", "HEAT")) < 0) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
593 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
594 return 1;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
595 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
596 }
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
597 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
598 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
599 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
600 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
601 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
602 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
603 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
604 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
605 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
606 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
607
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
608 /*
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
609 * Fermenting profiles
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
610 */
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
611 if (Config.profiles) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
612 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "PROFILES")) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
613 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
614 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
615 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
616 for (tmp4 = Config.profiles; tmp4; tmp4 = tmp4->next) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
617 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "PROFILE")) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
618 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
619 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
620 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
621 if ((rc = xmlTextWriterWriteElement(writer, BAD_CAST "VERSION", BAD_CAST "1")) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
622 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
623 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
624 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
625 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", tmp4->uuid)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
626 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
627 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
628 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
629 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", tmp4->name)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
630 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
631 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
632 }
136
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
633 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BUSY", "%d", tmp4->busy)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
634 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
136
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
635 return 1;
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
636 }
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
637 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "INITTEMP_LO", "%.1f", tmp4->inittemp_lo)) < 0) {
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
638 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
639 return 1;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
640 }
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
641 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "INITTEMP_HI", "%.1f", tmp4->inittemp_hi)) < 0) {
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
642 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
643 return 1;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
644 }
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
645 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIDGE_MODE", "%d", tmp4->fridge_mode)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
646 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
191
c74bbc24a1c8 Client/Server communication is now almost final
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
647 return 1;
c74bbc24a1c8 Client/Server communication is now almost final
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
648 }
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
649 if (tmp4->steps) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
650 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "STEPS")) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
651 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
652 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
653 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
654 for (tmp5 = tmp4->steps; tmp5; tmp5 = tmp5->next) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
655 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "STEP")) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
656 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
657 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
658 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
659 if ((rc = xmlTextWriterWriteElement(writer, BAD_CAST "VERSION", BAD_CAST "1")) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
660 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
661 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
662 }
92
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
663 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "RESTTIME", "%d", tmp5->resttime)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
664 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
665 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
666 }
92
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
667 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "STEPTIME", "%d", tmp5->steptime)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
668 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
92
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
669 return 1;
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
670 }
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
671 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TARGET_LO", "%.1f", tmp5->target_lo)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
672 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
673 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
674 }
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
675 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TARGET_HI", "%.1f", tmp5->target_hi)) < 0) {
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
676 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
677 return 1;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
678 }
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
679 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIDGE_MODE", "%d", tmp5->fridge_mode)) < 0) {
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
680 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
681 return 1;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
682 }
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
683 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
684 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
685 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
686 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
687 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
688 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
689 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
690 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
691 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
692 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
693 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
694 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
695 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
696 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
697 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
698 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
699 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
700 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
701 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
702 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
703
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
704 if (Config.devices) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
705 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "DEVICES")) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
706 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
707 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
708 }
240
6bdda35b4a13 Added thread locks for device processing
Michiel Broek <mbroek@mbse.eu>
parents: 235
diff changeset
709 #ifdef HAVE_WIRINGPI_H
6bdda35b4a13 Added thread locks for device processing
Michiel Broek <mbroek@mbse.eu>
parents: 235
diff changeset
710 piLock(LOCK_DEVICES);
6bdda35b4a13 Added thread locks for device processing
Michiel Broek <mbroek@mbse.eu>
parents: 235
diff changeset
711 #endif
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
712 for (device = Config.devices; device; device = device->next) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
713 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "DEVICE")) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
714 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
715 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
716 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
717 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "VERSION", "%d", device->version)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
718 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
719 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
720 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
721 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", device->uuid)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
722 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
723 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
724 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
725 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TYPE", "%s", DEVTYPE[device->type])) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
726 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
727 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
728 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
729 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "DIRECTION", "%s", DEVDIR[device->direction])) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
730 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
731 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
732 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
733 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "VALUE", "%d", device->value)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
734 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
735 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
736 }
209
c5b1dfd83e81 Added offset value for sensor that need it
Michiel Broek <mbroek@mbse.eu>
parents: 206
diff changeset
737 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "OFFSET", "%d", device->offset)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
738 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
209
c5b1dfd83e81 Added offset value for sensor that need it
Michiel Broek <mbroek@mbse.eu>
parents: 206
diff changeset
739 return 1;
c5b1dfd83e81 Added offset value for sensor that need it
Michiel Broek <mbroek@mbse.eu>
parents: 206
diff changeset
740 }
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
741 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PRESENT", "%s", DEVPRESENT[device->present])) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
742 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
743 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
744 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
745 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ADDRESS", "%s", device->address)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
746 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
747 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
748 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
749 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "SUBDEVICE", "%d", device->subdevice)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
750 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
751 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
752 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
753 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "GPIOPIN", "%d", device->gpiopin)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
754 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
755 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
756 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
757 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "DESCRIPTION", "%s", device->description)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
758 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
759 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
760 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
761 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "INUSE", "%d", device->inuse)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
762 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
763 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
764 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
765 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COMMENT", "%s", device->comment)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
766 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
767 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
768 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
769 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TIMESTAMP", "%d", (int)device->timestamp)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
770 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
771 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
772 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
773 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
774 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
775 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
776 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
777 }
240
6bdda35b4a13 Added thread locks for device processing
Michiel Broek <mbroek@mbse.eu>
parents: 235
diff changeset
778 #ifdef HAVE_WIRINGPI_H
6bdda35b4a13 Added thread locks for device processing
Michiel Broek <mbroek@mbse.eu>
parents: 235
diff changeset
779 piUnlock(LOCK_DEVICES);
6bdda35b4a13 Added thread locks for device processing
Michiel Broek <mbroek@mbse.eu>
parents: 235
diff changeset
780 #endif
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
781
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
782 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
783 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
784 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
785 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
786 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
787
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
788 #ifdef USE_SIMULATOR
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
789 if (Config.simulators) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
790 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "SIMULATORS")) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
791 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
792 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
793 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
794 for (simulator = Config.simulators; simulator; simulator = simulator->next) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
795 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "SIMULATOR")) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
796 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
797 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
798 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
799 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "VERSION", "%d", simulator->version)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
800 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
801 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
802 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
803 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", simulator->uuid)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
804 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
805 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
806 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
807 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", simulator->name)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
808 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
809 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
810 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
811 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "VOLUME_AIR", "%d", simulator->volume_air)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
812 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
813 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
814 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
815 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "VOLUME_BEER", "%d", simulator->volume_beer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
816 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
817 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
818 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
819 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOM_TEMPERATURE", "%.1f", simulator->room_temperature)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
820 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
821 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
822 }
262
d0014ccec615 Simulation of fridge cold loss to the room added for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 259
diff changeset
823 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_TEMPERATURE", "%f", simulator->air_temperature)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
824 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
825 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
826 }
262
d0014ccec615 Simulation of fridge cold loss to the room added for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 259
diff changeset
827 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_TEMPERATURE", "%f", simulator->beer_temperature)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
828 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
829 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
830 }
262
d0014ccec615 Simulation of fridge cold loss to the room added for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 259
diff changeset
831 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_TEMP", "%f", simulator->cooler_temp)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
832 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
833 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
834 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
835 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_TIME", "%d", simulator->cooler_time)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
836 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
837 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
838 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
839 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_SIZE", "%.3f", simulator->cooler_size)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
840 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
841 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
842 }
262
d0014ccec615 Simulation of fridge cold loss to the room added for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 259
diff changeset
843 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_TEMP", "%f", simulator->heater_temp)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
844 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
845 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
846 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
847 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_TIME", "%d", simulator->heater_time)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
848 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
849 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
850 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
851 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_SIZE", "%.3f", simulator->heater_size)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
852 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
853 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
854 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
855 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_STATE", "%d", simulator->heater_state)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
856 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
857 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
858 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
859 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_STATE", "%d", simulator->cooler_state)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
860 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
861 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
862 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
863 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIGO_ISOLATION", "%.3f", simulator->frigo_isolation)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
864 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
865 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
866 }
262
d0014ccec615 Simulation of fridge cold loss to the room added for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 259
diff changeset
867 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_YEAST_HEAT", "%f", simulator->s_yeast_heat)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
868 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
869 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
870 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
871 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_YEAST_STARTED", "%d", (int)simulator->s_yeast_started)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
872 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
873 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
874 }
262
d0014ccec615 Simulation of fridge cold loss to the room added for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 259
diff changeset
875 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_COOL_TEMP", "%f", simulator->s_cool_temp)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
876 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
877 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
878 }
262
d0014ccec615 Simulation of fridge cold loss to the room added for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 259
diff changeset
879 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_HEAT_TEMP", "%f", simulator->s_heat_temp)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
880 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
881 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
882 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
883 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_COOL_CHANGED", "%d", (int)simulator->s_cool_changed)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
884 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
885 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
886 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
887 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_HEAT_CHANGED", "%d", (int)simulator->s_heat_changed)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
888 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
889 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
890 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
891 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
892 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
893 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
894 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
895 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
896 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
897 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
898 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
899 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
900 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
901 #endif
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
902
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
903 /*
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
904 * All done, close any open elements
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
905 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
906 if ((rc = xmlTextWriterEndDocument(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
907 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndDocument");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
908 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
909 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
910 xmlFreeTextWriter(writer);
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
911
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
912 /*
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
913 * Now write the XML configuration
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
914 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
915 if (getenv((char *)"USER") == NULL) {
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
916 mypath = xstrcpy((char *)"/root");
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
917 } else {
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
918 mypath = xstrcpy(getenv((char *)"HOME"));
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
919 }
86
3d7a241329e2 Using final user paths for log, configuration and profiles
Michiel Broek <mbroek@mbse.eu>
parents: 83
diff changeset
920 mypath = xstrcat(mypath, (char *)"/.thermferm/etc/");
3d7a241329e2 Using final user paths for log, configuration and profiles
Michiel Broek <mbroek@mbse.eu>
parents: 83
diff changeset
921 mkdirs(mypath, 0755);
3d7a241329e2 Using final user paths for log, configuration and profiles
Michiel Broek <mbroek@mbse.eu>
parents: 83
diff changeset
922 mypath = xstrcat(mypath, (char *)"thermferm.xml");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
923
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
924 if (debug)
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
925 fprintf(stdout, "Writing %s\n", mypath);
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
926
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
927 if ((fp = fopen(mypath, "w")) == NULL) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
928 syslog(LOG_NOTICE, "could not rewrite %s", mypath);
370
843dc511c877 Fixed memory leak in wrconfig
Michiel Broek <mbroek@mbse.eu>
parents: 363
diff changeset
929 free(mypath);
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
930 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
931 }
370
843dc511c877 Fixed memory leak in wrconfig
Michiel Broek <mbroek@mbse.eu>
parents: 363
diff changeset
932 free(mypath);
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
933
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
934 fprintf(fp, "%s", (const char *) buf->content);
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
935 fclose(fp);
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
936 xmlBufferFree(buf);
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
937
166
c31ea86fec43 Forgot some close functions so tha program ran out of file descriptors. Better loggin for writing the configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 165
diff changeset
938 return 0;
c31ea86fec43 Forgot some close functions so tha program ran out of file descriptors. Better loggin for writing the configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 165
diff changeset
939 }
c31ea86fec43 Forgot some close functions so tha program ran out of file descriptors. Better loggin for writing the configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 165
diff changeset
940
c31ea86fec43 Forgot some close functions so tha program ran out of file descriptors. Better loggin for writing the configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 165
diff changeset
941
c31ea86fec43 Forgot some close functions so tha program ran out of file descriptors. Better loggin for writing the configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 165
diff changeset
942
c31ea86fec43 Forgot some close functions so tha program ran out of file descriptors. Better loggin for writing the configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 165
diff changeset
943 int wrconfig(void)
c31ea86fec43 Forgot some close functions so tha program ran out of file descriptors. Better loggin for writing the configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 165
diff changeset
944 {
c31ea86fec43 Forgot some close functions so tha program ran out of file descriptors. Better loggin for writing the configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 165
diff changeset
945 int rc;
c31ea86fec43 Forgot some close functions so tha program ran out of file descriptors. Better loggin for writing the configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 165
diff changeset
946
c31ea86fec43 Forgot some close functions so tha program ran out of file descriptors. Better loggin for writing the configuration.
Michiel Broek <mbroek@mbse.eu>
parents: 165
diff changeset
947 rc = do_wrconfig();
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
948 syslog(LOG_NOTICE, "Rewritten configuration, rc=%d", rc);
53
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
949 return rc;
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
950 }
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
951
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
952
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
953
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
954 /*
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
955 * Parse one LCD display
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
956 */
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
957 int parseLCD(xmlDocPtr doc, xmlNodePtr cur)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
958 {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
959 xmlChar *key;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
960 int ival;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
961
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
962 cur = cur->xmlChildrenNode;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
963 while (cur != NULL) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
964 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COLUMNS"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
965 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
966 if (sscanf((const char *)key, "%d", &ival) == 1)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
967 Config.lcd_cols = ival;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
968 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
969 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
970 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROWS"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
971 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
972 if (sscanf((const char *)key, "%d", &ival) == 1)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
973 Config.lcd_rows = ival;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
974 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
975 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
976 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ADDRESS"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
977 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
978 if (sscanf((const char *)key, "%x", &ival) == 1)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
979 Config.lcd_address = ival;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
980 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
981 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
982 cur = cur->next;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
983 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
984
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
985 return 0;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
986 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
987
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
988
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
989
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
990 int parseLCDs(xmlDocPtr doc, xmlNodePtr cur)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
991 {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
992 cur = cur->xmlChildrenNode;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
993 while (cur != NULL) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
994 if ((!xmlStrcmp(cur->name, (const xmlChar *)"LCD"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
995 parseLCD(doc, cur);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
996 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
997 cur = cur->next;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
998 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
999 return 0;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1000 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1001
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1002
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1003
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1004 /*
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1005 * Parse a fermenter unit
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1006 */
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1007 int parseUnit(xmlDocPtr doc, xmlNodePtr cur)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1008 {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1009 xmlChar *key;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1010 int i, ival;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1011 float val;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1012 units_list *unit, *tmp;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1013
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1014 unit = (units_list *)malloc(sizeof(units_list));
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1015 unit->next = NULL;
90
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1016 unit->version = 1;
175
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
1017 unit->uuid = unit->name = unit->air_address = unit->beer_address = unit->heater_address = \
306
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1018 unit->cooler_address = unit->fan_address = unit->door_address = \
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1019 unit->light_address = unit->psu_address = unit->profile = NULL;
289
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1020 unit->volume = unit->prof_peak_abs = unit->prof_peak_rel = 0.0;
101
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1021 unit->air_temperature = unit->beer_temperature = unit->beer_set = unit->fridge_set = 20.0;
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1022 unit->air_state = unit->beer_state = 1; // missing
306
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1023 unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = \
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1024 unit->light_state = unit->psu_state = unit->mode = unit->prof_state = 0;
270
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1025 unit->heater_delay = unit->cooler_delay = unit->fan_delay = 20; /* 5 minutes delay */
306
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1026 unit->light_delay = 1; /* 15 seconds delay */
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1027 unit->heater_wait = unit->cooler_wait = unit->fan_wait = unit->light_wait = 0;
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1028 unit->heater_usage = unit->cooler_usage = unit->fan_usage = unit->light_usage = 0;
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1029 unit->temp_set_min = 1.0;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1030 unit->temp_set_max = 30.0;
289
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1031 unit->prof_started = unit->prof_paused = unit->prof_primary_done = (time_t)0;
284
9e6fb5aed618 Profile progress is visible in the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 270
diff changeset
1032 unit->prof_percent = 0;
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1033 unit->PID_cool = (pid_var *)malloc(sizeof(pid_var));
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1034 unit->PID_heat = (pid_var *)malloc(sizeof(pid_var));
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1035 InitPID(unit->PID_cool, PID_TYPE_COOL);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1036 InitPID(unit->PID_heat, PID_TYPE_HEAT);
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1037
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1038 cur = cur->xmlChildrenNode;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1039 while (cur != NULL) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1040 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1041 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1042 if (xmlStrcmp(key, (const xmlChar *)"1")) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1043 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1044 return 1;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1045 }
90
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1046 unit->version = 1;
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1047 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1048 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1049 if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1050 unit->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1051 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1052 if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1053 unit->name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1054 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1055 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VOLUME"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1056 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1057 if (sscanf((const char *)key, "%f", &val) == 1)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1058 unit->volume = val;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1059 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1060 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1061 if ((!xmlStrcmp(cur->name, (const xmlChar *)"AIR_ADDRESS"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1062 unit->air_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1063 }
101
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1064 if ((!xmlStrcmp(cur->name, (const xmlChar *)"AIR_STATE"))) {
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1065 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1066 if (sscanf((const char *)key, "%d", &ival) == 1)
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1067 unit->air_state = ival;
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1068 xmlFree(key);
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1069 }
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1070 if ((!xmlStrcmp(cur->name, (const xmlChar *)"AIR_TEMPERATURE"))) {
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1071 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1072 if (sscanf((const char *)key, "%d", &ival) == 1)
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1073 unit->air_temperature = ival;
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1074 xmlFree(key);
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1075 }
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1076 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_ADDRESS"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1077 unit->beer_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1078 }
101
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1079 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_STATE"))) {
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1080 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1081 if (sscanf((const char *)key, "%d", &ival) == 1)
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1082 unit->beer_state = ival;
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1083 xmlFree(key);
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1084 }
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1085 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_TEMPERATURE"))) {
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1086 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1087 if (sscanf((const char *)key, "%d", &ival) == 1)
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1088 unit->beer_temperature = ival;
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1089 xmlFree(key);
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1090 }
175
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
1091 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HEATER_ADDRESS"))) {
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
1092 unit->heater_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1093 }
270
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1094 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HEATER_DELAY"))) {
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1095 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1096 if (sscanf((const char *)key, "%d", &ival) == 1)
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1097 unit->heater_delay = ival;
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1098 xmlFree(key);
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1099 }
293
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1100 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HEATER_USAGE"))) {
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1101 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1102 if (sscanf((const char *)key, "%d", &ival) == 1)
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1103 unit->heater_usage = ival;
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1104 xmlFree(key);
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1105 }
175
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
1106 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_ADDRESS"))) {
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
1107 unit->cooler_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1108 }
270
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1109 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_DELAY"))) {
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1110 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1111 if (sscanf((const char *)key, "%d", &ival) == 1)
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1112 unit->cooler_delay = ival;
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1113 xmlFree(key);
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1114 }
293
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1115 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_USAGE"))) {
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1116 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1117 if (sscanf((const char *)key, "%d", &ival) == 1)
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1118 unit->cooler_usage = ival;
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1119 xmlFree(key);
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1120 }
175
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
1121 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FAN_ADDRESS"))) {
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
1122 unit->fan_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1123 }
270
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1124 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FAN_DELAY"))) {
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1125 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1126 if (sscanf((const char *)key, "%d", &ival) == 1)
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1127 unit->fan_delay = ival;
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1128 xmlFree(key);
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1129 }
293
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1130 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FAN_USAGE"))) {
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1131 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1132 if (sscanf((const char *)key, "%d", &ival) == 1)
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1133 unit->fan_usage = ival;
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1134 xmlFree(key);
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1135 }
306
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1136 if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIGHT_ADDRESS"))) {
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1137 unit->light_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1138 }
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1139 if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIGHT_DELAY"))) {
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1140 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1141 if (sscanf((const char *)key, "%d", &ival) == 1)
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1142 unit->light_delay = ival;
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1143 xmlFree(key);
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1144 }
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1145 if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIGHT_USAGE"))) {
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1146 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1147 if (sscanf((const char *)key, "%d", &ival) == 1)
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1148 unit->light_usage = ival;
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1149 xmlFree(key);
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1150 }
175
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
1151 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DOOR_ADDRESS"))) {
b73490398368 Units editing is more or less complete. Changed structures for heating, cooling, fan and door. Updated the web interface to confuigure all these things.
Michiel Broek <mbroek@mbse.eu>
parents: 174
diff changeset
1152 unit->door_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1153 }
306
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1154 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PSU_ADDRESS"))) {
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1155 unit->psu_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
97602274eb58 Updated to add support for lights in a fermenter unit and a Power Supply status.
Michiel Broek <mbroek@mbse.eu>
parents: 293
diff changeset
1156 }
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1157 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MODE"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1158 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1159 for (i = 0; i < 5; i++) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1160 if (! xmlStrcmp(key, (const xmlChar *)UNITMODE[i])) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1161 unit->mode = i;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1162 break;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1163 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1164 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1165 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1166 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1167 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_SET"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1168 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1169 if (sscanf((const char *)key, "%f", &val) == 1)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1170 unit->beer_set = val;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1171 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1172 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1173 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FRIDGE_SET"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1174 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1175 if (sscanf((const char *)key, "%f", &val) == 1)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1176 unit->fridge_set = val;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1177 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1178 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1179 if ((!xmlStrcmp(cur->name, (const xmlChar *)"TEMP_SET_MIN"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1180 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1181 if (sscanf((const char *)key, "%f", &val) == 1)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1182 unit->temp_set_min = val;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1183 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1184 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1185 if ((!xmlStrcmp(cur->name, (const xmlChar *)"TEMP_SET_MAX"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1186 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1187 if (sscanf((const char *)key, "%f", &val) == 1)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1188 unit->temp_set_max = val;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1189 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1190 }
310
53774295e14a Added Kp, Kd and Ki settings to the units. Bumped to version 0.2.9
Michiel Broek <mbroek@mbse.eu>
parents: 306
diff changeset
1191 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_KP"))) {
53774295e14a Added Kp, Kd and Ki settings to the units. Bumped to version 0.2.9
Michiel Broek <mbroek@mbse.eu>
parents: 306
diff changeset
1192 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
53774295e14a Added Kp, Kd and Ki settings to the units. Bumped to version 0.2.9
Michiel Broek <mbroek@mbse.eu>
parents: 306
diff changeset
1193 if (sscanf((const char *)key, "%f", &val) == 1)
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1194 unit->PID_cool->pGain = unit->PID_heat->pGain = val; /* Upgrade config */
310
53774295e14a Added Kp, Kd and Ki settings to the units. Bumped to version 0.2.9
Michiel Broek <mbroek@mbse.eu>
parents: 306
diff changeset
1195 xmlFree(key);
53774295e14a Added Kp, Kd and Ki settings to the units. Bumped to version 0.2.9
Michiel Broek <mbroek@mbse.eu>
parents: 306
diff changeset
1196 }
53774295e14a Added Kp, Kd and Ki settings to the units. Bumped to version 0.2.9
Michiel Broek <mbroek@mbse.eu>
parents: 306
diff changeset
1197 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_KD"))) {
53774295e14a Added Kp, Kd and Ki settings to the units. Bumped to version 0.2.9
Michiel Broek <mbroek@mbse.eu>
parents: 306
diff changeset
1198 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
53774295e14a Added Kp, Kd and Ki settings to the units. Bumped to version 0.2.9
Michiel Broek <mbroek@mbse.eu>
parents: 306
diff changeset
1199 if (sscanf((const char *)key, "%f", &val) == 1)
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1200 unit->PID_cool->dGain = unit->PID_heat->dGain = val; /* Upgrade config */
310
53774295e14a Added Kp, Kd and Ki settings to the units. Bumped to version 0.2.9
Michiel Broek <mbroek@mbse.eu>
parents: 306
diff changeset
1201 xmlFree(key);
53774295e14a Added Kp, Kd and Ki settings to the units. Bumped to version 0.2.9
Michiel Broek <mbroek@mbse.eu>
parents: 306
diff changeset
1202 }
53774295e14a Added Kp, Kd and Ki settings to the units. Bumped to version 0.2.9
Michiel Broek <mbroek@mbse.eu>
parents: 306
diff changeset
1203 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_KI"))) {
53774295e14a Added Kp, Kd and Ki settings to the units. Bumped to version 0.2.9
Michiel Broek <mbroek@mbse.eu>
parents: 306
diff changeset
1204 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
53774295e14a Added Kp, Kd and Ki settings to the units. Bumped to version 0.2.9
Michiel Broek <mbroek@mbse.eu>
parents: 306
diff changeset
1205 if (sscanf((const char *)key, "%f", &val) == 1)
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1206 unit->PID_cool->iGain = unit->PID_heat->iGain = val; /* Upgrade config */
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1207 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1208 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1209 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDC_IMAX"))) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1210 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1211 if (sscanf((const char *)key, "%f", &val) == 1)
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1212 unit->PID_cool->iMax = val;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1213 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1214 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1215 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDC_IDLERANGE"))) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1216 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1217 if (sscanf((const char *)key, "%f", &val) == 1)
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1218 unit->PID_cool->idleRange = val;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1219 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1220 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1221 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDC_IGAIN"))) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1222 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1223 if (sscanf((const char *)key, "%f", &val) == 1)
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1224 unit->PID_cool->iGain = val;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1225 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1226 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1227 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDC_PGAIN"))) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1228 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1229 if (sscanf((const char *)key, "%f", &val) == 1)
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1230 unit->PID_cool->pGain = val;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1231 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1232 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1233 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDC_DGAIN"))) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1234 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1235 if (sscanf((const char *)key, "%f", &val) == 1)
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1236 unit->PID_cool->dGain = val;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1237 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1238 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1239 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDC_INPUT"))) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1240 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1241 if (sscanf((const char *)key, "%f", &val) == 1)
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1242 unit->PID_cool->Input = val;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1243 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1244 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1245 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDC_ERR"))) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1246 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1247 if (sscanf((const char *)key, "%f", &val) == 1)
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1248 unit->PID_cool->Err = val;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1249 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1250 }
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
1251 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDC_ISTATE"))) {
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1252 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1253 if (sscanf((const char *)key, "%f", &val) == 1)
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
1254 unit->PID_cool->iState = val;
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1255 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1256 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1257 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDC_SETP"))) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1258 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1259 if (sscanf((const char *)key, "%f", &val) == 1)
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1260 unit->PID_cool->SetP = val;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1261 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1262 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1263 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDC_OUTP"))) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1264 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1265 if (sscanf((const char *)key, "%f", &val) == 1)
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1266 unit->PID_cool->OutP = val;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1267 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1268 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1269 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDC_MODE"))) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1270 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1271 for (i = 0; i < 3; i++) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1272 if (! xmlStrcmp(key, (const xmlChar *)PIDMODE[i])) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1273 unit->PID_cool->Mode = i;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1274 break;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1275 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1276 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1277 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1278 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1279 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDH_IMAX"))) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1280 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1281 if (sscanf((const char *)key, "%f", &val) == 1)
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1282 unit->PID_heat->iMax = val;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1283 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1284 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1285 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDH_IDLERANGE"))) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1286 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1287 if (sscanf((const char *)key, "%f", &val) == 1)
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1288 unit->PID_heat->idleRange = val;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1289 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1290 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1291 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDH_IGAIN"))) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1292 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1293 if (sscanf((const char *)key, "%f", &val) == 1)
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1294 unit->PID_heat->iGain = val;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1295 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1296 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1297 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDH_PGAIN"))) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1298 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1299 if (sscanf((const char *)key, "%f", &val) == 1)
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1300 unit->PID_heat->pGain = val;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1301 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1302 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1303 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDH_DGAIN"))) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1304 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1305 if (sscanf((const char *)key, "%f", &val) == 1)
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1306 unit->PID_heat->dGain = val;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1307 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1308 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1309 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDH_INPUT"))) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1310 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1311 if (sscanf((const char *)key, "%f", &val) == 1)
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1312 unit->PID_heat->Input = val;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1313 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1314 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1315 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDH_ERR"))) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1316 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1317 if (sscanf((const char *)key, "%f", &val) == 1)
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1318 unit->PID_heat->Err = val;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1319 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1320 }
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
1321 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDH_ISTATE"))) {
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1322 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1323 if (sscanf((const char *)key, "%f", &val) == 1)
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
1324 unit->PID_heat->iState = val;
362
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1325 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1326 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1327 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDH_SETP"))) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1328 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1329 if (sscanf((const char *)key, "%f", &val) == 1)
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1330 unit->PID_heat->SetP = val;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1331 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1332 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1333 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDH_OUTP"))) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1334 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1335 if (sscanf((const char *)key, "%f", &val) == 1)
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1336 unit->PID_heat->OutP = val;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1337 xmlFree(key);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1338 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1339 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDH_MODE"))) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1340 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1341 for (i = 0; i < 3; i++) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1342 if (! xmlStrcmp(key, (const xmlChar *)PIDMODE[i])) {
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1343 unit->PID_heat->Mode = i;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1344 break;
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1345 }
c92651a54969 Made the client-server protocol more robust. When a change to a unit is made using the web interface, the main process is stopped during the update. Splitted the PID in two PID's, one for heating and one for cooling. Adjusted the web edit scrreen for this, but there are still rough edges. Replaced the PID code, maybe this one works better for our purpose. The simulator air temperature changes on the simulator heater and cooler, but it is not realistic at all. This is a development version, do not use in production. The version is 0.3.0
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
1346 }
310
53774295e14a Added Kp, Kd and Ki settings to the units. Bumped to version 0.2.9
Michiel Broek <mbroek@mbse.eu>
parents: 306
diff changeset
1347 xmlFree(key);
53774295e14a Added Kp, Kd and Ki settings to the units. Bumped to version 0.2.9
Michiel Broek <mbroek@mbse.eu>
parents: 306
diff changeset
1348 }
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1349 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROFILE"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1350 unit->profile = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1351 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1352 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROF_STARTED"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1353 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1354 if (sscanf((const char *)key, "%d", &ival) == 1)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1355 unit->prof_started = ival;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1356 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1357 }
194
9eaaba49450f Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
1358 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROF_PAUSED"))) {
9eaaba49450f Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
1359 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
9eaaba49450f Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
1360 if (sscanf((const char *)key, "%d", &ival) == 1)
9eaaba49450f Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
1361 unit->prof_paused = ival;
9eaaba49450f Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
1362 xmlFree(key);
9eaaba49450f Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
1363 }
90
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1364 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROF_STATE"))) {
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1365 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
217
2922d439ff63 Added profile state ABORT
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
1366 for (i = 0; i < 5; i++) {
90
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1367 if (! xmlStrcmp(key, (const xmlChar *)PROFSTATE[i])) {
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1368 unit->prof_state = i;
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1369 break;
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1370 }
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1371 }
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1372 xmlFree(key);
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1373 }
289
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1374 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROF_PEAK_ABS"))) {
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1375 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1376 if (sscanf((const char *)key, "%f", &val) == 1)
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1377 unit->prof_peak_abs = val;
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1378 xmlFree(key);
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1379 }
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1380 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROF_PEAK_REL"))) {
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1381 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1382 if (sscanf((const char *)key, "%f", &val) == 1)
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1383 unit->prof_peak_rel = val;
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1384 xmlFree(key);
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1385 }
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1386 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROF_PRIMARY_DONE"))) {
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1387 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1388 if (sscanf((const char *)key, "%d", &ival) == 1)
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1389 unit->prof_primary_done = ival;
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1390 xmlFree(key);
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1391 }
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1392 cur = cur->next;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1393 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1394
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1395 if (Config.units == NULL) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1396 Config.units = unit;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1397 } else {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1398 for (tmp = Config.units; tmp; tmp = tmp->next) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1399 if (tmp->next == NULL) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1400 tmp->next = unit;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1401 break;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1402 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1403 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1404 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1405
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1406 return 0;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1407 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1408
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1409
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1410
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1411 int parseFermenters(xmlDocPtr doc, xmlNodePtr cur)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1412 {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1413 cur = cur->xmlChildrenNode;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1414 while (cur != NULL) {
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1415 if ((!xmlStrcmp(cur->name, (const xmlChar *)"UNIT"))) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1416 parseUnit(doc, cur);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1417 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1418 cur = cur->next;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1419 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1420 return 0;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1421 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1422
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1423
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1424
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1425 int parseStep(xmlDocPtr doc, xmlNodePtr cur, prof_step **profstep)
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1426 {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1427 xmlChar *key;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1428 int ival;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1429 float val;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1430 prof_step *step, *tmp;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1431
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1432 step = (prof_step *)malloc(sizeof(prof_step));
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1433 step->next = NULL;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1434 step->version = 1;
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1435 step->steptime = step->resttime = step->fridge_mode = 0;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1436 step->target_lo = step->target_hi = 20.0;
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1437
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1438 cur = cur->xmlChildrenNode;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1439 while (cur != NULL) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1440 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1441 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1442 if (xmlStrcmp(key, (const xmlChar *)"1")) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1443 xmlFree(key);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1444 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1445 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1446 step->version = 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1447 xmlFree(key);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1448 }
92
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
1449 if ((!xmlStrcmp(cur->name, (const xmlChar *)"RESTTIME"))) {
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1450 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1451 if (sscanf((const char *)key, "%d", &ival) == 1)
92
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
1452 step->resttime = ival;
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
1453 xmlFree(key);
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
1454 }
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
1455 if ((!xmlStrcmp(cur->name, (const xmlChar *)"STEPTIME"))) {
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
1456 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
1457 if (sscanf((const char *)key, "%d", &ival) == 1)
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
1458 step->steptime = ival;
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1459 xmlFree(key);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1460 }
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1461 if ((!xmlStrcmp(cur->name, (const xmlChar *)"TARGET"))) { /* Upgrade from single values */
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1462 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1463 if (sscanf((const char *)key, "%f", &val) == 1) {
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1464 step->target_lo = val - 0.2;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1465 step->target_hi = val + 0.2;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1466 }
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1467 xmlFree(key);
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1468 }
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1469 if ((!xmlStrcmp(cur->name, (const xmlChar *)"TARGET_LO"))) {
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1470 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1471 if (sscanf((const char *)key, "%f", &val) == 1)
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1472 step->target_lo = val;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1473 xmlFree(key);
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1474 }
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1475 if ((!xmlStrcmp(cur->name, (const xmlChar *)"TARGET_HI"))) {
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1476 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1477 if (sscanf((const char *)key, "%f", &val) == 1)
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1478 step->target_hi = val;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1479 xmlFree(key);
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1480 }
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1481 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FRIDGE_MODE"))) {
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1482 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1483 if (sscanf((const char *)key, "%d", &ival) == 1)
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1484 step->fridge_mode = ival;
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1485 xmlFree(key);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1486 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1487 cur = cur->next;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1488 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1489
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1490 if (*profstep == NULL) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1491 *profstep = step;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1492 } else {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1493 for (tmp = *profstep; tmp; tmp = tmp->next) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1494 if (tmp->next == NULL) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1495 tmp->next = step;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1496 break;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1497 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1498 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1499 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1500 return 0;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1501 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1502
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1503
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1504
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1505 int parseSteps(xmlDocPtr doc, xmlNodePtr cur, prof_step **step)
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1506 {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1507 cur = cur->xmlChildrenNode;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1508 while (cur != NULL) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1509 if ((!xmlStrcmp(cur->name, (const xmlChar *)"STEP"))) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1510 parseStep(doc, cur, step);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1511 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1512 cur = cur->next;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1513 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1514 return 0;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1515 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1516
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1517
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1518
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1519 int parseProfile(xmlDocPtr doc, xmlNodePtr cur)
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1520 {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1521 xmlChar *key;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1522 profiles_list *profile, *tmp;
136
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
1523 int ival;
191
c74bbc24a1c8 Client/Server communication is now almost final
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
1524 float fval;
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1525
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1526 profile = (profiles_list *)malloc(sizeof(profiles_list));
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1527 profile->next = NULL;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1528 profile->version = 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1529 profile->uuid = profile->name = NULL;
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1530 profile->busy = profile->fridge_mode = 0;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1531 profile->inittemp_lo = profile->inittemp_hi = 20.0;
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1532 profile->steps = NULL;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1533
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1534 cur = cur->xmlChildrenNode;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1535 while (cur != NULL) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1536 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1537 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1538 if (xmlStrcmp(key, (const xmlChar *)"1")) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1539 xmlFree(key);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1540 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1541 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1542 profile->version = 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1543 xmlFree(key);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1544 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1545 if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1546 profile->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1547 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1548 if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1549 profile->name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1550 }
136
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
1551 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BUSY"))) {
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
1552 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
1553 if (sscanf((const char *)key, "%d", &ival) == 1)
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
1554 profile->busy = ival;
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
1555 xmlFree(key);
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
1556 }
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1557 if ((!xmlStrcmp(cur->name, (const xmlChar *)"INITTEMP"))) { /* Upgrade from single temp */
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1558 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1559 if (sscanf((const char *)key, "%f", &fval) == 1) {
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1560 profile->inittemp_lo = fval - 0.2;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1561 profile->inittemp_hi = fval + 0.2;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1562 }
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1563 xmlFree(key);
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1564 }
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1565 if ((!xmlStrcmp(cur->name, (const xmlChar *)"INITTEMP_LO"))) {
191
c74bbc24a1c8 Client/Server communication is now almost final
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
1566 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c74bbc24a1c8 Client/Server communication is now almost final
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
1567 if (sscanf((const char *)key, "%f", &fval) == 1)
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1568 profile->inittemp_lo = fval;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1569 xmlFree(key);
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1570 }
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1571 if ((!xmlStrcmp(cur->name, (const xmlChar *)"INITTEMP_HI"))) {
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1572 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1573 if (sscanf((const char *)key, "%f", &fval) == 1)
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1574 profile->inittemp_hi = fval;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1575 xmlFree(key);
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1576 }
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1577 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FRIDGE_MODE"))) {
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1578 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1579 if (sscanf((const char *)key, "%d", &ival) == 1)
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 388
diff changeset
1580 profile->fridge_mode = ival;
191
c74bbc24a1c8 Client/Server communication is now almost final
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
1581 xmlFree(key);
c74bbc24a1c8 Client/Server communication is now almost final
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
1582 }
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1583 if ((!xmlStrcmp(cur->name, (const xmlChar *)"STEPS"))) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1584 parseSteps(doc, cur, &(profile)->steps);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1585 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1586 cur = cur->next;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1587 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1588
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1589 if (Config.profiles == NULL) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1590 Config.profiles = profile;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1591 } else {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1592 for (tmp = Config.profiles; tmp; tmp = tmp->next) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1593 if (tmp->next == NULL) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1594 tmp->next = profile;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1595 break;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1596 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1597 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1598 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1599
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1600 return 0;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1601 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1602
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1603
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1604
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1605 int parseProfiles(xmlDocPtr doc, xmlNodePtr cur)
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1606 {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1607 cur = cur->xmlChildrenNode;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1608 while (cur != NULL) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1609 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROFILE"))) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1610 parseProfile(doc, cur);
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1611 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1612 cur = cur->next;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1613 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1614 return 0;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1615 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1616
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1617
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1618
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1619 int parseDevice(xmlDocPtr doc, xmlNodePtr cur)
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1620 {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1621 xmlChar *key;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1622 devices_list *device, *tmp;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1623 int i, ival;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1624
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1625 device = (devices_list *)malloc(sizeof(devices_list));
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1626 device->next = NULL;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1627 device->version = 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1628 device->uuid = device->address = device->description = device->comment = NULL;
209
c5b1dfd83e81 Added offset value for sensor that need it
Michiel Broek <mbroek@mbse.eu>
parents: 206
diff changeset
1629 device->type = device->direction = device->present = device->subdevice = device->inuse = device->offset = 0;
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1630 device->gpiopin = -1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1631 device->timestamp = (time_t)0;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1632
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1633 cur = cur->xmlChildrenNode;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1634 while (cur != NULL) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1635 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1636 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1637 if (xmlStrcmp(key, (const xmlChar *)"1")) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1638 xmlFree(key);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1639 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1640 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1641 device->version = 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1642 xmlFree(key);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1643 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1644 if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1645 device->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1646 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1647 if ((!xmlStrcmp(cur->name, (const xmlChar *)"TYPE"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1648 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1649 for (i = 0; i < 8; i++) {
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1650 if (! xmlStrcmp(key, (const xmlChar *)DEVTYPE[i])) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1651 device->type = i;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1652 break;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1653 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1654 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1655 xmlFree(key);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1656 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1657 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DIRECTION"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1658 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
162
6fc9e3f7962f Added Raspberry GPIO devices
Michiel Broek <mbroek@mbse.eu>
parents: 161
diff changeset
1659 for (i = 0; i < 7; i++) {
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1660 if (! xmlStrcmp(key, (const xmlChar *)DEVDIR[i])) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1661 device->direction = i;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1662 break;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1663 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1664 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1665 xmlFree(key);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1666 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1667 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VALUE"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1668 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1669 if (sscanf((const char *)key, "%d", &ival) == 1)
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1670 device->value = ival;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1671 xmlFree(key);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1672 }
209
c5b1dfd83e81 Added offset value for sensor that need it
Michiel Broek <mbroek@mbse.eu>
parents: 206
diff changeset
1673 if ((!xmlStrcmp(cur->name, (const xmlChar *)"OFFSET"))) {
c5b1dfd83e81 Added offset value for sensor that need it
Michiel Broek <mbroek@mbse.eu>
parents: 206
diff changeset
1674 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c5b1dfd83e81 Added offset value for sensor that need it
Michiel Broek <mbroek@mbse.eu>
parents: 206
diff changeset
1675 if (sscanf((const char *)key, "%d", &ival) == 1)
c5b1dfd83e81 Added offset value for sensor that need it
Michiel Broek <mbroek@mbse.eu>
parents: 206
diff changeset
1676 device->offset = ival;
c5b1dfd83e81 Added offset value for sensor that need it
Michiel Broek <mbroek@mbse.eu>
parents: 206
diff changeset
1677 xmlFree(key);
c5b1dfd83e81 Added offset value for sensor that need it
Michiel Broek <mbroek@mbse.eu>
parents: 206
diff changeset
1678 }
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1679 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1680 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1681 for (i = 0; i < 4; i++) {
174
244de612c572 Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1682 if (! xmlStrcmp(key, (const xmlChar *)DEVPRESENT[i])) {
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1683 device->present = i;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1684 break;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1685 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1686 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1687 xmlFree(key);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1688 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1689 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ADDRESS"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1690 device->address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1691 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1692 if ((!xmlStrcmp(cur->name, (const xmlChar *)"SUBDEVICE"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1693 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1694 if (sscanf((const char *)key, "%d", &ival) == 1)
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1695 device->subdevice = ival;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1696 xmlFree(key);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1697 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1698 if ((!xmlStrcmp(cur->name, (const xmlChar *)"GPIOPIN"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1699 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1700 if (sscanf((const char *)key, "%d", &ival) == 1)
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1701 device->gpiopin = ival;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1702 xmlFree(key);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1703 }
161
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
1704 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DESCRIPTION"))) {
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1705 device->description = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1706 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1707 if ((!xmlStrcmp(cur->name, (const xmlChar *)"INUSE"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1708 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1709 if (sscanf((const char *)key, "%d", &ival) == 1)
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1710 device->inuse = ival;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1711 xmlFree(key);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1712 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1713 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COMMENT"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1714 device->comment = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1715 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1716 if ((!xmlStrcmp(cur->name, (const xmlChar *)"TIMESTAMP"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1717 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1718 if (sscanf((const char *)key, "%d", &ival) == 1)
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1719 device->timestamp = (time_t)ival;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1720 xmlFree(key);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1721 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1722
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1723 cur = cur->next;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1724 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1725
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1726 if (Config.devices == NULL) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1727 Config.devices = device;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1728 } else {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1729 for (tmp = Config.devices; tmp; tmp = tmp->next) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1730 if (tmp->next == NULL) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1731 tmp->next = device;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1732 break;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1733 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1734 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1735 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1736
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1737 return 0;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1738 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1739
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1740
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1741
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1742 int parseDevices(xmlDocPtr doc, xmlNodePtr cur)
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1743 {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1744 cur = cur->xmlChildrenNode;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1745 while (cur != NULL) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1746 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DEVICE"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1747 parseDevice(doc, cur);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1748 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1749 cur = cur->next;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1750 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1751 return 0;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1752 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1753
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1754
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1755
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1756 #ifdef USE_SIMULATOR
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1757 int parseSimulator(xmlDocPtr doc, xmlNodePtr cur)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1758 {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1759 xmlChar *key;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1760 simulator_list *simulator, *tmp;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1761 int ival;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1762 float fval;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1763
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1764 simulator = (simulator_list *)malloc(sizeof(simulator_list));
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1765 simulator->next = NULL;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1766 simulator->version = 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1767 simulator->uuid = simulator->name = NULL;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1768 simulator->volume_air = simulator->volume_beer = 0;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1769 simulator->room_temperature = simulator->air_temperature = simulator->beer_temperature = simulator->s_cool_temp = simulator->s_heat_temp = 20.0;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1770 simulator->cooler_temp = simulator->cooler_size = simulator->heater_temp = simulator->heater_size = simulator->frigo_isolation = 0.0;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1771 simulator->cooler_time = simulator->heater_time = simulator->cooler_state = simulator->heater_state = 0;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1772 simulator->s_yeast_started = simulator->s_cool_changed = simulator->s_heat_changed = (time_t)0;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1773 simulator->s_yeast_heat = simulator->s_cool_temp = simulator->s_heat_temp = 0.0;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1774
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1775 cur = cur->xmlChildrenNode;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1776 while (cur != NULL) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1777 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1778 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1779 if (xmlStrcmp(key, (const xmlChar *)"1")) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1780 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1781 return 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1782 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1783 simulator->version = 1;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1784 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1785 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1786 if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1787 simulator->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1788 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1789 if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1790 simulator->name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1791 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1792 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VOLUME_AIR"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1793 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1794 if (sscanf((const char *)key, "%d", &ival) == 1)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1795 simulator->volume_air = ival;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1796 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1797 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1798 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VOLUME_BEER"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1799 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1800 if (sscanf((const char *)key, "%d", &ival) == 1)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1801 simulator->volume_beer = ival;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1802 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1803 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1804 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOM_TEMPERATURE"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1805 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1806 if (sscanf((const char *)key, "%f", &fval) == 1)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1807 simulator->room_temperature = fval;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1808 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1809 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1810 if ((!xmlStrcmp(cur->name, (const xmlChar *)"AIR_TEMPERATURE"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1811 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1812 if (sscanf((const char *)key, "%f", &fval) == 1)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1813 simulator->air_temperature = fval;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1814 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1815 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1816 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_TEMPERATURE"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1817 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1818 if (sscanf((const char *)key, "%f", &fval) == 1)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1819 simulator->beer_temperature = fval;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1820 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1821 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1822 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_TEMP"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1823 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1824 if (sscanf((const char *)key, "%f", &fval) == 1)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1825 simulator->cooler_temp = fval;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1826 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1827 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1828 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_TIME"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1829 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1830 if (sscanf((const char *)key, "%d", &ival) == 1)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1831 simulator->cooler_time = ival;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1832 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1833 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1834 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_SIZE"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1835 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1836 if (sscanf((const char *)key, "%f", &fval) == 1)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1837 simulator->cooler_size = fval;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1838 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1839 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1840 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HEATER_TEMP"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1841 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1842 if (sscanf((const char *)key, "%f", &fval) == 1)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1843 simulator->heater_temp = fval;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1844 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1845 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1846 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HEATER_TIME"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1847 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1848 if (sscanf((const char *)key, "%d", &ival) == 1)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1849 simulator->heater_time = ival;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1850 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1851 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1852 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HEATER_SIZE"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1853 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1854 if (sscanf((const char *)key, "%f", &fval) == 1)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1855 simulator->heater_size = fval;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1856 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1857 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1858 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HEATER_STATE"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1859 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1860 if (sscanf((const char *)key, "%d", &ival) == 1)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1861 simulator->heater_state = ival;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1862 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1863 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1864 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_STATE"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1865 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1866 if (sscanf((const char *)key, "%d", &ival) == 1)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1867 simulator->cooler_state = ival;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1868 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1869 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1870 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FRIGO_ISOLATION"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1871 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1872 if (sscanf((const char *)key, "%f", &fval) == 1)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1873 simulator->frigo_isolation = fval;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1874 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1875 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1876
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1877 if ((!xmlStrcmp(cur->name, (const xmlChar *)"S_YEAST_HEAT"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1878 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1879 if (sscanf((const char *)key, "%f", &fval) == 1)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1880 simulator->s_yeast_heat = fval;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1881 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1882 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1883 if ((!xmlStrcmp(cur->name, (const xmlChar *)"S_YEAST_STARTED"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1884 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1885 if (sscanf((const char *)key, "%d", &ival) == 1)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1886 simulator->s_yeast_started = (time_t)ival;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1887 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1888 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1889 if ((!xmlStrcmp(cur->name, (const xmlChar *)"S_COOL_TEMP"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1890 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1891 if (sscanf((const char *)key, "%f", &fval) == 1)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1892 simulator->s_cool_temp = fval;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1893 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1894 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1895 if ((!xmlStrcmp(cur->name, (const xmlChar *)"S_HEAT_TEMP"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1896 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1897 if (sscanf((const char *)key, "%f", &fval) == 1)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1898 simulator->s_heat_temp = fval;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1899 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1900 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1901 if ((!xmlStrcmp(cur->name, (const xmlChar *)"S_COOL_CHANGED"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1902 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1903 if (sscanf((const char *)key, "%d", &ival) == 1)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1904 simulator->s_cool_changed = (time_t)ival;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1905 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1906 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1907 if ((!xmlStrcmp(cur->name, (const xmlChar *)"S_HEAT_CHANGED"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1908 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1909 if (sscanf((const char *)key, "%d", &ival) == 1)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1910 simulator->s_heat_changed = (time_t)ival;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1911 xmlFree(key);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1912 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1913
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1914 cur = cur->next;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1915 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1916
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1917 if (Config.simulators == NULL) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1918 Config.simulators = simulator;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1919 } else {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1920 for (tmp = Config.simulators; tmp; tmp = tmp->next) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1921 if (tmp->next == NULL) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1922 tmp->next = simulator;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1923 break;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1924 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1925 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1926 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1927
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1928 return 0;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1929 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1930
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1931
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1932
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1933 int parseSimulators(xmlDocPtr doc, xmlNodePtr cur)
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1934 {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1935 cur = cur->xmlChildrenNode;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1936 while (cur != NULL) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1937 if ((!xmlStrcmp(cur->name, (const xmlChar *)"SIMULATOR"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1938 parseSimulator(doc, cur);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1939 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1940 cur = cur->next;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1941 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1942 return 0;
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1943 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1944 #endif
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1945
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1946
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1947
86
3d7a241329e2 Using final user paths for log, configuration and profiles
Michiel Broek <mbroek@mbse.eu>
parents: 83
diff changeset
1948 int rdconfig(void)
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1949 {
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1950 int rc = 0, ival;
370
843dc511c877 Fixed memory leak in wrconfig
Michiel Broek <mbroek@mbse.eu>
parents: 363
diff changeset
1951 char *mypath;
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1952 xmlDocPtr doc;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1953 xmlNodePtr cur;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1954 xmlChar *key;
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1955
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1956 killconfig();
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
1957 syslog(LOG_NOTICE, "HOME='%s' USER='%s' LOGNAME='%s'", MBSE_SS(getenv((char *)"HOME")), MBSE_SS(getenv((char *)"USER")), MBSE_SS(getenv((char *)"LOGNAME")));
56
f7711c6ac93c Workaround for empty environment at system boot
Michiel Broek <mbroek@mbse.eu>
parents: 55
diff changeset
1958
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1959 /*
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1960 * Search config file
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1961 */
56
f7711c6ac93c Workaround for empty environment at system boot
Michiel Broek <mbroek@mbse.eu>
parents: 55
diff changeset
1962 if (getenv((char *)"USER") == NULL) {
55
11d7cc3bdf31 If /home/mbroek is not set, assume root user.
Michiel Broek <mbroek@mbse.eu>
parents: 54
diff changeset
1963 mypath = xstrcpy((char *)"/root");
11d7cc3bdf31 If /home/mbroek is not set, assume root user.
Michiel Broek <mbroek@mbse.eu>
parents: 54
diff changeset
1964 } else {
11d7cc3bdf31 If /home/mbroek is not set, assume root user.
Michiel Broek <mbroek@mbse.eu>
parents: 54
diff changeset
1965 mypath = xstrcpy(getenv((char *)"HOME"));
11d7cc3bdf31 If /home/mbroek is not set, assume root user.
Michiel Broek <mbroek@mbse.eu>
parents: 54
diff changeset
1966 }
86
3d7a241329e2 Using final user paths for log, configuration and profiles
Michiel Broek <mbroek@mbse.eu>
parents: 83
diff changeset
1967 mypath = xstrcat(mypath, (char *)"/.thermferm/etc/");
3d7a241329e2 Using final user paths for log, configuration and profiles
Michiel Broek <mbroek@mbse.eu>
parents: 83
diff changeset
1968 mkdirs(mypath, 0755);
3d7a241329e2 Using final user paths for log, configuration and profiles
Michiel Broek <mbroek@mbse.eu>
parents: 83
diff changeset
1969 mypath = xstrcat(mypath, (char *)"thermferm.xml");
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1970 if ((doc = xmlParseFile(mypath)) == NULL) {
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1971 /*
388
05a55609cd9a Create a new configuration file if it doesn't exist.
Michiel Broek <mbroek@mbse.eu>
parents: 370
diff changeset
1972 * No config file, create a fresh one
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1973 */
388
05a55609cd9a Create a new configuration file if it doesn't exist.
Michiel Broek <mbroek@mbse.eu>
parents: 370
diff changeset
1974 syslog(LOG_NOTICE, "rdconfig: %s not found, creating", mypath);
05a55609cd9a Create a new configuration file if it doesn't exist.
Michiel Broek <mbroek@mbse.eu>
parents: 370
diff changeset
1975 wrconfig();
05a55609cd9a Create a new configuration file if it doesn't exist.
Michiel Broek <mbroek@mbse.eu>
parents: 370
diff changeset
1976
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1977 if ((doc = xmlParseFile(mypath)) == NULL) {
388
05a55609cd9a Create a new configuration file if it doesn't exist.
Michiel Broek <mbroek@mbse.eu>
parents: 370
diff changeset
1978 syslog(LOG_NOTICE, "rdconfig: could not create %s", mypath);
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1979 free(mypath);
388
05a55609cd9a Create a new configuration file if it doesn't exist.
Michiel Broek <mbroek@mbse.eu>
parents: 370
diff changeset
1980 return 1;
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1981 }
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1982 }
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
1983 syslog(LOG_NOTICE, "rdconfig: using %s", mypath);
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1984
497
18ace27338e5 Compiles mosquitto code if library is found on the system. Bumped to version 0.5.4
Michiel Broek <mbroek@mbse.eu>
parents: 492
diff changeset
1985 #ifdef HAVE_MOSQUITTO_H
18ace27338e5 Compiles mosquitto code if library is found on the system. Bumped to version 0.5.4
Michiel Broek <mbroek@mbse.eu>
parents: 492
diff changeset
1986 Config.mosq_host = xstrcpy((char *)"localhost");
18ace27338e5 Compiles mosquitto code if library is found on the system. Bumped to version 0.5.4
Michiel Broek <mbroek@mbse.eu>
parents: 492
diff changeset
1987 Config.mosq_port = 1883;
18ace27338e5 Compiles mosquitto code if library is found on the system. Bumped to version 0.5.4
Michiel Broek <mbroek@mbse.eu>
parents: 492
diff changeset
1988 #endif
18ace27338e5 Compiles mosquitto code if library is found on the system. Bumped to version 0.5.4
Michiel Broek <mbroek@mbse.eu>
parents: 492
diff changeset
1989
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1990 if ((cur = xmlDocGetRootElement(doc)) == NULL) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
1991 syslog(LOG_NOTICE, "XML file %s empty.", mypath);
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1992 xmlFreeDoc(doc);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1993 return 1;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1994 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1995 if (xmlStrcmp(cur->name, (const xmlChar*)"THERMFERM")) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
1996 syslog(LOG_NOTICE, "XML file %s is not a valid configuration file.", mypath);
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1997 xmlFreeDoc(doc);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1998 return 1;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1999 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2000
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2001 /*
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2002 * Parse configuration
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2003 */
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2004 cur = cur->xmlChildrenNode;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2005 while (cur != NULL) {
83
f99e9d6deff5 Removed old ascii configuration
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
2006 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) {
f99e9d6deff5 Removed old ascii configuration
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
2007 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f99e9d6deff5 Removed old ascii configuration
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
2008 if (xmlStrcmp(key, (const xmlChar *)"1")) {
f99e9d6deff5 Removed old ascii configuration
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
2009 xmlFree(key);
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
2010 syslog(LOG_NOTICE, "XML file %s is not a valid version", mypath);
83
f99e9d6deff5 Removed old ascii configuration
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
2011 return 1;
f99e9d6deff5 Removed old ascii configuration
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
2012 }
f99e9d6deff5 Removed old ascii configuration
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
2013 xmlFree(key);
f99e9d6deff5 Removed old ascii configuration
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
2014 }
286
674efa17be1d The global system name was not saved or restored from the configuration file.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
2015 if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) {
674efa17be1d The global system name was not saved or restored from the configuration file.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
2016 Config.name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
674efa17be1d The global system name was not saved or restored from the configuration file.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
2017 }
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2018 if ((!xmlStrcmp(cur->name, (const xmlChar *)"LISTEN_PORT"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2019 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2020 if (sscanf((const char *)key, "%d", &ival) == 1)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2021 Config.my_port = ival;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2022 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2023 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2024 if ((!xmlStrcmp(cur->name, (const xmlChar *)"TEMPFORMAT"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2025 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2026 Config.tempFormat = key[0];
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2027 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2028 }
206
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
2029 if ((!xmlStrcmp(cur->name, (const xmlChar *)"TEMP_ADDRESS"))) {
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
2030 Config.temp_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
2031 }
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
2032 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HUM_ADDRESS"))) {
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
2033 Config.hum_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
95
2c28afc329a5 Removed old brewPi settings
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
2034 }
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2035 if ((!xmlStrcmp(cur->name, (const xmlChar *)"LCDS"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2036 parseLCDs(doc, cur);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2037 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2038 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FERMENTERS"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2039 parseFermenters(doc, cur);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2040 }
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
2041 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROFILES"))) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
2042 parseProfiles(doc, cur);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
2043 }
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
2044 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DEVICES"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
2045 parseDevices(doc, cur);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
2046 }
259
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2047 #ifdef USE_SIMULATOR
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2048 if ((!xmlStrcmp(cur->name, (const xmlChar *)"SIMULATORS"))) {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2049 parseSimulators(doc, cur);
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2050 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2051 #endif
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2052 cur = cur->next;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2053 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2054 xmlFreeDoc(doc);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2055
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2056 free(mypath);
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2057 mypath = NULL;
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2058
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2059 return rc;
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2060 }
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2061
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2062
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2063

mercurial