#pragma once #include #include #include #include #include #include #include #include #include #include #include #include class LFR_UART { 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(uint8_t *buff, uint32_t bufferLength); int readFromFile(uint8_t *buff, uint32_t bufferLength); public: uint8_t doubleToByte(double in); double byteToDouble(uint8_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; } };