#pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include class LFR_UART { public: std::chrono::milliseconds last; int fileDescriptor; const char* serialPortPath = "/dev/ttyS0"; void openFile(const char *fileName); int closeFile(); struct termios tty; void openSerialPort(); void configureSerialPort(); void closeSerialPort(); int writeDataToFile(int8_t *buff, uint32_t bufferLength); int readFromFile(int8_t *buff, uint32_t bufferLength); public: int8_t doubleToByte(double in); double byteToDouble(int8_t in); void sendTelegram(double wheel1, double wheel2, double wheel3, double wheel4); bool readTelegram(double* buffer); LFR_UART(); ~LFR_UART(); }; class CommunicatorException: public std::exception { const char* msg; public: CommunicatorException(const char* msg): msg(msg) {} virtual const char* what() const throw() { return msg; } };