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-radiator-ajax.c Source File

web-radiator-ajax.c

00001 #include  <stdint.h>
00002 #include   <stdio.h>
00003 
00004 #include "http.h"
00005 #include "boiler.h"
00006 #include "radiator.h"
00007 #include "ds18b20.h"
00008 #include "program.h"
00009 #include "1-wire-device.h"
00010 
00011 void WebRadiatorAjax()
00012 {
00013     HttpOk("text/plain; charset=UTF-8", "no-cache", NULL, NULL);
00014                         
00015     HttpAddInt16AsHex(RadiatorGetHallDS18B20Value()); HttpAddChar('\n');
00016     
00017     int nibble = 0;
00018     if (ProgramTimerOutput   ) nibble |= 0x01;
00019     if (RadiatorGetWinter()  ) nibble |= 0x02;
00020     if (RadiatorGetOverride()) nibble |= 0x04;
00021     if (RadiatorPump         ) nibble |= 0x08;
00022     HttpAddNibbleAsHex (nibble); HttpAddChar('\n');
00023     
00024     HttpAddByteAsHex (RadiatorGetOverrideCancelHour()  ); HttpAddChar('\n');
00025     HttpAddByteAsHex (RadiatorGetOverrideCancelMinute()); HttpAddChar('\n');
00026     HttpAddInt16AsHex(RadiatorGetNightTemperature()    ); HttpAddChar('\n');
00027     HttpAddInt16AsHex(RadiatorGetFrostTemperature()    ); HttpAddChar('\n');
00028 }
00029