Andrew Boyson / oldheating

Dependencies:   net 1-wire lpc1768 crypto clock web fram log

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers web-boiler-query.c Source File

web-boiler-query.c

00001 #include <stdlib.h>
00002 #include <string.h>
00003 #include "http.h"
00004 #include "boiler.h"
00005 
00006 void WebBoilerQuery(char* pQuery)
00007 {
00008     while (pQuery)
00009     {
00010         char* pName;
00011         char* pValue;
00012         pQuery = HttpQuerySplit(pQuery, &pName, &pValue);
00013         
00014         
00015         if (HttpSameStr(pName, "boilercallenable"))
00016         {
00017             BoilerCallEnable = !BoilerCallEnable;
00018         }
00019         
00020         if (HttpSameStr(pName, "fullspeedsecs"  ))
00021         {
00022             int value = HttpQueryValueAsInt(pValue);
00023             BoilerSetFullSpeedSecs(value);
00024             return;
00025         }
00026         if (HttpSameStr(pName, "tanksetpoint"  ))
00027         {
00028             int value = HttpQueryValueAsInt(pValue);
00029             BoilerSetTankSetPoint(value);
00030             return;
00031         }
00032         if (HttpSameStr(pName, "tankhysteresis"))
00033         {
00034             int value = HttpQueryValueAsInt(pValue);
00035             BoilerSetTankHysteresis(value);
00036             return;
00037         }
00038         if (HttpSameStr(pName, "boilerresidual"))
00039         {
00040             double value = HttpQueryValueAsDouble(pValue);
00041             BoilerSetRunOnDeltaT((int)(value * 16));
00042             return;
00043         }
00044         if (HttpSameStr(pName, "boilerrunon"   ))
00045         {
00046             int value = HttpQueryValueAsInt(pValue);
00047             BoilerSetRunOnTime(value);
00048             return;
00049         }
00050         if (HttpSameStr(pName, "pumpspeedcalling"))
00051         {
00052             if (!pValue) return;
00053             switch (pValue[0])
00054             {
00055                 case  0 : return;
00056                 case 'a':
00057                 case 'A': BoilerSetPumpSpeedCalling(-1); return;
00058                 case 't':
00059                 case 'T': BoilerSetPumpSpeedCalling(-2); return;
00060             }
00061             int value = HttpQueryValueAsInt(pValue);
00062             BoilerSetPumpSpeedCalling(value);
00063             return;
00064         }
00065         if (HttpSameStr(pName, "pumpspeedrunon"))
00066         {
00067             int value = HttpQueryValueAsInt(pValue);
00068             BoilerSetRampDownTime(value);
00069             return;
00070         }
00071         if (HttpSameStr(pName, "boileroutputtarget"))
00072         {
00073             int value = HttpQueryValueAsInt(pValue);
00074             BoilerSetOutputTarget(value);
00075             return;
00076         }
00077         if (HttpSameStr(pName, "blrriseat0"))
00078         {
00079             double value = HttpQueryValueAsDouble(pValue);
00080             BoilerSetMinSpeed(value);
00081             return;
00082         }
00083         if (HttpSameStr(pName, "blrriseat50"))
00084         {
00085             double value = HttpQueryValueAsDouble(pValue);
00086             BoilerSetMidSpeedPwm(value);
00087             return;
00088         }
00089         if (HttpSameStr(pName, "blrriseat100"))
00090         {
00091             double value = HttpQueryValueAsDouble(pValue);
00092             BoilerSetFullSpeedDeltaT((int)(value * 16));
00093             return;
00094         }
00095     }
00096 }