Merge branch 'develop' into mueller/pus-15-tm-storage
This commit is contained in:
commit
046dbe1deb
@ -1,6 +1,7 @@
|
|||||||
#ifndef FSFW_TIMEMANAGER_TIMEREADERIF_H
|
#ifndef FSFW_TIMEMANAGER_TIMEREADERIF_H
|
||||||
#define FSFW_TIMEMANAGER_TIMEREADERIF_H
|
#define FSFW_TIMEMANAGER_TIMEREADERIF_H
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#include "fsfw/platform.h"
|
#include "fsfw/platform.h"
|
||||||
|
@ -22,7 +22,7 @@ ReturnValue_t SerialComIF::initializeInterface(CookieIF* cookie) {
|
|||||||
return NULLPOINTER;
|
return NULLPOINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
UartCookie* uartCookie = dynamic_cast<UartCookie*>(cookie);
|
SerialCookie* uartCookie = dynamic_cast<SerialCookie*>(cookie);
|
||||||
if (uartCookie == nullptr) {
|
if (uartCookie == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "UartComIF::initializeInterface: Invalid UART Cookie!" << std::endl;
|
sif::error << "UartComIF::initializeInterface: Invalid UART Cookie!" << std::endl;
|
||||||
@ -59,7 +59,7 @@ ReturnValue_t SerialComIF::initializeInterface(CookieIF* cookie) {
|
|||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SerialComIF::configureUartPort(UartCookie* uartCookie) {
|
int SerialComIF::configureUartPort(SerialCookie* uartCookie) {
|
||||||
struct termios options = {};
|
struct termios options = {};
|
||||||
|
|
||||||
std::string deviceFile = uartCookie->getDeviceFile();
|
std::string deviceFile = uartCookie->getDeviceFile();
|
||||||
@ -114,7 +114,7 @@ int SerialComIF::configureUartPort(UartCookie* uartCookie) {
|
|||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerialComIF::setStopBitOptions(struct termios* options, UartCookie* uartCookie) {
|
void SerialComIF::setStopBitOptions(struct termios* options, SerialCookie* uartCookie) {
|
||||||
/* Clear stop field. Sets stop bit to one bit */
|
/* Clear stop field. Sets stop bit to one bit */
|
||||||
options->c_cflag &= ~CSTOPB;
|
options->c_cflag &= ~CSTOPB;
|
||||||
switch (uartCookie->getStopBits()) {
|
switch (uartCookie->getStopBits()) {
|
||||||
@ -126,7 +126,7 @@ void SerialComIF::setStopBitOptions(struct termios* options, UartCookie* uartCoo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerialComIF::setDatasizeOptions(struct termios* options, UartCookie* uartCookie) {
|
void SerialComIF::setDatasizeOptions(struct termios* options, SerialCookie* uartCookie) {
|
||||||
/* Clear size bits */
|
/* Clear size bits */
|
||||||
options->c_cflag &= ~CSIZE;
|
options->c_cflag &= ~CSIZE;
|
||||||
switch (uartCookie->getBitsPerWord()) {
|
switch (uartCookie->getBitsPerWord()) {
|
||||||
@ -188,7 +188,7 @@ ReturnValue_t SerialComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData
|
|||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
UartCookie* uartCookie = dynamic_cast<UartCookie*>(cookie);
|
SerialCookie* uartCookie = dynamic_cast<SerialCookie*>(cookie);
|
||||||
if (uartCookie == nullptr) {
|
if (uartCookie == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "UartComIF::sendMessasge: Invalid UART Cookie!" << std::endl;
|
sif::warning << "UartComIF::sendMessasge: Invalid UART Cookie!" << std::endl;
|
||||||
@ -224,7 +224,7 @@ ReturnValue_t SerialComIF::getSendSuccess(CookieIF* cookie) { return returnvalue
|
|||||||
ReturnValue_t SerialComIF::requestReceiveMessage(CookieIF* cookie, size_t requestLen) {
|
ReturnValue_t SerialComIF::requestReceiveMessage(CookieIF* cookie, size_t requestLen) {
|
||||||
std::string deviceFile;
|
std::string deviceFile;
|
||||||
|
|
||||||
UartCookie* uartCookie = dynamic_cast<UartCookie*>(cookie);
|
SerialCookie* uartCookie = dynamic_cast<SerialCookie*>(cookie);
|
||||||
if (uartCookie == nullptr) {
|
if (uartCookie == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::debug << "UartComIF::requestReceiveMessage: Invalid Uart Cookie!" << std::endl;
|
sif::debug << "UartComIF::requestReceiveMessage: Invalid Uart Cookie!" << std::endl;
|
||||||
@ -257,7 +257,7 @@ ReturnValue_t SerialComIF::requestReceiveMessage(CookieIF* cookie, size_t reques
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SerialComIF::handleCanonicalRead(UartCookie& uartCookie,
|
ReturnValue_t SerialComIF::handleCanonicalRead(SerialCookie& uartCookie,
|
||||||
UartDeviceMap::iterator& iter, size_t requestLen) {
|
UartDeviceMap::iterator& iter, size_t requestLen) {
|
||||||
ReturnValue_t result = returnvalue::OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
uint8_t maxReadCycles = uartCookie.getReadCycles();
|
uint8_t maxReadCycles = uartCookie.getReadCycles();
|
||||||
@ -315,7 +315,7 @@ ReturnValue_t SerialComIF::handleCanonicalRead(UartCookie& uartCookie,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SerialComIF::handleNoncanonicalRead(UartCookie& uartCookie,
|
ReturnValue_t SerialComIF::handleNoncanonicalRead(SerialCookie& uartCookie,
|
||||||
UartDeviceMap::iterator& iter,
|
UartDeviceMap::iterator& iter,
|
||||||
size_t requestLen) {
|
size_t requestLen) {
|
||||||
int fd = iter->second.fileDescriptor;
|
int fd = iter->second.fileDescriptor;
|
||||||
@ -353,7 +353,7 @@ ReturnValue_t SerialComIF::handleNoncanonicalRead(UartCookie& uartCookie,
|
|||||||
ReturnValue_t SerialComIF::readReceivedMessage(CookieIF* cookie, uint8_t** buffer, size_t* size) {
|
ReturnValue_t SerialComIF::readReceivedMessage(CookieIF* cookie, uint8_t** buffer, size_t* size) {
|
||||||
std::string deviceFile;
|
std::string deviceFile;
|
||||||
|
|
||||||
UartCookie* uartCookie = dynamic_cast<UartCookie*>(cookie);
|
SerialCookie* uartCookie = dynamic_cast<SerialCookie*>(cookie);
|
||||||
if (uartCookie == nullptr) {
|
if (uartCookie == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::debug << "UartComIF::readReceivedMessage: Invalid uart cookie!" << std::endl;
|
sif::debug << "UartComIF::readReceivedMessage: Invalid uart cookie!" << std::endl;
|
||||||
@ -382,7 +382,7 @@ ReturnValue_t SerialComIF::readReceivedMessage(CookieIF* cookie, uint8_t** buffe
|
|||||||
|
|
||||||
ReturnValue_t SerialComIF::flushUartRxBuffer(CookieIF* cookie) {
|
ReturnValue_t SerialComIF::flushUartRxBuffer(CookieIF* cookie) {
|
||||||
std::string deviceFile;
|
std::string deviceFile;
|
||||||
UartCookie* uartCookie = dynamic_cast<UartCookie*>(cookie);
|
SerialCookie* uartCookie = dynamic_cast<SerialCookie*>(cookie);
|
||||||
if (uartCookie == nullptr) {
|
if (uartCookie == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "UartComIF::flushUartRxBuffer: Invalid uart cookie!" << std::endl;
|
sif::warning << "UartComIF::flushUartRxBuffer: Invalid uart cookie!" << std::endl;
|
||||||
@ -401,7 +401,7 @@ ReturnValue_t SerialComIF::flushUartRxBuffer(CookieIF* cookie) {
|
|||||||
|
|
||||||
ReturnValue_t SerialComIF::flushUartTxBuffer(CookieIF* cookie) {
|
ReturnValue_t SerialComIF::flushUartTxBuffer(CookieIF* cookie) {
|
||||||
std::string deviceFile;
|
std::string deviceFile;
|
||||||
UartCookie* uartCookie = dynamic_cast<UartCookie*>(cookie);
|
SerialCookie* uartCookie = dynamic_cast<SerialCookie*>(cookie);
|
||||||
if (uartCookie == nullptr) {
|
if (uartCookie == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "UartComIF::flushUartTxBuffer: Invalid uart cookie!" << std::endl;
|
sif::warning << "UartComIF::flushUartTxBuffer: Invalid uart cookie!" << std::endl;
|
||||||
@ -420,7 +420,7 @@ ReturnValue_t SerialComIF::flushUartTxBuffer(CookieIF* cookie) {
|
|||||||
|
|
||||||
ReturnValue_t SerialComIF::flushUartTxAndRxBuf(CookieIF* cookie) {
|
ReturnValue_t SerialComIF::flushUartTxAndRxBuf(CookieIF* cookie) {
|
||||||
std::string deviceFile;
|
std::string deviceFile;
|
||||||
UartCookie* uartCookie = dynamic_cast<UartCookie*>(cookie);
|
SerialCookie* uartCookie = dynamic_cast<SerialCookie*>(cookie);
|
||||||
if (uartCookie == nullptr) {
|
if (uartCookie == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "UartComIF::flushUartTxAndRxBuf: Invalid uart cookie!" << std::endl;
|
sif::warning << "UartComIF::flushUartTxAndRxBuf: Invalid uart cookie!" << std::endl;
|
||||||
|
@ -75,9 +75,9 @@ class SerialComIF : public DeviceCommunicationIF, public SystemObject {
|
|||||||
* uart device file, baudrate, parity, stopbits etc.
|
* uart device file, baudrate, parity, stopbits etc.
|
||||||
* @return The file descriptor of the configured uart.
|
* @return The file descriptor of the configured uart.
|
||||||
*/
|
*/
|
||||||
int configureUartPort(UartCookie* uartCookie);
|
int configureUartPort(SerialCookie* uartCookie);
|
||||||
|
|
||||||
void setStopBitOptions(struct termios* options, UartCookie* uartCookie);
|
void setStopBitOptions(struct termios* options, SerialCookie* uartCookie);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function sets options which are not configurable by the uartCookie.
|
* @brief This function sets options which are not configurable by the uartCookie.
|
||||||
@ -87,11 +87,11 @@ class SerialComIF : public DeviceCommunicationIF, public SystemObject {
|
|||||||
/**
|
/**
|
||||||
* @brief With this function the datasize settings are added to the termios options struct.
|
* @brief With this function the datasize settings are added to the termios options struct.
|
||||||
*/
|
*/
|
||||||
void setDatasizeOptions(struct termios* options, UartCookie* uartCookie);
|
void setDatasizeOptions(struct termios* options, SerialCookie* uartCookie);
|
||||||
|
|
||||||
ReturnValue_t handleCanonicalRead(UartCookie& uartCookie, UartDeviceMap::iterator& iter,
|
ReturnValue_t handleCanonicalRead(SerialCookie& uartCookie, UartDeviceMap::iterator& iter,
|
||||||
size_t requestLen);
|
size_t requestLen);
|
||||||
ReturnValue_t handleNoncanonicalRead(UartCookie& uartCookie, UartDeviceMap::iterator& iter,
|
ReturnValue_t handleNoncanonicalRead(SerialCookie& uartCookie, UartDeviceMap::iterator& iter,
|
||||||
size_t requestLen);
|
size_t requestLen);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <fsfw/serviceinterface.h>
|
#include <fsfw/serviceinterface.h>
|
||||||
|
|
||||||
UartCookie::UartCookie(object_id_t handlerId, std::string deviceFile, UartBaudRate baudrate,
|
SerialCookie::SerialCookie(object_id_t handlerId, std::string deviceFile, UartBaudRate baudrate,
|
||||||
size_t maxReplyLen, UartModes uartMode)
|
size_t maxReplyLen, UartModes uartMode)
|
||||||
: handlerId(handlerId),
|
: handlerId(handlerId),
|
||||||
deviceFile(deviceFile),
|
deviceFile(deviceFile),
|
||||||
@ -10,42 +10,42 @@ UartCookie::UartCookie(object_id_t handlerId, std::string deviceFile, UartBaudRa
|
|||||||
baudrate(baudrate),
|
baudrate(baudrate),
|
||||||
maxReplyLen(maxReplyLen) {}
|
maxReplyLen(maxReplyLen) {}
|
||||||
|
|
||||||
UartCookie::~UartCookie() {}
|
SerialCookie::~SerialCookie() {}
|
||||||
|
|
||||||
UartBaudRate UartCookie::getBaudrate() const { return baudrate; }
|
UartBaudRate SerialCookie::getBaudrate() const { return baudrate; }
|
||||||
|
|
||||||
size_t UartCookie::getMaxReplyLen() const { return maxReplyLen; }
|
size_t SerialCookie::getMaxReplyLen() const { return maxReplyLen; }
|
||||||
|
|
||||||
std::string UartCookie::getDeviceFile() const { return deviceFile; }
|
std::string SerialCookie::getDeviceFile() const { return deviceFile; }
|
||||||
|
|
||||||
void UartCookie::setParityOdd() { parity = Parity::ODD; }
|
void SerialCookie::setParityOdd() { parity = Parity::ODD; }
|
||||||
|
|
||||||
void UartCookie::setParityEven() { parity = Parity::EVEN; }
|
void SerialCookie::setParityEven() { parity = Parity::EVEN; }
|
||||||
|
|
||||||
Parity UartCookie::getParity() const { return parity; }
|
Parity SerialCookie::getParity() const { return parity; }
|
||||||
|
|
||||||
void UartCookie::setBitsPerWord(BitsPerWord bitsPerWord_) { bitsPerWord = bitsPerWord_; }
|
void SerialCookie::setBitsPerWord(BitsPerWord bitsPerWord_) { bitsPerWord = bitsPerWord_; }
|
||||||
|
|
||||||
BitsPerWord UartCookie::getBitsPerWord() const { return bitsPerWord; }
|
BitsPerWord SerialCookie::getBitsPerWord() const { return bitsPerWord; }
|
||||||
|
|
||||||
StopBits UartCookie::getStopBits() const { return stopBits; }
|
StopBits SerialCookie::getStopBits() const { return stopBits; }
|
||||||
|
|
||||||
void UartCookie::setTwoStopBits() { stopBits = StopBits::TWO_STOP_BITS; }
|
void SerialCookie::setTwoStopBits() { stopBits = StopBits::TWO_STOP_BITS; }
|
||||||
|
|
||||||
void UartCookie::setOneStopBit() { stopBits = StopBits::ONE_STOP_BIT; }
|
void SerialCookie::setOneStopBit() { stopBits = StopBits::ONE_STOP_BIT; }
|
||||||
|
|
||||||
UartModes UartCookie::getUartMode() const { return uartMode; }
|
UartModes SerialCookie::getUartMode() const { return uartMode; }
|
||||||
|
|
||||||
void UartCookie::setReadCycles(uint8_t readCycles) { this->readCycles = readCycles; }
|
void SerialCookie::setReadCycles(uint8_t readCycles) { this->readCycles = readCycles; }
|
||||||
|
|
||||||
void UartCookie::setToFlushInput(bool enable) { this->flushInput = enable; }
|
void SerialCookie::setToFlushInput(bool enable) { this->flushInput = enable; }
|
||||||
|
|
||||||
uint8_t UartCookie::getReadCycles() const { return readCycles; }
|
uint8_t SerialCookie::getReadCycles() const { return readCycles; }
|
||||||
|
|
||||||
bool UartCookie::getInputShouldBeFlushed() { return this->flushInput; }
|
bool SerialCookie::getInputShouldBeFlushed() { return this->flushInput; }
|
||||||
|
|
||||||
object_id_t UartCookie::getHandlerId() const { return this->handlerId; }
|
object_id_t SerialCookie::getHandlerId() const { return this->handlerId; }
|
||||||
|
|
||||||
void UartCookie::setNoFixedSizeReply() { replySizeFixed = false; }
|
void SerialCookie::setNoFixedSizeReply() { replySizeFixed = false; }
|
||||||
|
|
||||||
bool UartCookie::isReplySizeFixed() { return replySizeFixed; }
|
bool SerialCookie::isReplySizeFixed() { return replySizeFixed; }
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
*
|
*
|
||||||
* @author J. Meier
|
* @author J. Meier
|
||||||
*/
|
*/
|
||||||
class UartCookie : public CookieIF {
|
class SerialCookie : public CookieIF {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Constructor for the uart cookie.
|
* @brief Constructor for the uart cookie.
|
||||||
@ -29,10 +29,10 @@ class UartCookie : public CookieIF {
|
|||||||
* 8 databits (number of bits transfered with one uart frame)
|
* 8 databits (number of bits transfered with one uart frame)
|
||||||
* One stop bit
|
* One stop bit
|
||||||
*/
|
*/
|
||||||
UartCookie(object_id_t handlerId, std::string deviceFile, UartBaudRate baudrate,
|
SerialCookie(object_id_t handlerId, std::string deviceFile, UartBaudRate baudrate,
|
||||||
size_t maxReplyLen, UartModes uartMode = UartModes::NON_CANONICAL);
|
size_t maxReplyLen, UartModes uartMode = UartModes::NON_CANONICAL);
|
||||||
|
|
||||||
virtual ~UartCookie();
|
virtual ~SerialCookie();
|
||||||
|
|
||||||
UartBaudRate getBaudrate() const;
|
UartBaudRate getBaudrate() const;
|
||||||
size_t getMaxReplyLen() const;
|
size_t getMaxReplyLen() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user