Aktualizace na verzi 3.3.23
This commit is contained in:
@ -10,11 +10,13 @@
|
||||
#include <WebServer.h>
|
||||
#include <WiFi.h>
|
||||
#endif
|
||||
#include "StreamConcat.h"
|
||||
#include "StreamString.h"
|
||||
|
||||
#include <StreamString.h>
|
||||
#include <ESPAsyncWebServer.h>
|
||||
#include <LittleFS.h>
|
||||
|
||||
#include "StreamConcat.h"
|
||||
|
||||
DNSServer dnsServer;
|
||||
AsyncWebServer server(80);
|
||||
|
||||
|
@ -1,40 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Stream.h>
|
||||
|
||||
class StreamString : public Stream {
|
||||
public:
|
||||
size_t write(const uint8_t* p, size_t n) override { return _buffer.concat(reinterpret_cast<const char*>(p), n) ? n : 0; }
|
||||
size_t write(uint8_t c) override { return _buffer.concat(static_cast<char>(c)) ? 1 : 0; }
|
||||
void flush() override {}
|
||||
|
||||
int available() override { return static_cast<int>(_buffer.length()); }
|
||||
|
||||
int read() override {
|
||||
if (_buffer.length() == 0)
|
||||
return -1;
|
||||
char c = _buffer[0];
|
||||
_buffer.remove(0, 1);
|
||||
return c;
|
||||
}
|
||||
|
||||
#if defined(TARGET_RP2040)
|
||||
size_t readBytes(char* buffer, size_t length) {
|
||||
#else
|
||||
size_t readBytes(char* buffer, size_t length) override {
|
||||
#endif
|
||||
if (length > _buffer.length())
|
||||
length = _buffer.length();
|
||||
// Don't use _str.ToCharArray() because it inserts a terminator
|
||||
memcpy(buffer, _buffer.c_str(), length);
|
||||
_buffer.remove(0, static_cast<unsigned int>(length));
|
||||
return length;
|
||||
}
|
||||
|
||||
int peek() override { return _buffer.length() > 0 ? _buffer[0] : -1; }
|
||||
|
||||
const String& buffer() const { return _buffer; }
|
||||
|
||||
private:
|
||||
String _buffer;
|
||||
};
|
Reference in New Issue
Block a user