1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-13 02:22:55 +03:00
Files
esp8266/libraries/ESP8266HTTPUpdateServer/src/ESP8266HTTPUpdateServer.h
Ivan Grokhotkov ace0622e46 ESP8266HTTPUpdateServer: fix responses after uploading
- fix response not being delivered to the browser after upload is done
  (https://github.com/esp8266/Arduino/issues/2221)

- if Update.begin fails, don’t attempt to write data

- if update is not successful, send error message from Update to the
  client

- move strings into PROGMEM
2017-05-10 09:49:47 -05:00

42 lines
861 B
C++

#ifndef __HTTP_UPDATE_SERVER_H
#define __HTTP_UPDATE_SERVER_H
class ESP8266WebServer;
class ESP8266HTTPUpdateServer
{
public:
ESP8266HTTPUpdateServer(bool serial_debug=false);
void setup(ESP8266WebServer *server)
{
setup(server, NULL, NULL);
}
void setup(ESP8266WebServer *server, const char * path)
{
setup(server, path, NULL, NULL);
}
void setup(ESP8266WebServer *server, const char * username, const char * password)
{
setup(server, "/update", username, password);
}
void setup(ESP8266WebServer *server, const char * path, const char * username, const char * password);
protected:
void _setUpdaterError();
private:
bool _serial_output;
ESP8266WebServer *_server;
char * _username;
char * _password;
bool _authenticated;
String _updaterError;
};
#endif