
Controls the central heating system and the lights.
Dependencies: 1-wire clock crypto fram log lpc1768 net web wiz mbed
web-this/program/web-program-query.c@8:8ac076ce51af, 2022-11-12 (annotated)
- Committer:
- andrewboyson
- Date:
- Sat Nov 12 10:03:38 2022 +0000
- Revision:
- 8:8ac076ce51af
- Parent:
- 0:22b158d3c76f
Updated LPC1768 library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 0:22b158d3c76f | 1 | #include <string.h> |
andrewboyson | 0:22b158d3c76f | 2 | #include <stdlib.h> |
andrewboyson | 0:22b158d3c76f | 3 | #include "http.h" |
andrewboyson | 0:22b158d3c76f | 4 | #include "program.h" |
andrewboyson | 0:22b158d3c76f | 5 | |
andrewboyson | 0:22b158d3c76f | 6 | void WebProgramQuery(char* pQuery) |
andrewboyson | 0:22b158d3c76f | 7 | { |
andrewboyson | 0:22b158d3c76f | 8 | while (pQuery) |
andrewboyson | 0:22b158d3c76f | 9 | { |
andrewboyson | 0:22b158d3c76f | 10 | char* pName; |
andrewboyson | 0:22b158d3c76f | 11 | char* pValue; |
andrewboyson | 0:22b158d3c76f | 12 | pQuery = HttpQuerySplit(pQuery, &pName, &pValue); |
andrewboyson | 0:22b158d3c76f | 13 | |
andrewboyson | 0:22b158d3c76f | 14 | HttpQueryUnencode(pValue); |
andrewboyson | 0:22b158d3c76f | 15 | int value = HttpQueryValueAsInt(pValue); |
andrewboyson | 0:22b158d3c76f | 16 | int program = value; |
andrewboyson | 0:22b158d3c76f | 17 | if (program < 1) program = 1; |
andrewboyson | 0:22b158d3c76f | 18 | if (program > 3) program = 3; |
andrewboyson | 0:22b158d3c76f | 19 | program--; |
andrewboyson | 0:22b158d3c76f | 20 | |
andrewboyson | 0:22b158d3c76f | 21 | if (HttpSameStr(pName, "program1" )) ProgramParse (0, pValue); |
andrewboyson | 0:22b158d3c76f | 22 | if (HttpSameStr(pName, "program2" )) ProgramParse (1, pValue); |
andrewboyson | 0:22b158d3c76f | 23 | if (HttpSameStr(pName, "program3" )) ProgramParse (2, pValue); |
andrewboyson | 0:22b158d3c76f | 24 | if (HttpSameStr(pName, "mon" )) ProgramSetDay(1, program); |
andrewboyson | 0:22b158d3c76f | 25 | if (HttpSameStr(pName, "tue" )) ProgramSetDay(2, program); |
andrewboyson | 0:22b158d3c76f | 26 | if (HttpSameStr(pName, "wed" )) ProgramSetDay(3, program); |
andrewboyson | 0:22b158d3c76f | 27 | if (HttpSameStr(pName, "thu" )) ProgramSetDay(4, program); |
andrewboyson | 0:22b158d3c76f | 28 | if (HttpSameStr(pName, "fri" )) ProgramSetDay(5, program); |
andrewboyson | 0:22b158d3c76f | 29 | if (HttpSameStr(pName, "sat" )) ProgramSetDay(6, program); |
andrewboyson | 0:22b158d3c76f | 30 | if (HttpSameStr(pName, "sun" )) ProgramSetDay(0, program); |
andrewboyson | 0:22b158d3c76f | 31 | if (HttpSameStr(pName, "newdayhour")) ProgramSetNewDayHour(value); |
andrewboyson | 0:22b158d3c76f | 32 | |
andrewboyson | 0:22b158d3c76f | 33 | } |
andrewboyson | 0:22b158d3c76f | 34 | } |