#ifndef LINUX_BOARDTEST_UARTTESTCLASS_H_ #define LINUX_BOARDTEST_UARTTESTCLASS_H_ #include #include #include #include #include // Contains POSIX terminal control definitions #include #include "lwgps/lwgps.h" #include "mission/devices/devicedefinitions/ScexDefinitions.h" #include "test/testtasks/TestTask.h" class ScexUartReader; class ScexDleParser; class UartTestClass : public TestTask { public: UartTestClass(object_id_t objectId, ScexUartReader* reader); ReturnValue_t initialize() override; ReturnValue_t performOneShotAction() override; ReturnValue_t performPeriodicAction() override; private: enum TestModes { GPS, // Solar Cell Experiment SCEX }; enum ScexModes { SIMPLE, READER_TASK } scexMode; void gpsInit(); void gpsPeriodic(); void scexInit(); void scexPeriodic(); int prepareScexCmd(scex::ScexCmds cmd, bool tempCheck, uint8_t* cmdBuf, size_t* len); void scexSimplePeriodic(); void scexSimpleInit(); static void foundDlePacketHandler(const DleParser::Context& ctx); void handleFoundDlePacket(uint8_t* packet, size_t len); bool cmdSent = false; bool cmdDone = false; scex::ScexCmds currCmd = scex::ScexCmds::PING; TestModes mode = TestModes::GPS; DleEncoder dleEncoder = DleEncoder(); UartCookie* uartCookie = nullptr; size_t encodedLen = 0; lwgps_t gpsData = {}; struct termios tty = {}; int serialPort = 0; bool startFound = false; ScexUartReader* reader = nullptr; SimpleRingBuffer decodeRingBuf; std::array cmdBuf = {}; std::array recBuf = {}; std::array encodedBuf = {}; std::array decodedBuf = {}; ScexDleParser* dleParser; uint8_t recvCnt = 0; }; #endif /* LINUX_BOARDTEST_UARTTESTCLASS_H_ */