Compare commits

...

10 Commits

10 changed files with 79 additions and 17 deletions

View File

@ -443,6 +443,51 @@ ReturnValue_t UartComIF::readReceivedMessage(CookieIF *cookie,
return RETURN_OK; return RETURN_OK;
} }
ReturnValue_t UartComIF::flushUartRxBuffer(CookieIF *cookie) {
std::string deviceFile;
UartDeviceMapIter uartDeviceMapIter;
UartCookie* uartCookie = dynamic_cast<UartCookie*>(cookie);
if(uartCookie == nullptr) {
sif::warning << "UartComIF::flushUartRxBuffer: Invalid uart cookie!" << std::endl;
return NULLPOINTER;
}
deviceFile = uartCookie->getDeviceFile();
uartDeviceMapIter = uartDeviceMap.find(deviceFile);
int fd = uartDeviceMapIter->second.fileDescriptor;
tcflush(fd, TCIFLUSH);
return RETURN_OK;
}
ReturnValue_t UartComIF::flushUartTxBuffer(CookieIF *cookie) {
std::string deviceFile;
UartDeviceMapIter uartDeviceMapIter;
UartCookie* uartCookie = dynamic_cast<UartCookie*>(cookie);
if(uartCookie == nullptr) {
sif::warning << "UartComIF::flushUartTxBuffer: Invalid uart cookie!" << std::endl;
return NULLPOINTER;
}
deviceFile = uartCookie->getDeviceFile();
uartDeviceMapIter = uartDeviceMap.find(deviceFile);
int fd = uartDeviceMapIter->second.fileDescriptor;
tcflush(fd, TCOFLUSH);
return RETURN_OK;
}
ReturnValue_t UartComIF::flushUartTxAndRxBuf(CookieIF *cookie) {
std::string deviceFile;
UartDeviceMapIter uartDeviceMapIter;
UartCookie* uartCookie = dynamic_cast<UartCookie*>(cookie);
if(uartCookie == nullptr) {
sif::warning << "UartComIF::flushUartTxAndRxBuf: Invalid uart cookie!" << std::endl;
return NULLPOINTER;
}
deviceFile = uartCookie->getDeviceFile();
uartDeviceMapIter = uartDeviceMap.find(deviceFile);
int fd = uartDeviceMapIter->second.fileDescriptor;
tcflush(fd, TCIOFLUSH);
return RETURN_OK;
}
void UartComIF::setUartMode(struct termios *options, UartCookie &uartCookie) { void UartComIF::setUartMode(struct termios *options, UartCookie &uartCookie) {
UartModes uartMode = uartCookie.getUartMode(); UartModes uartMode = uartCookie.getUartMode();
if(uartMode == UartModes::NON_CANONICAL) { if(uartMode == UartModes::NON_CANONICAL) {

View File

@ -41,6 +41,21 @@ public:
ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer,
size_t *size) override; size_t *size) override;
/**
* @brief This function discards all data received but not read in the UART buffer.
*/
ReturnValue_t flushUartRxBuffer(CookieIF *cookie);
/**
* @brief This function discards all data in the transmit buffer of the UART driver.
*/
ReturnValue_t flushUartTxBuffer(CookieIF *cookie);
/**
* @brief This function discards both data in the transmit and receive buffer of the UART.
*/
ReturnValue_t flushUartTxAndRxBuf(CookieIF *cookie);
private: private:
using UartDeviceFile_t = std::string; using UartDeviceFile_t = std::string;

View File

@ -1,12 +1,10 @@
#ifndef FSFW_DEFAULTCFG_VERSION_H_ #ifndef FSFW_VERSION_H_
#define FSFW_DEFAULTCFG_VERSION_H_ #define FSFW_VERSION_H_
const char* const FSFW_VERSION_NAME = "ASTP"; const char* const FSFW_VERSION_NAME = "ASTP";
#define FSFW_VERSION 1 #define FSFW_VERSION 1
#define FSFW_SUBVERSION 0 #define FSFW_SUBVERSION 3
#define FSFW_REVISION 0 #define FSFW_REVISION 0
#endif /* FSFW_VERSION_H_ */
#endif /* FSFW_DEFAULTCFG_VERSION_H_ */

View File

@ -81,7 +81,7 @@ public:
* @param args Any other arguments which an implementation might require * @param args Any other arguments which an implementation might require
* @return * @return
*/ */
virtual ReturnValue_t deleteFile(const char* repositoryPath, virtual ReturnValue_t removeFile(const char* repositoryPath,
const char* filename, void* args = nullptr) = 0; const char* filename, void* args = nullptr) = 0;
/** /**

View File

@ -17,7 +17,7 @@
#endif #endif
const std::string TcpTmTcBridge::DEFAULT_UDP_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT; const std::string TcpTmTcBridge::DEFAULT_SERVER_PORT = tcpip::DEFAULT_TCP_SERVER_PORT;
TcpTmTcBridge::TcpTmTcBridge(object_id_t objectId, object_id_t tcDestination, TcpTmTcBridge::TcpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
object_id_t tmStoreId, object_id_t tcStoreId): object_id_t tmStoreId, object_id_t tcStoreId):

View File

@ -29,8 +29,8 @@ class TcpTmTcBridge:
public TmTcBridge { public TmTcBridge {
friend class TcpTmTcServer; friend class TcpTmTcServer;
public: public:
/* The ports chosen here should not be used by any other process. */ // The ports chosen here should not be used by any other process
static const std::string DEFAULT_UDP_SERVER_PORT; static const std::string DEFAULT_SERVER_PORT;
/** /**
* Constructor * Constructor

View File

@ -17,13 +17,13 @@
#define FSFW_UDP_SEND_WIRETAPPING_ENABLED 0 #define FSFW_UDP_SEND_WIRETAPPING_ENABLED 0
#endif #endif
const std::string UdpTmTcBridge::DEFAULT_UDP_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT; const std::string UdpTmTcBridge::DEFAULT_SERVER_PORT = tcpip::DEFAULT_UDP_SERVER_PORT;
UdpTmTcBridge::UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination, UdpTmTcBridge::UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
std::string udpServerPort, object_id_t tmStoreId, object_id_t tcStoreId): std::string udpServerPort, object_id_t tmStoreId, object_id_t tcStoreId):
TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) { TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
if(udpServerPort == "") { if(udpServerPort == "") {
this->udpServerPort = DEFAULT_UDP_SERVER_PORT; this->udpServerPort = DEFAULT_SERVER_PORT;
} }
else { else {
this->udpServerPort = udpServerPort; this->udpServerPort = udpServerPort;

View File

@ -28,7 +28,7 @@ class UdpTmTcBridge:
friend class UdpTcPollingTask; friend class UdpTcPollingTask;
public: public:
/* The ports chosen here should not be used by any other process. */ /* The ports chosen here should not be used by any other process. */
static const std::string DEFAULT_UDP_SERVER_PORT; static const std::string DEFAULT_SERVER_PORT;
UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination, UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
std::string udpServerPort = "", object_id_t tmStoreId = objects::TM_STORE, std::string udpServerPort = "", object_id_t tmStoreId = objects::TM_STORE,

View File

@ -13,7 +13,8 @@
namespace tcpip { namespace tcpip {
const char* const DEFAULT_SERVER_PORT = "7301"; const char* const DEFAULT_UDP_SERVER_PORT = "7301";
const char* const DEFAULT_TCP_SERVER_PORT = "7303";
enum class Protocol { enum class Protocol {
UDP, UDP,

View File

@ -1,5 +1,8 @@
#ifndef FRAMEWORK_TASKS_TYPEDEF_H_ #ifndef FSFW_TASKS_TYPEDEF_H_
#define FRAMEWORK_TASKS_TYPEDEF_H_ #define FSFW_TASKS_TYPEDEF_H_
#include <cstdint>
#include <cstddef>
typedef const char* TaskName; typedef const char* TaskName;
typedef uint32_t TaskPriority; typedef uint32_t TaskPriority;
@ -7,4 +10,4 @@ typedef size_t TaskStackSize;
typedef double TaskPeriod; typedef double TaskPeriod;
typedef void (*TaskDeadlineMissedFunction)(); typedef void (*TaskDeadlineMissedFunction)();
#endif /* FRAMEWORK_TASKS_TYPEDEF_H_ */ #endif /* FSFW_TASKS_TYPEDEF_H_ */