Comments (7)
An example for this can be seen here: https://github.com/nrwiersma/ConfigManager/blob/master/examples/custom-http/custom-http.ino#L109
from configmanager.
Hi,
like this way ?
server->on("/site", HTTPMethod::HTTP_GET, [server](){ server->on("/site", handle_OnConnect);
But there is no result...
Thanks a lot !
from configmanager.
No, like:
const char *siteHTML = (char *)"/site.html";
server->on("/site", HTTPMethod::HTTP_GET, [server](){
configManager.streamFile(siteHTML, mimeHTML);
});
You will need to upload site.html
into your SPIFFS. You can look to https://github.com/nrwiersma/ConfigManager#additional-files-saved for information.
from configmanager.
Ah...
But, there is aktually no html-file as site.html. The ESP32 sends it as a String like:
`void handle_OnConnect() {
server.send(200, "text/html", SendHTML());
}
String SendHTML() {
String ptr = " \n";
ptr += "<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">\n";
ptr += "<title>BLEScanner für Shelly</title>\n";
ptr += "<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}\n";
ptr += "body{margin-top: 50px;} h1 {color: #444444;margin: 50px auto 30px;}\n";
ptr += "p {font-size: 24px;color: #444444;margin-bottom: 10px;}\n";
ptr += "</style>\n";
ptr += "\n";
ptr += "\n";
ptr += "<div id="webpage">\n";
ptr += "
BLEScanner für Shelly
\n";ptr += "
Gescanntes Device 1: ";
ptr += "\n";
ptr += "\n";
ptr += "\n";
return ptr;
}`
So, he generate the answer from his own code. Is this possible in combination with your libary ?
Thanks..
from configmanager.
... config manager setup
configManager.setAPICallback(APICallback);
....
void APCallback(WebServer *server) {
server->on("/site", HTTPMethod::HTTP_GET, [server](){
server.send(200, "text/html", SendHTML());
});
}
from configmanager.
Tried it.
The following compilation error appears:
"request for member 'send' in 'server', which is of pointer type 'WebServer* const' (maybe you meant to use '->' ?)
Then, i switched to:
server->on("/site", HTTPMethod::HTTP_GET, [server](){ server->send(200, "text/html", SendHTML()); });
..and what should i say....?
Thanks again, man. It works...!!
Thanks a lot and best regards...
André
from configmanager.
No problem
from configmanager.
Related Issues (20)
- Unable to save WiFi settings to EEPROM [esp32] HOT 3
- Saving char arrays in EEPROM HOT 2
- Delay restarting device to allow web server response
- ConfigManager::begin() changes value of int in struct HOT 22
- Metadata adding config values HOT 2
- reading and writing from struct config data HOT 2
- Compiler warning HOT 1
- CORS errors HOT 6
- How can I make it to auto reconnect? HOT 4
- not possible to save the value 0 via settings.html
- Issue using LittleFS HOT 1
- Compiling / version issue with ArduinoJson HOT 3
- settings endpoint will only return last saved value HOT 5
- image file (.jpg/.png) cannot be used in index.html HOT 3
- v3 tracking issue HOT 11
- Saving config with wrong type wipes EEPROM memory HOT 3
- ESP32 Wifi Sucks .. connects every two tries .. Workaround thoughts HOT 4
- Problems with with variables in the sketch HOT 9
- One little problem with one parameter HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from configmanager.