thermferm/rdconfig.c

Fri, 03 Aug 2018 16:13:17 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 03 Aug 2018 16:13:17 +0200
changeset 561
fcfc3dbe85fa
parent 554
ab9f22ab57b5
child 562
119129969d37
permissions
-rw-r--r--

Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.

51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
534
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
2 * Copyright (C) 2014-2018
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 {
561
fcfc3dbe85fa Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
45 units_list *tmp2, *oldtmp2;
fcfc3dbe85fa Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
46 profiles_list *tmp3, *oldtmp3;
fcfc3dbe85fa Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
47 prof_step *tmp4, *oldtmp4;
fcfc3dbe85fa Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
48 devices_list *device, *olddev;
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
561
fcfc3dbe85fa Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
50 simulator_list *simulator, *oldsim;
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
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);
513
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
63 Config.temp_hum_idx = 0;
206
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
64 Config.temp_address = Config.hum_address = NULL;
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
65 Config.temp_value = 20000;
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
66 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
67 Config.hum_value = 50000;
500
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
68 if (Config.mqtt_host)
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
69 free(Config.mqtt_host);
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
70 Config.mqtt_host = NULL;
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
71 Config.mqtt_port = 1883;
534
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
72 if (Config.mqtt_username)
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
73 free(Config.mqtt_username);
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
74 Config.mqtt_username = NULL;
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
75 if (Config.mqtt_password)
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
76 free(Config.mqtt_password);
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
77 Config.mqtt_password = NULL;
540
5a26429abbf8 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload.
Michiel Broek <mbroek@mbse.eu>
parents: 534
diff changeset
78 if (Config.uuid)
5a26429abbf8 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload.
Michiel Broek <mbroek@mbse.eu>
parents: 534
diff changeset
79 free(Config.uuid);
5a26429abbf8 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload.
Michiel Broek <mbroek@mbse.eu>
parents: 534
diff changeset
80 Config.uuid = NULL;
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
81
561
fcfc3dbe85fa Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
82 for (tmp2 = Config.units; tmp2; tmp2 = oldtmp2) {
fcfc3dbe85fa Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
83 oldtmp2 = tmp2->next;
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
84 if (tmp2->uuid)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
85 free(tmp2->uuid);
554
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
86 if (tmp2->product_uuid)
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
87 free(tmp2->product_uuid);
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
88 if (tmp2->product_code)
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
89 free(tmp2->product_code);
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
90 if (tmp2->product_name)
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
91 free(tmp2->product_name);
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
92 if (tmp2->air_address)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
93 free(tmp2->air_address);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
94 if (tmp2->beer_address)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
95 free(tmp2->beer_address);
518
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
96 if (tmp2->chiller_address)
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
97 free(tmp2->chiller_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
98 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
99 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
100 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
101 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
102 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
103 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
104 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
105 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
106 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
107 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
108 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
109 free(tmp2->psu_address);
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
110 if (tmp2->profile)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
111 free(tmp2->profile);
561
fcfc3dbe85fa Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
112 if (tmp2->PID_cool)
fcfc3dbe85fa Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
113 free(tmp2->PID_cool);
fcfc3dbe85fa Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
114 if (tmp2->PID_heat)
fcfc3dbe85fa Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
115 free(tmp2->PID_heat);
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
116 free(tmp2);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
117 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
118 Config.units = NULL;
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119
561
fcfc3dbe85fa Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
120 for (tmp3 = Config.profiles; tmp3; tmp3 = oldtmp3) {
fcfc3dbe85fa Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
121 oldtmp3 = tmp3->next;
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
122 if (tmp3->uuid)
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
123 free(tmp3->uuid);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
124 if (tmp3->name)
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
125 free(tmp3->name);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
126 if (tmp3->steps) {
561
fcfc3dbe85fa Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
127 for (tmp4 = tmp3->steps; tmp4; tmp4 = oldtmp4) {
fcfc3dbe85fa Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
128 oldtmp4 = tmp4->next;
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
129 free(tmp4);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
130 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
131 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
132 free(tmp3);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
133 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
134 Config.profiles = NULL;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
135
561
fcfc3dbe85fa Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
136 for (device = Config.devices; device; device = olddev) {
fcfc3dbe85fa Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
137 olddev = device->next;
161
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
138 if (device->uuid)
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
139 free(device->uuid);
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
140 if (device->address)
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
141 free(device->address);
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
142 if (device->description)
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
143 free(device->description);
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
144 if (device->comment)
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
145 free(device->comment);
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
146 free(device);
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
147 }
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
148 Config.devices = NULL;
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
149
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
150 #ifdef USE_SIMULATOR
561
fcfc3dbe85fa Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
151 for (simulator = Config.simulators; simulator; simulator = oldsim) {
fcfc3dbe85fa Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
152 oldsim = simulator->next;
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
153 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
154 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
155 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
156 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
157 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
158 }
b7c967359771 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 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
160 #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
161
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
162 Config.lcd_cols = 16;
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
163 Config.lcd_rows = 2;
53
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
164 }
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
165
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
166
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
167
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
168 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
169 int do_wrconfig(void)
53
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
170 {
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
171 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
172 FILE *fp;
370
843dc511c877 Fixed memory leak in wrconfig
Michiel Broek <mbroek@mbse.eu>
parents: 363
diff changeset
173 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
174 xmlTextWriterPtr writer;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
175 xmlBufferPtr buf;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
176 units_list *tmp3;
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
177 profiles_list *tmp4;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
178 prof_step *tmp5;
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
179 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
180 #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
181 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
182 #endif
53
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
183
75
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 * 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
186 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
187 if ((buf = xmlBufferCreate()) == NULL) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
188 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
189 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
190 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
191
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
192 /*
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
193 * 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
194 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
195 if ((writer = xmlNewTextWriterMemory(buf, 0)) == NULL) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
196 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
197 return 1;
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
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
200 /*
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
201 * 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
202 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
203 if ((rc = xmlTextWriterSetIndent(writer, 2)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
204 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
205 return 1;
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
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
208 /*
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
209 * 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
210 * 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
211 * declaration.
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
212 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
213 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
214 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
215 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
216 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
217
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
218 /*
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
219 * 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
220 * 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
221 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
222 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
223 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
224 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
225 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
226
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
227 /*
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
228 * 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
229 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
230 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
231 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
232 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
233 }
286
674efa17be1d The global system name was not saved or restored from the configuration file.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
234 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
235 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
236 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
237 }
540
5a26429abbf8 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload.
Michiel Broek <mbroek@mbse.eu>
parents: 534
diff changeset
238 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", Config.uuid)) < 0) {
5a26429abbf8 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload.
Michiel Broek <mbroek@mbse.eu>
parents: 534
diff changeset
239 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
5a26429abbf8 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload.
Michiel Broek <mbroek@mbse.eu>
parents: 534
diff changeset
240 return 1;
5a26429abbf8 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload.
Michiel Broek <mbroek@mbse.eu>
parents: 534
diff changeset
241 }
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
242 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
243 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
244 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
245 }
77
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
246 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
247 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
248 return 1;
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
249 }
206
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
250 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
251 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
252 return 1;
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
253 }
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
254 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
255 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
256 return 1;
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
257 }
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
258 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
259 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
260 return 1;
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
261 }
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
262 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
263 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
264 return 1;
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
265 }
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
266 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
267 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
268 return 1;
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
269 }
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
270 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
271 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
272 return 1;
95
2c28afc329a5 Removed old brewPi settings
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
273 }
513
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
274 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_HUM_IDX", "%d", Config.temp_hum_idx)) < 0) {
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
275 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
276 return 1;
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
277 }
500
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
278 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NEXT_UNIT", "%d", Config.next_unit)) < 0) {
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
279 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
280 return 1;
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
281 }
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
282 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MQTT_HOST", "%s", Config.mqtt_host)) < 0) {
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
283 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
284 return 1;
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
285 }
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
286 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MQTT_PORT", "%d", Config.mqtt_port)) < 0) {
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
287 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
288 return 1;
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
289 }
534
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
290 if (Config.mqtt_username && Config.mqtt_password) {
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
291 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MQTT_USER", "%s", Config.mqtt_username)) < 0) {
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
292 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
293 return 1;
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
294 }
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
295 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MQTT_PASS", "%s", Config.mqtt_password)) < 0) {
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
296 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
297 return 1;
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
298 }
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
299 }
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
300
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 * 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
303 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
304 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
305 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
306 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
307 }
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
308 /*
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
309 * 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
310 * 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
311 */
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
312 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
313 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
314 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
315 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
316 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
317 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
318 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
319 }
78
c49ab5179bf3 Added lcd i2c address to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 77
diff changeset
320 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
321 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
322 return 1;
c49ab5179bf3 Added lcd i2c address to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 77
diff changeset
323 }
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
324 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
325 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
326 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
327 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
328 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
329 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
330 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
331 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
332 /*
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
333 * 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
334 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
335 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
336 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
337 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
338 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
339 /*
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
340 * 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
341 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
342 if ((rc = xmlTextWriterEndElement(writer)) < 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 xmlTextWriterEndElement");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
344 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
345 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
346
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
347 /*
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
348 * Fermenter units
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
349 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
350 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
351 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
352 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
353 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
354 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
355 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
356 /*
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
357 * 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
358 * are written to a state file.
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
359 */
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
360 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
361 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
362 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
363 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
364 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
365 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
366 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
367 }
77
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
368 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
369 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
370 return 1;
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
371 }
554
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
372 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PRODUCT_UUID", "%s", tmp3->product_uuid)) < 0) {
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
373 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
374 return 1;
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
375 }
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
376 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PRODUCT_CODE", "%s", tmp3->product_code)) < 0) {
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
377 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
378 return 1;
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
379 }
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
380 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PRODUCT_NAME", "%s", tmp3->product_name)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
381 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
382 return 1;
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
383 }
500
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
384 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ALIAS", "%s", tmp3->alias)) < 0) {
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
385 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
386 return 1;
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
387 }
77
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
388 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
389 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
390 return 1;
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
391 }
101
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
392 if (tmp3->air_address) {
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
393 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
394 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
395 return 1;
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
396 }
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
397 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
398 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
399 return 1;
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
400 }
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
401 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
402 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
403 return 1;
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
404 }
513
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
405 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_IDX", "%d", tmp3->air_idx)) < 0)) {
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
406 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
407 return 1;
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
408 }
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
409 }
101
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
410 if (tmp3->beer_address) {
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
411 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
412 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
413 return 1;
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
414 }
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
415 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
416 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
417 return 1;
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
418 }
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
419 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
420 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
421 return 1;
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
422 }
513
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
423 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_IDX", "%d", tmp3->beer_idx)) < 0)) {
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
424 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
425 return 1;
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
426 }
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
427 }
518
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
428 if (tmp3->chiller_address) {
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
429 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "CHILLER_ADDRESS", "%s", tmp3->chiller_address)) < 0)) {
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
430 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
431 return 1;
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
432 }
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
433 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "CHILLER_STATE", "%d", tmp3->chiller_state)) < 0)) {
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
434 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
435 return 1;
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
436 }
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
437 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "CHILLER_TEMPERATURE", "%d", tmp3->chiller_temperature)) < 0)) {
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
438 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
439 return 1;
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
440 }
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
441 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "CHILLER_IDX", "%d", tmp3->chiller_idx)) < 0)) {
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
442 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
443 return 1;
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
444 }
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
445 }
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
446 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
447 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
448 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
449 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
450 }
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
451 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
452 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
453 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
454 }
270
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
455 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
456 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
457 return 1;
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
458 }
293
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
459 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
460 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
461 return 1;
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
462 }
513
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
463 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_IDX", "%d", tmp3->heater_idx)) < 0)) {
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
464 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
465 return 1;
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
466 }
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
467 }
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
468 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
469 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
470 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
471 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
472 }
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
473 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
474 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
475 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
476 }
270
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
477 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
478 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
479 return 1;
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
480 }
293
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
481 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
482 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
483 return 1;
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
484 }
513
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
485 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_IDX", "%d", tmp3->cooler_idx)) < 0)) {
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
486 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
487 return 1;
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
488 }
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
489 }
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
490 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
491 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
492 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
493 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
494 }
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
495 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
496 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
497 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
498 }
270
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
499 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
500 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
501 return 1;
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
502 }
293
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
503 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
504 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
505 return 1;
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
506 }
513
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
507 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_IDX", "%d", tmp3->fan_idx)) < 0)) {
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
508 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
509 return 1;
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
510 }
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
511 }
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
512 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
513 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
514 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
515 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
516 }
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
517 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
518 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
519 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
520 }
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
521 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
522 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
523 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
524 }
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
525 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
526 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
527 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
528 }
513
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
529 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_IDX", "%d", tmp3->light_idx)) < 0)) {
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
530 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
531 return 1;
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
532 }
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
533 }
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
534 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
535 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
536 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
537 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
538 }
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
539 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
540 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
541 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
542 }
513
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
543 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "DOOR_IDX", "%d", tmp3->door_idx)) < 0)) {
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
544 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
545 return 1;
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
546 }
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
547 }
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
548 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
549 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
550 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
551 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
552 }
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
553 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
554 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
555 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
556 }
513
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
557 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PSU_IDX", "%d", tmp3->psu_idx)) < 0)) {
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
558 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
559 return 1;
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
560 }
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
561 }
77
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
562 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
563 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
564 return 1;
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
565 }
77
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
566 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
567 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
568 return 1;
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
569 }
77
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
570 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
571 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
572 return 1;
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
573 }
77
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
574 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
575 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
576 return 1;
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
577 }
77
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
578 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
579 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
580 return 1;
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
581 }
77
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
582 if (tmp3->profile) {
143077e54255 Added old configuration to write xml config
Michiel Broek <mbroek@mbse.eu>
parents: 76
diff changeset
583 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
584 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
585 return 1;
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
586 }
90
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
587 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
588 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
90
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
589 return 1;
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
590 }
194
9eaaba49450f Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
591 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
592 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
194
9eaaba49450f Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
593 return 1;
9eaaba49450f Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
594 }
90
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
595 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
596 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
597 return 1;
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
598 }
289
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
599 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
600 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
601 return 1;
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
602 }
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
603 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
604 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
605 return 1;
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
606 }
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
607 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
608 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
609 return 1;
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
610 }
76
d2c7b32f27d6 Can now write the fermenter units configurations
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
611 }
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
612 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
613 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
614 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
615 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
616 }
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
617 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
618 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
619 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
620 }
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
621 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
622 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
623 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
624 }
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
625 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
626 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
627 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
628 }
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
629 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
630 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
631 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
632 }
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
633 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
634 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
635 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
636 }
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
637 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
638 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
639 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
640 }
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
641 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
642 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
643 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
644 }
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
645 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
646 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
647 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
648 }
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
649 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
650 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
651 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
652 }
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
653 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
654 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
655 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
656 }
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
657 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
658 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
659 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
660 }
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
661 }
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
662 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
663 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
664 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
665 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
666 }
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
667 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
668 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
669 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
670 }
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
671 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
672 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
673 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
674 }
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
675 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
676 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
677 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
678 }
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
679 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
680 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
681 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
682 }
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
683 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
684 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
685 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
686 }
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
687 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
688 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
689 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
690 }
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
691 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
692 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
693 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
694 }
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
695 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
696 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
697 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
698 }
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
699 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
700 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
701 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
702 }
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
703 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
704 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
705 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
706 }
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
707 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
708 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
709 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
710 }
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
711 }
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
712 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
713 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
714 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
715 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
716 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
717 if ((rc = xmlTextWriterEndElement(writer)) < 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 xmlTextWriterEndElement");
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
719 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
720 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
721 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
722
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
723 /*
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
724 * Fermenting profiles
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
725 */
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
726 if (Config.profiles) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
727 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
728 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
729 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
730 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
731 for (tmp4 = Config.profiles; tmp4; tmp4 = tmp4->next) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
732 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
733 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
734 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
735 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
736 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
737 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
738 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
739 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
740 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
741 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
742 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
743 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
744 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
745 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
746 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
747 }
136
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
748 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
749 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
136
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
750 return 1;
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
751 }
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
752 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
753 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
754 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
755 }
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
756 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
757 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
758 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
759 }
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
760 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
761 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
762 return 1;
c74bbc24a1c8 Client/Server communication is now almost final
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
763 }
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
764 if (tmp4->steps) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
765 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
766 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
767 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
768 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
769 for (tmp5 = tmp4->steps; tmp5; tmp5 = tmp5->next) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
770 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
771 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
772 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
773 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
774 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
775 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
776 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
777 }
92
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
778 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
779 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
780 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
781 }
92
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
782 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
783 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
92
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
784 return 1;
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
785 }
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
786 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
787 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
788 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
789 }
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
790 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
791 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
792 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
793 }
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
794 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
795 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
796 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
797 }
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
798 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
799 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
800 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
801 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
802 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
803 if ((rc = xmlTextWriterEndElement(writer)) < 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 xmlTextWriterEndElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
805 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
806 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
807 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
808 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
809 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
810 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
811 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
812 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
813 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
814 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
815 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
816 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
817 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
818
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
819 if (Config.devices) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
820 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
821 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
822 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
823 }
240
6bdda35b4a13 Added thread locks for device processing
Michiel Broek <mbroek@mbse.eu>
parents: 235
diff changeset
824 #ifdef HAVE_WIRINGPI_H
6bdda35b4a13 Added thread locks for device processing
Michiel Broek <mbroek@mbse.eu>
parents: 235
diff changeset
825 piLock(LOCK_DEVICES);
6bdda35b4a13 Added thread locks for device processing
Michiel Broek <mbroek@mbse.eu>
parents: 235
diff changeset
826 #endif
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
827 for (device = Config.devices; device; device = device->next) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
828 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
829 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
830 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
831 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
832 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
833 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
834 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
835 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
836 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
837 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
838 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
839 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
840 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
841 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
842 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
843 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
844 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
845 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
846 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
847 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
848 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
849 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
850 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
851 }
209
c5b1dfd83e81 Added offset value for sensor that need it
Michiel Broek <mbroek@mbse.eu>
parents: 206
diff changeset
852 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
853 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
854 return 1;
c5b1dfd83e81 Added offset value for sensor that need it
Michiel Broek <mbroek@mbse.eu>
parents: 206
diff changeset
855 }
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
856 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
857 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
858 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
859 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
860 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
861 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
862 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
863 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
864 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
865 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
866 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
867 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
868 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
869 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
870 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
871 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
872 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
873 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
874 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
875 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
876 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
877 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
878 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
879 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
880 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
881 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
882 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
883 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
884 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
885 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
886 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
887 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
888 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
889 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
890 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
891 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
892 }
240
6bdda35b4a13 Added thread locks for device processing
Michiel Broek <mbroek@mbse.eu>
parents: 235
diff changeset
893 #ifdef HAVE_WIRINGPI_H
6bdda35b4a13 Added thread locks for device processing
Michiel Broek <mbroek@mbse.eu>
parents: 235
diff changeset
894 piUnlock(LOCK_DEVICES);
6bdda35b4a13 Added thread locks for device processing
Michiel Broek <mbroek@mbse.eu>
parents: 235
diff changeset
895 #endif
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
896
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
897 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
898 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
899 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
900 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
901 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
902
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
903 #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
904 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
905 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
906 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
907 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
908 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
909 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
910 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
911 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
912 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
913 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
914 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
915 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
916 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
917 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
918 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
919 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
920 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
921 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
922 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
923 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
924 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
925 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
926 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
927 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
928 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
929 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
930 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
931 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
932 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
933 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
934 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
935 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
936 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
937 }
553
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
938 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOM_HUMIDITY", "%.1f", simulator->room_humidity)) < 0) {
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
939 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
940 return 1;
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
941 }
262
d0014ccec615 Simulation of fridge cold loss to the room added for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 259
diff changeset
942 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
943 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
944 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
945 }
262
d0014ccec615 Simulation of fridge cold loss to the room added for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 259
diff changeset
946 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
947 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
948 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
949 }
553
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
950 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "CHILLER_TEMPERATURE", "%f", simulator->chiller_temperature)) < 0) {
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
951 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
952 return 1;
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
953 }
262
d0014ccec615 Simulation of fridge cold loss to the room added for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 259
diff changeset
954 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
955 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
956 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
957 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
958 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
959 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
960 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
961 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
962 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
963 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
964 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
965 }
262
d0014ccec615 Simulation of fridge cold loss to the room added for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 259
diff changeset
966 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
967 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
968 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
969 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
970 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
971 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
972 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
973 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
974 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
975 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
976 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
977 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
978 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
979 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
980 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
981 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
982 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
983 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
984 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
985 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
986 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
987 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
988 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
989 }
262
d0014ccec615 Simulation of fridge cold loss to the room added for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 259
diff changeset
990 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
991 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
992 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
993 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
994 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
995 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
996 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
997 }
262
d0014ccec615 Simulation of fridge cold loss to the room added for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 259
diff changeset
998 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
999 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
1000 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
1001 }
262
d0014ccec615 Simulation of fridge cold loss to the room added for testing.
Michiel Broek <mbroek@mbse.eu>
parents: 259
diff changeset
1002 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
1003 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
1004 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
1005 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1006 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
1007 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
1008 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
1009 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1010 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
1011 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
1012 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
1013 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1014 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
1015 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
1016 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
1017 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1018 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1019 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
1020 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
1021 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
1022 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1023 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1024 #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
1025
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1026 /*
75
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1027 * 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
1028 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1029 if ((rc = xmlTextWriterEndDocument(writer)) < 0) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
1030 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
1031 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1032 }
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1033 xmlFreeTextWriter(writer);
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1034
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1035 /*
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1036 * 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
1037 */
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1038 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
1039 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
1040 } else {
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1041 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
1042 }
86
3d7a241329e2 Using final user paths for log, configuration and profiles
Michiel Broek <mbroek@mbse.eu>
parents: 83
diff changeset
1043 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
1044 mkdirs(mypath, 0755);
3d7a241329e2 Using final user paths for log, configuration and profiles
Michiel Broek <mbroek@mbse.eu>
parents: 83
diff changeset
1045 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
1046
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1047 if (debug)
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1048 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
1049
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1050 if ((fp = fopen(mypath, "w")) == NULL) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
1051 syslog(LOG_NOTICE, "could not rewrite %s", mypath);
370
843dc511c877 Fixed memory leak in wrconfig
Michiel Broek <mbroek@mbse.eu>
parents: 363
diff changeset
1052 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
1053 return 1;
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1054 }
370
843dc511c877 Fixed memory leak in wrconfig
Michiel Broek <mbroek@mbse.eu>
parents: 363
diff changeset
1055 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
1056
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1057 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
1058 fclose(fp);
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1059 xmlBufferFree(buf);
4b976601737d Writes a basic xml configuration next to the plain ascii config file
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1060
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
1061 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
1062 }
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
1063
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
1064
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
1065
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
1066 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
1067 {
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
1068 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
1069
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
1070 rc = do_wrconfig();
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
1071 syslog(LOG_NOTICE, "Rewritten configuration, rc=%d", rc);
53
37623517e0ef Added writing configuration
Michiel Broek <mbroek@mbse.eu>
parents: 51
diff changeset
1072 return rc;
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1073 }
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1074
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1075
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1076
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1077 /*
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1078 * Parse one LCD display
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1079 */
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1080 int parseLCD(xmlDocPtr doc, xmlNodePtr cur)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1081 {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1082 xmlChar *key;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1083 int ival;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1084
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1085 cur = cur->xmlChildrenNode;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1086 while (cur != NULL) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1087 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COLUMNS"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1088 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1089 if (sscanf((const char *)key, "%d", &ival) == 1)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1090 Config.lcd_cols = ival;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1091 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1092 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1093 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROWS"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1094 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1095 if (sscanf((const char *)key, "%d", &ival) == 1)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1096 Config.lcd_rows = ival;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1097 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1098 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1099 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ADDRESS"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1100 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1101 if (sscanf((const char *)key, "%x", &ival) == 1)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1102 Config.lcd_address = ival;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1103 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1104 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1105 cur = cur->next;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1106 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1107
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1108 return 0;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1109 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1110
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1111
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1112
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1113 int parseLCDs(xmlDocPtr doc, xmlNodePtr cur)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1114 {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1115 cur = cur->xmlChildrenNode;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1116 while (cur != NULL) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1117 if ((!xmlStrcmp(cur->name, (const xmlChar *)"LCD"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1118 parseLCD(doc, cur);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1119 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1120 cur = cur->next;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1121 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1122 return 0;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1123 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1124
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1125
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1126
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1127 /*
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1128 * Parse a fermenter unit
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1129 */
506
cdcd07bbee30 New MQTT protocol
Michiel Broek <mbroek@mbse.eu>
parents: 500
diff changeset
1130 int parseUnit(xmlDocPtr doc, xmlNodePtr cur/* , int number */)
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1131 {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1132 xmlChar *key;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1133 int i, ival;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1134 float val;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1135 units_list *unit, *tmp;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1136
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1137 unit = (units_list *)malloc(sizeof(units_list));
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1138 unit->next = NULL;
90
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1139 unit->version = 1;
554
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1140 unit->uuid = unit->product_uuid = unit->product_code = unit->product_name = unit->event_msg = \
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1141 unit->alias = unit->air_address = unit->beer_address = unit->chiller_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
1142 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
1143 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
1144 unit->volume = unit->prof_peak_abs = unit->prof_peak_rel = 0.0;
518
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1145 unit->air_temperature = unit->beer_temperature = unit->chiller_temperature = unit->beer_set = unit->fridge_set = 20.0;
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1146 unit->air_state = unit->beer_state = unit->chiller_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
1147 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
1148 unit->light_state = unit->psu_state = unit->mode = unit->prof_state = 0;
518
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1149 unit->air_idx = unit->beer_idx = unit->chiller_idx = unit->heater_idx = unit->cooler_idx = unit->fan_idx = \
513
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1150 unit->door_idx = unit->light_idx = unit->psu_idx = 0;
270
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1151 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
1152 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
1153 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
1154 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
1155 unit->temp_set_min = 1.0;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1156 unit->temp_set_max = 30.0;
289
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1157 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
1158 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
1159 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
1160 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
1161 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
1162 InitPID(unit->PID_heat, PID_TYPE_HEAT);
80
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 cur = cur->xmlChildrenNode;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1165 while (cur != NULL) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1166 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1167 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1168 if (xmlStrcmp(key, (const xmlChar *)"1")) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1169 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1170 return 1;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1171 }
90
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1172 unit->version = 1;
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1173 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1174 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1175 if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1176 unit->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1177 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1178 if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) {
554
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1179 /*
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1180 * Upgrade to product code and name
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1181 */
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1182 char *oldname = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1183 if (strstr(oldname, (char *)" ")) {
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1184 unit->product_code = xstrcpy(strtok(oldname, " "));
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1185 unit->product_name = xstrcpy(strtok(NULL, "\0"));
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1186 } else {
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1187 unit->product_code = xstrcpy((char *)"000000");
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1188 unit->product_name = xstrcpy(oldname);
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1189 }
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1190 }
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1191 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRODUCT_UUID"))) {
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1192 unit->product_uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1193 }
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1194 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRODUCT_CODE"))) {
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1195 unit->product_code = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1196 }
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1197 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRODUCT_NAME"))) {
ab9f22ab57b5 Versie 0.8.5. Implementatie product code en product naam. Implementatie DLOG MQTT berichten. Verminderde server rotocol debug berichten.
Michiel Broek <mbroek@mbse.eu>
parents: 553
diff changeset
1198 unit->product_name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1199 }
500
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
1200 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ALIAS"))) {
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
1201 unit->alias = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
1202 }
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1203 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VOLUME"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1204 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1205 if (sscanf((const char *)key, "%f", &val) == 1)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1206 unit->volume = val;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1207 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1208 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1209 if ((!xmlStrcmp(cur->name, (const xmlChar *)"AIR_ADDRESS"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1210 unit->air_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1211 }
101
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1212 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
1213 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1214 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
1215 unit->air_state = ival;
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1216 xmlFree(key);
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1217 }
513
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1218 if ((!xmlStrcmp(cur->name, (const xmlChar *)"AIR_IDX"))) {
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1219 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1220 if (sscanf((const char *)key, "%d", &ival) == 1)
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1221 unit->air_idx = ival;
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1222 xmlFree(key);
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1223 }
101
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1224 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
1225 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1226 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
1227 unit->air_temperature = ival;
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1228 xmlFree(key);
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1229 }
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1230 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_ADDRESS"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1231 unit->beer_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1232 }
101
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1233 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
1234 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1235 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
1236 unit->beer_state = ival;
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1237 xmlFree(key);
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1238 }
513
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1239 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_IDX"))) {
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1240 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1241 if (sscanf((const char *)key, "%d", &ival) == 1)
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1242 unit->beer_idx = ival;
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1243 xmlFree(key);
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1244 }
101
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1245 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
1246 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1247 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
1248 unit->beer_temperature = ival;
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1249 xmlFree(key);
1302abe92eb1 Made temperature sensors working in the units
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
1250 }
518
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1251 if ((!xmlStrcmp(cur->name, (const xmlChar *)"CHILLER_ADDRESS"))) {
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1252 unit->chiller_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1253 }
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1254 if ((!xmlStrcmp(cur->name, (const xmlChar *)"CHILLER_STATE"))) {
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1255 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1256 if (sscanf((const char *)key, "%d", &ival) == 1)
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1257 unit->chiller_state = ival;
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1258 xmlFree(key);
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1259 }
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1260 if ((!xmlStrcmp(cur->name, (const xmlChar *)"CHILLER_IDX"))) {
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1261 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1262 if (sscanf((const char *)key, "%d", &ival) == 1)
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1263 unit->chiller_idx = ival;
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1264 xmlFree(key);
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1265 }
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1266 if ((!xmlStrcmp(cur->name, (const xmlChar *)"CHILLER_TEMPERATURE"))) {
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1267 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1268 if (sscanf((const char *)key, "%d", &ival) == 1)
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1269 unit->chiller_temperature = ival;
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1270 xmlFree(key);
fd36bedab944 Added chiller configuration items
Michiel Broek <mbroek@mbse.eu>
parents: 513
diff changeset
1271 }
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
1272 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
1273 unit->heater_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1274 }
270
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1275 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
1276 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
1277 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
1278 unit->heater_delay = ival;
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1279 xmlFree(key);
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1280 }
513
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1281 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HEATER_IDX"))) {
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1282 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1283 if (sscanf((const char *)key, "%d", &ival) == 1)
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1284 unit->heater_idx = ival;
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1285 xmlFree(key);
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1286 }
293
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1287 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HEATER_USAGE"))) {
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1288 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1289 if (sscanf((const char *)key, "%d", &ival) == 1)
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1290 unit->heater_usage = ival;
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1291 xmlFree(key);
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1292 }
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
1293 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
1294 unit->cooler_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1295 }
270
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1296 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
1297 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
1298 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
1299 unit->cooler_delay = ival;
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1300 xmlFree(key);
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1301 }
513
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1302 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_IDX"))) {
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1303 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1304 if (sscanf((const char *)key, "%d", &ival) == 1)
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1305 unit->cooler_idx = ival;
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1306 xmlFree(key);
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1307 }
293
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1308 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_USAGE"))) {
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1309 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1310 if (sscanf((const char *)key, "%d", &ival) == 1)
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1311 unit->cooler_usage = ival;
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1312 xmlFree(key);
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1313 }
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
1314 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
1315 unit->fan_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1316 }
270
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1317 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
1318 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
1319 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
1320 unit->fan_delay = ival;
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1321 xmlFree(key);
df81d583c2c3 The PID commands have an adjustable delay, default 5 minutes
Michiel Broek <mbroek@mbse.eu>
parents: 268
diff changeset
1322 }
513
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1323 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FAN_IDX"))) {
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1324 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1325 if (sscanf((const char *)key, "%d", &ival) == 1)
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1326 unit->fan_idx = ival;
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1327 xmlFree(key);
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1328 }
293
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1329 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FAN_USAGE"))) {
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1330 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1331 if (sscanf((const char *)key, "%d", &ival) == 1)
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1332 unit->fan_usage = ival;
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1333 xmlFree(key);
881b1ae75468 Added usage counters
Michiel Broek <mbroek@mbse.eu>
parents: 289
diff changeset
1334 }
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
1335 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
1336 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
1337 }
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
1338 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
1339 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
1340 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
1341 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
1342 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
1343 }
513
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1344 if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIGHT_IDX"))) {
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1345 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1346 if (sscanf((const char *)key, "%d", &ival) == 1)
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1347 unit->light_idx = ival;
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1348 xmlFree(key);
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1349 }
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
1350 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
1351 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
1352 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
1353 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
1354 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
1355 }
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
1356 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
1357 unit->door_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1358 }
513
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1359 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DOOR_IDX"))) {
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1360 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1361 if (sscanf((const char *)key, "%d", &ival) == 1)
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1362 unit->door_idx = ival;
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1363 xmlFree(key);
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1364 }
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
1365 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
1366 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
1367 }
513
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1368 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PSU_IDX"))) {
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1369 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1370 if (sscanf((const char *)key, "%d", &ival) == 1)
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1371 unit->psu_idx = ival;
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1372 xmlFree(key);
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1373 }
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1374 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MODE"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1375 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1376 for (i = 0; i < 5; i++) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1377 if (! xmlStrcmp(key, (const xmlChar *)UNITMODE[i])) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1378 unit->mode = i;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1379 break;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1380 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1381 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1382 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1383 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1384 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_SET"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1385 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1386 if (sscanf((const char *)key, "%f", &val) == 1)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1387 unit->beer_set = val;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1388 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1389 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1390 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FRIDGE_SET"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1391 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1392 if (sscanf((const char *)key, "%f", &val) == 1)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1393 unit->fridge_set = val;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1394 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1395 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1396 if ((!xmlStrcmp(cur->name, (const xmlChar *)"TEMP_SET_MIN"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1397 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1398 if (sscanf((const char *)key, "%f", &val) == 1)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1399 unit->temp_set_min = val;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1400 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1401 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1402 if ((!xmlStrcmp(cur->name, (const xmlChar *)"TEMP_SET_MAX"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1403 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1404 if (sscanf((const char *)key, "%f", &val) == 1)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1405 unit->temp_set_max = val;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1406 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1407 }
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
1408 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
1409 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
1410 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
1411 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
1412 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
1413 }
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
1414 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
1415 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
1416 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
1417 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
1418 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
1419 }
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
1420 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
1421 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
1422 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
1423 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
1424 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
1425 }
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
1426 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
1427 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
1428 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
1429 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
1430 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
1431 }
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
1432 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
1433 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
1434 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
1435 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
1436 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
1437 }
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
1438 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
1439 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
1440 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
1441 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
1442 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
1443 }
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
1444 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
1445 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
1446 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
1447 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
1448 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
1449 }
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
1450 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
1451 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
1452 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
1453 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
1454 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
1455 }
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
1456 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
1457 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
1458 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
1459 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
1460 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
1461 }
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
1462 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
1463 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
1464 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
1465 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
1466 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
1467 }
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
1468 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
1469 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
1470 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
1471 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
1472 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
1473 }
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
1474 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
1475 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
1476 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
1477 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
1478 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
1479 }
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
1480 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
1481 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
1482 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
1483 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
1484 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
1485 }
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
1486 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
1487 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
1488 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
1489 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
1490 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
1491 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
1492 }
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
1493 }
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
1494 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
1495 }
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
1496 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
1497 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
1498 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
1499 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
1500 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
1501 }
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
1502 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
1503 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
1504 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
1505 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
1506 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
1507 }
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
1508 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
1509 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
1510 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
1511 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
1512 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
1513 }
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
1514 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
1515 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
1516 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
1517 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
1518 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
1519 }
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
1520 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
1521 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
1522 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
1523 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
1524 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
1525 }
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
1526 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
1527 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
1528 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
1529 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
1530 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
1531 }
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
1532 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
1533 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
1534 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
1535 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
1536 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
1537 }
363
468ec0d96cce Back to the old PID algorythm. Version 0.3.1.
Michiel Broek <mbroek@mbse.eu>
parents: 362
diff changeset
1538 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
1539 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
1540 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
1541 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
1542 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
1543 }
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
1544 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
1545 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
1546 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
1547 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
1548 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
1549 }
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
1550 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
1551 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
1552 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
1553 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
1554 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
1555 }
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
1556 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
1557 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
1558 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
1559 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
1560 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
1561 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
1562 }
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
1563 }
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
1564 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
1565 }
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1566 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROFILE"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1567 unit->profile = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1568 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1569 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROF_STARTED"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1570 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1571 if (sscanf((const char *)key, "%d", &ival) == 1)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1572 unit->prof_started = ival;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1573 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1574 }
194
9eaaba49450f Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
1575 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROF_PAUSED"))) {
9eaaba49450f Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
1576 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
9eaaba49450f Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
1577 if (sscanf((const char *)key, "%d", &ival) == 1)
9eaaba49450f Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
1578 unit->prof_paused = ival;
9eaaba49450f Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
1579 xmlFree(key);
9eaaba49450f Added some ideas about profiles.
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
1580 }
90
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1581 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROF_STATE"))) {
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1582 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
217
2922d439ff63 Added profile state ABORT
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
1583 for (i = 0; i < 5; i++) {
90
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1584 if (! xmlStrcmp(key, (const xmlChar *)PROFSTATE[i])) {
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1585 unit->prof_state = i;
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1586 break;
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1587 }
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1588 }
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1589 xmlFree(key);
28ee293654fd Added profile parameters
Michiel Broek <mbroek@mbse.eu>
parents: 86
diff changeset
1590 }
289
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1591 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
1592 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1593 if (sscanf((const char *)key, "%f", &val) == 1)
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1594 unit->prof_peak_abs = val;
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1595 xmlFree(key);
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1596 }
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1597 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
1598 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1599 if (sscanf((const char *)key, "%f", &val) == 1)
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1600 unit->prof_peak_rel = val;
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1601 xmlFree(key);
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1602 }
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1603 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
1604 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1605 if (sscanf((const char *)key, "%d", &ival) == 1)
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1606 unit->prof_primary_done = ival;
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1607 xmlFree(key);
d810df0df36a Added code to detect primary fermentation
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
1608 }
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1609 cur = cur->next;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1610 }
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 if (Config.units == NULL) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1613 Config.units = unit;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1614 } else {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1615 for (tmp = Config.units; tmp; tmp = tmp->next) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1616 if (tmp->next == NULL) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1617 tmp->next = unit;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1618 break;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1619 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1620 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1621 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1622
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1623 return 0;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1624 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1625
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1626
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1627
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1628 int parseFermenters(xmlDocPtr doc, xmlNodePtr cur)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1629 {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1630 cur = cur->xmlChildrenNode;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1631 while (cur != NULL) {
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1632 if ((!xmlStrcmp(cur->name, (const xmlChar *)"UNIT"))) {
513
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
1633 parseUnit(doc, cur);
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1634 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1635 cur = cur->next;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1636 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1637 return 0;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1638 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1639
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1640
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1641
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1642 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
1643 {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1644 xmlChar *key;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1645 int ival;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1646 float val;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1647 prof_step *step, *tmp;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1648
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1649 step = (prof_step *)malloc(sizeof(prof_step));
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1650 step->next = NULL;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1651 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
1652 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
1653 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
1654
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1655 cur = cur->xmlChildrenNode;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1656 while (cur != NULL) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1657 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1658 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1659 if (xmlStrcmp(key, (const xmlChar *)"1")) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1660 xmlFree(key);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1661 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1662 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1663 step->version = 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1664 xmlFree(key);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1665 }
92
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
1666 if ((!xmlStrcmp(cur->name, (const xmlChar *)"RESTTIME"))) {
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1667 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1668 if (sscanf((const char *)key, "%d", &ival) == 1)
92
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
1669 step->resttime = ival;
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
1670 xmlFree(key);
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
1671 }
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
1672 if ((!xmlStrcmp(cur->name, (const xmlChar *)"STEPTIME"))) {
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
1673 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
1674 if (sscanf((const char *)key, "%d", &ival) == 1)
116226a8c70a Added profiles configuration
Michiel Broek <mbroek@mbse.eu>
parents: 91
diff changeset
1675 step->steptime = ival;
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1676 xmlFree(key);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1677 }
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
1678 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
1679 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
1680 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
1681 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
1682 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
1683 }
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
1684 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
1685 }
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
1686 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
1687 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1688 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
1689 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
1690 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
1691 }
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
1692 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
1693 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
1694 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
1695 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
1696 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
1697 }
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
1698 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
1699 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
1700 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
1701 step->fridge_mode = ival;
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1702 xmlFree(key);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1703 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1704 cur = cur->next;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1705 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1706
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1707 if (*profstep == NULL) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1708 *profstep = step;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1709 } else {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1710 for (tmp = *profstep; tmp; tmp = tmp->next) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1711 if (tmp->next == NULL) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1712 tmp->next = step;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1713 break;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1714 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1715 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1716 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1717 return 0;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1718 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1719
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1720
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1721
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1722 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
1723 {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1724 cur = cur->xmlChildrenNode;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1725 while (cur != NULL) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1726 if ((!xmlStrcmp(cur->name, (const xmlChar *)"STEP"))) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1727 parseStep(doc, cur, step);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1728 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1729 cur = cur->next;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1730 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1731 return 0;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1732 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1733
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1734
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1735
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1736 int parseProfile(xmlDocPtr doc, xmlNodePtr cur)
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1737 {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1738 xmlChar *key;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1739 profiles_list *profile, *tmp;
136
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
1740 int ival;
191
c74bbc24a1c8 Client/Server communication is now almost final
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
1741 float fval;
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1742
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1743 profile = (profiles_list *)malloc(sizeof(profiles_list));
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1744 profile->next = NULL;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1745 profile->version = 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1746 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
1747 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
1748 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
1749 profile->steps = NULL;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1750
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1751 cur = cur->xmlChildrenNode;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1752 while (cur != NULL) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1753 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1754 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1755 if (xmlStrcmp(key, (const xmlChar *)"1")) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1756 xmlFree(key);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1757 return 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1758 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1759 profile->version = 1;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1760 xmlFree(key);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1761 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1762 if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1763 profile->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1764 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1765 if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1766 profile->name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1767 }
136
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
1768 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BUSY"))) {
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
1769 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
1770 if (sscanf((const char *)key, "%d", &ival) == 1)
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
1771 profile->busy = ival;
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
1772 xmlFree(key);
264e5ee5abfc Profiles now have a busy state
Michiel Broek <mbroek@mbse.eu>
parents: 106
diff changeset
1773 }
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
1774 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
1775 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
1776 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
1777 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
1778 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
1779 }
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
1780 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
1781 }
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
1782 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
1783 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c74bbc24a1c8 Client/Server communication is now almost final
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
1784 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
1785 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
1786 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
1787 }
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
1788 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
1789 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
1790 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
1791 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
1792 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
1793 }
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
1794 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
1795 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
1796 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
1797 profile->fridge_mode = ival;
191
c74bbc24a1c8 Client/Server communication is now almost final
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
1798 xmlFree(key);
c74bbc24a1c8 Client/Server communication is now almost final
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
1799 }
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1800 if ((!xmlStrcmp(cur->name, (const xmlChar *)"STEPS"))) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1801 parseSteps(doc, cur, &(profile)->steps);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1802 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1803 cur = cur->next;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1804 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1805
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1806 if (Config.profiles == NULL) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1807 Config.profiles = profile;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1808 } else {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1809 for (tmp = Config.profiles; tmp; tmp = tmp->next) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1810 if (tmp->next == NULL) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1811 tmp->next = profile;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1812 break;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1813 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1814 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1815 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1816
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1817 return 0;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1818 }
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1819
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1820
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1821
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1822 int parseProfiles(xmlDocPtr doc, xmlNodePtr cur)
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1823 {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1824 cur = cur->xmlChildrenNode;
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1825 while (cur != NULL) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1826 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROFILE"))) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
1827 parseProfile(doc, cur);
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1828 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1829 cur = cur->next;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1830 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1831 return 0;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1832 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1833
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1834
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1835
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1836 int parseDevice(xmlDocPtr doc, xmlNodePtr cur)
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1837 {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1838 xmlChar *key;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1839 devices_list *device, *tmp;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1840 int i, ival;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1841
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1842 device = (devices_list *)malloc(sizeof(devices_list));
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1843 device->next = NULL;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1844 device->version = 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1845 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
1846 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
1847 device->gpiopin = -1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1848 device->timestamp = (time_t)0;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1849
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1850 cur = cur->xmlChildrenNode;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1851 while (cur != NULL) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1852 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1853 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1854 if (xmlStrcmp(key, (const xmlChar *)"1")) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1855 xmlFree(key);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1856 return 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1857 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1858 device->version = 1;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1859 xmlFree(key);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1860 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1861 if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1862 device->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1863 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1864 if ((!xmlStrcmp(cur->name, (const xmlChar *)"TYPE"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1865 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
1866 for (i = 0; i < 8; i++) {
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1867 if (! xmlStrcmp(key, (const xmlChar *)DEVTYPE[i])) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1868 device->type = i;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1869 break;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1870 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1871 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1872 xmlFree(key);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1873 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1874 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DIRECTION"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1875 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
162
6fc9e3f7962f Added Raspberry GPIO devices
Michiel Broek <mbroek@mbse.eu>
parents: 161
diff changeset
1876 for (i = 0; i < 7; i++) {
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1877 if (! xmlStrcmp(key, (const xmlChar *)DEVDIR[i])) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1878 device->direction = i;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1879 break;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1880 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1881 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1882 xmlFree(key);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1883 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1884 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VALUE"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1885 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1886 if (sscanf((const char *)key, "%d", &ival) == 1)
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1887 device->value = ival;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1888 xmlFree(key);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1889 }
209
c5b1dfd83e81 Added offset value for sensor that need it
Michiel Broek <mbroek@mbse.eu>
parents: 206
diff changeset
1890 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
1891 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
c5b1dfd83e81 Added offset value for sensor that need it
Michiel Broek <mbroek@mbse.eu>
parents: 206
diff changeset
1892 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
1893 device->offset = ival;
c5b1dfd83e81 Added offset value for sensor that need it
Michiel Broek <mbroek@mbse.eu>
parents: 206
diff changeset
1894 xmlFree(key);
c5b1dfd83e81 Added offset value for sensor that need it
Michiel Broek <mbroek@mbse.eu>
parents: 206
diff changeset
1895 }
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1896 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1897 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1898 for (i = 0; i < 4; i++) {
174
244de612c572 Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
1899 if (! xmlStrcmp(key, (const xmlChar *)DEVPRESENT[i])) {
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1900 device->present = i;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1901 break;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1902 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1903 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1904 xmlFree(key);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1905 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1906 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ADDRESS"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1907 device->address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1908 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1909 if ((!xmlStrcmp(cur->name, (const xmlChar *)"SUBDEVICE"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1910 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1911 if (sscanf((const char *)key, "%d", &ival) == 1)
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1912 device->subdevice = ival;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1913 xmlFree(key);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1914 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1915 if ((!xmlStrcmp(cur->name, (const xmlChar *)"GPIOPIN"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1916 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1917 if (sscanf((const char *)key, "%d", &ival) == 1)
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1918 device->gpiopin = ival;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1919 xmlFree(key);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1920 }
161
493e39bb0a08 Small fixes for device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 158
diff changeset
1921 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DESCRIPTION"))) {
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1922 device->description = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1923 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1924 if ((!xmlStrcmp(cur->name, (const xmlChar *)"INUSE"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1925 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1926 if (sscanf((const char *)key, "%d", &ival) == 1)
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1927 device->inuse = ival;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1928 xmlFree(key);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1929 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1930 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COMMENT"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1931 device->comment = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1932 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1933 if ((!xmlStrcmp(cur->name, (const xmlChar *)"TIMESTAMP"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1934 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1935 if (sscanf((const char *)key, "%d", &ival) == 1)
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1936 device->timestamp = (time_t)ival;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1937 xmlFree(key);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1938 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1939
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1940 cur = cur->next;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1941 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1942
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1943 if (Config.devices == NULL) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1944 Config.devices = device;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1945 } else {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1946 for (tmp = Config.devices; tmp; tmp = tmp->next) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1947 if (tmp->next == NULL) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1948 tmp->next = device;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1949 break;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1950 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1951 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1952 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1953
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1954 return 0;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1955 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1956
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1957
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1958
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1959 int parseDevices(xmlDocPtr doc, xmlNodePtr cur)
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1960 {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1961 cur = cur->xmlChildrenNode;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1962 while (cur != NULL) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1963 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DEVICE"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1964 parseDevice(doc, cur);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1965 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1966 cur = cur->next;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1967 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1968 return 0;
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1969 }
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1970
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1971
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
1972
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
1973 #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
1974 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
1975 {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1976 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
1977 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
1978 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
1979 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
1980
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1981 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
1982 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
1983 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
1984 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
1985 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
1986 simulator->room_temperature = simulator->air_temperature = simulator->beer_temperature = simulator->s_cool_temp = simulator->s_heat_temp = 20.0;
553
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
1987 simulator->chiller_temperature = 1.5;
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
1988 simulator->room_humidity = 49.2;
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
1989 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
1990 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
1991 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
1992 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
1993
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
1994 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
1995 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
1996 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
1997 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
1998 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
1999 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
2000 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
2001 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2002 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
2003 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
2004 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2005 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
2006 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
2007 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2008 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
2009 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
2010 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2011 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
2012 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
2013 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
2014 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
2015 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
2016 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2017 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
2018 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
2019 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
2020 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
2021 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
2022 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2023 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
2024 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
2025 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
2026 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
2027 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
2028 }
553
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
2029 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOM_GUMIDITY"))) {
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
2030 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
2031 if (sscanf((const char *)key, "%f", &fval) == 1)
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
2032 simulator->room_humidity= fval;
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
2033 xmlFree(key);
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
2034 }
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
2035 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
2036 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
2037 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
2038 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
2039 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
2040 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2041 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
2042 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
2043 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
2044 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
2045 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
2046 }
553
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
2047 if ((!xmlStrcmp(cur->name, (const xmlChar *)"CHILLER_TEMPERATURE"))) {
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
2048 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
2049 if (sscanf((const char *)key, "%f", &fval) == 1)
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
2050 simulator->chiller_temperature = fval;
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
2051 xmlFree(key);
4091d4fe217f Updated simulator with more simulated devices.
Michiel Broek <mbroek@mbse.eu>
parents: 540
diff changeset
2052 }
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
2053 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
2054 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
2055 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
2056 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
2057 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
2058 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2059 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
2060 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
2061 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
2062 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
2063 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
2064 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2065 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
2066 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
2067 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
2068 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
2069 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
2070 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2071 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
2072 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
2073 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
2074 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
2075 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
2076 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2077 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
2078 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
2079 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
2080 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
2081 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
2082 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2083 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
2084 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
2085 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
2086 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
2087 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
2088 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2089 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
2090 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
2091 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
2092 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
2093 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
2094 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2095 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
2096 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
2097 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
2098 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
2099 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
2100 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2101 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
2102 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
2103 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
2104 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
2105 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
2106 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2107
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2108 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
2109 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
2110 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
2111 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
2112 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
2113 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2114 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
2115 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
2116 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
2117 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
2118 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
2119 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2120 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
2121 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
2122 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
2123 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
2124 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
2125 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2126 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
2127 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
2128 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
2129 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
2130 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
2131 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2132 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
2133 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
2134 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
2135 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
2136 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
2137 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2138 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
2139 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
2140 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
2141 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
2142 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
2143 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2144
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2145 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
2146 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2147
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2148 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
2149 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
2150 } 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
2151 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
2152 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
2153 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
2154 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
2155 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2156 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2157 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2158
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2159 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
2160 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2161
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2162
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2163
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2164 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
2165 {
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2166 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
2167 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
2168 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
2169 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
2170 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2171 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
2172 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2173 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
2174 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2175 #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
2176
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2177
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2178
86
3d7a241329e2 Using final user paths for log, configuration and profiles
Michiel Broek <mbroek@mbse.eu>
parents: 83
diff changeset
2179 int rdconfig(void)
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2180 {
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2181 int rc = 0, ival;
370
843dc511c877 Fixed memory leak in wrconfig
Michiel Broek <mbroek@mbse.eu>
parents: 363
diff changeset
2182 char *mypath;
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2183 xmlDocPtr doc;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2184 xmlNodePtr cur;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2185 xmlChar *key;
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2186
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2187 killconfig();
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
2188 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
2189
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2190 /*
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2191 * Search config file
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2192 */
56
f7711c6ac93c Workaround for empty environment at system boot
Michiel Broek <mbroek@mbse.eu>
parents: 55
diff changeset
2193 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
2194 mypath = xstrcpy((char *)"/root");
11d7cc3bdf31 If /home/mbroek is not set, assume root user.
Michiel Broek <mbroek@mbse.eu>
parents: 54
diff changeset
2195 } else {
11d7cc3bdf31 If /home/mbroek is not set, assume root user.
Michiel Broek <mbroek@mbse.eu>
parents: 54
diff changeset
2196 mypath = xstrcpy(getenv((char *)"HOME"));
11d7cc3bdf31 If /home/mbroek is not set, assume root user.
Michiel Broek <mbroek@mbse.eu>
parents: 54
diff changeset
2197 }
86
3d7a241329e2 Using final user paths for log, configuration and profiles
Michiel Broek <mbroek@mbse.eu>
parents: 83
diff changeset
2198 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
2199 mkdirs(mypath, 0755);
3d7a241329e2 Using final user paths for log, configuration and profiles
Michiel Broek <mbroek@mbse.eu>
parents: 83
diff changeset
2200 mypath = xstrcat(mypath, (char *)"thermferm.xml");
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2201 if ((doc = xmlParseFile(mypath)) == NULL) {
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2202 /*
388
05a55609cd9a Create a new configuration file if it doesn't exist.
Michiel Broek <mbroek@mbse.eu>
parents: 370
diff changeset
2203 * 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
2204 */
388
05a55609cd9a Create a new configuration file if it doesn't exist.
Michiel Broek <mbroek@mbse.eu>
parents: 370
diff changeset
2205 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
2206 wrconfig();
05a55609cd9a Create a new configuration file if it doesn't exist.
Michiel Broek <mbroek@mbse.eu>
parents: 370
diff changeset
2207
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2208 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
2209 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
2210 free(mypath);
388
05a55609cd9a Create a new configuration file if it doesn't exist.
Michiel Broek <mbroek@mbse.eu>
parents: 370
diff changeset
2211 return 1;
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2212 }
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2213 }
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
2214 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
2215
500
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
2216 Config.mqtt_host = xstrcpy((char *)"localhost");
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
2217 Config.mqtt_port = 1883;
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
2218 Config.next_unit = 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
2219
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2220 if ((cur = xmlDocGetRootElement(doc)) == NULL) {
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
2221 syslog(LOG_NOTICE, "XML file %s empty.", mypath);
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2222 xmlFreeDoc(doc);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2223 return 1;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2224 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2225 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
2226 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
2227 xmlFreeDoc(doc);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2228 return 1;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2229 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2230
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2231 /*
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2232 * Parse configuration
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2233 */
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2234 cur = cur->xmlChildrenNode;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2235 while (cur != NULL) {
83
f99e9d6deff5 Removed old ascii configuration
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
2236 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) {
f99e9d6deff5 Removed old ascii configuration
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
2237 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
f99e9d6deff5 Removed old ascii configuration
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
2238 if (xmlStrcmp(key, (const xmlChar *)"1")) {
f99e9d6deff5 Removed old ascii configuration
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
2239 xmlFree(key);
268
dda91dfa4aa8 All syslog logging only to LOG_NOTICE
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
2240 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
2241 return 1;
f99e9d6deff5 Removed old ascii configuration
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
2242 }
f99e9d6deff5 Removed old ascii configuration
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
2243 xmlFree(key);
f99e9d6deff5 Removed old ascii configuration
Michiel Broek <mbroek@mbse.eu>
parents: 82
diff changeset
2244 }
286
674efa17be1d The global system name was not saved or restored from the configuration file.
Michiel Broek <mbroek@mbse.eu>
parents: 284
diff changeset
2245 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
2246 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
2247 }
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2248 if ((!xmlStrcmp(cur->name, (const xmlChar *)"LISTEN_PORT"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2249 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2250 if (sscanf((const char *)key, "%d", &ival) == 1)
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2251 Config.my_port = ival;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2252 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2253 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2254 if ((!xmlStrcmp(cur->name, (const xmlChar *)"TEMPFORMAT"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2255 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2256 Config.tempFormat = key[0];
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2257 xmlFree(key);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2258 }
206
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
2259 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
2260 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
2261 }
78fb6f99e473 Added GLOBAL GET and GLOBAL PUT commands.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
2262 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
2263 Config.hum_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
95
2c28afc329a5 Removed old brewPi settings
Michiel Broek <mbroek@mbse.eu>
parents: 92
diff changeset
2264 }
513
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
2265 if ((!xmlStrcmp(cur->name, (const xmlChar *)"TEMP_HUM_IDX"))) {
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
2266 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
2267 if (sscanf((const char *)key, "%d", &ival) == 1)
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
2268 Config.temp_hum_idx = ival;
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
2269 xmlFree(key);
a2732027afb3 Version 0.6.1 added support for domoticz mqtt sensors.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
2270 }
500
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
2271 if ((!xmlStrcmp(cur->name, (const xmlChar *)"NEXT_UNIT"))) {
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
2272 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
2273 if (sscanf((const char *)key, "%d", &ival) == 1)
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
2274 Config.next_unit = ival;
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
2275 xmlFree(key);
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
2276 }
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
2277 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MQTT_HOST"))) {
561
fcfc3dbe85fa Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
2278 if (Config.mqtt_host)
fcfc3dbe85fa Versie 0.8.7. Fixed a lot of memory leaks with the aid of valgrind.
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
2279 free(Config.mqtt_host);
500
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
2280 Config.mqtt_host = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
2281 }
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
2282 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MQTT_PORT"))) {
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
2283 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
2284 if (sscanf((const char *)key, "%d", &ival) == 1)
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
2285 Config.mqtt_port = ival;
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
2286 xmlFree(key);
5aa914eb644e Units now have an unique alias name so that the MQTT messages are more friendly.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
2287 }
534
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
2288 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MQTT_USER"))) {
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
2289 Config.mqtt_username = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
2290 }
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
2291 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MQTT_PASS"))) {
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
2292 Config.mqtt_password = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
92b546d4a839 Versie 0.6.4. Aan de global setup de MQTT instellingen toegevoegd. Die zijn er ook als MQTT niet op het systeem aanwezig is. Indien het de global setup wijzigd, wordt de MQTT verbinding opnieuw gemaakt.
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
2293 }
540
5a26429abbf8 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload.
Michiel Broek <mbroek@mbse.eu>
parents: 534
diff changeset
2294 if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) {
5a26429abbf8 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload.
Michiel Broek <mbroek@mbse.eu>
parents: 534
diff changeset
2295 Config.uuid= (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
5a26429abbf8 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload.
Michiel Broek <mbroek@mbse.eu>
parents: 534
diff changeset
2296 }
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2297 if ((!xmlStrcmp(cur->name, (const xmlChar *)"LCDS"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2298 parseLCDs(doc, cur);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2299 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2300 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FERMENTERS"))) {
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2301 parseFermenters(doc, cur);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2302 }
91
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
2303 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROFILES"))) {
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
2304 parseProfiles(doc, cur);
901ca9858a7a Added fermenting profiles to the configuration
Michiel Broek <mbroek@mbse.eu>
parents: 90
diff changeset
2305 }
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
2306 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DEVICES"))) {
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
2307 parseDevices(doc, cur);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
2308 }
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
2309 #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
2310 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
2311 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
2312 }
b7c967359771 Added framework for a simulation of a fridge with heater to use as controlled fermentor
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2313 #endif
80
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2314 cur = cur->next;
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2315 }
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2316 xmlFreeDoc(doc);
81bf78a7618e Switched to xml configuration
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
2317
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2318 free(mypath);
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2319 mypath = NULL;
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2320
540
5a26429abbf8 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload.
Michiel Broek <mbroek@mbse.eu>
parents: 534
diff changeset
2321 /*
5a26429abbf8 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload.
Michiel Broek <mbroek@mbse.eu>
parents: 534
diff changeset
2322 * If the system uuid is not set, do it now.
5a26429abbf8 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload.
Michiel Broek <mbroek@mbse.eu>
parents: 534
diff changeset
2323 */
5a26429abbf8 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload.
Michiel Broek <mbroek@mbse.eu>
parents: 534
diff changeset
2324 if (Config.uuid == NULL) {
5a26429abbf8 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload.
Michiel Broek <mbroek@mbse.eu>
parents: 534
diff changeset
2325 uuid_t uu;
5a26429abbf8 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload.
Michiel Broek <mbroek@mbse.eu>
parents: 534
diff changeset
2326
5a26429abbf8 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload.
Michiel Broek <mbroek@mbse.eu>
parents: 534
diff changeset
2327 Config.uuid = malloc(37);
5a26429abbf8 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload.
Michiel Broek <mbroek@mbse.eu>
parents: 534
diff changeset
2328 uuid_generate(uu);
5a26429abbf8 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload.
Michiel Broek <mbroek@mbse.eu>
parents: 534
diff changeset
2329 uuid_unparse(uu, Config.uuid);
5a26429abbf8 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload.
Michiel Broek <mbroek@mbse.eu>
parents: 534
diff changeset
2330 }
5a26429abbf8 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload.
Michiel Broek <mbroek@mbse.eu>
parents: 534
diff changeset
2331
51
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2332 return rc;
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2333 }
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2334
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2335
a03b6dac5398 Removed library, bumped to version 0.0.7
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2336

mercurial