# HG changeset patch # User Michiel Broek # Date 1406373480 -7200 # Node ID 264e5ee5abfceb49edc64e47f94b9d04d766f4b8 # Parent 0882292322b3041d22bcf21b97af18b74d975f5b Profiles now have a busy state diff -r 0882292322b3 -r 264e5ee5abfc thermferm/rdconfig.c --- a/thermferm/rdconfig.c Fri Jul 25 23:28:44 2014 +0200 +++ b/thermferm/rdconfig.c Sat Jul 26 13:18:00 2014 +0200 @@ -444,6 +444,10 @@ syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); return 1; } + if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BUSY", "%d", tmp4->busy)) < 0) { + syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); + return 1; + } if (tmp4->steps) { if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "STEPS")) < 0) { syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement"); @@ -928,11 +932,13 @@ { xmlChar *key; profiles_list *profile, *tmp; + int ival; profile = (profiles_list *)malloc(sizeof(profiles_list)); profile->next = NULL; profile->version = 1; profile->uuid = profile->name = NULL; + profile->busy = 0; profile->steps = NULL; cur = cur->xmlChildrenNode; @@ -952,6 +958,12 @@ if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) { profile->name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"BUSY"))) { + key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); + if (sscanf((const char *)key, "%d", &ival) == 1) + profile->busy = ival; + xmlFree(key); + } if ((!xmlStrcmp(cur->name, (const xmlChar *)"STEPS"))) { parseSteps(doc, cur, &(profile)->steps); } diff -r 0882292322b3 -r 264e5ee5abfc thermferm/server.c --- a/thermferm/server.c Fri Jul 25 23:28:44 2014 +0200 +++ b/thermferm/server.c Sat Jul 26 13:18:00 2014 +0200 @@ -332,7 +332,7 @@ j = 0; for (step = profile->steps; step; step = step->next) j++; - srv_send((char *)"%s,%s,%d", profile->uuid, profile->name, j); + srv_send((char *)"%s,%s,%d,%d", profile->uuid, profile->name, j, profile->busy); } srv_send((char *)"."); return 0; diff -r 0882292322b3 -r 264e5ee5abfc thermferm/thermferm.h --- a/thermferm/thermferm.h Fri Jul 25 23:28:44 2014 +0200 +++ b/thermferm/thermferm.h Sat Jul 26 13:18:00 2014 +0200 @@ -125,6 +125,7 @@ int version; /* Version 1 */ char *uuid; /* Profile uuid */ char *name; /* Profile name */ + int busy; /* Profile busy == 1, free == 0 */ prof_step *steps; /* Profile steps */ } profiles_list; diff -r 0882292322b3 -r 264e5ee5abfc www-thermferm/profiles.php --- a/www-thermferm/profiles.php Fri Jul 25 23:28:44 2014 +0200 +++ b/www-thermferm/profiles.php Sat Jul 26 13:18:00 2014 +0200 @@ -86,6 +86,10 @@ +/* + * @link Edit profile + * @link Add profile + */ function profile_list() { $sock = open_socket(); @@ -112,7 +116,12 @@ $outstr .= '
'.PHP_EOL; $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; + $outstr .= ' '.PHP_EOL; + $outstr .= ' '.PHP_EOL; + $outstr .= ' '.PHP_EOL; + $outstr .= ' '.PHP_EOL; + $outstr .= ' '.PHP_EOL; + $outstr .= ' '.PHP_EOL; if (startsWith($arr[0], "212")) { $j = 1; @@ -120,7 +129,16 @@ if (strcmp($arr[$j], ".") == 0) break; $f = explode(",", $arr[$j]); - $outstr .= ' '.PHP_EOL; + $busy = 0; + $outstr .= ' '.PHP_EOL; + $outstr .= ' '.PHP_EOL; + $outstr .= ' '.PHP_EOL; + $outstr .= ' '.PHP_EOL; + if ($busy == 1) + $outstr .= ' '.PHP_EOL; + else + $outstr .= ' '.PHP_EOL; + $outstr .= ' '.PHP_EOL; $j++; } }
UUIDNameStepsspare
UUIDNameStepsEdit
'.$f[0].''.$f[1].''.$f[2].'bla
'.$f[0].''.$f[1].''.$f[2].'BusyEdit