//
#ifndef SerialUart_h
#define SerialUart_h
//
//--------------------------------------------
// Include
//--------------------------------------------
#include <Define.h>
#include <Pinout.h>
//
//--------------------------------------------
// Constant Uart
//--------------------------------------------
const int BAUDRATE_9600 = 9600;
const int BAUDRATE_19200 = 19200;
const int BAUDRATE_115200 = 115200;
//
const int INIT_SERIALUART_BUFFERSIZE = 64;
//........................................
#define TERMINAL_ZERO           0x00
#define TERMINAL_CARRIAGERETURN 0x0D
#define TERMINAL_LINEFEED       0x0A
#define TERMINAL_NEWLINE        "\r\n"
//
#define TERMINAL_SPACE          " "
#define TERMINAL_EVENT          "!"
#define TERMINAL_COMMAND        "@"
#define TERMINAL_RESPONSE       "&"
#define TERMINAL_COMMENT        "#"
#define TERMINAL_DEBUG          "|"
#define TERMINAL_ERROR          ":"
#define TERMINAL_WARNING        "."
//
#define TERMINAL_INPUT          ">"
//
//--------------------------------------------
// Class CSerialUart
//--------------------------------------------
class CSerialUart : public HardwareSerial
{
    protected:
    int FPinRX, FPinTX;
    public:
    // Management
    CSerialUart(HardwareSerial& serial); 
    bool Open(long unsigned baudrate, int pinrx = -1, int pintx = -1);
    bool Close(void);
    // Handler
    void Message(const char* format, ...);
};
//
#endif //  SerialUart_h