-credentials.h
-*.txt
+credentials.h\r
+*.txt\r
.vscode
\ No newline at end of file
-#include "include/bmp.h"
-#include "include/sd_card.h"
-
-BMP::BMP(const char* filename) :
- bmp_file{SD_card_fs::get_file(filename)},
- data_idx{0}
-{
-
- bmp_file->seek(10); // idx of 4 bytes representing start of image data
-
- data_idx = bmp_file->read();
-
- for(uint8_t i{0}; i < 3; i++)
- {
- data_idx << 8;
- data_idx |= bmp_file->read();
- }
-
- bmp_file->seek(data_idx);
-}
-
-char BMP::read_pixel()
-{
- return bmp_file->read();
-}
-
-void BMP::read_pixel(const char* buffer, const uint32_t len)
-{
- bmp_file->read((uint8_t*)buffer, len);
-}
-
-uint32_t BMP::position() const
-{
- return bmp_file->position();
-}
-
-uint32_t BMP::available() const
-{
- return bmp_file->available();
-}
-
-void BMP::seek(const uint32_t pos)
-{
- if (pos < data_idx) bmp_file->seek(data_idx);
- else bmp_file->seek(pos);
-}
+#include "include/bmp.h"\r
+#include "include/sd_card.h"\r
+\r
+BMP::BMP(const char* filename) : \r
+ bmp_file{SD_card_fs::get_file(filename)},\r
+ data_idx{0}\r
+{\r
+\r
+ bmp_file->seek(10); // idx of 4 bytes representing start of image data\r
+\r
+ data_idx = bmp_file->read();\r
+\r
+ for(uint8_t i{0}; i < 3; i++)\r
+ {\r
+ data_idx << 8;\r
+ data_idx |= bmp_file->read();\r
+ }\r
+ \r
+ bmp_file->seek(data_idx);\r
+}\r
+\r
+char BMP::read_pixel()\r
+{\r
+ return bmp_file->read();\r
+}\r
+\r
+void BMP::read_pixel(const char* buffer, const uint32_t len)\r
+{\r
+ bmp_file->read((uint8_t*)buffer, len);\r
+}\r
+\r
+uint32_t BMP::position() const\r
+{\r
+ return bmp_file->position();\r
+}\r
+\r
+uint32_t BMP::available() const\r
+{\r
+ return bmp_file->available();\r
+}\r
+\r
+void BMP::seek(const uint32_t pos)\r
+{\r
+ if (pos < data_idx) bmp_file->seek(data_idx);\r
+ else bmp_file->seek(pos);\r
+}\r
-#include "include/sd_card.h"
-#include "include/bmp.h"
-#include "include/web_server.h"
-
-/**
- * @file e-paper-project.ino
- * @author Nils Forssén (nilsforssen.se)
- * @brief
- * Project-sketch to fetch images from an web-server, process them (scaling and dithering)
- * and then display them on an E-paper-display (SPI). Should switch image every 24 hours
- * and go to sleep in between. Should support adding, removing and listing images on SD-card
- * via a webserver as long as a physical switch is set high. When switched low, the
- * device go back to the daily sleep->image->sleep cycle.
- *
- * @version 1.0
- * @date 2023-12-13
- *
- * @copyright Copyright (c) 2023
- */
-
-
-/**
- * Connect the SPI bus to SD-card and E-paper
- * MOSI - GPIO 23
- * MISO - GPIO 19
- * SCLK - GPIO 18
- * CS - [SD to GPIO 5] or [E-paper to GPIO 17]
-*/
-
-void setup(){
- Serial.begin(115200);
-
- SD_card_fs::init_SD(5);
- Web_server::init_wifi();
- Web_server::init_server();
-}
-
-void loop()
-{
- Web_server::handle_client();
+#include "include/sd_card.h"\r
+#include "include/bmp.h"\r
+#include "include/web_server.h"\r
+\r
+/**\r
+ * @file e-paper-project.ino\r
+ * @author Nils Forssén (nilsforssen.se)\r
+ * @brief\r
+ * Project-sketch to fetch images from an web-server, process them (scaling and dithering)\r
+ * and then display them on an E-paper-display (SPI). Should switch image every 24 hours \r
+ * and go to sleep in between. Should support adding, removing and listing images on SD-card\r
+ * via a webserver as long as a physical switch is set high. When switched low, the \r
+ * device go back to the daily sleep->image->sleep cycle.\r
+ * \r
+ * @version 1.0\r
+ * @date 2023-12-13\r
+ * \r
+ * @copyright Copyright (c) 2023\r
+ */\r
+\r
+\r
+/**\r
+ * Connect the SPI bus to SD-card and E-paper\r
+ * MOSI - GPIO 23\r
+ * MISO - GPIO 19\r
+ * SCLK - GPIO 18\r
+ * CS - [SD to GPIO 5] or [E-paper to GPIO 17]\r
+*/\r
+\r
+void setup(){\r
+ Serial.begin(115200);\r
+ \r
+ SD_card_fs::init_SD(5);\r
+ Web_server::init_wifi();\r
+ Web_server::init_server();\r
+}\r
+\r
+void loop()\r
+{ \r
+ Web_server::handle_client();\r
}
\ No newline at end of file
-#include "include/epd_spi.h"
-#include "include/bmp.h"
-
-EPD_SPI_interface::EPD_SPI_interface(const epd_spi_pinout& p) : pinout{p}
-{
- // init SPI pins
- pinMode(pinout.pin_busy, INPUT);
- pinMode(pinout.pin_rst, OUTPUT);
- pinMode(pinout.pin_dc, OUTPUT);
- pinMode(pinout.pin_clk, OUTPUT);
- pinMode(pinout.pin_din, OUTPUT);
- pinMode(pinout.pin_cs, OUTPUT);
-
- digitalWrite(pinout.pin_cs , HIGH);
- digitalWrite(pinout.pin_clk, LOW);
-
- // init EPD
- digitalWrite(pinout.pin_rst, HIGH);
- delay(200);
- digitalWrite(pinout.pin_rst, LOW);
- delay(5);
- digitalWrite(pinout.pin_rst, HIGH);
- delay(200);
-
- // send init-data
- waitfor_busyhigh();
- send_command(0x00);
- send_byte(0xEF);
- send_byte(0x08);
- send_command(0x01);
- send_byte(0x37);
- send_byte(0x00);
- send_byte(0x23);
- send_byte(0x23);
- send_command(0x03);
- send_byte(0x00);
- send_command(0x06);
- send_byte(0xC7);
- send_byte(0xC7);
- send_byte(0x1D);
- send_command(0x30);
- send_byte(0x3C);
- send_command(0x41);
- send_byte(0x00);
- send_command(0x50);
- send_byte(0x37);
- send_command(0x60);
- send_byte(0x22);
- send_command(0x61);
- send_byte(0x02);
- send_byte(0x58);
- send_byte(0x01);
- send_byte(0xC0);
- send_command(0xE3);
- send_byte(0xAA);
- delay(100);
- send_command(0x50);
- send_byte(0x37);
- send_command(0x61);
- send_byte(0x02);
- send_byte(0x58);
- send_byte(0x01);
- send_byte(0xC0);
- send_command(0x10);
-}
-
-void EPD_SPI_interface::send_byte(byte data)
-{
- digitalWrite(pinout.pin_dc, HIGH);
- send_spi_data(data);
-}
-
-void EPD_SPI_interface::send_command(byte command)
-{
- digitalWrite(pinout.pin_dc, LOW);
- send_spi_data(command);
-}
-
-void EPD_SPI_interface::show()
-{
- send_command(0x04);
- waitfor_busyhigh();
- send_command(0x12);
- waitfor_busyhigh();
- send_command(0x02);
- waitfor_busylow();
- delay(200);
-}
-
-void EPD_SPI_interface::sleep()
-{
- delay(100);
- send_command(0x07);
- send_byte(0xA5);
- delay(100);
- digitalWrite(pinout.pin_rst, LOW);
-}
-
-void EPD_SPI_interface::send_spi_data(byte data)
-{
- digitalWrite(pinout.pin_cs, LOW);
-
- for (int i = 0; i < 8; i++)
- {
- if ((data & 0x80))
- {
- digitalWrite(pinout.pin_din, HIGH);
- }
- else
- {
- digitalWrite(pinout.pin_din, LOW);
- }
-
- data <<= 1;
- digitalWrite(pinout.pin_clk, HIGH);
- digitalWrite(pinout.pin_clk, LOW);
- }
-
- digitalWrite(pinout.pin_cs, HIGH);
-}
-
-void EPD_SPI_interface::waitfor_busyhigh() const
-{
- while(!(digitalRead(pinout.pin_busy)));
-}
-
-void EPD_SPI_interface::waitfor_busylow() const
-{
- while(digitalRead(pinout.pin_busy));
-}
-
-void EPD_SPI_interface::display(std::unique_ptr<BMP> bmp)
-{
- bmp->seek(0);
- for (uint32_t i{0}; i < EPD_HEIGHT; i++)
- {
- for (uint32_t j{0}; j < EPD_WIDTH / 2; i++) // Every byte is 2 pixels
- {
- send_byte(bmp->read_pixel());
- }
- }
- show();
-}
-
-void EPD_SPI_interface::fill(color c)
-{
- for (uint32_t i{0}; i < EPD_HEIGHT; i++)
- {
- for (uint32_t j{0}; j < EPD_WIDTH / 2; i++) // Every byte is 2 pixels
- {
- send_byte((c << 4)|c);
- }
- }
- show();
+#include "include/epd_spi.h"\r
+#include "include/bmp.h"\r
+\r
+EPD_SPI_interface::EPD_SPI_interface(const epd_spi_pinout& p) : pinout{p}\r
+{\r
+ // init SPI pins\r
+ pinMode(pinout.pin_busy, INPUT);\r
+ pinMode(pinout.pin_rst, OUTPUT);\r
+ pinMode(pinout.pin_dc, OUTPUT);\r
+ pinMode(pinout.pin_clk, OUTPUT);\r
+ pinMode(pinout.pin_din, OUTPUT);\r
+ pinMode(pinout.pin_cs, OUTPUT);\r
+\r
+ digitalWrite(pinout.pin_cs , HIGH);\r
+ digitalWrite(pinout.pin_clk, LOW);\r
+\r
+ // init EPD\r
+ digitalWrite(pinout.pin_rst, HIGH); \r
+ delay(200); \r
+ digitalWrite(pinout.pin_rst, LOW); \r
+ delay(5);\r
+ digitalWrite(pinout.pin_rst, HIGH); \r
+ delay(200); \r
+\r
+ // send init-data\r
+ waitfor_busyhigh();\r
+ send_command(0x00);\r
+ send_byte(0xEF);\r
+ send_byte(0x08);\r
+ send_command(0x01);\r
+ send_byte(0x37);\r
+ send_byte(0x00);\r
+ send_byte(0x23);\r
+ send_byte(0x23);\r
+ send_command(0x03);\r
+ send_byte(0x00);\r
+ send_command(0x06);\r
+ send_byte(0xC7);\r
+ send_byte(0xC7);\r
+ send_byte(0x1D);\r
+ send_command(0x30);\r
+ send_byte(0x3C);\r
+ send_command(0x41);\r
+ send_byte(0x00);\r
+ send_command(0x50);\r
+ send_byte(0x37);\r
+ send_command(0x60);\r
+ send_byte(0x22);\r
+ send_command(0x61);\r
+ send_byte(0x02);\r
+ send_byte(0x58);\r
+ send_byte(0x01);\r
+ send_byte(0xC0);\r
+ send_command(0xE3);\r
+ send_byte(0xAA);\r
+ delay(100);\r
+ send_command(0x50);\r
+ send_byte(0x37);\r
+ send_command(0x61);\r
+ send_byte(0x02);\r
+ send_byte(0x58);\r
+ send_byte(0x01);\r
+ send_byte(0xC0);\r
+ send_command(0x10);\r
+}\r
+\r
+void EPD_SPI_interface::send_byte(byte data) \r
+{\r
+ digitalWrite(pinout.pin_dc, HIGH);\r
+ send_spi_data(data);\r
+}\r
+\r
+void EPD_SPI_interface::send_command(byte command)\r
+{\r
+ digitalWrite(pinout.pin_dc, LOW);\r
+ send_spi_data(command);\r
+}\r
+\r
+void EPD_SPI_interface::show()\r
+{\r
+ send_command(0x04);\r
+ waitfor_busyhigh();\r
+ send_command(0x12);\r
+ waitfor_busyhigh();\r
+ send_command(0x02);\r
+ waitfor_busylow();\r
+ delay(200); \r
+}\r
+\r
+void EPD_SPI_interface::sleep()\r
+{\r
+ delay(100);\r
+ send_command(0x07);\r
+ send_byte(0xA5);\r
+ delay(100);\r
+ digitalWrite(pinout.pin_rst, LOW);\r
+}\r
+\r
+void EPD_SPI_interface::send_spi_data(byte data)\r
+{\r
+ digitalWrite(pinout.pin_cs, LOW);\r
+\r
+ for (int i = 0; i < 8; i++)\r
+ {\r
+ if ((data & 0x80))\r
+ {\r
+ digitalWrite(pinout.pin_din, HIGH); \r
+ }\r
+ else\r
+ {\r
+ digitalWrite(pinout.pin_din, LOW);\r
+ } \r
+\r
+ data <<= 1;\r
+ digitalWrite(pinout.pin_clk, HIGH);\r
+ digitalWrite(pinout.pin_clk, LOW);\r
+ }\r
+ \r
+ digitalWrite(pinout.pin_cs, HIGH);\r
+}\r
+\r
+void EPD_SPI_interface::waitfor_busyhigh() const\r
+{\r
+ while(!(digitalRead(pinout.pin_busy)));\r
+}\r
+\r
+void EPD_SPI_interface::waitfor_busylow() const\r
+{\r
+ while(digitalRead(pinout.pin_busy));\r
+}\r
+\r
+void EPD_SPI_interface::display(std::unique_ptr<BMP> bmp)\r
+{\r
+ bmp->seek(0);\r
+ for (uint32_t i{0}; i < EPD_HEIGHT; i++)\r
+ {\r
+ for (uint32_t j{0}; j < EPD_WIDTH / 2; i++) // Every byte is 2 pixels\r
+ {\r
+ send_byte(bmp->read_pixel());\r
+ }\r
+ }\r
+ show();\r
+}\r
+\r
+void EPD_SPI_interface::fill(color c)\r
+{\r
+ for (uint32_t i{0}; i < EPD_HEIGHT; i++)\r
+ {\r
+ for (uint32_t j{0}; j < EPD_WIDTH / 2; i++) // Every byte is 2 pixels\r
+ {\r
+ send_byte((c << 4)|c);\r
+ }\r
+ }\r
+ show();\r
}
\ No newline at end of file
-#ifndef BMP_H_
-#define BMP_H_
-
-/**
- * @file sd_card.h
- * @author Nils Forssén (nilsforssen.se)
- * @brief
- * Useful filesystem functions for interacting with an SD-card
- *
- * @version 0.1
- * @date 2023-12-13
- *
- * @copyright Copyright (c) 2023
- */
-
-#include <SD.h>
-#include <string>
-
-class BMP
-{
-public:
- BMP(const char* filename);
- ~BMP() = default; // Smart pointer closes itself!
-
- char read_pixel();
- void read_pixel(const char* buffer, const uint32_t len);
- uint32_t position() const;
- uint32_t available() const;
- void seek(const uint32_t pos);
-
-protected:
-private:
- std::unique_ptr<File> bmp_file;
- uint32_t data_idx;
-};
-
-
+#ifndef BMP_H_\r
+#define BMP_H_\r
+\r
+/**\r
+ * @file sd_card.h\r
+ * @author Nils Forssén (nilsforssen.se)\r
+ * @brief\r
+ * Useful filesystem functions for interacting with an SD-card\r
+ * \r
+ * @version 0.1\r
+ * @date 2023-12-13\r
+ * \r
+ * @copyright Copyright (c) 2023\r
+ */\r
+\r
+#include <SD.h>\r
+#include <string>\r
+\r
+class BMP\r
+{\r
+public:\r
+ BMP(const char* filename);\r
+ ~BMP() = default; // Smart pointer closes itself!\r
+\r
+ char read_pixel();\r
+ void read_pixel(const char* buffer, const uint32_t len);\r
+ uint32_t position() const;\r
+ uint32_t available() const;\r
+ void seek(const uint32_t pos);\r
+\r
+protected:\r
+private:\r
+ std::unique_ptr<File> bmp_file;\r
+ uint32_t data_idx;\r
+};\r
+\r
+\r
#endif
\ No newline at end of file
-#ifndef SIMPLE_SPI_H_
-#define SIMPLE_SPI_H_
-
-#include <Arduino.h>
-#include <memory>
-
-#define EPD_WIDTH 600
-#define EPD_HEIGHT 448
-
-enum color: byte
-{
- EPD_5IN65F_BLACK, /// 000
- EPD_5IN65F_WHITE, /// 001
- EPD_5IN65F_GREEN, /// 010
- EPD_5IN65F_BLUE, /// 011
- EPD_5IN65F_RED, /// 100
- EPD_5IN65F_YELLOW, /// 101
- EPD_5IN65F_ORANGE /// 110
-};
-
-struct epd_spi_pinout
-{
- const uint8_t pin_busy;
- const uint8_t pin_rst;
- const uint8_t pin_dc;
- const uint8_t pin_cs;
- const uint8_t pin_clk;
- const uint8_t pin_din;
-};
-
-class BMP;
-
-class EPD_SPI_interface
-{
-public:
- EPD_SPI_interface(const epd_spi_pinout& p);
- ~EPD_SPI_interface() = default;
-
- void send_byte(byte data);
- void send_command(byte command);
- void display(std::unique_ptr<BMP> bmp);
- void fill(color c);
-
- void show();
- void sleep();
-protected:
-private:
- void send_spi_data(byte data);
- void waitfor_busyhigh() const;
- void waitfor_busylow() const;
-
- const epd_spi_pinout pinout;
-};
-
-#endif
+#ifndef SIMPLE_SPI_H_\r
+#define SIMPLE_SPI_H_\r
+\r
+#include <Arduino.h>\r
+#include <memory>\r
+\r
+#define EPD_WIDTH 600\r
+#define EPD_HEIGHT 448\r
+\r
+enum color: byte\r
+{ \r
+ EPD_5IN65F_BLACK, /// 000\r
+ EPD_5IN65F_WHITE, /// 001\r
+ EPD_5IN65F_GREEN, /// 010\r
+ EPD_5IN65F_BLUE, /// 011\r
+ EPD_5IN65F_RED, /// 100\r
+ EPD_5IN65F_YELLOW, /// 101\r
+ EPD_5IN65F_ORANGE /// 110\r
+};\r
+\r
+struct epd_spi_pinout\r
+{\r
+ const uint8_t pin_busy;\r
+ const uint8_t pin_rst;\r
+ const uint8_t pin_dc;\r
+ const uint8_t pin_cs;\r
+ const uint8_t pin_clk;\r
+ const uint8_t pin_din;\r
+};\r
+\r
+class BMP;\r
+\r
+class EPD_SPI_interface\r
+{\r
+public:\r
+ EPD_SPI_interface(const epd_spi_pinout& p);\r
+ ~EPD_SPI_interface() = default;\r
+\r
+ void send_byte(byte data);\r
+ void send_command(byte command);\r
+ void display(std::unique_ptr<BMP> bmp);\r
+ void fill(color c);\r
+\r
+ void show();\r
+ void sleep();\r
+protected:\r
+private:\r
+ void send_spi_data(byte data);\r
+ void waitfor_busyhigh() const;\r
+ void waitfor_busylow() const;\r
+\r
+ const epd_spi_pinout pinout;\r
+};\r
+\r
+#endif\r
-#ifndef SD_CARD_H_
-#define SD_CARD_H_
-
-/**
- * @file sd_card.h
- * @author Nils Forssén (nilsforssen.se)
- * @brief
- * Useful filesystem functions for interacting with an SD-card
- *
- * @date 2023-12-13
- *
- * @copyright Copyright (c) 2023
- */
-
-#include <memory>
-#include <SD.h>
-
-typedef enum : uint8_t
-{
- FS_OK = 0,
- FS_FAIL = 1,
- FS_WARNING = 2,
-} fs_error_t;
-
-namespace SD_card_fs
-{
- fs_error_t init_SD(const uint16_t cs);
- fs_error_t create_dir(const char* path);
- fs_error_t remove_dir(const char* path);
- std::unique_ptr<File> get_file(const char* path);
- fs_error_t write_to_file(const char* path, const uint8_t* data, uint32_t len); // Make sure data is null-terminated
- fs_error_t close_file();
- fs_error_t open_file(const char* path);
- fs_error_t append_to_file(const uint8_t* data, uint32_t len); // Make sure data is null-terminated
- fs_error_t rename_file(const char* path1, const char* path2);
- fs_error_t delete_file(const char* path);
-};
-
-
+#ifndef SD_CARD_H_\r
+#define SD_CARD_H_\r
+\r
+/**\r
+ * @file sd_card.h\r
+ * @author Nils Forssén (nilsforssen.se)\r
+ * @brief\r
+ * Useful filesystem functions for interacting with an SD-card\r
+ * \r
+ * @date 2023-12-13\r
+ * \r
+ * @copyright Copyright (c) 2023\r
+ */\r
+\r
+#include <memory>\r
+#include <SD.h>\r
+\r
+typedef enum : uint8_t\r
+{\r
+ FS_OK = 0,\r
+ FS_FAIL = 1,\r
+ FS_WARNING = 2,\r
+} fs_error_t;\r
+\r
+namespace SD_card_fs\r
+{\r
+ fs_error_t init_SD(const uint16_t cs);\r
+ fs_error_t create_dir(const char* path);\r
+ fs_error_t remove_dir(const char* path);\r
+ std::unique_ptr<File> get_file(const char* path);\r
+ fs_error_t write_to_file(const char* path, const uint8_t* data, uint32_t len); // Make sure data is null-terminated\r
+ fs_error_t close_file();\r
+ fs_error_t open_file(const char* path);\r
+ fs_error_t append_to_file(const uint8_t* data, uint32_t len); // Make sure data is null-terminated\r
+ fs_error_t rename_file(const char* path1, const char* path2);\r
+ fs_error_t delete_file(const char* path);\r
+};\r
+\r
+\r
#endif
\ No newline at end of file
-#ifndef WEB_HTML_H_
-#define WEB_HTML_H_
-
-/**
- * @file web_HTML.h
- * @author Nils Forssén (nilsforssen.se)
- * @brief
- * web-server functionality based on https://github.com/G6EJD/ESP32-ESP8266-File-Download-Upload-Delete-Stream-and-Directory/tree/master
- *
- * @date 2023-12-14
- *
- * @copyright Copyright (c) 2023
- */
-
-namespace HTML_data
-{
- const char home_page_str[] PROGMEM = "<a href='/upload'><button>Upload</button></a><a href='/dir'><button>Directory</button></a>";
-
- const char file_upload_str[] PROGMEM = "<h3>Select File to Upload</h3><FORM action='/fupload' method='post' enctype='multipart/form-data'><input class='buttons' style='width:40%' type='file' name='fupload' id = 'fupload' value=''><br><br><button class='buttons' style='width:10%' type='submit'>Upload File</button><br><a href='/'>[Back]</a><br><br>";
-
- const char upload_finished_str[] PROGMEM = "<h3>File was successfully uploaded</h3>";
-
- const char dir_page_str[] PROGMEM = "<h3 class='rcorners_m'>SD Card Contents</h3><br><table align='center'><tr><th>Name/Type</th><th style='width:20%'>Type File/Dir</th><th>File Size</th></tr>";
-
- const char append_page_header[] PROGMEM = "<!DOCTYPE html><html><head><title>File Server</title><meta name='viewport' content='user-scalable=yes,initial-scale=1.0,width=device-width'><style>body{max-width:65%;margin:0 auto;font-family:arial;font-size:105%;text-align:center;color:blue;background-color:#F7F2Fd;}ul{list-style-type:none;margin:0.1em;padding:0;border-radius:0.375em;overflow:hidden;background-color:#dcade6;font-size:1em;}li{float:left;border-radius:0.375em;border-right:0.06em solid #bbb;}last-child {border-right:none;font-size:85%}li a{display: block;border-radius:0.375em;padding:0.44em 0.44em;text-decoration:none;font-size:85%}li a:hover{background-color:#EAE3EA;border-radius:0.375em;font-size:85%}section {font-size:0.88em;}h1{color:white;border-radius:0.5em;font-size:1em;padding:0.2em 0.2em;background:#558ED5;}h2{color:orange;font-size:1.0em;}h3{font-size:0.8em;}table{font-family:arial,sans-serif;font-size:0.9em;border-collapse:collapse;width:85%;} th,td {border:0.06em solid #dddddd;text-align:left;padding:0.3em;border-bottom:0.06em solid #dddddd;} tr:nth-child(odd) {background-color:#eeeeee;}.rcorners_n {border-radius:0.5em;background:#558ED5;padding:0.3em 0.3em;width:20%;color:white;font-size:75%;}.rcorners_m {border-radius:0.5em;background:#558ED5;padding:0.3em 0.3em;width:50%;color:white;font-size:75%;}.rcorners_w {border-radius:0.5em;background:#558ED5;padding:0.3em 0.3em;width:70%;color:white;font-size:75%;}.column{float:left;width:50%;height:45%;}.row:after{content:'';display:table;clear:both;}*{box-sizing:border-box;}footer{background-color:#eedfff; text-align:center;padding:0.3em 0.3em;border-radius:0.375em;font-size:60%;}button{border-radius:0.5em;background:#558ED5;padding:0.3em 0.3em;width:20%;color:white;font-size:130%;}.buttons {border-radius:0.5em;background:#558ED5;padding:0.3em 0.3em;width:15%;color:white;font-size:80%;}.buttonsm{border-radius:0.5em;background:#558ED5;padding:0.3em 0.3em;width:9%; color:white;font-size:70%;}.buttonm {border-radius:0.5em;background:#558ED5;padding:0.3em 0.3em;width:15%;color:white;font-size:70%;}.buttonw {border-radius:0.5em;background:#558ED5;padding:0.3em 0.3em;width:40%;color:white;font-size:70%;}a{font-size:75%;}p{font-size:75%;}</style></head><body><h1>File Server</h1>";
-
- const char append_page_footer[] PROGMEM = "<ul><li><a href='/'>Home</a></li><li><a href='/upload'>Upload</a></li><li><a href='/dir'>Directory</a></li></ul></body></html>";
-};
-
-
+#ifndef WEB_HTML_H_\r
+#define WEB_HTML_H_\r
+\r
+/**\r
+ * @file web_HTML.h\r
+ * @author Nils Forssén (nilsforssen.se)\r
+ * @brief\r
+ * web-server functionality based on https://github.com/G6EJD/ESP32-ESP8266-File-Download-Upload-Delete-Stream-and-Directory/tree/master\r
+ * \r
+ * @date 2023-12-14\r
+ * \r
+ * @copyright Copyright (c) 2023\r
+ */\r
+\r
+namespace HTML_data\r
+{\r
+ const char home_page_str[] PROGMEM = "<a href='/upload'><button>Upload</button></a><a href='/dir'><button>Directory</button></a>";\r
+ \r
+ const char file_upload_str[] PROGMEM = "<h3>Select File to Upload</h3><FORM action='/fupload' method='post' enctype='multipart/form-data'><input class='buttons' style='width:40%' type='file' name='fupload' id = 'fupload' value=''><br><br><button class='buttons' style='width:10%' type='submit'>Upload File</button><br><a href='/'>[Back]</a><br><br>";\r
+ \r
+ const char upload_finished_str[] PROGMEM = "<h3>File was successfully uploaded</h3>";\r
+\r
+ const char dir_page_str[] PROGMEM = "<h3 class='rcorners_m'>SD Card Contents</h3><br><table align='center'><tr><th>Name/Type</th><th style='width:20%'>Type File/Dir</th><th>File Size</th></tr>";\r
+\r
+ const char append_page_header[] PROGMEM = "<!DOCTYPE html><html><head><title>File Server</title><meta name='viewport' content='user-scalable=yes,initial-scale=1.0,width=device-width'><style>body{max-width:65%;margin:0 auto;font-family:arial;font-size:105%;text-align:center;color:blue;background-color:#F7F2Fd;}ul{list-style-type:none;margin:0.1em;padding:0;border-radius:0.375em;overflow:hidden;background-color:#dcade6;font-size:1em;}li{float:left;border-radius:0.375em;border-right:0.06em solid #bbb;}last-child {border-right:none;font-size:85%}li a{display: block;border-radius:0.375em;padding:0.44em 0.44em;text-decoration:none;font-size:85%}li a:hover{background-color:#EAE3EA;border-radius:0.375em;font-size:85%}section {font-size:0.88em;}h1{color:white;border-radius:0.5em;font-size:1em;padding:0.2em 0.2em;background:#558ED5;}h2{color:orange;font-size:1.0em;}h3{font-size:0.8em;}table{font-family:arial,sans-serif;font-size:0.9em;border-collapse:collapse;width:85%;} th,td {border:0.06em solid #dddddd;text-align:left;padding:0.3em;border-bottom:0.06em solid #dddddd;} tr:nth-child(odd) {background-color:#eeeeee;}.rcorners_n {border-radius:0.5em;background:#558ED5;padding:0.3em 0.3em;width:20%;color:white;font-size:75%;}.rcorners_m {border-radius:0.5em;background:#558ED5;padding:0.3em 0.3em;width:50%;color:white;font-size:75%;}.rcorners_w {border-radius:0.5em;background:#558ED5;padding:0.3em 0.3em;width:70%;color:white;font-size:75%;}.column{float:left;width:50%;height:45%;}.row:after{content:'';display:table;clear:both;}*{box-sizing:border-box;}footer{background-color:#eedfff; text-align:center;padding:0.3em 0.3em;border-radius:0.375em;font-size:60%;}button{border-radius:0.5em;background:#558ED5;padding:0.3em 0.3em;width:20%;color:white;font-size:130%;}.buttons {border-radius:0.5em;background:#558ED5;padding:0.3em 0.3em;width:15%;color:white;font-size:80%;}.buttonsm{border-radius:0.5em;background:#558ED5;padding:0.3em 0.3em;width:9%; color:white;font-size:70%;}.buttonm {border-radius:0.5em;background:#558ED5;padding:0.3em 0.3em;width:15%;color:white;font-size:70%;}.buttonw {border-radius:0.5em;background:#558ED5;padding:0.3em 0.3em;width:40%;color:white;font-size:70%;}a{font-size:75%;}p{font-size:75%;}</style></head><body><h1>File Server</h1>";\r
+\r
+ const char append_page_footer[] PROGMEM = "<ul><li><a href='/'>Home</a></li><li><a href='/upload'>Upload</a></li><li><a href='/dir'>Directory</a></li></ul></body></html>";\r
+};\r
+\r
+\r
#endif
\ No newline at end of file
-#ifndef WEB_SERVER_H_
-#define WEB_SERVER_H_
-
-/**
- * @file web_server.h
- * @author Nils Forssén (nilsforssen.se)
- * @brief
- * web-server functionality based on https://github.com/G6EJD/ESP32-ESP8266-File-Download-Upload-Delete-Stream-and-Directory/tree/master
- *
- * @date 2023-12-14
- *
- * @copyright Copyright (c) 2023
- */
-
-#ifdef ESP8266
- #include <ESP8266WebServer.h>
- #include <ESP8266WiFi.h>
- #include <ESP8266WiFiMulti.h>
-#else
- #include <ESP32WebServer.h>
- #include <WiFi.h>
-#endif
-
-#include "credentials.h"
-
-#define SERVER_PORT 80
-
-namespace Web_server
-{
- void init_wifi();
- void init_server();
- void handle_client();
-};
-
+#ifndef WEB_SERVER_H_\r
+#define WEB_SERVER_H_\r
+\r
+/**\r
+ * @file web_server.h\r
+ * @author Nils Forssén (nilsforssen.se)\r
+ * @brief\r
+ * web-server functionality based on https://github.com/G6EJD/ESP32-ESP8266-File-Download-Upload-Delete-Stream-and-Directory/tree/master\r
+ * \r
+ * @date 2023-12-14\r
+ * \r
+ * @copyright Copyright (c) 2023\r
+ */\r
+\r
+#ifdef ESP8266\r
+ #include <ESP8266WebServer.h>\r
+ #include <ESP8266WiFi.h>\r
+ #include <ESP8266WiFiMulti.h>\r
+#else\r
+ #include <ESP32WebServer.h>\r
+ #include <WiFi.h>\r
+#endif\r
+\r
+#include "credentials.h"\r
+\r
+#define SERVER_PORT 80\r
+\r
+namespace Web_server\r
+{ \r
+ void init_wifi();\r
+ void init_server();\r
+ void handle_client();\r
+};\r
+\r
#endif
\ No newline at end of file
-#include "include/sd_card.h"
-
-static File file;
-namespace SD_card_fs
-{
- fs_error_t init_SD(const uint16_t cs)
- {
- if(!SD.begin(cs)){
- Serial.println("Card Mount Failed");
- return FS_FAIL;
- }
- uint8_t cardType = SD.cardType();
-
- if(cardType == CARD_NONE){
- Serial.println("No SD card attached");
- return FS_FAIL;
- }
-
- Serial.printf("SD card initialized!\nSize: %lluMB\n", SD.cardSize() / (1024 * 1024));
- return FS_OK;
- }
-
- fs_error_t create_dir(const char* path)
- {
- if(SD.mkdir(path)){
- Serial.printf("Created directory: %s\n", path);
- return FS_OK;
- } else {
- Serial.printf("failed to create directory: %s\n", path);
- return FS_FAIL;
- }
- }
-
- fs_error_t remove_dir(const char* path)
- {
- if(SD.rmdir(path)){
- Serial.printf("Removed directory: %s\n", path);
- return FS_OK;
- } else {
- Serial.printf("failed to remove directory: %s\n", path);
- return FS_FAIL;
- }
- }
-
- std::unique_ptr<File> get_file(const char* path)
- {
- File* file = new File{SD.open(path)};
- if(!(*file)){
- Serial.printf("failed to open file: %s\n", path);
- return nullptr;
- }
- return std::unique_ptr<File>{file};
- }
-
- fs_error_t open_file(const char* path)
- {
- file = SD.open(path, FILE_WRITE);
- if(!file){
- Serial.printf("failed to open file: %s\n", path);
- return FS_FAIL;
- }
- return FS_OK;
- }
-
- fs_error_t close_file()
- {
- file.close();
- return FS_OK;
- }
-
- fs_error_t write_to_file(const char* path, const uint8_t* data, uint32_t len)
- {
- open_file(path);
-
- if(file.write(&data[0], len)){
- Serial.printf("File written: %s\n", path);
- close_file();
- return FS_OK;
- } else {
- Serial.printf("Write failed: %s\n", path);
- close_file();
- return FS_FAIL;
- }
- }
-
-
-
- fs_error_t append_to_file(const uint8_t* data, uint32_t len)
- {
- if(file.write(&data[0], len)){
- Serial.printf("Message appended\n");
- return FS_OK;
- } else {
- Serial.printf("Append failed\n");
- return FS_FAIL;
- }
- }
-
- fs_error_t rename_file(const char* path1, const char* path2){
- if (SD.rename(path1, path2)) {
- Serial.printf("File renamed: %s to %s\n", path1, path2);
- return FS_OK;
- } else {
- Serial.printf("Rename failed: %s to %s\n", path1, path2);
- return FS_FAIL;
- }
- }
-
- fs_error_t delete_file(const char* path){
- if(SD.remove(path)){
- Serial.printf("File deleted: %s\n", path);
- return FS_OK;
- } else {
- Serial.printf("Delete failed: %s\n", path);
- return FS_FAIL;
- }
- }
+#include "include/sd_card.h"\r
+\r
+static File file;\r
+namespace SD_card_fs\r
+{\r
+ fs_error_t init_SD(const uint16_t cs)\r
+ {\r
+ if(!SD.begin(cs)){\r
+ Serial.println("Card Mount Failed");\r
+ return FS_FAIL;\r
+ }\r
+ uint8_t cardType = SD.cardType();\r
+\r
+ if(cardType == CARD_NONE){\r
+ Serial.println("No SD card attached");\r
+ return FS_FAIL;\r
+ }\r
+\r
+ Serial.printf("SD card initialized!\nSize: %lluMB\n", SD.cardSize() / (1024 * 1024));\r
+ return FS_OK;\r
+ }\r
+\r
+ fs_error_t create_dir(const char* path)\r
+ {\r
+ if(SD.mkdir(path)){\r
+ Serial.printf("Created directory: %s\n", path);\r
+ return FS_OK;\r
+ } else {\r
+ Serial.printf("failed to create directory: %s\n", path);\r
+ return FS_FAIL;\r
+ }\r
+ }\r
+\r
+ fs_error_t remove_dir(const char* path)\r
+ {\r
+ if(SD.rmdir(path)){\r
+ Serial.printf("Removed directory: %s\n", path);\r
+ return FS_OK;\r
+ } else {\r
+ Serial.printf("failed to remove directory: %s\n", path);\r
+ return FS_FAIL;\r
+ }\r
+ }\r
+\r
+ std::unique_ptr<File> get_file(const char* path)\r
+ {\r
+ File* file = new File{SD.open(path)};\r
+ if(!(*file)){\r
+ Serial.printf("failed to open file: %s\n", path);\r
+ return nullptr;\r
+ }\r
+ return std::unique_ptr<File>{file};\r
+ }\r
+\r
+ fs_error_t open_file(const char* path)\r
+ {\r
+ file = SD.open(path, FILE_WRITE);\r
+ if(!file){\r
+ Serial.printf("failed to open file: %s\n", path);\r
+ return FS_FAIL;\r
+ }\r
+ return FS_OK;\r
+ }\r
+\r
+ fs_error_t close_file()\r
+ {\r
+ file.close();\r
+ return FS_OK;\r
+ }\r
+\r
+ fs_error_t write_to_file(const char* path, const uint8_t* data, uint32_t len)\r
+ {\r
+ open_file(path);\r
+\r
+ if(file.write(&data[0], len)){\r
+ Serial.printf("File written: %s\n", path);\r
+ close_file();\r
+ return FS_OK;\r
+ } else {\r
+ Serial.printf("Write failed: %s\n", path);\r
+ close_file();\r
+ return FS_FAIL;\r
+ }\r
+ }\r
+\r
+\r
+\r
+ fs_error_t append_to_file(const uint8_t* data, uint32_t len)\r
+ {\r
+ if(file.write(&data[0], len)){\r
+ Serial.printf("Message appended\n");\r
+ return FS_OK;\r
+ } else {\r
+ Serial.printf("Append failed\n");\r
+ return FS_FAIL;\r
+ }\r
+ }\r
+\r
+ fs_error_t rename_file(const char* path1, const char* path2){\r
+ if (SD.rename(path1, path2)) {\r
+ Serial.printf("File renamed: %s to %s\n", path1, path2);\r
+ return FS_OK;\r
+ } else {\r
+ Serial.printf("Rename failed: %s to %s\n", path1, path2);\r
+ return FS_FAIL;\r
+ }\r
+ }\r
+\r
+ fs_error_t delete_file(const char* path){\r
+ if(SD.remove(path)){\r
+ Serial.printf("File deleted: %s\n", path);\r
+ return FS_OK;\r
+ } else {\r
+ Serial.printf("Delete failed: %s\n", path);\r
+ return FS_FAIL;\r
+ }\r
+ }\r
}
\ No newline at end of file
-#include "include/web_server.h"
-#include "include/web_HTML.h"
-#include "include/sd_card.h"
-
-#ifdef ESP8266
- static ESP8266WebServer server{SERVER_PORT};
-#else
- static ESP32WebServer server{SERVER_PORT};
-#endif
-
-static void send_HTML_page(const char* webpage)
-{
- server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
- server.sendHeader("Pragma", "no-cache");
- server.sendHeader("Expires", "-1");
- server.setContentLength(CONTENT_LENGTH_UNKNOWN);
- server.send(200, "text/html", ""); // Empty content inhibits Content-length header so we have to close the socket ourselves.
- server.sendContent(HTML_data::append_page_header);
-
- server.sendContent(webpage);
- server.sendContent(HTML_data::append_page_footer);
- server.client().stop();
-}
-
-static void home_page()
-{
- send_HTML_page(HTML_data::home_page_str);
-}
-
-static void dir_page()
-{
- // Only lists files and directories in root "/", no recursion into folders...
-
- std::unique_ptr<File> root = SD_card_fs::get_file("/");
- if (*root)
- {
- root->rewindDirectory();
- String web_content {HTML_data::dir_page_str};
-
- File file = root->openNextFile();
- while (file)
- {
- // Serial.print(String(file.name())+"\t");
- web_content += "<tr><td>" + String(file.name()) + "</td>";
- Serial.print(String(file.isDirectory() ? "Dir " : "File ") + String(file.name()) + "\t");
- web_content += "<td>" + String(file.isDirectory() ? "Dir" : "File") + "</td>";
- int bytes = file.size();
- String fsize = "";
- if (bytes < 1024)
- fsize = String(bytes) + " B";
- else if (bytes < (1024 * 1024))
- fsize = String(bytes / 1024.0, 3) + " KB";
- else if (bytes < (1024 * 1024 * 1024))
- fsize = String(bytes / 1024.0 / 1024.0, 3) + " MB";
- else
- fsize = String(bytes / 1024.0 / 1024.0 / 1024.0, 3) + " GB";
- web_content += "<td>" + fsize + "</td></tr>";
- Serial.println(String(fsize));
-
- file = root->openNextFile();
- }
- web_content += "</table>";
- send_HTML_page(web_content.c_str());
- root->close();
- }
- else
- {
- send_HTML_page("<h3>No Files Found</h3>");
- }
-}
-
-static void file_upload()
-{
- send_HTML_page(HTML_data::file_upload_str);
-}
-
-static void handle_file_upload()
-{
- HTTPUpload &uploadfile = server.upload();
-
- if (uploadfile.status == UPLOAD_FILE_START)
- {
- String filename {uploadfile.filename};
-
- if (!filename.startsWith("/"))
- filename = "/" + filename;
-
- Serial.print("Upload File Name: ");
- Serial.println(filename);
- SD_card_fs::delete_file(filename.c_str()); // Remove a previous version, otherwise data is appended the file again
- SD_card_fs::open_file(filename.c_str()); // Open the file for writing in SPIFFS (create it, if doesn't exist)
- }
- else if (uploadfile.status == UPLOAD_FILE_WRITE)
- {
- Serial.println("Writing file...");
- SD_card_fs::append_to_file(uploadfile.buf, uploadfile.currentSize);
- }
- else if (uploadfile.status == UPLOAD_FILE_END)
- {
- Serial.print("Upload Size: ");
- Serial.println(uploadfile.totalSize);
- SD_card_fs::close_file();
-
- send_HTML_page(HTML_data::upload_finished_str);
-
- epd_spi_pinout pinout{
-
- }
- EPD_SPI_interface epd_display{}
- BMP my_bitmap{filename.c_str()};
-
-
- }
- else
- {
- server.send(500, "text/plain", "500: couldn't create file");
- }
-}
-
-namespace Web_server
-{
- void init_server()
- {
- server.on("/", home_page);
- server.on("/upload", file_upload);
- server.on("/fupload", HTTP_POST,[](){server.send(200);}, handle_file_upload);
- //server.on("/delete", file_delete);
- server.on("/dir", dir_page);
- Serial.println("Web-server starting!");
- server.begin();
- }
-
- void init_wifi()
- {
- WiFi.mode(WIFI_STA);
- WiFi.begin(ssid, passw);
- Serial.println("Connecting");
-
- while(WiFi.status() != WL_CONNECTED){
- Serial.print(".");
- delay(500);
- }
-
- Serial.println("\nConnected to the WiFi network");
- Serial.print("Local ESP32 IP: ");
- Serial.println(WiFi.localIP());
- }
-
- void handle_client()
- {
- server.handleClient();
- }
-};
-
-
-
-
-
-
+#include "include/web_server.h"\r
+#include "include/web_HTML.h"\r
+#include "include/sd_card.h"\r
+\r
+#ifdef ESP8266\r
+ static ESP8266WebServer server{SERVER_PORT};\r
+#else\r
+ static ESP32WebServer server{SERVER_PORT};\r
+#endif\r
+\r
+static void send_HTML_page(const char* webpage)\r
+{\r
+ server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate"); \r
+ server.sendHeader("Pragma", "no-cache"); \r
+ server.sendHeader("Expires", "-1"); \r
+ server.setContentLength(CONTENT_LENGTH_UNKNOWN); \r
+ server.send(200, "text/html", ""); // Empty content inhibits Content-length header so we have to close the socket ourselves. \r
+ server.sendContent(HTML_data::append_page_header);\r
+\r
+ server.sendContent(webpage);\r
+ server.sendContent(HTML_data::append_page_footer);\r
+ server.client().stop();\r
+}\r
+\r
+static void home_page()\r
+{\r
+ send_HTML_page(HTML_data::home_page_str);\r
+}\r
+\r
+static void dir_page()\r
+{\r
+ // Only lists files and directories in root "/", no recursion into folders...\r
+\r
+ std::unique_ptr<File> root = SD_card_fs::get_file("/");\r
+ if (*root)\r
+ {\r
+ root->rewindDirectory();\r
+ String web_content {HTML_data::dir_page_str};\r
+\r
+ File file = root->openNextFile();\r
+ while (file)\r
+ {\r
+ // Serial.print(String(file.name())+"\t");\r
+ web_content += "<tr><td>" + String(file.name()) + "</td>";\r
+ Serial.print(String(file.isDirectory() ? "Dir " : "File ") + String(file.name()) + "\t");\r
+ web_content += "<td>" + String(file.isDirectory() ? "Dir" : "File") + "</td>";\r
+ int bytes = file.size();\r
+ String fsize = "";\r
+ if (bytes < 1024)\r
+ fsize = String(bytes) + " B";\r
+ else if (bytes < (1024 * 1024))\r
+ fsize = String(bytes / 1024.0, 3) + " KB";\r
+ else if (bytes < (1024 * 1024 * 1024))\r
+ fsize = String(bytes / 1024.0 / 1024.0, 3) + " MB";\r
+ else\r
+ fsize = String(bytes / 1024.0 / 1024.0 / 1024.0, 3) + " GB";\r
+ web_content += "<td>" + fsize + "</td></tr>";\r
+ Serial.println(String(fsize));\r
+\r
+ file = root->openNextFile();\r
+ }\r
+ web_content += "</table>";\r
+ send_HTML_page(web_content.c_str());\r
+ root->close();\r
+ }\r
+ else\r
+ {\r
+ send_HTML_page("<h3>No Files Found</h3>");\r
+ }\r
+}\r
+\r
+static void file_upload()\r
+{\r
+ send_HTML_page(HTML_data::file_upload_str);\r
+}\r
+\r
+static void handle_file_upload()\r
+{\r
+ HTTPUpload &uploadfile = server.upload();\r
+\r
+ if (uploadfile.status == UPLOAD_FILE_START)\r
+ {\r
+ String filename {uploadfile.filename};\r
+\r
+ if (!filename.startsWith("/"))\r
+ filename = "/" + filename;\r
+\r
+ Serial.print("Upload File Name: ");\r
+ Serial.println(filename);\r
+ SD_card_fs::delete_file(filename.c_str()); // Remove a previous version, otherwise data is appended the file again\r
+ SD_card_fs::open_file(filename.c_str()); // Open the file for writing in SPIFFS (create it, if doesn't exist)\r
+ }\r
+ else if (uploadfile.status == UPLOAD_FILE_WRITE)\r
+ {\r
+ Serial.println("Writing file...");\r
+ SD_card_fs::append_to_file(uploadfile.buf, uploadfile.currentSize);\r
+ }\r
+ else if (uploadfile.status == UPLOAD_FILE_END)\r
+ {\r
+ Serial.print("Upload Size: ");\r
+ Serial.println(uploadfile.totalSize);\r
+ SD_card_fs::close_file();\r
+\r
+ send_HTML_page(HTML_data::upload_finished_str);\r
+\r
+ epd_spi_pinout pinout{\r
+ \r
+ }\r
+ EPD_SPI_interface epd_display{}\r
+ BMP my_bitmap{filename.c_str()};\r
+\r
+\r
+ }\r
+ else \r
+ {\r
+ server.send(500, "text/plain", "500: couldn't create file");\r
+ }\r
+}\r
+\r
+namespace Web_server\r
+{\r
+ void init_server()\r
+ {\r
+ server.on("/", home_page);\r
+ server.on("/upload", file_upload);\r
+ server.on("/fupload", HTTP_POST,[](){server.send(200);}, handle_file_upload);\r
+ //server.on("/delete", file_delete);\r
+ server.on("/dir", dir_page);\r
+ Serial.println("Web-server starting!");\r
+ server.begin();\r
+ }\r
+\r
+ void init_wifi()\r
+ {\r
+ WiFi.mode(WIFI_STA);\r
+ WiFi.begin(ssid, passw);\r
+ Serial.println("Connecting");\r
+\r
+ while(WiFi.status() != WL_CONNECTED){\r
+ Serial.print(".");\r
+ delay(500);\r
+ }\r
+\r
+ Serial.println("\nConnected to the WiFi network");\r
+ Serial.print("Local ESP32 IP: ");\r
+ Serial.println(WiFi.localIP());\r
+ }\r
+\r
+ void handle_client()\r
+ {\r
+ server.handleClient();\r
+ }\r
+};\r
+\r
+\r
+\r
+\r
+\r
+\r