fsfw/src/fsfw_hal/linux/uart/UartCookie.cpp

52 lines
1.7 KiB
C++
Raw Normal View History

2022-03-22 17:38:47 +01:00
#include "UartCookie.h"
2021-07-13 19:19:25 +02:00
#include <fsfw/serviceinterface.h>
2021-07-13 19:19:25 +02:00
UartCookie::UartCookie(object_id_t handlerId, std::string deviceFile, UartModes uartMode,
UartBaudRate baudrate, size_t maxReplyLen)
2022-02-02 10:29:30 +01:00
: handlerId(handlerId),
deviceFile(deviceFile),
uartMode(uartMode),
baudrate(baudrate),
maxReplyLen(maxReplyLen) {}
2021-07-13 19:19:25 +02:00
UartCookie::~UartCookie() {}
UartBaudRate UartCookie::getBaudrate() const { return baudrate; }
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
size_t UartCookie::getMaxReplyLen() const { return maxReplyLen; }
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
std::string UartCookie::getDeviceFile() const { return deviceFile; }
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
void UartCookie::setParityOdd() { parity = Parity::ODD; }
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
void UartCookie::setParityEven() { parity = Parity::EVEN; }
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
Parity UartCookie::getParity() const { return parity; }
2021-07-13 19:19:25 +02:00
2022-04-27 08:39:21 +02:00
void UartCookie::setBitsPerWord(BitsPerWord bitsPerWord_) { bitsPerWord = bitsPerWord_; }
2021-07-13 19:19:25 +02:00
BitsPerWord UartCookie::getBitsPerWord() const { return bitsPerWord; }
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
StopBits UartCookie::getStopBits() const { return stopBits; }
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
void UartCookie::setTwoStopBits() { stopBits = StopBits::TWO_STOP_BITS; }
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
void UartCookie::setOneStopBit() { stopBits = StopBits::ONE_STOP_BIT; }
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
UartModes UartCookie::getUartMode() const { return uartMode; }
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
void UartCookie::setReadCycles(uint8_t readCycles) { this->readCycles = readCycles; }
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
void UartCookie::setToFlushInput(bool enable) { this->flushInput = enable; }
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
uint8_t UartCookie::getReadCycles() const { return readCycles; }
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
bool UartCookie::getInputShouldBeFlushed() { return this->flushInput; }
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
object_id_t UartCookie::getHandlerId() const { return this->handlerId; }
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
void UartCookie::setNoFixedSizeReply() { replySizeFixed = false; }
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
bool UartCookie::isReplySizeFixed() { return replySizeFixed; }