mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
Добавляем базовый класс для работы с Serial
This commit is contained in:
34
include/classes/IoTUart.h
Normal file
34
include/classes/IoTUart.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
#include "classes/IoTItem.h"
|
||||
|
||||
#ifdef ESP8266
|
||||
#include <SoftwareSerial.h>
|
||||
#else
|
||||
#include <HardwareSerial.h>
|
||||
#endif
|
||||
|
||||
|
||||
class IoTUart : public IoTItem {
|
||||
public:
|
||||
IoTUart(const String& parameters);
|
||||
~IoTUart();
|
||||
|
||||
virtual void uartHandle();
|
||||
|
||||
virtual void loop();
|
||||
|
||||
void uartPrintStrInUTF16(const char *strUTF8, int length);
|
||||
void uartPrintln(const String& msg);
|
||||
void uartPrint(const String& msg);
|
||||
void uartPrintHex(const String& msg);
|
||||
virtual IoTValue execute(String command, std::vector<IoTValue> ¶m);
|
||||
|
||||
protected:
|
||||
#ifdef ESP8266
|
||||
SoftwareSerial* _myUART;
|
||||
#else
|
||||
HardwareSerial* _myUART;
|
||||
#endif
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user