mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-29 15:42:20 +03:00
delete
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
// StreamUtils - github.com/bblanchon/ArduinoStreamUtils
|
||||
// Copyright Benoit Blanchon 2019-2021
|
||||
// MIT License
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Client.h>
|
||||
#include <Print.h>
|
||||
#include <Stream.h>
|
||||
#include <WString.h>
|
||||
|
||||
#include <time.h>
|
||||
|
||||
inline unsigned long millis() {
|
||||
return static_cast<unsigned long>(time(NULL));
|
||||
}
|
||||
|
||||
inline void yield() {}
|
||||
@@ -1,22 +0,0 @@
|
||||
# StreamUtils - github.com/bblanchon/ArduinoStreamUtils
|
||||
# Copyright Benoit Blanchon 2019-2021
|
||||
# MIT License
|
||||
|
||||
add_library(AvrCore
|
||||
Client.h
|
||||
EEPROM.cpp
|
||||
EEPROM.h
|
||||
Print.h
|
||||
Stream.h
|
||||
WString.h
|
||||
)
|
||||
|
||||
target_include_directories(AvrCore
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
target_compile_definitions(AvrCore
|
||||
PUBLIC
|
||||
ARDUINO_ARCH_AVR
|
||||
)
|
||||
@@ -1,27 +0,0 @@
|
||||
// StreamUtils - github.com/bblanchon/ArduinoStreamUtils
|
||||
// Copyright Benoit Blanchon 2019-2021
|
||||
// MIT License
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Stream.h"
|
||||
#include "WString.h"
|
||||
|
||||
using IPAddress = String;
|
||||
|
||||
struct Client : Stream {
|
||||
virtual int connect(IPAddress ip, uint16_t port) = 0;
|
||||
virtual int connect(const char *host, uint16_t port) = 0;
|
||||
virtual uint8_t connected() = 0;
|
||||
virtual void stop() = 0;
|
||||
virtual operator bool() = 0;
|
||||
|
||||
// Already in Stream
|
||||
virtual size_t write(uint8_t) = 0;
|
||||
virtual size_t write(const uint8_t *buf, size_t size) = 0;
|
||||
virtual int available() = 0;
|
||||
virtual int read() = 0;
|
||||
|
||||
// Curiously not in Stream
|
||||
virtual int read(uint8_t *buf, size_t size) = 0;
|
||||
};
|
||||
@@ -1,12 +0,0 @@
|
||||
#include "EEPROM.h"
|
||||
|
||||
EEPROMClass EEPROM;
|
||||
static uint8_t data[512];
|
||||
|
||||
uint8_t EEPROMClass::read(int address) {
|
||||
return data[address];
|
||||
}
|
||||
|
||||
void EEPROMClass::update(int address, uint8_t value) {
|
||||
data[address] = value;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
class EEPROMClass {
|
||||
public:
|
||||
uint8_t read(int);
|
||||
void update(int, uint8_t);
|
||||
// void write(int, uint8_t); <- it exists but we want to use update() instead
|
||||
};
|
||||
|
||||
extern EEPROMClass EEPROM;
|
||||
@@ -1,42 +0,0 @@
|
||||
// StreamUtils - github.com/bblanchon/ArduinoStreamUtils
|
||||
// Copyright Benoit Blanchon 2019-2021
|
||||
// MIT License
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstring>
|
||||
|
||||
#include <WString.h>
|
||||
|
||||
struct Print {
|
||||
virtual size_t write(const uint8_t *buffer, size_t size) = 0;
|
||||
virtual size_t write(uint8_t data) = 0;
|
||||
virtual void flush() {}
|
||||
|
||||
size_t write(const char *buffer, size_t size) {
|
||||
return write((const uint8_t *)buffer, size);
|
||||
}
|
||||
|
||||
size_t print(const String &s) {
|
||||
return write(s.c_str(), s.length());
|
||||
}
|
||||
|
||||
size_t print(const char *s) {
|
||||
return write(s, std::strlen(s));
|
||||
}
|
||||
|
||||
size_t println() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
size_t print(const T &value) {
|
||||
return print(String(value));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
size_t println(const T &value) {
|
||||
return print(value);
|
||||
}
|
||||
};
|
||||
@@ -1,41 +0,0 @@
|
||||
// StreamUtils - github.com/bblanchon/ArduinoStreamUtils
|
||||
// Copyright Benoit Blanchon 2019-2021
|
||||
// MIT License
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Print.h"
|
||||
|
||||
struct Stream : Print {
|
||||
virtual int available() = 0;
|
||||
virtual int read() = 0;
|
||||
virtual int peek() = 0;
|
||||
|
||||
size_t readBytes(char *buffer, size_t length) {
|
||||
size_t count = 0;
|
||||
while (count < length) {
|
||||
int c = timedRead();
|
||||
if (c < 0)
|
||||
break;
|
||||
*buffer++ = (char)c;
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
String readString() {
|
||||
String result;
|
||||
int c;
|
||||
while ((c = timedRead()) >= 0) {
|
||||
result += static_cast<char>(c);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void setTimeout(unsigned long) {}
|
||||
|
||||
protected:
|
||||
int timedRead() {
|
||||
return read();
|
||||
}
|
||||
};
|
||||
@@ -1,43 +0,0 @@
|
||||
// StreamUtils - github.com/bblanchon/ArduinoStreamUtils
|
||||
// Copyright Benoit Blanchon 2019-2021
|
||||
// MIT License
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
class String : private std::string {
|
||||
public:
|
||||
String() {}
|
||||
String(const String& s) : std::string(s) {}
|
||||
String(String&& s) : std::string(std::move(s)) {}
|
||||
String(const char* s) : std::string(s) {}
|
||||
String(int n) : std::string(std::to_string(n)) {}
|
||||
|
||||
String& operator=(const String& rhs) {
|
||||
std::string::operator=(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
using std::string::c_str;
|
||||
using std::string::length;
|
||||
using std::string::operator+=;
|
||||
using std::string::operator[];
|
||||
|
||||
void remove(unsigned int index, unsigned int count) {
|
||||
erase(begin() + index, begin() + index + count);
|
||||
}
|
||||
|
||||
void toCharArray(char* buf, unsigned int bufsize,
|
||||
unsigned int index = 0) const {
|
||||
copy(buf, bufsize, index);
|
||||
}
|
||||
|
||||
friend bool operator==(const String& lhs, const char* rhs) {
|
||||
return static_cast<const std::string&>(lhs) == rhs;
|
||||
}
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& lhs, const String& rhs) {
|
||||
return lhs << static_cast<const std::string&>(rhs);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user