206 return 1; |
201 return 1; |
207 } |
202 } |
208 |
203 |
209 /* |
204 /* |
210 * Start the document with the xml default for the version, |
205 * Start the document with the xml default for the version, |
211 * encoding ISO 8859-1 and the default for the standalone |
206 * encoding UTF-8 and the default for the standalone declaration. |
212 * declaration. |
|
213 */ |
207 */ |
214 if ((rc = xmlTextWriterStartDocument(writer, NULL, MY_ENCODING, NULL)) < 0) { |
208 xmlTextWriterStartDocument(writer, NULL, MY_ENCODING, NULL); |
215 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartDocument"); |
|
216 return 1; |
|
217 } |
|
218 |
209 |
219 /* |
210 /* |
220 * Start an element named "THERMFERM". Since thist is the first |
211 * Start an element named "THERMFERM". Since thist is the first |
221 * element, this will be the root element of the document. |
212 * element, this will be the root element of the document. |
222 */ |
213 */ |
223 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "THERMFERM")) < 0) { |
214 xmlTextWriterStartElement(writer, BAD_CAST "THERMFERM"); |
224 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
215 |
225 return 1; |
216 xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", Config.name); |
226 } |
217 xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", Config.uuid); |
227 |
218 xmlTextWriterWriteFormatElement(writer, BAD_CAST "LISTEN_PORT", "%d", Config.my_port); |
228 /* |
219 xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMPFORMAT", "%c", Config.tempFormat); |
229 * Add an attribute with name "VERSION" and value "1" to THERMFERM. |
220 |
230 */ |
221 xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_ADDRESS", "%s", Config.temp_address); |
231 if ((rc = xmlTextWriterWriteElement(writer, BAD_CAST "VERSION", BAD_CAST "1")) < 0) { |
222 xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_STATE", "%d", Config.temp_state); |
232 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
223 xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_VALUE", "%d", Config.temp_value); |
233 return 1; |
224 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HUM_ADDRESS", "%s", Config.hum_address); |
234 } |
225 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HUM_STATE", "%d", Config.hum_state); |
235 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", Config.name)) < 0) { |
226 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HUM_VALUE", "%d", Config.hum_value); |
236 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
227 xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_HUM_IDX", "%d", Config.temp_hum_idx); |
237 return 1; |
228 |
238 } |
229 xmlTextWriterWriteFormatElement(writer, BAD_CAST "NEXT_UNIT", "%d", Config.next_unit); |
239 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", Config.uuid)) < 0) { |
230 |
240 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
231 xmlTextWriterWriteFormatElement(writer, BAD_CAST "MQTT_HOST", "%s", Config.mqtt_host); |
241 return 1; |
232 xmlTextWriterWriteFormatElement(writer, BAD_CAST "MQTT_PORT", "%d", Config.mqtt_port); |
242 } |
|
243 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "LISTEN_PORT", "%d", Config.my_port)) < 0) { |
|
244 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
245 return 1; |
|
246 } |
|
247 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMPFORMAT", "%c", Config.tempFormat)) < 0) { |
|
248 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
249 return 1; |
|
250 } |
|
251 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_ADDRESS", "%s", Config.temp_address)) < 0) { |
|
252 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
253 return 1; |
|
254 } |
|
255 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_STATE", "%d", Config.temp_state)) < 0) { |
|
256 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
257 return 1; |
|
258 } |
|
259 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_VALUE", "%d", Config.temp_value)) < 0) { |
|
260 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
261 return 1; |
|
262 } |
|
263 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HUM_ADDRESS", "%s", Config.hum_address)) < 0) { |
|
264 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
265 return 1; |
|
266 } |
|
267 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HUM_STATE", "%d", Config.hum_state)) < 0) { |
|
268 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
269 return 1; |
|
270 } |
|
271 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HUM_VALUE", "%d", Config.hum_value)) < 0) { |
|
272 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
273 return 1; |
|
274 } |
|
275 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_HUM_IDX", "%d", Config.temp_hum_idx)) < 0) { |
|
276 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
277 return 1; |
|
278 } |
|
279 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NEXT_UNIT", "%d", Config.next_unit)) < 0) { |
|
280 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
281 return 1; |
|
282 } |
|
283 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MQTT_HOST", "%s", Config.mqtt_host)) < 0) { |
|
284 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
285 return 1; |
|
286 } |
|
287 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MQTT_PORT", "%d", Config.mqtt_port)) < 0) { |
|
288 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
289 return 1; |
|
290 } |
|
291 if (Config.mqtt_username && Config.mqtt_password) { |
233 if (Config.mqtt_username && Config.mqtt_password) { |
292 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MQTT_USER", "%s", Config.mqtt_username)) < 0) { |
234 xmlTextWriterWriteFormatElement(writer, BAD_CAST "MQTT_USER", "%s", Config.mqtt_username); |
293 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
235 xmlTextWriterWriteFormatElement(writer, BAD_CAST "MQTT_PASS", "%s", Config.mqtt_password); |
294 return 1; |
|
295 } |
|
296 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MQTT_PASS", "%s", Config.mqtt_password)) < 0) { |
|
297 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
298 return 1; |
|
299 } |
|
300 } |
236 } |
301 |
237 |
302 /* |
238 /* |
303 * Start an element named "LCDS" as child of THERMFERM. |
239 * Start an element named "LCDS" as child of THERMFERM. |
304 */ |
240 */ |
305 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "LCDS")) < 0) { |
241 xmlTextWriterStartElement(writer, BAD_CAST "LCDS"); |
306 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
|
307 return 1; |
|
308 } |
|
309 /* |
242 /* |
310 * Start one LCD. It is possible to connect 7 LCD displays on the i2c bus. |
243 * Start one LCD. It is possible to connect 7 LCD displays on the i2c bus. |
311 * However this program doesn't use more then one yet. |
244 * However this program doesn't use more then one yet. |
312 */ |
245 */ |
313 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "LCD")) < 0) { |
246 xmlTextWriterStartElement(writer, BAD_CAST "LCD"); |
314 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
247 xmlTextWriterWriteFormatElement(writer, BAD_CAST "ADDRESS", "0x%x", Config.lcd_address); |
315 return 1; |
248 xmlTextWriterWriteFormatElement(writer, BAD_CAST "COLUMNS", "%d", Config.lcd_cols); |
316 } |
249 xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROWS", "%d", Config.lcd_rows); |
317 if ((rc = xmlTextWriterWriteElement(writer, BAD_CAST "VERSION", BAD_CAST "1")) < 0) { |
250 xmlTextWriterEndElement(writer); // close LCD |
318 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
251 xmlTextWriterEndElement(writer); // close LCDS |
319 return 1; |
|
320 } |
|
321 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ADDRESS", "0x%x", Config.lcd_address)) < 0) { |
|
322 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
323 return 1; |
|
324 } |
|
325 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COLUMNS", "%d", Config.lcd_cols)) < 0) { |
|
326 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
327 return 1; |
|
328 } |
|
329 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROWS", "%d", Config.lcd_rows)) < 0) { |
|
330 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
331 return 1; |
|
332 } |
|
333 /* |
|
334 * Close the element named LCD. |
|
335 */ |
|
336 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
|
337 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
|
338 return 1; |
|
339 } |
|
340 /* |
|
341 * Close the element LCDS. |
|
342 */ |
|
343 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
|
344 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
|
345 return 1; |
|
346 } |
|
347 |
252 |
348 /* |
253 /* |
349 * Fermenter units |
254 * Fermenter units |
350 */ |
255 */ |
351 if (Config.units) { |
256 if (Config.units) { |
352 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "FERMENTERS")) < 0) { |
257 xmlTextWriterStartElement(writer, BAD_CAST "FERMENTERS"); |
353 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
|
354 return 1; |
|
355 } |
|
356 for (tmp3 = Config.units; tmp3; tmp3 = tmp3->next) { |
258 for (tmp3 = Config.units; tmp3; tmp3 = tmp3->next) { |
357 /* |
259 xmlTextWriterStartElement(writer, BAD_CAST "FERMENTER"); |
358 * Only configuration items are written, measured values and states |
260 xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", tmp3->uuid); |
359 * are written to a state file. |
261 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PRODUCT_UUID", "%s", tmp3->product_uuid); |
360 */ |
262 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PRODUCT_CODE", "%s", tmp3->product_code); |
361 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "UNIT")) < 0) { |
263 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PRODUCT_NAME", "%s", tmp3->product_name); |
362 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
264 xmlTextWriterWriteFormatElement(writer, BAD_CAST "ALIAS", "%s", tmp3->alias); |
363 return 1; |
265 xmlTextWriterWriteFormatElement(writer, BAD_CAST "VOLUME", "%.1f", tmp3->volume); |
364 } |
266 |
365 if ((rc = xmlTextWriterWriteElement(writer, BAD_CAST "VERSION", BAD_CAST "1")) < 0) { |
|
366 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
367 return 1; |
|
368 } |
|
369 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", tmp3->uuid)) < 0) { |
|
370 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
371 return 1; |
|
372 } |
|
373 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PRODUCT_UUID", "%s", tmp3->product_uuid)) < 0) { |
|
374 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
375 return 1; |
|
376 } |
|
377 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PRODUCT_CODE", "%s", tmp3->product_code)) < 0) { |
|
378 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
379 return 1; |
|
380 } |
|
381 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PRODUCT_NAME", "%s", tmp3->product_name)) < 0) { |
|
382 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
383 return 1; |
|
384 } |
|
385 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ALIAS", "%s", tmp3->alias)) < 0) { |
|
386 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
387 return 1; |
|
388 } |
|
389 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "VOLUME", "%.1f", tmp3->volume)) < 0) { |
|
390 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
391 return 1; |
|
392 } |
|
393 if (tmp3->air_address) { |
267 if (tmp3->air_address) { |
394 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_ADDRESS", "%s", tmp3->air_address)) < 0)) { |
268 xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_ADDRESS", "%s", tmp3->air_address); |
395 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
269 xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_STATE", "%d", tmp3->air_state); |
396 return 1; |
270 xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_TEMPERATURE", "%d", tmp3->air_temperature); |
397 } |
271 xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_IDX", "%d", tmp3->air_idx); |
398 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_STATE", "%d", tmp3->air_state)) < 0)) { |
272 } |
399 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
273 if (tmp3->beer_address) { |
400 return 1; |
274 xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_ADDRESS", "%s", tmp3->beer_address); |
|
275 xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_STATE", "%d", tmp3->beer_state); |
|
276 xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_TEMPERATURE", "%d", tmp3->beer_temperature); |
|
277 xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_IDX", "%d", tmp3->beer_idx); |
|
278 } |
|
279 if (tmp3->chiller_address) { |
|
280 xmlTextWriterWriteFormatElement(writer, BAD_CAST "CHILLER_ADDRESS", "%s", tmp3->chiller_address); |
|
281 xmlTextWriterWriteFormatElement(writer, BAD_CAST "CHILLER_STATE", "%d", tmp3->chiller_state); |
|
282 xmlTextWriterWriteFormatElement(writer, BAD_CAST "CHILLER_TEMPERATURE", "%d", tmp3->chiller_temperature); |
|
283 xmlTextWriterWriteFormatElement(writer, BAD_CAST "CHILLER_IDX", "%d", tmp3->chiller_idx); |
|
284 } |
|
285 if (tmp3->heater_address) { |
|
286 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_ADDRESS", "%s", tmp3->heater_address); |
|
287 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_STATE", "%d", tmp3->heater_state); |
|
288 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_DELAY", "%d", tmp3->heater_delay); |
|
289 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_USAGE", "%d", tmp3->heater_usage); |
|
290 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_IDX", "%d", tmp3->heater_idx); |
|
291 } |
|
292 if (tmp3->cooler_address) { |
|
293 xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_ADDRESS", "%s", tmp3->cooler_address); |
|
294 xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_STATE", "%d", tmp3->cooler_state); |
|
295 xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_DELAY", "%d", tmp3->cooler_delay); |
|
296 xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_USAGE", "%d", tmp3->cooler_usage); |
|
297 xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_IDX", "%d", tmp3->cooler_idx); |
|
298 } |
|
299 if (tmp3->fan_address) { |
|
300 xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_ADDRESS", "%s", tmp3->fan_address); |
|
301 xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_STATE", "%d", tmp3->fan_state); |
|
302 xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_DELAY", "%d", tmp3->fan_delay); |
|
303 xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_USAGE", "%d", tmp3->fan_usage); |
|
304 xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_IDX", "%d", tmp3->fan_idx); |
|
305 } |
|
306 if (tmp3->light_address) { |
|
307 xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_ADDRESS", "%s", tmp3->light_address); |
|
308 xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_STATE", "%d", tmp3->light_state); |
|
309 xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_DELAY", "%d", tmp3->light_delay); |
|
310 xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_USAGE", "%d", tmp3->light_usage); |
|
311 xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_IDX", "%d", tmp3->light_idx); |
|
312 } |
|
313 if (tmp3->door_address) { |
|
314 xmlTextWriterWriteFormatElement(writer, BAD_CAST "DOOR_ADDRESS", "%s", tmp3->door_address); |
|
315 xmlTextWriterWriteFormatElement(writer, BAD_CAST "DOOR_STATE", "%d", tmp3->door_state); |
|
316 xmlTextWriterWriteFormatElement(writer, BAD_CAST "DOOR_IDX", "%d", tmp3->door_idx); |
|
317 } |
|
318 if (tmp3->psu_address) { |
|
319 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PSU_ADDRESS", "%s", tmp3->psu_address); |
|
320 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PSU_STATE", "%d", tmp3->psu_state); |
|
321 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PSU_IDX", "%d", tmp3->psu_idx); |
|
322 } |
|
323 xmlTextWriterWriteFormatElement(writer, BAD_CAST "MODE", "%s", UNITMODE[tmp3->mode] ); |
|
324 xmlTextWriterWriteFormatElement(writer, BAD_CAST "STAGE", "%s", UNITSTAGE[tmp3->stage] ); |
|
325 xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_SET", "%.1f", tmp3->beer_set); |
|
326 xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIDGE_SET", "%.1f", tmp3->fridge_set); |
|
327 xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_SET_MIN", "%.1f", tmp3->temp_set_min); |
|
328 xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_SET_MAX", "%.1f", tmp3->temp_set_max); |
|
329 |
|
330 if (tmp3->profile_uuid) { |
|
331 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROFILE_UUID", "%s", tmp3->profile_uuid); |
|
332 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROFILE_NAME", "%s", tmp3->profile_name); |
|
333 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROFILE_INITTEMP_LO", "%.1f", tmp3->profile_inittemp_lo); |
|
334 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROFILE_INITTEMP_HI", "%.1f", tmp3->profile_inittemp_hi); |
|
335 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROFILE_FRIDGE_MODE", "%d", tmp3->profile_fridge_mode); |
|
336 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROFILE_DURATION", "%d", tmp3->profile_duration); |
|
337 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROFILE_TOTALSTEPS", "%d", tmp3->profile_totalsteps); |
|
338 if (tmp3->profile_steps) { |
|
339 xmlTextWriterStartElement(writer, BAD_CAST "PROFILE_STEPS"); |
|
340 for (tmp5 = tmp3->profile_steps; tmp5; tmp5 = tmp5->next) { |
|
341 xmlTextWriterStartElement(writer, BAD_CAST "PROFILE_STEP"); |
|
342 if (tmp5->name) |
|
343 xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", tmp5->name); |
|
344 xmlTextWriterWriteFormatElement(writer, BAD_CAST "RESTTIME", "%d", tmp5->resttime); |
|
345 xmlTextWriterWriteFormatElement(writer, BAD_CAST "STEPTIME", "%d", tmp5->steptime); |
|
346 xmlTextWriterWriteFormatElement(writer, BAD_CAST "TARGET_LO", "%.1f", tmp5->target_lo); |
|
347 xmlTextWriterWriteFormatElement(writer, BAD_CAST "TARGET_HI", "%.1f", tmp5->target_hi); |
|
348 xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIDGE_MODE", "%d", tmp5->fridge_mode); |
|
349 xmlTextWriterEndElement(writer); // close PROFILE_STEP |
|
350 } |
|
351 xmlTextWriterEndElement(writer); // close PROFILE_STEPS |
401 } |
352 } |
402 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_TEMPERATURE", "%d", tmp3->air_temperature)) < 0)) { |
353 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_STARTED", "%d", (unsigned int)tmp3->prof_started); |
403 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
354 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_PAUSED", "%d", (unsigned int)tmp3->prof_paused); |
404 return 1; |
355 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_STATE", "%s", PROFSTATE[tmp3->prof_state] ); |
405 } |
356 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_PEAK_ABS", "%.3f", tmp3->prof_peak_abs); |
406 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_IDX", "%d", tmp3->air_idx)) < 0)) { |
357 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_PEAK_REL", "%.3f", tmp3->prof_peak_rel); |
407 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
358 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_PRIMARY_DONE", "%d", (unsigned int)tmp3->prof_primary_done); |
408 return 1; |
|
409 } |
|
410 } |
|
411 if (tmp3->beer_address) { |
|
412 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_ADDRESS", "%s", tmp3->beer_address)) < 0)) { |
|
413 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
414 return 1; |
|
415 } |
|
416 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_STATE", "%d", tmp3->beer_state)) < 0)) { |
|
417 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
418 return 1; |
|
419 } |
|
420 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_TEMPERATURE", "%d", tmp3->beer_temperature)) < 0)) { |
|
421 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
422 return 1; |
|
423 } |
|
424 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_IDX", "%d", tmp3->beer_idx)) < 0)) { |
|
425 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
426 return 1; |
|
427 } |
|
428 } |
|
429 if (tmp3->chiller_address) { |
|
430 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "CHILLER_ADDRESS", "%s", tmp3->chiller_address)) < 0)) { |
|
431 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
432 return 1; |
|
433 } |
|
434 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "CHILLER_STATE", "%d", tmp3->chiller_state)) < 0)) { |
|
435 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
436 return 1; |
|
437 } |
|
438 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "CHILLER_TEMPERATURE", "%d", tmp3->chiller_temperature)) < 0)) { |
|
439 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
440 return 1; |
|
441 } |
|
442 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "CHILLER_IDX", "%d", tmp3->chiller_idx)) < 0)) { |
|
443 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
444 return 1; |
|
445 } |
|
446 } |
|
447 if (tmp3->heater_address) { |
|
448 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_ADDRESS", "%s", tmp3->heater_address)) < 0)) { |
|
449 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
450 return 1; |
|
451 } |
|
452 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_STATE", "%d", tmp3->heater_state)) < 0)) { |
|
453 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
454 return 1; |
|
455 } |
|
456 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_DELAY", "%d", tmp3->heater_delay)) < 0)) { |
|
457 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
458 return 1; |
|
459 } |
|
460 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_USAGE", "%d", tmp3->heater_usage)) < 0)) { |
|
461 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
462 return 1; |
|
463 } |
|
464 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_IDX", "%d", tmp3->heater_idx)) < 0)) { |
|
465 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
466 return 1; |
|
467 } |
|
468 } |
|
469 if (tmp3->cooler_address) { |
|
470 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_ADDRESS", "%s", tmp3->cooler_address)) < 0)) { |
|
471 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
472 return 1; |
|
473 } |
|
474 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_STATE", "%d", tmp3->cooler_state)) < 0)) { |
|
475 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
476 return 1; |
|
477 } |
|
478 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_DELAY", "%d", tmp3->cooler_delay)) < 0)) { |
|
479 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
480 return 1; |
|
481 } |
|
482 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_USAGE", "%d", tmp3->cooler_usage)) < 0)) { |
|
483 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
484 return 1; |
|
485 } |
|
486 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_IDX", "%d", tmp3->cooler_idx)) < 0)) { |
|
487 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
488 return 1; |
|
489 } |
|
490 } |
|
491 if (tmp3->fan_address) { |
|
492 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_ADDRESS", "%s", tmp3->fan_address)) < 0)) { |
|
493 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
494 return 1; |
|
495 } |
|
496 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_STATE", "%d", tmp3->fan_state)) < 0)) { |
|
497 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
498 return 1; |
|
499 } |
|
500 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_DELAY", "%d", tmp3->fan_delay)) < 0)) { |
|
501 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
502 return 1; |
|
503 } |
|
504 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_USAGE", "%d", tmp3->fan_usage)) < 0)) { |
|
505 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
506 return 1; |
|
507 } |
|
508 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_IDX", "%d", tmp3->fan_idx)) < 0)) { |
|
509 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
510 return 1; |
|
511 } |
|
512 } |
|
513 if (tmp3->light_address) { |
|
514 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_ADDRESS", "%s", tmp3->light_address)) < 0)) { |
|
515 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
516 return 1; |
|
517 } |
|
518 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_STATE", "%d", tmp3->light_state)) < 0)) { |
|
519 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
520 return 1; |
|
521 } |
|
522 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_DELAY", "%d", tmp3->light_delay)) < 0)) { |
|
523 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
524 return 1; |
|
525 } |
|
526 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_USAGE", "%d", tmp3->light_usage)) < 0)) { |
|
527 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
528 return 1; |
|
529 } |
|
530 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_IDX", "%d", tmp3->light_idx)) < 0)) { |
|
531 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
532 return 1; |
|
533 } |
|
534 } |
|
535 if (tmp3->door_address) { |
|
536 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "DOOR_ADDRESS", "%s", tmp3->door_address)) < 0)) { |
|
537 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
538 return 1; |
|
539 } |
|
540 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "DOOR_STATE", "%d", tmp3->door_state)) < 0)) { |
|
541 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
542 return 1; |
|
543 } |
|
544 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "DOOR_IDX", "%d", tmp3->door_idx)) < 0)) { |
|
545 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
546 return 1; |
|
547 } |
|
548 } |
|
549 if (tmp3->psu_address) { |
|
550 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PSU_ADDRESS", "%s", tmp3->psu_address)) < 0)) { |
|
551 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
552 return 1; |
|
553 } |
|
554 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PSU_STATE", "%d", tmp3->psu_state)) < 0)) { |
|
555 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
556 return 1; |
|
557 } |
|
558 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PSU_IDX", "%d", tmp3->psu_idx)) < 0)) { |
|
559 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
560 return 1; |
|
561 } |
|
562 } |
|
563 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MODE", "%s", UNITMODE[tmp3->mode] )) < 0) { |
|
564 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
565 return 1; |
|
566 } |
|
567 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "STAGE", "%s", UNITSTAGE[tmp3->stage] )) < 0) { |
|
568 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
569 return 1; |
|
570 } |
|
571 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_SET", "%.1f", tmp3->beer_set)) < 0) { |
|
572 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
573 return 1; |
|
574 } |
|
575 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIDGE_SET", "%.1f", tmp3->fridge_set)) < 0) { |
|
576 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
577 return 1; |
|
578 } |
|
579 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_SET_MIN", "%.1f", tmp3->temp_set_min)) < 0) { |
|
580 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
581 return 1; |
|
582 } |
|
583 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_SET_MAX", "%.1f", tmp3->temp_set_max)) < 0) { |
|
584 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
585 return 1; |
|
586 } |
|
587 if (tmp3->profile) { |
|
588 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROFILE", "%s", tmp3->profile)) < 0) { |
|
589 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
590 return 1; |
|
591 } |
|
592 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_STARTED", "%d", (unsigned int)tmp3->prof_started)) < 0) { |
|
593 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
594 return 1; |
|
595 } |
|
596 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_PAUSED", "%d", (unsigned int)tmp3->prof_paused)) < 0) { |
|
597 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
598 return 1; |
|
599 } |
|
600 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_STATE", "%s", PROFSTATE[tmp3->prof_state] )) < 0) { |
|
601 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
602 return 1; |
|
603 } |
|
604 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_PEAK_ABS", "%.3f", tmp3->prof_peak_abs)) < 0) { |
|
605 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
606 return 1; |
|
607 } |
|
608 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_PEAK_REL", "%.3f", tmp3->prof_peak_rel)) < 0) { |
|
609 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
610 return 1; |
|
611 } |
|
612 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_PRIMARY_DONE", "%d", (unsigned int)tmp3->prof_primary_done)) < 0) { |
|
613 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
614 return 1; |
|
615 } |
|
616 } |
359 } |
617 if (tmp3->PID_cool) { |
360 if (tmp3->PID_cool) { |
618 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_IMAX", "%.2f", tmp3->PID_cool->iMax)) < 0) { |
361 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_IMAX", "%.2f", tmp3->PID_cool->iMax); |
619 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
362 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_IGAIN", "%.3f", tmp3->PID_cool->iGain); |
620 return 1; |
363 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_PGAIN", "%.3f", tmp3->PID_cool->pGain); |
621 } |
364 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_DGAIN", "%.3f", tmp3->PID_cool->dGain); |
622 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_IGAIN", "%.3f", tmp3->PID_cool->iGain)) < 0) { |
365 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_IDLERANGE", "%.2f", tmp3->PID_cool->idleRange); |
623 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
366 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_INPUT", "%.2f", tmp3->PID_cool->Input); |
624 return 1; |
367 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_ERR", "%.2f", tmp3->PID_cool->Err); |
625 } |
368 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_ISTATE", "%.2f", tmp3->PID_cool->iState); |
626 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_PGAIN", "%.3f", tmp3->PID_cool->pGain)) < 0) { |
369 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_SETP", "%.2f", tmp3->PID_cool->SetP); |
627 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
370 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_OUTP", "%.2f", tmp3->PID_cool->OutP); |
628 return 1; |
371 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_MODE", "%s", PIDMODE[tmp3->PID_cool->Mode]); |
629 } |
372 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_TYPE", "COOL"); |
630 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_DGAIN", "%.3f", tmp3->PID_cool->dGain)) < 0) { |
|
631 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
632 return 1; |
|
633 } |
|
634 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_IDLERANGE", "%.2f", tmp3->PID_cool->idleRange)) < 0) { |
|
635 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
636 return 1; |
|
637 } |
|
638 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_INPUT", "%.2f", tmp3->PID_cool->Input)) < 0) { |
|
639 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
640 return 1; |
|
641 } |
|
642 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_ERR", "%.2f", tmp3->PID_cool->Err)) < 0) { |
|
643 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
644 return 1; |
|
645 } |
|
646 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_ISTATE", "%.2f", tmp3->PID_cool->iState)) < 0) { |
|
647 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
648 return 1; |
|
649 } |
|
650 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_SETP", "%.2f", tmp3->PID_cool->SetP)) < 0) { |
|
651 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
652 return 1; |
|
653 } |
|
654 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_OUTP", "%.2f", tmp3->PID_cool->OutP)) < 0) { |
|
655 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
656 return 1; |
|
657 } |
|
658 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_MODE", "%s", PIDMODE[tmp3->PID_cool->Mode])) < 0) { |
|
659 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
660 return 1; |
|
661 } |
|
662 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_TYPE", "COOL")) < 0) { |
|
663 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
664 return 1; |
|
665 } |
|
666 } |
373 } |
667 if (tmp3->PID_heat) { |
374 if (tmp3->PID_heat) { |
668 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_IMAX", "%.2f", tmp3->PID_heat->iMax)) < 0) { |
375 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_IMAX", "%.2f", tmp3->PID_heat->iMax); |
669 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
376 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_IGAIN", "%.3f", tmp3->PID_heat->iGain); |
670 return 1; |
377 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_PGAIN", "%.3f", tmp3->PID_heat->pGain); |
671 } |
378 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_DGAIN", "%.3f", tmp3->PID_heat->dGain); |
672 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_IDLERANGE", "%.2f", tmp3->PID_heat->idleRange)) < 0) { |
379 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_IDLERANGE", "%.2f", tmp3->PID_heat->idleRange); |
673 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
380 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_INPUT", "%.2f", tmp3->PID_heat->Input); |
674 return 1; |
381 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_ERR", "%.2f", tmp3->PID_heat->Err); |
675 } |
382 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_ISTATE", "%.2f", tmp3->PID_heat->iState); |
676 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_IGAIN", "%.3f", tmp3->PID_heat->iGain)) < 0) { |
383 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_SETP", "%.2f", tmp3->PID_heat->SetP); |
677 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
384 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_OUTP", "%.2f", tmp3->PID_heat->OutP); |
678 return 1; |
385 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_MODE", "%s", PIDMODE[tmp3->PID_heat->Mode]); |
679 } |
386 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_TYPE", "HEAT"); |
680 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_PGAIN", "%.3f", tmp3->PID_heat->pGain)) < 0) { |
387 } |
681 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
388 xmlTextWriterEndElement(writer); // close FERMENTER |
682 return 1; |
389 } |
683 } |
390 xmlTextWriterEndElement(writer); // close FERMENTERS |
684 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_DGAIN", "%.3f", tmp3->PID_heat->dGain)) < 0) { |
|
685 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
686 return 1; |
|
687 } |
|
688 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_INPUT", "%.2f", tmp3->PID_heat->Input)) < 0) { |
|
689 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
690 return 1; |
|
691 } |
|
692 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_ERR", "%.2f", tmp3->PID_heat->Err)) < 0) { |
|
693 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
694 return 1; |
|
695 } |
|
696 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_ISTATE", "%.2f", tmp3->PID_heat->iState)) < 0) { |
|
697 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
698 return 1; |
|
699 } |
|
700 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_SETP", "%.2f", tmp3->PID_heat->SetP)) < 0) { |
|
701 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
702 return 1; |
|
703 } |
|
704 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_OUTP", "%.2f", tmp3->PID_heat->OutP)) < 0) { |
|
705 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
706 return 1; |
|
707 } |
|
708 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_MODE", "%s", PIDMODE[tmp3->PID_heat->Mode])) < 0) { |
|
709 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
710 return 1; |
|
711 } |
|
712 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_TYPE", "HEAT")) < 0) { |
|
713 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
714 return 1; |
|
715 } |
|
716 } |
|
717 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
|
718 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
|
719 return 1; |
|
720 } |
|
721 } |
|
722 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
|
723 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
|
724 return 1; |
|
725 } |
|
726 } |
|
727 |
|
728 /* |
|
729 * Fermenting profiles |
|
730 */ |
|
731 if (Config.profiles) { |
|
732 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "PROFILES")) < 0) { |
|
733 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
|
734 return 1; |
|
735 } |
|
736 for (tmp4 = Config.profiles; tmp4; tmp4 = tmp4->next) { |
|
737 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "PROFILE")) < 0) { |
|
738 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
|
739 return 1; |
|
740 } |
|
741 if ((rc = xmlTextWriterWriteElement(writer, BAD_CAST "VERSION", BAD_CAST "1")) < 0) { |
|
742 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
743 return 1; |
|
744 } |
|
745 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", tmp4->uuid)) < 0) { |
|
746 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
747 return 1; |
|
748 } |
|
749 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", tmp4->name)) < 0) { |
|
750 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
751 return 1; |
|
752 } |
|
753 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BUSY", "%d", tmp4->busy)) < 0) { |
|
754 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
755 return 1; |
|
756 } |
|
757 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "INITTEMP_LO", "%.1f", tmp4->inittemp_lo)) < 0) { |
|
758 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
759 return 1; |
|
760 } |
|
761 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "INITTEMP_HI", "%.1f", tmp4->inittemp_hi)) < 0) { |
|
762 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
763 return 1; |
|
764 } |
|
765 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIDGE_MODE", "%d", tmp4->fridge_mode)) < 0) { |
|
766 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
767 return 1; |
|
768 } |
|
769 if (tmp4->steps) { |
|
770 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "STEPS")) < 0) { |
|
771 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
|
772 return 1; |
|
773 } |
|
774 for (tmp5 = tmp4->steps; tmp5; tmp5 = tmp5->next) { |
|
775 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "STEP")) < 0) { |
|
776 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
|
777 return 1; |
|
778 } |
|
779 if ((rc = xmlTextWriterWriteElement(writer, BAD_CAST "VERSION", BAD_CAST "1")) < 0) { |
|
780 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
781 return 1; |
|
782 } |
|
783 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "RESTTIME", "%d", tmp5->resttime)) < 0) { |
|
784 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
785 return 1; |
|
786 } |
|
787 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "STEPTIME", "%d", tmp5->steptime)) < 0) { |
|
788 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
789 return 1; |
|
790 } |
|
791 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TARGET_LO", "%.1f", tmp5->target_lo)) < 0) { |
|
792 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
793 return 1; |
|
794 } |
|
795 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TARGET_HI", "%.1f", tmp5->target_hi)) < 0) { |
|
796 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
797 return 1; |
|
798 } |
|
799 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIDGE_MODE", "%d", tmp5->fridge_mode)) < 0) { |
|
800 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
801 return 1; |
|
802 } |
|
803 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
|
804 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
|
805 return 1; |
|
806 } |
|
807 } |
|
808 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
|
809 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
|
810 return 1; |
|
811 } |
|
812 } |
|
813 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
|
814 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
|
815 return 1; |
|
816 } |
|
817 } |
|
818 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
|
819 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
|
820 return 1; |
|
821 } |
|
822 } |
391 } |
823 |
392 |
824 if (Config.devices) { |
393 if (Config.devices) { |
825 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "DEVICES")) < 0) { |
394 xmlTextWriterStartElement(writer, BAD_CAST "DEVICES"); |
826 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
|
827 return 1; |
|
828 } |
|
829 #ifdef HAVE_WIRINGPI_H |
395 #ifdef HAVE_WIRINGPI_H |
830 piLock(LOCK_DEVICES); |
396 piLock(LOCK_DEVICES); |
831 #endif |
397 #endif |
832 for (device = Config.devices; device; device = device->next) { |
398 for (device = Config.devices; device; device = device->next) { |
833 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "DEVICE")) < 0) { |
399 xmlTextWriterStartElement(writer, BAD_CAST "DEVICE"); |
834 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
400 xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", device->uuid); |
835 return 1; |
401 xmlTextWriterWriteFormatElement(writer, BAD_CAST "TYPE", "%s", DEVTYPE[device->type]); |
836 } |
402 xmlTextWriterWriteFormatElement(writer, BAD_CAST "DIRECTION", "%s", DEVDIR[device->direction]); |
837 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "VERSION", "%d", device->version)) < 0) { |
403 xmlTextWriterWriteFormatElement(writer, BAD_CAST "VALUE", "%d", device->value); |
838 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
404 xmlTextWriterWriteFormatElement(writer, BAD_CAST "OFFSET", "%d", device->offset); |
839 return 1; |
405 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PRESENT", "%s", DEVPRESENT[device->present]); |
840 } |
406 xmlTextWriterWriteFormatElement(writer, BAD_CAST "ADDRESS", "%s", device->address); |
841 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", device->uuid)) < 0) { |
407 xmlTextWriterWriteFormatElement(writer, BAD_CAST "SUBDEVICE", "%d", device->subdevice); |
842 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
408 xmlTextWriterWriteFormatElement(writer, BAD_CAST "GPIOPIN", "%d", device->gpiopin); |
843 return 1; |
409 xmlTextWriterWriteFormatElement(writer, BAD_CAST "DESCRIPTION", "%s", device->description); |
844 } |
410 xmlTextWriterWriteFormatElement(writer, BAD_CAST "INUSE", "%d", device->inuse); |
845 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TYPE", "%s", DEVTYPE[device->type])) < 0) { |
411 xmlTextWriterWriteFormatElement(writer, BAD_CAST "COMMENT", "%s", device->comment); |
846 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
412 xmlTextWriterWriteFormatElement(writer, BAD_CAST "TIMESTAMP", "%d", (int)device->timestamp); |
847 return 1; |
413 xmlTextWriterEndElement(writer); // close DEVICE |
848 } |
|
849 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "DIRECTION", "%s", DEVDIR[device->direction])) < 0) { |
|
850 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
851 return 1; |
|
852 } |
|
853 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "VALUE", "%d", device->value)) < 0) { |
|
854 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
855 return 1; |
|
856 } |
|
857 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "OFFSET", "%d", device->offset)) < 0) { |
|
858 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
859 return 1; |
|
860 } |
|
861 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PRESENT", "%s", DEVPRESENT[device->present])) < 0) { |
|
862 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
863 return 1; |
|
864 } |
|
865 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ADDRESS", "%s", device->address)) < 0) { |
|
866 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
867 return 1; |
|
868 } |
|
869 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "SUBDEVICE", "%d", device->subdevice)) < 0) { |
|
870 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
871 return 1; |
|
872 } |
|
873 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "GPIOPIN", "%d", device->gpiopin)) < 0) { |
|
874 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
875 return 1; |
|
876 } |
|
877 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "DESCRIPTION", "%s", device->description)) < 0) { |
|
878 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
879 return 1; |
|
880 } |
|
881 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "INUSE", "%d", device->inuse)) < 0) { |
|
882 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
883 return 1; |
|
884 } |
|
885 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COMMENT", "%s", device->comment)) < 0) { |
|
886 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
887 return 1; |
|
888 } |
|
889 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TIMESTAMP", "%d", (int)device->timestamp)) < 0) { |
|
890 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
891 return 1; |
|
892 } |
|
893 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
|
894 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
|
895 return 1; |
|
896 } |
|
897 } |
414 } |
898 #ifdef HAVE_WIRINGPI_H |
415 #ifdef HAVE_WIRINGPI_H |
899 piUnlock(LOCK_DEVICES); |
416 piUnlock(LOCK_DEVICES); |
900 #endif |
417 #endif |
901 |
418 xmlTextWriterEndElement(writer); // close DEVICES |
902 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
|
903 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
|
904 return 1; |
|
905 } |
|
906 } |
419 } |
907 |
420 |
908 #ifdef USE_SIMULATOR |
421 #ifdef USE_SIMULATOR |
909 if (Config.simulators) { |
422 if (Config.simulators) { |
910 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "SIMULATORS")) < 0) { |
423 xmlTextWriterStartElement(writer, BAD_CAST "SIMULATORS"); |
911 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
|
912 return 1; |
|
913 } |
|
914 for (simulator = Config.simulators; simulator; simulator = simulator->next) { |
424 for (simulator = Config.simulators; simulator; simulator = simulator->next) { |
915 if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "SIMULATOR")) < 0) { |
425 xmlTextWriterStartElement(writer, BAD_CAST "SIMULATOR"); |
916 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); |
426 xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", simulator->uuid); |
917 return 1; |
427 xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", simulator->name); |
918 } |
428 xmlTextWriterWriteFormatElement(writer, BAD_CAST "VOLUME_AIR", "%d", simulator->volume_air); |
919 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "VERSION", "%d", simulator->version)) < 0) { |
429 xmlTextWriterWriteFormatElement(writer, BAD_CAST "VOLUME_BEER", "%d", simulator->volume_beer); |
920 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
430 xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOM_TEMPERATURE", "%.1f", simulator->room_temperature); |
921 return 1; |
431 xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOM_HUMIDITY", "%.1f", simulator->room_humidity); |
922 } |
432 xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_TEMPERATURE", "%f", simulator->air_temperature); |
923 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", simulator->uuid)) < 0) { |
433 xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_TEMPERATURE", "%f", simulator->beer_temperature); |
924 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
434 xmlTextWriterWriteFormatElement(writer, BAD_CAST "CHILLER_TEMPERATURE", "%f", simulator->chiller_temperature); |
925 return 1; |
435 xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_TEMP", "%f", simulator->cooler_temp); |
926 } |
436 xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_TIME", "%d", simulator->cooler_time); |
927 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", simulator->name)) < 0) { |
437 xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_SIZE", "%.3f", simulator->cooler_size); |
928 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
438 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_TEMP", "%f", simulator->heater_temp); |
929 return 1; |
439 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_TIME", "%d", simulator->heater_time); |
930 } |
440 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_SIZE", "%.3f", simulator->heater_size); |
931 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "VOLUME_AIR", "%d", simulator->volume_air)) < 0) { |
441 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_STATE", "%d", simulator->heater_state); |
932 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
442 xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_STATE", "%d", simulator->cooler_state); |
933 return 1; |
443 xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIGO_ISOLATION", "%.3f", simulator->frigo_isolation); |
934 } |
444 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_YEAST_HEAT", "%f", simulator->s_yeast_heat); |
935 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "VOLUME_BEER", "%d", simulator->volume_beer)) < 0) { |
445 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_YEAST_STARTED", "%d", (int)simulator->s_yeast_started); |
936 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
446 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_COOL_TEMP", "%f", simulator->s_cool_temp); |
937 return 1; |
447 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_HEAT_TEMP", "%f", simulator->s_heat_temp); |
938 } |
448 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_COOL_CHANGED", "%d", (int)simulator->s_cool_changed); |
939 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOM_TEMPERATURE", "%.1f", simulator->room_temperature)) < 0) { |
449 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_HEAT_CHANGED", "%d", (int)simulator->s_heat_changed); |
940 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
450 xmlTextWriterEndElement(writer); |
941 return 1; |
451 } |
942 } |
452 xmlTextWriterEndElement(writer); |
943 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOM_HUMIDITY", "%.1f", simulator->room_humidity)) < 0) { |
|
944 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
945 return 1; |
|
946 } |
|
947 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_TEMPERATURE", "%f", simulator->air_temperature)) < 0) { |
|
948 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
949 return 1; |
|
950 } |
|
951 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_TEMPERATURE", "%f", simulator->beer_temperature)) < 0) { |
|
952 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
953 return 1; |
|
954 } |
|
955 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "CHILLER_TEMPERATURE", "%f", simulator->chiller_temperature)) < 0) { |
|
956 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
957 return 1; |
|
958 } |
|
959 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_TEMP", "%f", simulator->cooler_temp)) < 0) { |
|
960 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
961 return 1; |
|
962 } |
|
963 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_TIME", "%d", simulator->cooler_time)) < 0) { |
|
964 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
965 return 1; |
|
966 } |
|
967 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_SIZE", "%.3f", simulator->cooler_size)) < 0) { |
|
968 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
969 return 1; |
|
970 } |
|
971 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_TEMP", "%f", simulator->heater_temp)) < 0) { |
|
972 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
973 return 1; |
|
974 } |
|
975 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_TIME", "%d", simulator->heater_time)) < 0) { |
|
976 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
977 return 1; |
|
978 } |
|
979 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_SIZE", "%.3f", simulator->heater_size)) < 0) { |
|
980 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
981 return 1; |
|
982 } |
|
983 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_STATE", "%d", simulator->heater_state)) < 0) { |
|
984 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
985 return 1; |
|
986 } |
|
987 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_STATE", "%d", simulator->cooler_state)) < 0) { |
|
988 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
989 return 1; |
|
990 } |
|
991 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIGO_ISOLATION", "%.3f", simulator->frigo_isolation)) < 0) { |
|
992 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
993 return 1; |
|
994 } |
|
995 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_YEAST_HEAT", "%f", simulator->s_yeast_heat)) < 0) { |
|
996 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
997 return 1; |
|
998 } |
|
999 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_YEAST_STARTED", "%d", (int)simulator->s_yeast_started)) < 0) { |
|
1000 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
1001 return 1; |
|
1002 } |
|
1003 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_COOL_TEMP", "%f", simulator->s_cool_temp)) < 0) { |
|
1004 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
1005 return 1; |
|
1006 } |
|
1007 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_HEAT_TEMP", "%f", simulator->s_heat_temp)) < 0) { |
|
1008 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
1009 return 1; |
|
1010 } |
|
1011 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_COOL_CHANGED", "%d", (int)simulator->s_cool_changed)) < 0) { |
|
1012 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
1013 return 1; |
|
1014 } |
|
1015 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_HEAT_CHANGED", "%d", (int)simulator->s_heat_changed)) < 0) { |
|
1016 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
|
1017 return 1; |
|
1018 } |
|
1019 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
|
1020 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
|
1021 return 1; |
|
1022 } |
|
1023 } |
|
1024 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
|
1025 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); |
|
1026 return 1; |
|
1027 } |
|
1028 } |
453 } |
1029 #endif |
454 #endif |
1030 |
455 |
1031 /* |
456 /* |
1032 * All done, close any open elements |
457 * All done, close any open elements |