#ifndef LINUX_DEVICES_SCEXUARTREADER_H_ #define LINUX_DEVICES_SCEXUARTREADER_H_ #include #include #include #include #include #include #include #include // Contains POSIX terminal control definitions class SemaphoreIF; class MutexIF; class ScexUartReader : public SystemObject, // strg+shift+n public ExecutableObjectIF, public DeviceCommunicationIF { friend class UartTestClass; public: enum class States { NOT_READY, IDLE, RUNNING, FINISH }; ScexUartReader(object_id_t objectId); ReturnValue_t finish(); void setDebugMode(bool enable); private: SemaphoreIF *semaphore; bool debugMode = false; MutexIF *lock; int serialPort = 0; States state = States::IDLE; struct termios tty = {}; bool doFinish = false; DleEncoder dleEncoder = DleEncoder(); SimpleRingBuffer ringBuffer; DynamicFIFO sizesQueue; Countdown finishCoutdown = Countdown(180 * 1000); std::array cmdbuf = {}; std::array recBuf = {}; std::array ipcBuffer = {}; ReturnValue_t performOperation(uint8_t operationCode = 0) override; // DeviceCommunicationIF implementation ReturnValue_t initializeInterface(CookieIF *cookie) override; ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) override; ReturnValue_t getSendSuccess(CookieIF *cookie) override; ReturnValue_t requestReceiveMessage(CookieIF *cookie, size_t requestLen) override; ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) override; }; #endif /* LINUX_DEVICES_SCEXUARTREADER_H_ */