|
@@ -77,6 +77,16 @@ extern const uint8_t code_js_start[] asm("_binary_code_js_start");
|
|
|
extern const uint8_t code_js_end[] asm("_binary_code_js_end");
|
|
|
extern const uint8_t index_html_start[] asm("_binary_index_html_start");
|
|
|
extern const uint8_t index_html_end[] asm("_binary_index_html_end");
|
|
|
+extern const uint8_t battery-0_svg_start[] asm("_binary_battery-0_svg_start");
|
|
|
+extern const uint8_t battery-0_svg_end[] asm("_binary_battery-0_svg_end");
|
|
|
+extern const uint8_t battery-1_svg_start[] asm("_binary_battery-1_svg_start");
|
|
|
+extern const uint8_t battery-1_svg_end[] asm("_binary_battery-1_svg_end");
|
|
|
+extern const uint8_t battery-2_svg_start[] asm("_binary_battery-2_svg_start");
|
|
|
+extern const uint8_t battery-2_svg_end[] asm("_binary_battery-2_svg_end");
|
|
|
+extern const uint8_t battery-3_svg_start[] asm("_binary_battery-3_svg_start");
|
|
|
+extern const uint8_t battery-3_svg_end[] asm("_binary_battery-3_svg_end");
|
|
|
+extern const uint8_t battery-4_svg_start[] asm("_binary_battery-4_svg_start");
|
|
|
+extern const uint8_t battery-4_svg_end[] asm("_binary_battery-4_svg_end");
|
|
|
|
|
|
|
|
|
/* const http headers stored in ROM */
|
|
@@ -84,6 +94,7 @@ const static char http_hdr_template[] = "HTTP/1.1 200 OK\nContent-type: %s\nAcce
|
|
|
const static char http_html_hdr[] = "HTTP/1.1 200 OK\nContent-type: text/html\nAccess-Control-Allow-Origin: *\nAccept-Encoding: identity\n\n";
|
|
|
const static char http_css_hdr[] = "HTTP/1.1 200 OK\nContent-type: text/css\nCache-Control: public, max-age=31536000\nAccess-Control-Allow-Origin: *\n\n";
|
|
|
const static char http_js_hdr[] = "HTTP/1.1 200 OK\nContent-type: text/javascript\nAccess-Control-Allow-Origin: *\n\n";
|
|
|
+const static char http_svg_hdr[] = "HTTP/1.1 200 OK\nContent-type: image/svg+xml\nAccess-Control-Allow-Origin: *\n\n";
|
|
|
const static char http_400_hdr[] = "HTTP/1.1 400 Bad Request\nContent-Length: 0\n\n";
|
|
|
const static char http_404_hdr[] = "HTTP/1.1 404 Not Found\nContent-Length: 0\n\n";
|
|
|
const static char http_503_hdr[] = "HTTP/1.1 503 Service Unavailable\nContent-Length: 0\n\n";
|
|
@@ -393,6 +404,26 @@ void http_server_netconn_serve(struct netconn *conn) {
|
|
|
else if(strstr(line, "GET /bootstrap.css ")) {
|
|
|
http_server_send_resource_file(conn,bootstrap_css_gz_start, bootstrap_css_gz_end, "text/css", "gzip" );
|
|
|
}
|
|
|
+ else if(strstr(line, "GET /battery-0.svg ")) {
|
|
|
+ netconn_write(conn, http_svg_hdr, sizeof(http_svg_hdr) - 1, NETCONN_NOCOPY);
|
|
|
+ netconn_write(conn, battery-0_svg_start, battery-0_svg_end - battery-0_svg_start, NETCONN_NOCOPY);
|
|
|
+ }
|
|
|
+ else if(strstr(line, "GET /battery-1.svg ")) {
|
|
|
+ netconn_write(conn, http_svg_hdr, sizeof(http_svg_hdr) - 1, NETCONN_NOCOPY);
|
|
|
+ netconn_write(conn, battery-1_svg_start, battery-1_svg_end - battery-1_svg_start, NETCONN_NOCOPY);
|
|
|
+ }
|
|
|
+ else if(strstr(line, "GET /battery-2.svg ")) {
|
|
|
+ netconn_write(conn, http_svg_hdr, sizeof(http_svg_hdr) - 1, NETCONN_NOCOPY);
|
|
|
+ netconn_write(conn, battery-2_svg_start, battery-2_svg_end - battery-2_svg_start, NETCONN_NOCOPY);
|
|
|
+ }
|
|
|
+ else if(strstr(line, "GET /battery-3.svg ")) {
|
|
|
+ netconn_write(conn, http_svg_hdr, sizeof(http_svg_hdr) - 1, NETCONN_NOCOPY);
|
|
|
+ netconn_write(conn, battery-3_svg_start, battery-3_svg_end - battery-3_svg_start, NETCONN_NOCOPY);
|
|
|
+ }
|
|
|
+ else if(strstr(line, "GET /battery-4.svg ")) {
|
|
|
+ netconn_write(conn, http_svg_hdr, sizeof(http_svg_hdr) - 1, NETCONN_NOCOPY);
|
|
|
+ netconn_write(conn, battery-4_svg_start, battery-4_svg_end - battery-4_svg_start, NETCONN_NOCOPY);
|
|
|
+ }
|
|
|
|
|
|
//dynamic stuff
|
|
|
else if(strstr(line, "GET /scan.json ")) {
|