Manages the 1-wire bus
Dependents: oldheating heating
Diff: http/http-1wire-query.c
- Revision:
- 1:c272b1fcc834
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/http/http-1wire-query.c Fri Apr 26 14:29:44 2019 +0000 @@ -0,0 +1,27 @@ +#include <string.h> +#include <stdlib.h> +#include "http.h" +#include "1-wire-device.h" +#include "settings.h" +#include "ds18b20.h" + +void HttpOneWireQuery(char* pQuery) +{ + while (pQuery) + { + char* pName; + char* pValue; + pQuery = HttpQuerySplit(pQuery, &pName, &pValue); + + HttpQueryUnencode(pValue); + + int value = HttpQueryValueAsInt(pValue); + + if (HttpSameStr(pName, "rom0")) { char rom[8]; DeviceParseAddress(pValue, rom); DS18B20RomSetters[0](rom); } + if (HttpSameStr(pName, "rom1")) { char rom[8]; DeviceParseAddress(pValue, rom); DS18B20RomSetters[1](rom); } + if (HttpSameStr(pName, "rom2")) { char rom[8]; DeviceParseAddress(pValue, rom); DS18B20RomSetters[2](rom); } + if (HttpSameStr(pName, "rom3")) { char rom[8]; DeviceParseAddress(pValue, rom); DS18B20RomSetters[3](rom); } + + if (HttpSameStr(pName, "onewiretrace" )) ChgTraceOneWire(); + } +}