Andrew Boyson / Mbed 2 deprecated heating

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

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     HttpAddInt16AsHex(BoilerGetTankDS18B20Value()  ); HttpAddChar('\n');
00017     
00018     int byte = 0;
00019     if (ProgramTimerOutput            ) byte |= 0x01;
00020     if (RadiatorGetWinter()           ) byte |= 0x02;
00021     if (RadiatorGetOverride()         ) byte |= 0x04;
00022     if (RadiatorPump                  ) byte |= 0x08;
00023     if (RadiatorGetHotWaterProtectOn()) byte |= 0x10;
00024     if (RadiatorsOn                   ) byte |= 0x20;
00025     HttpAddByteAsHex(byte);    HttpAddChar('\n');
00026     
00027     HttpAddByteAsHex (RadiatorGetOverrideCancelHour()  ); HttpAddChar('\n');
00028     HttpAddByteAsHex (RadiatorGetOverrideCancelMinute()); HttpAddChar('\n');
00029     HttpAddInt16AsHex(RadiatorGetNightTemperature()    ); HttpAddChar('\n');
00030     HttpAddInt16AsHex(RadiatorGetFrostTemperature()    ); HttpAddChar('\n');
00031     HttpAddByteAsHex (RadiatorGetHotWaterProtectTemp() ); HttpAddChar('\n');
00032 }
00033