brewco/rdconfig.c

changeset 446
78e9d5234d15
parent 445
3ec477cda546
child 447
b48368855ec4
equal deleted inserted replaced
445:3ec477cda546 446:78e9d5234d15
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 *****************************************************************************/ 21 *****************************************************************************/
22 22
23 #include "rdconfig.h" 23 #include "rdconfig.h"
24 #include "brewco.h" 24 #include "brewco.h"
25 #include "futil.h" 25 #include "util.h"
26 #include "xutil.h" 26 #include "xutil.h"
27 27
28 int debug = TRUE; 28 int debug = TRUE;
29 sys_config Config; /* System configuration */ 29 sys_config Config; /* System configuration */
30 30
32 32
33 const char TEMPSTATE[3][8] = { "OK", "MISSING", "ERROR" }; 33 const char TEMPSTATE[3][8] = { "OK", "MISSING", "ERROR" };
34 const char DEVTYPE[6][5] = { "NA", "W1", "GPIO", "I2C", "SPI", "SIM" }; 34 const char DEVTYPE[6][5] = { "NA", "W1", "GPIO", "I2C", "SPI", "SIM" };
35 const char DEVPRESENT[4][6] = { "UNDEF", "NO", "YES", "ERROR" }; 35 const char DEVPRESENT[4][6] = { "UNDEF", "NO", "YES", "ERROR" };
36 const char DEVDIR[7][11] = { "UNDEF", "IN_BIN", "OUT_BIN", "IN_ANALOG", "OUT_ANALOG", "OUT_PWM", "INTERN" }; 36 const char DEVDIR[7][11] = { "UNDEF", "IN_BIN", "OUT_BIN", "IN_ANALOG", "OUT_ANALOG", "OUT_PWM", "INTERN" };
37 const char PIDMODE[3][5] = { "NONE", "AUTO", "BOO" };
38 const char WHIRLPOOL_TYPE[3][5] = { "OFF", "COLD", "HOT" }; 37 const char WHIRLPOOL_TYPE[3][5] = { "OFF", "COLD", "HOT" };
38 const char PIDDIRECTION[2][8] = { "DIRECT", "REVERSE" };
39 const char PIDMODE[2][10] = { "MANUAL", "AUTOMATIC" };
39 40
40 41
41 void killconfig(void) 42 void killconfig(void)
42 { 43 {
43 units_list *unit; 44 units_list *unit;
400 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 401 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
401 return 1; 402 return 1;
402 } 403 }
403 404
404 if (unit->PID_hlt) { 405 if (unit->PID_hlt) {
405 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_IMAX", "%.2f", unit->PID_hlt->iMax)) < 0) { 406 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_KP", "%.2lf", unit->PID_hlt->Kp)) < 0) {
406 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 407 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
407 return 1; 408 return 1;
408 } 409 }
409 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_IGAIN", "%.2f", unit->PID_hlt->iGain)) < 0) { 410 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_KI", "%.2lf", unit->PID_hlt->Ki)) < 0) {
410 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 411 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
411 return 1; 412 return 1;
412 } 413 }
413 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_PGAIN", "%.2f", unit->PID_hlt->pGain)) < 0) { 414 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_KD", "%.2lf", unit->PID_hlt->Kd)) < 0) {
414 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 415 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
415 return 1; 416 return 1;
416 } 417 }
417 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_DGAIN", "%.2f", unit->PID_hlt->dGain)) < 0) { 418 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_DIRECTION", "%s", PIDDIRECTION[unit->PID_hlt->Direction])) < 0) {
418 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 419 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
419 return 1; 420 return 1;
420 } 421 }
421 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_INPUT", "%.2f", unit->PID_hlt->Input)) < 0) {
422 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
423 return 1;
424 }
425 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_ERR", "%.2f", unit->PID_hlt->Err)) < 0) {
426 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
427 return 1;
428 }
429 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_ERRLAST", "%.2f", unit->PID_hlt->ErrLast)) < 0) {
430 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
431 return 1;
432 }
433 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_ISTATE", "%.2f", unit->PID_hlt->iState)) < 0) {
434 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
435 return 1;
436 }
437 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_SETP", "%.2f", unit->PID_hlt->SetP)) < 0) {
438 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
439 return 1;
440 }
441 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_OUTP", "%.2f", unit->PID_hlt->OutP)) < 0) {
442 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
443 return 1;
444 }
445 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_MODE", "%s", PIDMODE[unit->PID_hlt->Mode])) < 0) {
446 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
447 return 1;
448 }
449 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_TIMES", "%d", unit->PID_hlt->Times)) < 0)) {
450 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
451 return 1;
452 }
453 } 422 }
454 423
455 if (unit->PID_mlt) { 424 if (unit->PID_mlt) {
456 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_IMAX", "%.2f", unit->PID_mlt->iMax)) < 0) { 425 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_KP", "%.2lf", unit->PID_mlt->Kp)) < 0) {
457 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 426 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
458 return 1; 427 return 1;
459 } 428 }
460 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_IGAIN", "%.2f", unit->PID_mlt->iGain)) < 0) { 429 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_KI", "%.2lf", unit->PID_mlt->Ki)) < 0) {
461 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 430 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
462 return 1; 431 return 1;
463 } 432 }
464 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_PGAIN", "%.2f", unit->PID_mlt->pGain)) < 0) { 433 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_KD", "%.2lf", unit->PID_mlt->Kd)) < 0) {
465 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 434 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
466 return 1; 435 return 1;
467 } 436 }
468 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_DGAIN", "%.2f", unit->PID_mlt->dGain)) < 0) { 437 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_DIRECTION", "%s", PIDDIRECTION[unit->PID_mlt->Direction])) < 0) {
469 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 438 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
470 return 1; 439 return 1;
471 } 440 }
472 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_INPUT", "%.2f", unit->PID_mlt->Input)) < 0) {
473 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
474 return 1;
475 }
476 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_ERR", "%.2f", unit->PID_mlt->Err)) < 0) {
477 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
478 return 1;
479 }
480 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_ERRLAST", "%.2f", unit->PID_mlt->ErrLast)) < 0) {
481 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
482 return 1;
483 }
484 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_ISTATE", "%.2f", unit->PID_mlt->iState)) < 0) {
485 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
486 return 1;
487 }
488 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_SETP", "%.2f", unit->PID_mlt->SetP)) < 0) {
489 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
490 return 1;
491 }
492 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_OUTP", "%.2f", unit->PID_mlt->OutP)) < 0) {
493 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
494 return 1;
495 }
496 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_MODE", "%s", PIDMODE[unit->PID_mlt->Mode])) < 0) {
497 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
498 return 1;
499 }
500 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_MLT_TIMES", "%d", unit->PID_mlt->Times)) < 0)) {
501 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
502 return 1;
503 }
504 } 441 }
505 442
506 if ((rc = xmlTextWriterEndElement(writer)) < 0) { 443 if ((rc = xmlTextWriterEndElement(writer)) < 0) {
507 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement"); 444 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
508 return 1; 445 return 1;
773 int parseBrewsystem(xmlDocPtr doc, xmlNodePtr cur) 710 int parseBrewsystem(xmlDocPtr doc, xmlNodePtr cur)
774 { 711 {
775 xmlChar *key; 712 xmlChar *key;
776 int i, ival; 713 int i, ival;
777 float fval; 714 float fval;
715 double dval;
778 units_list *unit, *tmp; 716 units_list *unit, *tmp;
779 717
780 unit = (units_list *)malloc(sizeof(units_list)); 718 unit = (units_list *)malloc(sizeof(units_list));
781 unit->next = NULL; 719 unit->next = NULL;
782 unit->version = 1; 720 unit->version = 1;
798 unit->skip_iodine = 0; 736 unit->skip_iodine = 0;
799 unit->iodine_time = 90; 737 unit->iodine_time = 90;
800 unit->whirlpool = 1; 738 unit->whirlpool = 1;
801 unit->PID_hlt = (pid_var *)malloc(sizeof(pid_var)); 739 unit->PID_hlt = (pid_var *)malloc(sizeof(pid_var));
802 unit->PID_mlt = (pid_var *)malloc(sizeof(pid_var)); 740 unit->PID_mlt = (pid_var *)malloc(sizeof(pid_var));
803 InitPID(unit->PID_hlt);
804 InitPID(unit->PID_mlt);
805 741
806 cur = cur->xmlChildrenNode; 742 cur = cur->xmlChildrenNode;
807 while (cur != NULL) { 743 while (cur != NULL) {
808 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) { 744 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) {
809 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 745 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1025 } 961 }
1026 } 962 }
1027 xmlFree(key); 963 xmlFree(key);
1028 } 964 }
1029 965
1030 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_IMAX"))) { 966 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_KP"))) {
1031 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 967 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1032 if (sscanf((const char *)key, "%f", &fval) == 1) 968 if (sscanf((const char *)key, "%lf", &dval) == 1)
1033 unit->PID_hlt->iMax = fval; 969 unit->PID_hlt->Kp = dval;
1034 xmlFree(key); 970 xmlFree(key);
1035 } 971 }
1036 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_IGAIN"))) { 972 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_KI"))) {
1037 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 973 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1038 if (sscanf((const char *)key, "%f", &fval) == 1) 974 if (sscanf((const char *)key, "%lf", &dval) == 1)
1039 unit->PID_hlt->iGain = fval; 975 unit->PID_hlt->Ki = dval;
1040 xmlFree(key); 976 xmlFree(key);
1041 } 977 }
1042 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_PGAIN"))) { 978 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_KD"))) {
1043 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 979 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1044 if (sscanf((const char *)key, "%f", &fval) == 1) 980 if (sscanf((const char *)key, "%lf", &dval) == 1)
1045 unit->PID_hlt->pGain = fval; 981 unit->PID_hlt->Kd = dval;
1046 xmlFree(key); 982 xmlFree(key);
1047 } 983 }
1048 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_DGAIN"))) { 984
1049 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 985 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_KP"))) {
1050 if (sscanf((const char *)key, "%f", &fval) == 1) 986 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1051 unit->PID_hlt->dGain = fval; 987 if (sscanf((const char *)key, "%lf", &dval) == 1)
1052 xmlFree(key); 988 unit->PID_mlt->Kp = dval;
1053 } 989 xmlFree(key);
1054 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_INPUT"))) { 990 }
1055 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 991 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_KI"))) {
1056 if (sscanf((const char *)key, "%f", &fval) == 1) 992 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1057 unit->PID_hlt->Input = fval; 993 if (sscanf((const char *)key, "%lf", &dval) == 1)
1058 xmlFree(key); 994 unit->PID_mlt->Ki = dval;
1059 } 995 xmlFree(key);
1060 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_ERR"))) { 996 }
1061 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 997 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_KD"))) {
1062 if (sscanf((const char *)key, "%f", &fval) == 1) 998 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1063 unit->PID_hlt->Err = fval; 999 if (sscanf((const char *)key, "%lf", &dval) == 1)
1064 xmlFree(key); 1000 unit->PID_mlt->Kd = dval;
1065 }
1066 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_ERRLAST"))) {
1067 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1068 if (sscanf((const char *)key, "%f", &fval) == 1)
1069 unit->PID_hlt->ErrLast = fval;
1070 xmlFree(key);
1071 }
1072 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_ISTATE"))) {
1073 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1074 if (sscanf((const char *)key, "%f", &fval) == 1)
1075 unit->PID_hlt->iState = fval;
1076 xmlFree(key);
1077 }
1078 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_SETP"))) {
1079 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1080 if (sscanf((const char *)key, "%f", &fval) == 1)
1081 unit->PID_hlt->SetP = fval;
1082 xmlFree(key);
1083 }
1084 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_OUTP"))) {
1085 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1086 if (sscanf((const char *)key, "%f", &fval) == 1)
1087 unit->PID_hlt->OutP = fval;
1088 xmlFree(key);
1089 }
1090 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_MODE"))) {
1091 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1092 for (i = 0; i < 3; i++) {
1093 if (! xmlStrcmp(key, (const xmlChar *)PIDMODE[i])) {
1094 unit->PID_hlt->Mode = i;
1095 break;
1096 }
1097 }
1098 xmlFree(key);
1099 }
1100
1101 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_IMAX"))) {
1102 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1103 if (sscanf((const char *)key, "%f", &fval) == 1)
1104 unit->PID_mlt->iMax = fval;
1105 xmlFree(key);
1106 }
1107 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_IGAIN"))) {
1108 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1109 if (sscanf((const char *)key, "%f", &fval) == 1)
1110 unit->PID_mlt->iGain = fval;
1111 xmlFree(key);
1112 }
1113 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_PGAIN"))) {
1114 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1115 if (sscanf((const char *)key, "%f", &fval) == 1)
1116 unit->PID_mlt->pGain = fval;
1117 xmlFree(key);
1118 }
1119 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_DGAIN"))) {
1120 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1121 if (sscanf((const char *)key, "%f", &fval) == 1)
1122 unit->PID_mlt->dGain = fval;
1123 xmlFree(key);
1124 }
1125 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_INPUT"))) {
1126 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1127 if (sscanf((const char *)key, "%f", &fval) == 1)
1128 unit->PID_mlt->Input = fval;
1129 xmlFree(key);
1130 }
1131 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_ERR"))) {
1132 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1133 if (sscanf((const char *)key, "%f", &fval) == 1)
1134 unit->PID_mlt->Err = fval;
1135 xmlFree(key);
1136 }
1137 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_ERRLAST"))) {
1138 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1139 if (sscanf((const char *)key, "%f", &fval) == 1)
1140 unit->PID_mlt->ErrLast = fval;
1141 xmlFree(key);
1142 }
1143 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_ISTATE"))) {
1144 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1145 if (sscanf((const char *)key, "%f", &fval) == 1)
1146 unit->PID_mlt->iState = fval;
1147 xmlFree(key);
1148 }
1149 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_SETP"))) {
1150 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1151 if (sscanf((const char *)key, "%f", &fval) == 1)
1152 unit->PID_mlt->SetP = fval;
1153 xmlFree(key);
1154 }
1155 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_OUTP"))) {
1156 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1157 if (sscanf((const char *)key, "%f", &fval) == 1)
1158 unit->PID_mlt->OutP = fval;
1159 xmlFree(key);
1160 }
1161 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_MLT_MODE"))) {
1162 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1163 for (i = 0; i < 3; i++) {
1164 if (! xmlStrcmp(key, (const xmlChar *)PIDMODE[i])) {
1165 unit->PID_mlt->Mode = i;
1166 break;
1167 }
1168 }
1169 xmlFree(key); 1001 xmlFree(key);
1170 } 1002 }
1171 1003
1172 cur = cur->next; 1004 cur = cur->next;
1173 } 1005 }

mercurial