Monitor motorhome leisure battery and provide simple control of habitation

Dependencies:   net lpc1768 crypto clock web fram log

web-this/boiler/web-boiler-query.c

Committer:
andrewboyson
Date:
2021-01-14
Revision:
0:b843d647695c

File content as of revision 0:b843d647695c:

#include <stdlib.h>
#include <string.h>
#include "http.h"
#include "boiler.h"

void WebBoilerQuery(char* pQuery)
{
    while (pQuery)
    {
        char* pName;
        char* pValue;
        pQuery = HttpQuerySplit(pQuery, &pName, &pValue);
                    
        if (HttpSameStr(pName, "tanksetpoint"  ))
        {
            int value = HttpQueryValueAsInt(pValue);
            BoilerSetTankSetPoint(value);
            return;
        }
        if (HttpSameStr(pName, "tankhysteresis"))
        {
            int value = HttpQueryValueAsInt(pValue);
            BoilerSetTankHysteresis(value);
            return;
        }
        if (HttpSameStr(pName, "boilerresidual"))
        {
            double value = HttpQueryValueAsDouble(pValue);
            BoilerSetRunOnResidual16ths((int)(value * 16));
            return;
        }
        if (HttpSameStr(pName, "boilerrunon"   ))
        {
            int value = HttpQueryValueAsInt(pValue);
            BoilerSetRunOnTime(value);
            return;
        }
    }
}