Bugfix in Command Executor and Timer Update #10
@ -453,9 +453,12 @@ ReturnValue_t UartComIF::flushUartRxBuffer(CookieIF *cookie) {
|
|||||||
}
|
}
|
||||||
deviceFile = uartCookie->getDeviceFile();
|
deviceFile = uartCookie->getDeviceFile();
|
||||||
uartDeviceMapIter = uartDeviceMap.find(deviceFile);
|
uartDeviceMapIter = uartDeviceMap.find(deviceFile);
|
||||||
|
if(uartDeviceMapIter != uartDeviceMap.end()) {
|
||||||
int fd = uartDeviceMapIter->second.fileDescriptor;
|
int fd = uartDeviceMapIter->second.fileDescriptor;
|
||||||
tcflush(fd, TCIFLUSH);
|
tcflush(fd, TCIFLUSH);
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t UartComIF::flushUartTxBuffer(CookieIF *cookie) {
|
ReturnValue_t UartComIF::flushUartTxBuffer(CookieIF *cookie) {
|
||||||
@ -468,9 +471,12 @@ ReturnValue_t UartComIF::flushUartTxBuffer(CookieIF *cookie) {
|
|||||||
}
|
}
|
||||||
deviceFile = uartCookie->getDeviceFile();
|
deviceFile = uartCookie->getDeviceFile();
|
||||||
uartDeviceMapIter = uartDeviceMap.find(deviceFile);
|
uartDeviceMapIter = uartDeviceMap.find(deviceFile);
|
||||||
|
if(uartDeviceMapIter != uartDeviceMap.end()) {
|
||||||
int fd = uartDeviceMapIter->second.fileDescriptor;
|
int fd = uartDeviceMapIter->second.fileDescriptor;
|
||||||
tcflush(fd, TCOFLUSH);
|
tcflush(fd, TCOFLUSH);
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t UartComIF::flushUartTxAndRxBuf(CookieIF *cookie) {
|
ReturnValue_t UartComIF::flushUartTxAndRxBuf(CookieIF *cookie) {
|
||||||
@ -483,9 +489,12 @@ ReturnValue_t UartComIF::flushUartTxAndRxBuf(CookieIF *cookie) {
|
|||||||
}
|
}
|
||||||
deviceFile = uartCookie->getDeviceFile();
|
deviceFile = uartCookie->getDeviceFile();
|
||||||
uartDeviceMapIter = uartDeviceMap.find(deviceFile);
|
uartDeviceMapIter = uartDeviceMap.find(deviceFile);
|
||||||
|
if(uartDeviceMapIter != uartDeviceMap.end()) {
|
||||||
int fd = uartDeviceMapIter->second.fileDescriptor;
|
int fd = uartDeviceMapIter->second.fileDescriptor;
|
||||||
tcflush(fd, TCIOFLUSH);
|
tcflush(fd, TCIOFLUSH);
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UartComIF::setUartMode(struct termios *options, UartCookie &uartCookie) {
|
void UartComIF::setUartMode(struct termios *options, UartCookie &uartCookie) {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const std::string TcpTmTcBridge::DEFAULT_SERVER_PORT = tcpip::DEFAULT_TCP_SERVER_PORT;
|
const std::string TcpTmTcBridge::DEFAULT_SERVER_PORT = tcpip::DEFAULT_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):
|
||||||
|
@ -29,7 +29,7 @@ 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_SERVER_PORT;
|
static const std::string DEFAULT_SERVER_PORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,14 +22,14 @@
|
|||||||
#define FSFW_TCP_RECV_WIRETAPPING_ENABLED 0
|
#define FSFW_TCP_RECV_WIRETAPPING_ENABLED 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const std::string TcpTmTcServer::DEFAULT_TCP_SERVER_PORT = "7303";
|
const std::string TcpTmTcServer::DEFAULT_SERVER_PORT = TcpTmTcBridge::DEFAULT_SERVER_PORT;
|
||||||
|
|
||||||
TcpTmTcServer::TcpTmTcServer(object_id_t objectId, object_id_t tmtcTcpBridge,
|
TcpTmTcServer::TcpTmTcServer(object_id_t objectId, object_id_t tmtcTcpBridge,
|
||||||
size_t receptionBufferSize, std::string customTcpServerPort):
|
size_t receptionBufferSize, std::string customTcpServerPort):
|
||||||
SystemObject(objectId), tmtcBridgeId(tmtcTcpBridge),
|
SystemObject(objectId), tmtcBridgeId(tmtcTcpBridge),
|
||||||
tcpPort(customTcpServerPort), receptionBuffer(receptionBufferSize) {
|
tcpPort(customTcpServerPort), receptionBuffer(receptionBufferSize) {
|
||||||
if(tcpPort == "") {
|
if(tcpPort == "") {
|
||||||
tcpPort = DEFAULT_TCP_SERVER_PORT;
|
tcpPort = DEFAULT_SERVER_PORT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,8 +41,7 @@ class TcpTmTcServer:
|
|||||||
public TcpIpBase,
|
public TcpIpBase,
|
||||||
public ExecutableObjectIF {
|
public ExecutableObjectIF {
|
||||||
public:
|
public:
|
||||||
/* The ports chosen here should not be used by any other process. */
|
static const std::string DEFAULT_SERVER_PORT;
|
||||||
static const std::string DEFAULT_TCP_SERVER_PORT;
|
|
||||||
|
|
||||||
static constexpr size_t ETHERNET_MTU_SIZE = 1500;
|
static constexpr size_t ETHERNET_MTU_SIZE = 1500;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#define FSFW_UDP_SEND_WIRETAPPING_ENABLED 0
|
#define FSFW_UDP_SEND_WIRETAPPING_ENABLED 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const std::string UdpTmTcBridge::DEFAULT_SERVER_PORT = tcpip::DEFAULT_UDP_SERVER_PORT;
|
const std::string UdpTmTcBridge::DEFAULT_SERVER_PORT = tcpip::DEFAULT_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):
|
||||||
|
@ -13,8 +13,7 @@
|
|||||||
|
|
||||||
namespace tcpip {
|
namespace tcpip {
|
||||||
|
|
||||||
const char* const DEFAULT_UDP_SERVER_PORT = "7301";
|
const char* const DEFAULT_SERVER_PORT = "7301";
|
||||||
const char* const DEFAULT_TCP_SERVER_PORT = "7303";
|
|
||||||
|
|
||||||
enum class Protocol {
|
enum class Protocol {
|
||||||
UDP,
|
UDP,
|
||||||
|
@ -46,6 +46,7 @@ ReturnValue_t CommandExecutor::execute() {
|
|||||||
currentFd = fileno(currentCmdFile);
|
currentFd = fileno(currentCmdFile);
|
||||||
waiter.fd = currentFd;
|
waiter.fd = currentFd;
|
||||||
}
|
}
|
||||||
|
state = States::PENDING;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ int Timer::setTimer(uint32_t intervalMs) {
|
|||||||
timer.it_value.tv_nsec = (intervalMs * 1000000) % (1000000000);
|
timer.it_value.tv_nsec = (intervalMs * 1000000) % (1000000000);
|
||||||
timer.it_interval.tv_sec = 0;
|
timer.it_interval.tv_sec = 0;
|
||||||
timer.it_interval.tv_nsec = 0;
|
timer.it_interval.tv_nsec = 0;
|
||||||
|
set = true;
|
||||||
return timer_settime(timerId, 0, &timer, NULL);
|
return timer_settime(timerId, 0, &timer, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,3 +44,14 @@ int Timer::getTimer(uint32_t* remainingTimeMs){
|
|||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Timer::isSet() const {
|
||||||
|
return this->set;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Timer::resetTimer() {
|
||||||
|
if(not this->set) {
|
||||||
|
set = false;
|
||||||
|
}
|
||||||
|
setTimer(0);
|
||||||
|
}
|
||||||
|
@ -38,7 +38,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
int getTimer(uint32_t* remainingTimeMs);
|
int getTimer(uint32_t* remainingTimeMs);
|
||||||
|
|
||||||
|
bool isSet() const;
|
||||||
|
void resetTimer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool set = true;
|
||||||
timer_t timerId;
|
timer_t timerId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -56,21 +56,21 @@ void fsfwPrint(sif::PrintLevel printType, const char* fmt, va_list arg) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (printType == sif::PrintLevel::INFO_LEVEL) {
|
if (printType == sif::PrintLevel::INFO_LEVEL) {
|
||||||
len += sprintf(bufferPosition + len, "INFO: ");
|
len += sprintf(bufferPosition + len, "INFO");
|
||||||
}
|
}
|
||||||
if(printType == sif::PrintLevel::DEBUG_LEVEL) {
|
if(printType == sif::PrintLevel::DEBUG_LEVEL) {
|
||||||
len += sprintf(bufferPosition + len, "DEBUG: ");
|
len += sprintf(bufferPosition + len, "DEBUG");
|
||||||
}
|
}
|
||||||
if(printType == sif::PrintLevel::WARNING_LEVEL) {
|
if(printType == sif::PrintLevel::WARNING_LEVEL) {
|
||||||
len += sprintf(bufferPosition + len, "WARNING: ");
|
len += sprintf(bufferPosition + len, "WARNING");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(printType == sif::PrintLevel::ERROR_LEVEL) {
|
if(printType == sif::PrintLevel::ERROR_LEVEL) {
|
||||||
len += sprintf(bufferPosition + len, "ERROR: ");
|
len += sprintf(bufferPosition + len, "ERROR");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FSFW_COLORED_OUTPUT == 1
|
#if FSFW_COLORED_OUTPUT == 1
|
||||||
len += sprintf(bufferPosition, sif::ANSI_COLOR_RESET);
|
len += sprintf(bufferPosition + len, sif::ANSI_COLOR_RESET);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Clock::TimeOfDay_t now;
|
Clock::TimeOfDay_t now;
|
||||||
@ -78,7 +78,7 @@ void fsfwPrint(sif::PrintLevel printType, const char* fmt, va_list arg) {
|
|||||||
/*
|
/*
|
||||||
* Log current time to terminal if desired.
|
* Log current time to terminal if desired.
|
||||||
*/
|
*/
|
||||||
len += sprintf(bufferPosition + len, "| %lu:%02lu:%02lu.%03lu | ",
|
len += sprintf(bufferPosition + len, " | %lu:%02lu:%02lu.%03lu | ",
|
||||||
(unsigned long) now.hour,
|
(unsigned long) now.hour,
|
||||||
(unsigned long) now.minute,
|
(unsigned long) now.minute,
|
||||||
(unsigned long) now.second,
|
(unsigned long) now.second,
|
||||||
|
Loading…
Reference in New Issue
Block a user