Andrew Boyson / web

Dependents:   oldheating gps motorhome heating

firmware/web-firmware-ajax.c

Committer:
andrewboyson
Date:
2019-04-27
Revision:
103:91194cc19bbb

File content as of revision 103:91194cc19bbb:

#include   <stdio.h>

#include "http.h"
#include "web-base.h"
#include "firmware.h"
#include "web-firmware.h"

void WebFirmwareAjax()
{
    //Header
    HttpOk("text/plain; charset=UTF-8", "no-cache", NULL, NULL);
    
    //Upload status
    if (FirmwareSentLength == FirmwareFileLength)
    {
        HttpAddText("Length ok\r\n");
    }
    else
    {
        HttpAddText("Length error\r\n");
        HttpAddF   ("  sent %6d\r\n", FirmwareSentLength);
        HttpAddF   ("  rcvd %6d\r\n", FirmwareRcvdLength);
        HttpAddF   ("  file %6d\r\n", FirmwareFileLength);
    }
    
    //Save status
    if (FirmwareFailed)
    {
        HttpAddText("Save failed - see log");
    }
    else
    {
        HttpAddText("Saved  ok");
    }
    
    //Delimiter
    HttpAddChar('\f');
    
    //New directory list
    WebFirmwareListSemihostFiles();
}