eive-obsw/linux/boardtest/UartTestClass.h

52 lines
1.2 KiB
C
Raw Normal View History

2021-03-04 18:29:28 +01:00
#ifndef LINUX_BOARDTEST_UARTTESTCLASS_H_
#define LINUX_BOARDTEST_UARTTESTCLASS_H_
2022-02-22 20:13:16 +01:00
#include <fsfw/globalfunctions/DleEncoder.h>
2022-04-08 19:12:21 +02:00
#include <fsfw_hal/linux/uart/UartCookie.h>
2022-01-17 13:48:55 +01:00
#include <termios.h> // Contains POSIX terminal control definitions
2021-06-16 18:38:06 +02:00
#include <array>
2021-03-04 18:29:28 +01:00
2022-01-17 13:48:55 +01:00
#include "lwgps/lwgps.h"
#include "test/testtasks/TestTask.h"
2021-03-04 18:29:28 +01:00
2022-04-08 19:12:21 +02:00
class ScexUartReader;
2022-01-17 13:48:55 +01:00
class UartTestClass : public TestTask {
public:
2022-04-08 19:12:21 +02:00
UartTestClass(object_id_t objectId, ScexUartReader* reader);
2021-03-04 18:29:28 +01:00
2022-01-17 13:48:55 +01:00
ReturnValue_t initialize() override;
ReturnValue_t performOneShotAction() override;
ReturnValue_t performPeriodicAction() override;
2021-06-16 18:38:06 +02:00
2022-01-17 13:48:55 +01:00
private:
2022-02-03 13:37:48 +01:00
enum TestModes {
GPS,
// Solar Cell Experiment
2022-02-04 17:48:05 +01:00
SCEX
2022-02-03 13:37:48 +01:00
};
2022-04-08 19:12:21 +02:00
enum ScexModes { SIMPLE, READER_TASK } scexMode;
2022-02-03 13:37:48 +01:00
void gpsInit();
void gpsPeriodic();
2022-02-04 17:48:05 +01:00
void scexInit();
void scexPeriodic();
2022-04-08 19:12:21 +02:00
int prepareScexPing(uint8_t* cmdBuf, size_t* len);
2022-02-03 13:37:48 +01:00
TestModes mode = TestModes::GPS;
2022-02-22 20:13:16 +01:00
DleEncoder dleEncoder = DleEncoder();
2022-04-08 19:12:21 +02:00
UartCookie* uartCookie = nullptr;
2022-02-22 20:13:16 +01:00
size_t encodedLen = 0;
2022-01-17 13:48:55 +01:00
lwgps_t gpsData = {};
struct termios tty = {};
int serialPort = 0;
2022-02-04 17:48:05 +01:00
std::array<uint8_t, 64> cmdBuf = {};
std::array<uint8_t, 4096> recBuf = {};
2022-01-17 13:48:55 +01:00
uint8_t recvCnt = 0;
2022-04-08 19:12:21 +02:00
ScexUartReader* reader = nullptr;
2021-03-04 18:29:28 +01:00
};
#endif /* LINUX_BOARDTEST_UARTTESTCLASS_H_ */