thermferm/rdconfig.c

changeset 506
cdcd07bbee30
parent 500
5aa914eb644e
child 513
a2732027afb3
equal deleted inserted replaced
504:862de87f9f89 506:cdcd07bbee30
1 /***************************************************************************** 1 /*****************************************************************************
2 * Copyright (C) 2014-2016 2 * Copyright (C) 2014-2017
3 * 3 *
4 * Michiel Broek <mbroek at mbse dot eu> 4 * Michiel Broek <mbroek at mbse dot eu>
5 * 5 *
6 * This file is part of the mbsePi-apps 6 * This file is part of the mbsePi-apps
7 * 7 *
1020 1020
1021 1021
1022 /* 1022 /*
1023 * Parse a fermenter unit 1023 * Parse a fermenter unit
1024 */ 1024 */
1025 int parseUnit(xmlDocPtr doc, xmlNodePtr cur, int number) 1025 int parseUnit(xmlDocPtr doc, xmlNodePtr cur/* , int number */)
1026 { 1026 {
1027 xmlChar *key; 1027 xmlChar *key;
1028 int i, ival; 1028 int i, ival;
1029 float val; 1029 float val;
1030 units_list *unit, *tmp; 1030 units_list *unit, *tmp;
1414 } 1414 }
1415 1415
1416 /* 1416 /*
1417 * If there is no alias name, create it. 1417 * If there is no alias name, create it.
1418 */ 1418 */
1419 if (unit->alias == NULL) { 1419 // if (unit->alias == NULL) {
1420 char an[128]; 1420 // char an[128];
1421 sprintf(an, "unit%d", number); 1421 // sprintf(an, "unit%d", number);
1422 unit->alias = xstrcpy(an); 1422 // unit->alias = xstrcpy(an);
1423 } 1423 // }
1424 1424
1425 if (Config.units == NULL) { 1425 if (Config.units == NULL) {
1426 Config.units = unit; 1426 Config.units = unit;
1427 } else { 1427 } else {
1428 for (tmp = Config.units; tmp; tmp = tmp->next) { 1428 for (tmp = Config.units; tmp; tmp = tmp->next) {
1441 int parseFermenters(xmlDocPtr doc, xmlNodePtr cur) 1441 int parseFermenters(xmlDocPtr doc, xmlNodePtr cur)
1442 { 1442 {
1443 cur = cur->xmlChildrenNode; 1443 cur = cur->xmlChildrenNode;
1444 while (cur != NULL) { 1444 while (cur != NULL) {
1445 if ((!xmlStrcmp(cur->name, (const xmlChar *)"UNIT"))) { 1445 if ((!xmlStrcmp(cur->name, (const xmlChar *)"UNIT"))) {
1446 parseUnit(doc, cur, Config.next_unit); 1446 parseUnit(doc, cur/* , Config.next_unit*/);
1447 Config.next_unit++; 1447 // Config.next_unit++;
1448 } 1448 }
1449 cur = cur->next; 1449 cur = cur->next;
1450 } 1450 }
1451 return 0; 1451 return 0;
1452 } 1452 }

mercurial