2023-11-16 22:28:17 +03:00
|
|
|
#pragma once
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
|
#include "classes/IoTItem.h"
|
|
|
|
|
|
|
|
|
|
#ifdef ESP8266
|
|
|
|
|
#include <SoftwareSerial.h>
|
|
|
|
|
#else
|
|
|
|
|
#include <HardwareSerial.h>
|
2023-11-17 00:18:23 +03:00
|
|
|
#include <SoftwareSerial.h>
|
2023-11-16 22:28:17 +03:00
|
|
|
#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;
|
2025-03-27 23:11:34 +03:00
|
|
|
#elif LIBRETINY
|
|
|
|
|
SerialClass* _myUART;
|
2023-11-16 22:28:17 +03:00
|
|
|
#else
|
2023-11-17 00:18:23 +03:00
|
|
|
Stream* _myUART;
|
2023-11-16 22:28:17 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
};
|