Skip to content

Commit

Permalink
Initial Library
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushsharma82 committed Mar 19, 2019
1 parent eb68602 commit 9bfc04e
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 0 deletions.
Binary file added docs/elegantOtaDemo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions examples/ESP8266_Demo/ESP8266_Demo.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ElegantOTA.h>

const char* ssid = "........";
const char* password = "........";

ESP8266WebServer server(80);


void setup(void) {
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
Serial.println("");

// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());

server.on("/", []() {
server.send(200, "text/plain", "Hi! I am ESP8266.");
});

ElegantOTA.begin(&server); // Start ElegantOTA
server.begin();
Serial.println("HTTP server started");
}

void loop(void) {
server.handleClient();
}
2 changes: 2 additions & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ElegantOTA KEYWORD1
begin KEYWORD2
21 changes: 21 additions & 0 deletions library.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "ElegantOTA",
"keywords": "ElegantOTA, OTA, Update, ESP8266, ESP32, Over, the, air",
"description": "Perform OTAs for ESP8266 Elegantly!",
"repository":
{
"type": "git",
"url": "https://github.com/ayushsharma82/ElegantOTA.git"
},
"authors":
[
{
"name": "Ayush Sharma",
"email": "asrocks5@gmail.com",
"maintainer": true
}
],
"version": "1.0.0",
"frameworks": "arduino",
"platforms": "espressif"
}
9 changes: 9 additions & 0 deletions library.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name=ElegantOTA
version=1.0.0
author=Ayush Sharma
category=Communication
maintainer=Ayush Sharma <asrocks5@gmail.com>
sentence=Perform OTAs for ESP8266 Elegantly!
paragraph=A User Interface Library which provides interactive elements for your Over the Air Updates on ESP8266. UI has a size of only 50Kb!
url=https://github.com/ayushsharma82/ElegantOTA
architectures=esp8266
41 changes: 41 additions & 0 deletions src/ElegantOTA.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#ifndef ElegantOTA_h
#define ElegantOTA_h

#if defined(ESP8266)
#include "Arduino.h"
#include "stdlib_noniso.h"
#include "elegantWebpage.h"
#endif

#if defined(ESP8266)
#define HARDWARE "ESP8266"
#include "ESP8266WiFi.h"
#include "WiFiClient.h"
#include "ESP8266WebServer.h"
#include "ESP8266HTTPUpdateServer.h"
#endif

class ElegantOtaClass{
public:
#if defined(ESP8266)
void begin(ESP8266WebServer *server){
_server = server;

_server->on("/update", HTTP_GET, [&](){
_server->sendHeader("Content-Encoding", "gzip");
_server->send_P(200, "text/html", (const char*)ELEGANT_HTML, ELEGANT_HTML_SIZE);
});

_httpUpdater.setup(server);
}
#endif

private:
#if defined(ESP8266)
ESP8266WebServer *_server;
ESP8266HTTPUpdateServer _httpUpdater;
#endif
};

ElegantOtaClass ElegantOTA;
#endif
3 changes: 3 additions & 0 deletions src/elegantWebpage.h

Large diffs are not rendered by default.

0 comments on commit 9bfc04e

Please sign in to comment.