add UPNP / SSPD, see issue #23
This commit is contained in:
@@ -25,3 +25,4 @@ lib_deps =
|
|||||||
ESP Async WebServer@>=1.2.0
|
ESP Async WebServer@>=1.2.0
|
||||||
AsyncTCP@>=1.1.1
|
AsyncTCP@>=1.1.1
|
||||||
ArduinoJson@>=6.15.2
|
ArduinoJson@>=6.15.2
|
||||||
|
ESP32SSPD@>=1.1.0
|
||||||
@@ -226,11 +226,7 @@ void weather_forecast_sync_Task( void * pvParameters ) {
|
|||||||
localtime_r( &now, &info );
|
localtime_r( &now, &info );
|
||||||
strftime( buf, sizeof(buf), "updated: %d.%b %H:%M", &info );
|
strftime( buf, sizeof(buf), "updated: %d.%b %H:%M", &info );
|
||||||
lv_label_set_text( weather_forecast_update_label, buf );
|
lv_label_set_text( weather_forecast_update_label, buf );
|
||||||
}
|
lv_obj_invalidate( lv_scr_act() );
|
||||||
else {
|
|
||||||
char buf[64];
|
|
||||||
snprintf( buf, sizeof(buf), "Error: %d", retval );
|
|
||||||
lv_label_set_text( weather_forecast_update_label, buf );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,6 @@
|
|||||||
/*
|
/*
|
||||||
* firmeware version string
|
* firmeware version string
|
||||||
*/
|
*/
|
||||||
#define __FIRMWARE__ "2020080701"
|
#define __FIRMWARE__ "2020080702"
|
||||||
|
|
||||||
#endif // _CONFIG_H
|
#endif // _CONFIG_H
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#define ESP_WPS_MODE WPS_TYPE_PBC
|
#define ESP_WPS_MODE WPS_TYPE_PBC
|
||||||
#define ESP_MANUFACTURER "ESPRESSIF"
|
#define ESP_MANUFACTURER "ESPRESSIF"
|
||||||
#define ESP_MODEL_NUMBER "ESP32"
|
#define ESP_MODEL_NUMBER "ESP32"
|
||||||
#define ESP_MODEL_NAME "ESPRESSIF IOT"
|
#define ESP_MODEL_NAME "LILYGO T-WATCH2020 V1"
|
||||||
#define ESP_DEVICE_NAME "ESP STATION"
|
#define ESP_DEVICE_NAME "ESP STATION"
|
||||||
|
|
||||||
struct networklist {
|
struct networklist {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include <AsyncTCP.h>
|
#include <AsyncTCP.h>
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <SPIFFSEditor.h>
|
#include <SPIFFSEditor.h>
|
||||||
|
#include <ESP32SSDP.h>
|
||||||
|
|
||||||
#include "webserver.h"
|
#include "webserver.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@@ -168,5 +169,52 @@ void asyncwebserver_setup(void){
|
|||||||
[](AsyncWebServerRequest *request, const String& filename, size_t index, uint8_t *data, size_t len, bool final) { handleUpdate(request, filename, index, data, len, final); }
|
[](AsyncWebServerRequest *request, const String& filename, size_t index, uint8_t *data, size_t len, bool final) { handleUpdate(request, filename, index, data, len, final); }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
asyncserver.on("/description.xml", HTTP_GET, [](AsyncWebServerRequest *request) {
|
||||||
|
byte mac[6];
|
||||||
|
WiFi.macAddress(mac);
|
||||||
|
char tmp[12 + 1];
|
||||||
|
snprintf(tmp, sizeof(tmp), "%02X%02X%02X%02X%02X%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||||
|
String MacStrPart = String(tmp).substring(6);
|
||||||
|
|
||||||
|
String xmltext = String("<?xml version=\"1.0\"?>\n") +
|
||||||
|
"<root xmlns=\"urn:schemas-upnp-org:device-1-0\">\n"
|
||||||
|
"<specVersion>\n"
|
||||||
|
"\t<major>1</major>\n"
|
||||||
|
"\t<minor>0</minor>\n"
|
||||||
|
"</specVersion>\n"
|
||||||
|
"<URLBase>http://" + WiFi.localIP().toString() + "/</URLBase>\n"
|
||||||
|
"<device>\n"
|
||||||
|
"\t<deviceType>upnp:rootdevice</deviceType>\n"
|
||||||
|
|
||||||
|
/*this is the icon name in Windows*/
|
||||||
|
/*"\t<friendlyName>" + WiFi.getHostname() + "</friendlyName>\n"*/
|
||||||
|
"\t<friendlyName>" + DEV_NAME + " " + MacStrPart + "</friendlyName>\n" /*because the hostename is 'Espressif' */
|
||||||
|
|
||||||
|
"\t<presentationURL>/</presentationURL>\n"
|
||||||
|
"\t<manufacturer>" + "Dirk Broßwick (sharandac)" + "</manufacturer>\n"
|
||||||
|
"\t<manufacturerURL>https://github.com/sharandac/My-TTGO-Watch</manufacturerURL>\n"
|
||||||
|
"\t<modelName>" + DEV_INFO + "</modelName>\n"
|
||||||
|
|
||||||
|
"\t<modelNumber>" + WiFi.getHostname() + "</modelNumber>\n"
|
||||||
|
"\t<modelURL>" +
|
||||||
|
"/" + "</modelURL>\n"
|
||||||
|
|
||||||
|
"\t<serialNumber>Build: " + __FIRMWARE__ + "</serialNumber>\n"
|
||||||
|
//The last six bytes of the UUID are the hardware address of the first Ethernet adapter in the system the UUID was generated on.
|
||||||
|
"\t<UDN>uuid:38323636-4558-4DDA-9188-CDA0E6" + MacStrPart + "</UDN>\n"
|
||||||
|
"</device>\n"
|
||||||
|
"</root>\r\n"
|
||||||
|
"\r\n";
|
||||||
|
|
||||||
|
request->send(200, "text/xml", xmltext);
|
||||||
|
});
|
||||||
|
|
||||||
|
//Upnp / SSDP presentation - Multicast - link to description.xml
|
||||||
|
SSDP.setSchemaURL("description.xml");
|
||||||
|
SSDP.setHTTPPort( UPNPPORT );
|
||||||
|
SSDP.setURL("/");
|
||||||
|
SSDP.setDeviceType("upnp:rootdevice");
|
||||||
|
SSDP.begin();
|
||||||
|
|
||||||
asyncserver.begin();
|
asyncserver.begin();
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,11 @@
|
|||||||
|
|
||||||
#define _ASYNCWEBSERVER_H
|
#define _ASYNCWEBSERVER_H
|
||||||
|
|
||||||
#define WEBSERVERPORT 80
|
#define WEBSERVERPORT 80
|
||||||
|
#define UPNPPORT 80
|
||||||
|
|
||||||
|
#define DEV_NAME "My-Watch"
|
||||||
|
#define DEV_INFO "Watch based on ESP32 from Espressif Systems"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief setup builtin webserver, call after first wifi-connection. otherwise esp32 will crash
|
* @brief setup builtin webserver, call after first wifi-connection. otherwise esp32 will crash
|
||||||
|
|||||||
Binary file not shown.
@@ -1 +1 @@
|
|||||||
{"version":"2020080701","host":"http://www.neo-guerillaz.de","file":"ttgo-t-watch2020_v1.ino.bin"}
|
{"version":"2020080702","host":"http://www.neo-guerillaz.de","file":"ttgo-t-watch2020_v1.ino.bin"}
|
||||||
|
|||||||
Reference in New Issue
Block a user