Controls the central heating system and the lights.

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

web-this/radiator/web-radiator-query.c

Committer:
andrewboyson
Date:
2021-05-10
Revision:
0:22b158d3c76f
Child:
5:3579001bea1b

File content as of revision 0:22b158d3c76f:

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

void WebRadiatorQuery(char* pQuery)
{
    while (pQuery)
    {
        char* pName;
        char* pValue;
        pQuery = HttpQuerySplit(pQuery, &pName, &pValue);
        int value = HttpQueryValueAsInt(pValue);
        
        if (HttpSameStr(pName, "overridecancelminute"))
        {
            int hour   = value / 100;
            int minute = value % 100;
            RadiatorSetOverrideCancelHour  (hour);
            RadiatorSetOverrideCancelMinute(minute);
        }
        
        if (HttpSameStr(pName, "htg-chg-mode"        )) RadiatorChgWinter();
        if (HttpSameStr(pName, "htg-chg-override"    )) RadiatorChgOverride();
        
        if (HttpSameStr(pName, "nighttemp"           )) RadiatorSetNightTemperature(value);
        if (HttpSameStr(pName, "frosttemp"           )) RadiatorSetFrostTemperature(value);
    }
}