Andrew Boyson / web

Dependents:   oldheating gps motorhome heating

fault/http-fault-html.c

Committer:
andrewboyson
Date:
2019-03-08
Revision:
58:e5ab14ef6ea6
Parent:
56:f6e814fe0159
Child:
59:309e78f243dd

File content as of revision 58:e5ab14ef6ea6:

#include <stdio.h>

#include         "http.h"
#include         "page.h"
#include "page-derived.h"
#include  "http-server.h"
#include        "fault.h"

void HttpFaultHtml()
{
    HttpOk("text/html; charset=UTF-8", "no-cache", NULL, NULL);
    PageAddHeader(PageSite, "Fault", "settings.css", NULL);
    PageAddNav(FAULT_PAGE);
    PageAddH1(PageSite, "Fault");
    
    PageAddH2("Last fault");
    int faultType = FaultTypeGet();
    char text[20];
    FaultTypeToString(faultType, sizeof(text), text);
    PageAddLabelledValue("Fault type", 17, text);
    if (faultType)
    {
        FaultZoneToString(FaultZoneGet(), sizeof(text), text);
        PageAddLabelledValue("Fault zone", 17, text);
        PageAddLabelledInt("After point", 17, FaultPointGet());
        PageAddInputButton(0, "Clear fault", "clear", "/fault", "faultclear");
    }
    else
    {
        PageAddInputButton(0, "Test fault",  "test",  "/fault", "faulttest");
    }
    
    PageAddEnd();
}