it compiles again

This commit is contained in:
Robin Müller 2022-05-09 00:09:13 +02:00
parent 1b34b90ae0
commit 83a2882f9d
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
96 changed files with 563 additions and 1210 deletions

View File

@ -1,30 +1,19 @@
#include "fsfw_hal/common/gpio/GpioCookie.h" #include "fsfw_hal/common/gpio/GpioCookie.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
GpioCookie::GpioCookie() {} GpioCookie::GpioCookie() = default;
ReturnValue_t GpioCookie::addGpio(gpioId_t gpioId, GpioBase* gpioConfig) { ReturnValue_t GpioCookie::addGpio(gpioId_t gpioId, GpioBase* gpioConfig) {
if (gpioConfig == nullptr) { if (gpioConfig == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGW("addGpio: gpioConfig is nullpointer\n");
sif::warning << "GpioCookie::addGpio: gpioConfig is nullpointer" << std::endl;
#else
sif::printWarning("GpioCookie::addGpio: gpioConfig is nullpointer\n");
#endif
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
auto gpioMapIter = gpioMap.find(gpioId); auto gpioMapIter = gpioMap.find(gpioId);
if (gpioMapIter == gpioMap.end()) { if (gpioMapIter == gpioMap.end()) {
auto statusPair = gpioMap.emplace(gpioId, gpioConfig); auto statusPair = gpioMap.emplace(gpioId, gpioConfig);
if (statusPair.second == false) { if (!statusPair.second) {
#if FSFW_VERBOSE_LEVEL >= 1 FSFW_LOGW("addGpio: Failed to add GPIO {} to GPIO map\n", gpioId);
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "GpioCookie::addGpio: Failed to add GPIO " << gpioId << " to GPIO map"
<< std::endl;
#else
sif::printWarning("GpioCookie::addGpio: Failed to add GPIO %d to GPIO map\n", gpioId);
#endif
#endif
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;

View File

@ -60,16 +60,8 @@ ReturnValue_t GyroHandlerL3GD20H::buildTransitionDeviceCommand(DeviceCommandId_t
return buildCommandFromCommand(*id, nullptr, 0); return buildCommandFromCommand(*id, nullptr, 0);
} }
default: default:
#if FSFW_CPP_OSTREAM_ENABLED == 1
/* Might be a configuration error. */ /* Might be a configuration error. */
sif::warning << "GyroL3GD20Handler::buildTransitionDeviceCommand: " FSFW_LOGW("buildTransitionDeviceCommand: Unknown internal state\n");
"Unknown internal state!"
<< std::endl;
#else
sif::printDebug(
"GyroL3GD20Handler::buildTransitionDeviceCommand: "
"Unknown internal state!\n");
#endif
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
@ -192,17 +184,8 @@ ReturnValue_t GyroHandlerL3GD20H::interpretDeviceReply(DeviceCommandId_t id,
if (periodicPrintout) { if (periodicPrintout) {
if (debugDivider.checkAndIncrement()) { if (debugDivider.checkAndIncrement()) {
/* Set terminal to utf-8 if there is an issue with micro printout. */ /* Set terminal to utf-8 if there is an issue with micro printout. */
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGI("GyroHandlerL3GD20H: Angular velocities (deg/s):\nX {} | Y {} | Z {}\n",
sif::info << "GyroHandlerL3GD20H: Angular velocities (deg/s):" << std::endl; angVelocX, angVelocY, angVelocZ);
sif::info << "X: " << angVelocX << std::endl;
sif::info << "Y: " << angVelocY << std::endl;
sif::info << "Z: " << angVelocZ << std::endl;
#else
sif::printInfo("GyroHandlerL3GD20H: Angular velocities (deg/s):\n");
sif::printInfo("X: %f\n", angVelocX);
sif::printInfo("Y: %f\n", angVelocY);
sif::printInfo("Z: %f\n", angVelocZ);
#endif
} }
} }

View File

@ -76,21 +76,16 @@ ReturnValue_t MgmLIS3MDLHandler::buildTransitionDeviceCommand(DeviceCommandId_t
} }
default: { default: {
/* might be a configuration error. */ /* might be a configuration error. */
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGW("buildTransitionDeviceCommand: Unknown internal state\n");
sif::warning << "GyroHandler::buildTransitionDeviceCommand: Unknown internal state!"
<< std::endl;
#else
sif::printWarning("GyroHandler::buildTransitionDeviceCommand: Unknown internal state!\n");
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
} }
return buildCommandFromCommand(*id, NULL, 0); return buildCommandFromCommand(*id, nullptr, 0);
} }
uint8_t MgmLIS3MDLHandler::readCommand(uint8_t command, bool continuousCom) { uint8_t MgmLIS3MDLHandler::readCommand(uint8_t command, bool continuousCom) {
command |= (1 << MGMLIS3MDL::RW_BIT); command |= (1 << MGMLIS3MDL::RW_BIT);
if (continuousCom == true) { if (continuousCom) {
command |= (1 << MGMLIS3MDL::MS_BIT); command |= (1 << MGMLIS3MDL::MS_BIT);
} }
return command; return command;
@ -98,7 +93,7 @@ uint8_t MgmLIS3MDLHandler::readCommand(uint8_t command, bool continuousCom) {
uint8_t MgmLIS3MDLHandler::writeCommand(uint8_t command, bool continuousCom) { uint8_t MgmLIS3MDLHandler::writeCommand(uint8_t command, bool continuousCom) {
command &= ~(1 << MGMLIS3MDL::RW_BIT); command &= ~(1 << MGMLIS3MDL::RW_BIT);
if (continuousCom == true) { if (continuousCom) {
command |= (1 << MGMLIS3MDL::MS_BIT); command |= (1 << MGMLIS3MDL::MS_BIT);
} }
return command; return command;
@ -186,13 +181,7 @@ ReturnValue_t MgmLIS3MDLHandler::scanForReply(const uint8_t *start, size_t len,
// Check validity by checking config registers // Check validity by checking config registers
if (start[1] != registers[0] or start[2] != registers[1] or start[3] != registers[2] or if (start[1] != registers[0] or start[2] != registers[1] or start[3] != registers[2] or
start[4] != registers[3] or start[5] != registers[4]) { start[4] != registers[3] or start[5] != registers[4]) {
#if FSFW_VERBOSE_LEVEL >= 1 FSFW_LOGW("scanForReply: Invalid registers\n");
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "MGMHandlerLIS3MDL::scanForReply: Invalid registers!" << std::endl;
#else
sif::printWarning("MGMHandlerLIS3MDL::scanForReply: Invalid registers!\n");
#endif
#endif
return DeviceHandlerIF::INVALID_DATA; return DeviceHandlerIF::INVALID_DATA;
} }
if (mode == _MODE_START_UP) { if (mode == _MODE_START_UP) {
@ -210,17 +199,9 @@ ReturnValue_t MgmLIS3MDLHandler::scanForReply(const uint8_t *start, size_t len,
*foundId = getPendingCommand(); *foundId = getPendingCommand();
if (*foundId == MGMLIS3MDL::IDENTIFY_DEVICE) { if (*foundId == MGMLIS3MDL::IDENTIFY_DEVICE) {
if (start[1] != MGMLIS3MDL::DEVICE_ID) { if (start[1] != MGMLIS3MDL::DEVICE_ID) {
#if FSFW_VERBOSE_LEVEL >= 1 FSFW_FLOGW(
#if FSFW_CPP_OSTREAM_ENABLED == 1 "scanForReply: Device identification failed, found ID {} not equal to expected {}\n",
sif::warning << "MGMHandlerLIS3MDL::scanForReply: " start[1], MGMLIS3MDL::DEVICE_ID);
"Device identification failed!"
<< std::endl;
#else
sif::printWarning(
"MGMHandlerLIS3MDL::scanForReply: "
"Device identification failed!\n");
#endif
#endif
return DeviceHandlerIF::INVALID_DATA; return DeviceHandlerIF::INVALID_DATA;
} }
@ -268,19 +249,10 @@ ReturnValue_t MgmLIS3MDLHandler::interpretDeviceReply(DeviceCommandId_t id, cons
if (periodicPrintout) { if (periodicPrintout) {
if (debugDivider.checkAndIncrement()) { if (debugDivider.checkAndIncrement()) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGI(
sif::info << "MGMHandlerLIS3: Magnetic field strength in" "MGMHandlerLIS3: Magnetic field strength in"
" microtesla:" " microtesla (uT):\nX {} | Y {} | Z {}\n",
<< std::endl; mgmX, mgmY, mgmZ);
sif::info << "X: " << mgmX << " uT" << std::endl;
sif::info << "Y: " << mgmY << " uT" << std::endl;
sif::info << "Z: " << mgmZ << " uT" << std::endl;
#else
sif::printInfo("MGMHandlerLIS3: Magnetic field strength in microtesla:\n");
sif::printInfo("X: %f uT\n", mgmX);
sif::printInfo("Y: %f uT\n", mgmY);
sif::printInfo("Z: %f uT\n", mgmZ);
#endif /* FSFW_CPP_OSTREAM_ENABLED == 0 */
} }
} }
@ -311,15 +283,11 @@ ReturnValue_t MgmLIS3MDLHandler::interpretDeviceReply(DeviceCommandId_t id, cons
} }
case MGMLIS3MDL::READ_TEMPERATURE: { case MGMLIS3MDL::READ_TEMPERATURE: {
int16_t tempValueRaw = packet[2] << 8 | packet[1]; auto tempValueRaw = static_cast<int16_t>((packet[2] << 8) | packet[1]);
float tempValue = 25.0 + ((static_cast<float>(tempValueRaw)) / 8.0); float tempValue = 25.0 + ((static_cast<float>(tempValueRaw)) / 8.0);
if (periodicPrintout) { if (periodicPrintout) {
if (debugDivider.check()) { if (debugDivider.check()) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGI("MGMHandlerLIS3: Temperature: {} C\n", tempValue);
sif::info << "MGMHandlerLIS3: Temperature: " << tempValue << " C" << std::endl;
#else
sif::printInfo("MGMHandlerLIS3: Temperature: %f C\n");
#endif
} }
} }

View File

@ -81,18 +81,8 @@ ReturnValue_t MgmRM3100Handler::buildTransitionDeviceCommand(DeviceCommandId_t *
break; break;
} }
default: default:
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
// Might be a configuration error // Might be a configuration error
sif::warning << "MgmRM3100Handler::buildTransitionDeviceCommand: " FSFW_LOGW("buildTransitionDeviceCommand: Unknown internal state\n");
"Unknown internal state"
<< std::endl;
#else
sif::printWarning(
"MgmRM3100Handler::buildTransitionDeviceCommand: "
"Unknown internal state\n");
#endif
#endif
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
@ -335,19 +325,10 @@ ReturnValue_t MgmRM3100Handler::handleDataReadout(const uint8_t *packet) {
if (periodicPrintout) { if (periodicPrintout) {
if (debugDivider.checkAndIncrement()) { if (debugDivider.checkAndIncrement()) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGI(
sif::info << "MgmRM3100Handler: Magnetic field strength in" "MgmRM3100Handler: Magnetic field strength in"
" microtesla:" " microtesla(uT)\nX {} | Y {} | Z {}\n",
<< std::endl; fieldStrengthX, fieldStrengthY, fieldStrengthZ);
sif::info << "X: " << fieldStrengthX << " uT" << std::endl;
sif::info << "Y: " << fieldStrengthY << " uT" << std::endl;
sif::info << "Z: " << fieldStrengthZ << " uT" << std::endl;
#else
sif::printInfo("MgmRM3100Handler: Magnetic field strength in microtesla:\n");
sif::printInfo("X: %f uT\n", fieldStrengthX);
sif::printInfo("Y: %f uT\n", fieldStrengthY);
sif::printInfo("Z: %f uT\n", fieldStrengthZ);
#endif
} }
} }

View File

@ -59,22 +59,16 @@ ReturnValue_t CommandExecutor::close() {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
void CommandExecutor::printLastError(std::string funcName) const { void CommandExecutor::printLastError(const std::string& funcName) const {
if (lastError != 0) { if (lastError != 0) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGW("{} | pclose failed with code {} | {}\n", funcName, lastError, strerror(lastError));
sif::warning << funcName << " pclose failed with code " << lastError << ": "
<< strerror(lastError) << std::endl;
#else
sif::printError("%s pclose failed with code %d: %s\n", funcName, lastError,
strerror(lastError));
#endif
} }
} }
void CommandExecutor::setRingBuffer(SimpleRingBuffer* ringBuffer, void CommandExecutor::setRingBuffer(SimpleRingBuffer* ringBuffer_,
DynamicFIFO<uint16_t>* sizesFifo) { DynamicFIFO<uint16_t>* sizesFifo_) {
this->ringBuffer = ringBuffer; this->ringBuffer = ringBuffer_;
this->sizesFifo = sizesFifo; this->sizesFifo = sizesFifo_;
} }
ReturnValue_t CommandExecutor::check(bool& replyReceived) { ReturnValue_t CommandExecutor::check(bool& replyReceived) {
@ -102,23 +96,13 @@ ReturnValue_t CommandExecutor::check(bool& replyReceived) {
ssize_t readBytes = read(currentFd, readVec.data(), readVec.size()); ssize_t readBytes = read(currentFd, readVec.data(), readVec.size());
if (readBytes == 0) { if (readBytes == 0) {
// Should not happen // Should not happen
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGWT("CommandExecutor::check: No bytes read after poll event\n");
sif::warning << "CommandExecutor::check: No bytes read "
"after poll event.."
<< std::endl;
#else
sif::printWarning("CommandExecutor::check: No bytes read after poll event..\n");
#endif
break; break;
} else if (readBytes > 0) { } else if (readBytes > 0) {
replyReceived = true; replyReceived = true;
if (printOutput) { if (printOutput) {
// It is assumed the command output is line terminated // It is assumed the command output is line terminated
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGIT("{} | {}", currentCmd, readVec.data());
sif::info << currentCmd << " | " << readVec.data();
#else
sif::printInfo("%s | %s", currentCmd, readVec.data());
#endif
} }
if (ringBuffer != nullptr) { if (ringBuffer != nullptr) {
ringBuffer->writeData(reinterpret_cast<const uint8_t*>(readVec.data()), readBytes); ringBuffer->writeData(reinterpret_cast<const uint8_t*>(readVec.data()), readBytes);
@ -130,20 +114,11 @@ ReturnValue_t CommandExecutor::check(bool& replyReceived) {
} }
} else { } else {
// Should also not happen // Should also not happen
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGW("check: Error {} | {}\n", errno, strerror(errno));
sif::warning << "CommandExecutor::check: Error " << errno << ": " << strerror(errno)
<< std::endl;
#else
sif::printWarning("CommandExecutor::check: Error %d: %s\n", errno, strerror(errno));
#endif
} }
} }
if (waiter.revents & POLLERR) { if (waiter.revents & POLLERR) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGW("check: Poll error\n");
sif::warning << "CommandExecuter::check: Poll error" << std::endl;
#else
sif::printWarning("CommandExecuter::check: Poll error\n");
#endif
return COMMAND_ERROR; return COMMAND_ERROR;
} }
if (waiter.revents & POLLHUP) { if (waiter.revents & POLLHUP) {
@ -183,11 +158,7 @@ ReturnValue_t CommandExecutor::executeBlocking() {
while (fgets(readVec.data(), readVec.size(), currentCmdFile) != nullptr) { while (fgets(readVec.data(), readVec.size(), currentCmdFile) != nullptr) {
std::string output(readVec.data()); std::string output(readVec.data());
if (printOutput) { if (printOutput) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGI("{} | {}", currentCmd, output);
sif::info << currentCmd << " | " << output;
#else
sif::printInfo("%s | %s", currentCmd, output);
#endif
} }
if (ringBuffer != nullptr) { if (ringBuffer != nullptr) {
ringBuffer->writeData(reinterpret_cast<const uint8_t*>(output.data()), output.size()); ringBuffer->writeData(reinterpret_cast<const uint8_t*>(output.data()), output.size());

View File

@ -93,7 +93,7 @@ class CommandExecutor {
States getCurrentState() const; States getCurrentState() const;
int getLastError() const; int getLastError() const;
void printLastError(std::string funcName) const; void printLastError(const std::string& funcName) const;
/** /**
* Assign a ring buffer and a FIFO which will be filled by the executor with the output * Assign a ring buffer and a FIFO which will be filled by the executor with the output

View File

@ -14,15 +14,8 @@ UnixFileGuard::UnixFileGuard(std::string device, int* fileDescriptor, int flags,
} }
*fileDescriptor = open(device.c_str(), flags); *fileDescriptor = open(device.c_str(), flags);
if (*fileDescriptor < 0) { if (*fileDescriptor < 0) {
#if FSFW_VERBOSE_LEVEL >= 1 FSFW_LOGW("{} | Opening device failed with error code {} | {}\n", diagnosticPrefix, errno,
#if FSFW_CPP_OSTREAM_ENABLED == 1 strerror(errno));
sif::warning << diagnosticPrefix << ": Opening device failed with error code " << errno << ": "
<< strerror(errno) << std::endl;
#else
sif::printWarning("%s: Opening device failed with error code %d: %s\n", diagnosticPrefix, errno,
strerror(errno));
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
openStatus = OPEN_FILE_FAILED; openStatus = OPEN_FILE_FAILED;
} }
} }

View File

@ -26,7 +26,7 @@ ReturnValue_t I2cComIF::initializeInterface(CookieIF* cookie) {
std::string deviceFile; std::string deviceFile;
if (cookie == nullptr) { if (cookie == nullptr) {
FSFW_LOGE("{}", "initializeInterface: Invalid cookie\n"); FSFW_FLOGE("{}", "initializeInterface: Invalid cookie\n");
return NULLPOINTER; return NULLPOINTER;
} }
auto* i2cCookie = dynamic_cast<I2cCookie*>(cookie); auto* i2cCookie = dynamic_cast<I2cCookie*>(cookie);
@ -38,14 +38,14 @@ ReturnValue_t I2cComIF::initializeInterface(CookieIF* cookie) {
I2cInstance i2cInstance = {std::vector<uint8_t>(maxReplyLen), 0}; I2cInstance i2cInstance = {std::vector<uint8_t>(maxReplyLen), 0};
auto statusPair = i2cDeviceMap.emplace(i2cAddress, i2cInstance); auto statusPair = i2cDeviceMap.emplace(i2cAddress, i2cInstance);
if (not statusPair.second) { if (not statusPair.second) {
FSFW_LOGW("initializeInterface: Failed to insert device with address {} to I2C device map\n", FSFW_FLOGW("initializeInterface: Failed to insert device with address {} to I2C device map\n",
i2cAddress); i2cAddress);
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
FSFW_LOGE("initializeInterface: Device with address {} already in use\n", i2cAddress); FSFW_FLOGE("initializeInterface: Device with address {} already in use\n", i2cAddress);
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
@ -55,7 +55,7 @@ ReturnValue_t I2cComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
std::string deviceFile; std::string deviceFile;
if (sendData == nullptr) { if (sendData == nullptr) {
FSFW_LOGW("{}", "sendMessage: Send Data is nullptr\n"); FSFW_FLOGW("{}", "sendMessage: Send Data is nullptr\n");
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
@ -65,14 +65,14 @@ ReturnValue_t I2cComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
auto* i2cCookie = dynamic_cast<I2cCookie*>(cookie); auto* i2cCookie = dynamic_cast<I2cCookie*>(cookie);
if (i2cCookie == nullptr) { if (i2cCookie == nullptr) {
FSFW_LOGWT("{}", "sendMessage: Invalid I2C Cookie\n"); FSFW_FLOGWT("{}", "sendMessage: Invalid I2C Cookie\n");
return NULLPOINTER; return NULLPOINTER;
} }
address_t i2cAddress = i2cCookie->getAddress(); address_t i2cAddress = i2cCookie->getAddress();
i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress); i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress);
if (i2cDeviceMapIter == i2cDeviceMap.end()) { if (i2cDeviceMapIter == i2cDeviceMap.end()) {
FSFW_LOGWT("{}", "sendMessage: I2C address of cookie not registered in I2C device map\n"); FSFW_FLOGWT("{}", "sendMessage: I2C address of cookie not registered in I2C device map\n");
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
@ -87,8 +87,8 @@ ReturnValue_t I2cComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
} }
if (write(fd, sendData, sendLen) != static_cast<int>(sendLen)) { if (write(fd, sendData, sendLen) != static_cast<int>(sendLen)) {
FSFW_LOGE("sendMessage: Failed to send data to I2C device with error code {} | {}\n", errno, FSFW_FLOGE("sendMessage: Failed to send data to I2C device with error code {} | {}\n", errno,
strerror(errno)); strerror(errno));
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
@ -112,7 +112,7 @@ ReturnValue_t I2cComIF::requestReceiveMessage(CookieIF* cookie, size_t requestLe
auto* i2cCookie = dynamic_cast<I2cCookie*>(cookie); auto* i2cCookie = dynamic_cast<I2cCookie*>(cookie);
if (i2cCookie == nullptr) { if (i2cCookie == nullptr) {
FSFW_LOGWT("{}", "requestReceiveMessage: Invalid I2C Cookie\n"); FSFW_FLOGWT("{}", "requestReceiveMessage: Invalid I2C Cookie\n");
i2cDeviceMapIter->second.replyLen = 0; i2cDeviceMapIter->second.replyLen = 0;
return NULLPOINTER; return NULLPOINTER;
} }
@ -120,8 +120,8 @@ ReturnValue_t I2cComIF::requestReceiveMessage(CookieIF* cookie, size_t requestLe
address_t i2cAddress = i2cCookie->getAddress(); address_t i2cAddress = i2cCookie->getAddress();
i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress); i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress);
if (i2cDeviceMapIter == i2cDeviceMap.end()) { if (i2cDeviceMapIter == i2cDeviceMap.end()) {
FSFW_LOGW("requestReceiveMessage: I2C address {} of Cookie not registered in i2cDeviceMap", FSFW_FLOGW("requestReceiveMessage: I2C address {} of Cookie not registered in i2cDeviceMap",
i2cAddress); i2cAddress);
i2cDeviceMapIter->second.replyLen = 0; i2cDeviceMapIter->second.replyLen = 0;
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
@ -141,7 +141,7 @@ ReturnValue_t I2cComIF::requestReceiveMessage(CookieIF* cookie, size_t requestLe
ssize_t readLen = read(fd, replyBuffer, requestLen); ssize_t readLen = read(fd, replyBuffer, requestLen);
if (readLen != static_cast<int>(requestLen)) { if (readLen != static_cast<int>(requestLen)) {
FSFW_LOGWT( FSFW_FLOGWT(
"requestReceiveMessage: Reading from I2C device failed with error code " "requestReceiveMessage: Reading from I2C device failed with error code "
"{} | {}\nRead only {} from {} bytes\n", "{} | {}\nRead only {} from {} bytes\n",
errno, strerror(errno), readLen, requestLen); errno, strerror(errno), readLen, requestLen);
@ -161,15 +161,15 @@ ReturnValue_t I2cComIF::requestReceiveMessage(CookieIF* cookie, size_t requestLe
ReturnValue_t I2cComIF::readReceivedMessage(CookieIF* cookie, uint8_t** buffer, size_t* size) { ReturnValue_t I2cComIF::readReceivedMessage(CookieIF* cookie, uint8_t** buffer, size_t* size) {
auto* i2cCookie = dynamic_cast<I2cCookie*>(cookie); auto* i2cCookie = dynamic_cast<I2cCookie*>(cookie);
if (i2cCookie == nullptr) { if (i2cCookie == nullptr) {
FSFW_LOGW("{}", "readReceivedMessage: Invalid I2C Cookie\n"); FSFW_FLOGW("{}", "readReceivedMessage: Invalid I2C Cookie\n");
return NULLPOINTER; return NULLPOINTER;
} }
address_t i2cAddress = i2cCookie->getAddress(); address_t i2cAddress = i2cCookie->getAddress();
i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress); i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress);
if (i2cDeviceMapIter == i2cDeviceMap.end()) { if (i2cDeviceMapIter == i2cDeviceMap.end()) {
FSFW_LOGE("readReceivedMessage: I2C address {} of cookie not found in I2C device map\n", FSFW_FLOGE("readReceivedMessage: I2C address {} of cookie not found in I2C device map\n",
i2cAddress); i2cAddress);
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
*buffer = i2cDeviceMapIter->second.replyBuffer.data(); *buffer = i2cDeviceMapIter->second.replyBuffer.data();
@ -181,8 +181,8 @@ ReturnValue_t I2cComIF::readReceivedMessage(CookieIF* cookie, uint8_t** buffer,
ReturnValue_t I2cComIF::openDevice(std::string deviceFile, address_t i2cAddress, ReturnValue_t I2cComIF::openDevice(std::string deviceFile, address_t i2cAddress,
int* fileDescriptor) { int* fileDescriptor) {
if (ioctl(*fileDescriptor, I2C_SLAVE, i2cAddress) < 0) { if (ioctl(*fileDescriptor, I2C_SLAVE, i2cAddress) < 0) {
FSFW_LOGWT("openDevice: Specifying target device failed with error code {} | {}\n", errno, FSFW_FLOGWT("openDevice: Specifying target device failed with error code {} | {}\n", errno,
strerror(errno)); strerror(errno));
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;

View File

@ -19,7 +19,7 @@
SpiComIF::SpiComIF(object_id_t objectId, GpioIF* gpioComIF) SpiComIF::SpiComIF(object_id_t objectId, GpioIF* gpioComIF)
: SystemObject(objectId), gpioComIF(gpioComIF) { : SystemObject(objectId), gpioComIF(gpioComIF) {
if (gpioComIF == nullptr) { if (gpioComIF == nullptr) {
FSFW_LOGET("{}", "SpiComIF::SpiComIF: GPIO communication interface invalid\n"); FSFW_FLOGET("{}", "SpiComIF::SpiComIF: GPIO communication interface invalid\n");
} }
spiMutex = MutexFactory::instance()->createMutex(); spiMutex = MutexFactory::instance()->createMutex();
@ -40,7 +40,7 @@ ReturnValue_t SpiComIF::initializeInterface(CookieIF* cookie) {
SpiInstance spiInstance(bufferSize); SpiInstance spiInstance(bufferSize);
auto statusPair = spiDeviceMap.emplace(spiAddress, spiInstance); auto statusPair = spiDeviceMap.emplace(spiAddress, spiInstance);
if (not statusPair.second) { if (not statusPair.second) {
FSFW_LOGWT( FSFW_FLOGWT(
"SpiComIF::initializeInterface: Failed to insert device with address {} to SPI device " "SpiComIF::initializeInterface: Failed to insert device with address {} to SPI device "
"map\n", "map\n",
spiAddress); spiAddress);
@ -50,7 +50,7 @@ ReturnValue_t SpiComIF::initializeInterface(CookieIF* cookie) {
to the SPI driver transfer struct */ to the SPI driver transfer struct */
spiCookie->assignReadBuffer(statusPair.first->second.replyBuffer.data()); spiCookie->assignReadBuffer(statusPair.first->second.replyBuffer.data());
} else { } else {
FSFW_LOGWT("{}", "initializeInterface: SPI address already exists\n"); FSFW_FLOGWT("{}", "initializeInterface: SPI address already exists\n");
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
@ -123,7 +123,7 @@ ReturnValue_t SpiComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
} }
if (sendLen > spiCookie->getMaxBufferSize()) { if (sendLen > spiCookie->getMaxBufferSize()) {
FSFW_LOGW( FSFW_FLOGW(
"sendMessage: Too much data sent, send length {} larger than maximum buffer length {}\n", "sendMessage: Too much data sent, send length {} larger than maximum buffer length {}\n",
spiCookie->getMaxBufferSize(), sendLen); spiCookie->getMaxBufferSize(), sendLen);
return DeviceCommunicationIF::TOO_MUCH_DATA; return DeviceCommunicationIF::TOO_MUCH_DATA;
@ -173,12 +173,12 @@ ReturnValue_t SpiComIF::performRegularSendOperation(SpiCookie* spiCookie, const
if (gpioId != gpio::NO_GPIO) { if (gpioId != gpio::NO_GPIO) {
result = spiMutex->lockMutex(timeoutType, timeoutMs); result = spiMutex->lockMutex(timeoutType, timeoutMs);
if (result != RETURN_OK) { if (result != RETURN_OK) {
FSFW_LOGET("{}", "sendMessage: Failed to lock mutex\n"); FSFW_FLOGET("{}", "sendMessage: Failed to lock mutex\n");
return result; return result;
} }
result = gpioComIF->pullLow(gpioId); result = gpioComIF->pullLow(gpioId);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
FSFW_LOGW("{}", "sendMessage: Pulling low CS pin failed\n"); FSFW_FLOGW("{}", "sendMessage: Pulling low CS pin failed\n");
return result; return result;
} }
} }
@ -197,7 +197,7 @@ ReturnValue_t SpiComIF::performRegularSendOperation(SpiCookie* spiCookie, const
} else { } else {
/* We write with a blocking half-duplex transfer here */ /* We write with a blocking half-duplex transfer here */
if (write(fileDescriptor, sendData, sendLen) != static_cast<ssize_t>(sendLen)) { if (write(fileDescriptor, sendData, sendLen) != static_cast<ssize_t>(sendLen)) {
FSFW_LOGET("{}", "sendMessage: Half-Duplex write operation failed\n"); FSFW_FLOGET("{}", "sendMessage: Half-Duplex write operation failed\n");
result = HALF_DUPLEX_TRANSFER_FAILED; result = HALF_DUPLEX_TRANSFER_FAILED;
} }
} }
@ -206,7 +206,7 @@ ReturnValue_t SpiComIF::performRegularSendOperation(SpiCookie* spiCookie, const
gpioComIF->pullHigh(gpioId); gpioComIF->pullHigh(gpioId);
result = spiMutex->unlockMutex(); result = spiMutex->unlockMutex();
if (result != RETURN_OK) { if (result != RETURN_OK) {
FSFW_LOGWT("{}", "sendMessage: Failed to unlock mutex\n"); FSFW_FLOGWT("{}", "sendMessage: Failed to unlock mutex\n");
return result; return result;
} }
} }
@ -248,14 +248,14 @@ ReturnValue_t SpiComIF::performHalfDuplexReception(SpiCookie* spiCookie) {
if (gpioId != gpio::NO_GPIO) { if (gpioId != gpio::NO_GPIO) {
result = spiMutex->lockMutex(timeoutType, timeoutMs); result = spiMutex->lockMutex(timeoutType, timeoutMs);
if (result != RETURN_OK) { if (result != RETURN_OK) {
FSFW_LOGW("{}", "getSendSuccess: Failed to lock mutex\n"); FSFW_FLOGW("{}", "getSendSuccess: Failed to lock mutex\n");
return result; return result;
} }
gpioComIF->pullLow(gpioId); gpioComIF->pullLow(gpioId);
} }
if (read(fileDescriptor, rxBuf, readSize) != static_cast<ssize_t>(readSize)) { if (read(fileDescriptor, rxBuf, readSize) != static_cast<ssize_t>(readSize)) {
FSFW_LOGW("{}", "sendMessage: Half-Duplex read operation failed\n"); FSFW_FLOGW("{}", "sendMessage: Half-Duplex read operation failed\n");
result = HALF_DUPLEX_TRANSFER_FAILED; result = HALF_DUPLEX_TRANSFER_FAILED;
} }
@ -263,7 +263,7 @@ ReturnValue_t SpiComIF::performHalfDuplexReception(SpiCookie* spiCookie) {
gpioComIF->pullHigh(gpioId); gpioComIF->pullHigh(gpioId);
result = spiMutex->unlockMutex(); result = spiMutex->unlockMutex();
if (result != RETURN_OK) { if (result != RETURN_OK) {
FSFW_LOGW("{}", "getSendSuccess: Failed to unlock mutex\n"); FSFW_FLOGW("{}", "getSendSuccess: Failed to unlock mutex\n");
return result; return result;
} }
} }

View File

@ -25,7 +25,7 @@ ReturnValue_t UartComIF::initializeInterface(CookieIF* cookie) {
auto* uartCookie = dynamic_cast<UartCookie*>(cookie); auto* uartCookie = dynamic_cast<UartCookie*>(cookie);
if (uartCookie == nullptr) { if (uartCookie == nullptr) {
FSFW_LOGE("{}", "initializeInterface: Invalid UART Cookie\n"); FSFW_FLOGE("{}", "initializeInterface: Invalid UART Cookie\n");
return NULLPOINTER; return NULLPOINTER;
} }
@ -41,11 +41,12 @@ ReturnValue_t UartComIF::initializeInterface(CookieIF* cookie) {
UartElements uartElements = {fileDescriptor, std::vector<uint8_t>(maxReplyLen), 0}; UartElements uartElements = {fileDescriptor, std::vector<uint8_t>(maxReplyLen), 0};
auto status = uartDeviceMap.emplace(deviceFile, uartElements); auto status = uartDeviceMap.emplace(deviceFile, uartElements);
if (!status.second) { if (!status.second) {
FSFW_LOGW("initializeInterface: Failed to insert device {} to UART device map\n", deviceFile); FSFW_FLOGW("initializeInterface: Failed to insert device {} to UART device map\n",
deviceFile);
return RETURN_FAILED; return RETURN_FAILED;
} }
} else { } else {
FSFW_LOGW("initializeInterface: UART device {} already in use\n", deviceFile); FSFW_FLOGW("initializeInterface: UART device {} already in use\n", deviceFile);
return RETURN_FAILED; return RETURN_FAILED;
} }
@ -65,14 +66,14 @@ int UartComIF::configureUartPort(UartCookie* uartCookie) {
int fd = open(deviceFile.c_str(), flags); int fd = open(deviceFile.c_str(), flags);
if (fd < 0) { if (fd < 0) {
FSFW_LOGW("configureUartPort: Failed to open UART {} with error code {} | {}\n", deviceFile, FSFW_FLOGW("configureUartPort: Failed to open UART {} with error code {} | {}\n", deviceFile,
errno, strerror(errno)); errno, strerror(errno));
return fd; return fd;
} }
/* Read in existing settings */ /* Read in existing settings */
if (tcgetattr(fd, &options) != 0) { if (tcgetattr(fd, &options) != 0) {
FSFW_LOGW("configureUartPort: Error {} from tcgetattr: {}\n", errno, strerror(errno)); FSFW_FLOGW("configureUartPort: Error {} from tcgetattr: {}\n", errno, strerror(errno));
return fd; return fd;
} }
@ -93,8 +94,8 @@ int UartComIF::configureUartPort(UartCookie* uartCookie) {
/* Save option settings */ /* Save option settings */
if (tcsetattr(fd, TCSANOW, &options) != 0) { if (tcsetattr(fd, TCSANOW, &options) != 0) {
FSFW_LOGW("configureUartPort: Failed to set options with error {} | {}\n", errno, FSFW_FLOGW("configureUartPort: Failed to set options with error {} | {}\n", errno,
strerror(errno)); strerror(errno));
return fd; return fd;
} }
return fd; return fd;
@ -146,8 +147,8 @@ void UartComIF::setDatasizeOptions(struct termios* options, UartCookie* uartCook
options->c_cflag |= CS8; options->c_cflag |= CS8;
break; break;
default: default:
FSFW_LOGW("setDatasizeOptions: Invalid size {} specified\n", FSFW_FLOGW("setDatasizeOptions: Invalid size {} specified\n",
static_cast<unsigned int>(uartCookie->getBitsPerWord())); static_cast<unsigned int>(uartCookie->getBitsPerWord()));
break; break;
} }
} }
@ -300,7 +301,7 @@ void UartComIF::configureBaudrate(struct termios* options, UartCookie* uartCooki
break; break;
#endif // ! __APPLE__ #endif // ! __APPLE__
default: default:
FSFW_LOGW("{}", "UartComIF::configureBaudrate: Baudrate not supported\n"); FSFW_FLOGW("{}", "UartComIF::configureBaudrate: Baudrate not supported\n");
break; break;
} }
} }
@ -315,27 +316,27 @@ ReturnValue_t UartComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData,
} }
if (sendData == nullptr) { if (sendData == nullptr) {
FSFW_LOGWT("{}", "sendMessage: Send data is nullptr"); FSFW_FLOGWT("{}", "sendMessage: Send data is nullptr");
return RETURN_FAILED; return RETURN_FAILED;
} }
auto* uartCookie = dynamic_cast<UartCookie*>(cookie); auto* uartCookie = dynamic_cast<UartCookie*>(cookie);
if (uartCookie == nullptr) { if (uartCookie == nullptr) {
FSFW_LOGWT("{}", "sendMessage: Invalid UART Cookie\n"); FSFW_FLOGWT("{}", "sendMessage: Invalid UART Cookie\n");
return NULLPOINTER; return NULLPOINTER;
} }
deviceFile = uartCookie->getDeviceFile(); deviceFile = uartCookie->getDeviceFile();
uartDeviceMapIter = uartDeviceMap.find(deviceFile); uartDeviceMapIter = uartDeviceMap.find(deviceFile);
if (uartDeviceMapIter == uartDeviceMap.end()) { if (uartDeviceMapIter == uartDeviceMap.end()) {
FSFW_LOGWT("{}", "sendMessage: Device file {} not in UART map\n", deviceFile); FSFW_FLOGWT("{}", "sendMessage: Device file {} not in UART map\n", deviceFile);
return RETURN_FAILED; return RETURN_FAILED;
} }
fd = uartDeviceMapIter->second.fileDescriptor; fd = uartDeviceMapIter->second.fileDescriptor;
if (write(fd, sendData, sendLen) != static_cast<int>(sendLen)) { if (write(fd, sendData, sendLen) != static_cast<int>(sendLen)) {
FSFW_LOGE("sendMessage: Failed to send data with error code {} | {}", errno, strerror(errno)); FSFW_FLOGE("sendMessage: Failed to send data with error code {} | {}", errno, strerror(errno));
return RETURN_FAILED; return RETURN_FAILED;
} }
@ -350,7 +351,7 @@ ReturnValue_t UartComIF::requestReceiveMessage(CookieIF* cookie, size_t requestL
auto* uartCookie = dynamic_cast<UartCookie*>(cookie); auto* uartCookie = dynamic_cast<UartCookie*>(cookie);
if (uartCookie == nullptr) { if (uartCookie == nullptr) {
FSFW_LOGWT("{}", "requestReceiveMessage: Invalid UART Cookie\n"); FSFW_FLOGWT("{}", "requestReceiveMessage: Invalid UART Cookie\n");
return NULLPOINTER; return NULLPOINTER;
} }
@ -363,7 +364,7 @@ ReturnValue_t UartComIF::requestReceiveMessage(CookieIF* cookie, size_t requestL
} }
if (uartDeviceMapIter == uartDeviceMap.end()) { if (uartDeviceMapIter == uartDeviceMap.end()) {
FSFW_LOGW("requestReceiveMessage: Device file {} not in UART map\n", deviceFile); FSFW_FLOGW("requestReceiveMessage: Device file {} not in UART map\n", deviceFile);
return RETURN_FAILED; return RETURN_FAILED;
} }
@ -392,7 +393,7 @@ ReturnValue_t UartComIF::handleCanonicalRead(UartCookie& uartCookie, UartDeviceM
if (currentBytesRead >= maxReplySize) { if (currentBytesRead >= maxReplySize) {
// Overflow risk. Emit warning, trigger event and break. If this happens, // Overflow risk. Emit warning, trigger event and break. If this happens,
// the reception buffer is not large enough or data is not polled often enough. // the reception buffer is not large enough or data is not polled often enough.
FSFW_LOGWT("{}", "requestReceiveMessage: Next read would cause overflow\n"); FSFW_FLOGWT("{}", "requestReceiveMessage: Next read would cause overflow\n");
result = UART_RX_BUFFER_TOO_SMALL; result = UART_RX_BUFFER_TOO_SMALL;
break; break;
} else { } else {
@ -403,7 +404,7 @@ ReturnValue_t UartComIF::handleCanonicalRead(UartCookie& uartCookie, UartDeviceM
if (bytesRead < 0) { if (bytesRead < 0) {
// EAGAIN: No data available in non-blocking mode // EAGAIN: No data available in non-blocking mode
if (errno != EAGAIN) { if (errno != EAGAIN) {
FSFW_LOGWT("handleCanonicalRead: read failed with code {} | {}\n", errno, strerror(errno)); FSFW_FLOGWT("handleCanonicalRead: read failed with code {} | {}\n", errno, strerror(errno));
return RETURN_FAILED; return RETURN_FAILED;
} }
@ -423,7 +424,7 @@ ReturnValue_t UartComIF::handleNoncanonicalRead(UartCookie& uartCookie, UartDevi
auto bufferPtr = iter->second.replyBuffer.data(); auto bufferPtr = iter->second.replyBuffer.data();
// Size check to prevent buffer overflow // Size check to prevent buffer overflow
if (requestLen > uartCookie.getMaxReplyLen()) { if (requestLen > uartCookie.getMaxReplyLen()) {
FSFW_LOGW("{}", "requestReceiveMessage: Next read would cause overflow\n"); FSFW_FLOGW("{}", "requestReceiveMessage: Next read would cause overflow\n");
return UART_RX_BUFFER_TOO_SMALL; return UART_RX_BUFFER_TOO_SMALL;
} }
ssize_t bytesRead = read(fd, bufferPtr, requestLen); ssize_t bytesRead = read(fd, bufferPtr, requestLen);
@ -431,8 +432,8 @@ ReturnValue_t UartComIF::handleNoncanonicalRead(UartCookie& uartCookie, UartDevi
return RETURN_FAILED; return RETURN_FAILED;
} else if (bytesRead != static_cast<int>(requestLen)) { } else if (bytesRead != static_cast<int>(requestLen)) {
if (uartCookie.isReplySizeFixed()) { if (uartCookie.isReplySizeFixed()) {
FSFW_LOGWT("UartComIF::requestReceiveMessage: Only read {} of {} bytes\n", bytesRead, FSFW_FLOGWT("UartComIF::requestReceiveMessage: Only read {} of {} bytes\n", bytesRead,
requestLen); requestLen);
return RETURN_FAILED; return RETURN_FAILED;
} }
} }
@ -446,14 +447,14 @@ ReturnValue_t UartComIF::readReceivedMessage(CookieIF* cookie, uint8_t** buffer,
auto* uartCookie = dynamic_cast<UartCookie*>(cookie); auto* uartCookie = dynamic_cast<UartCookie*>(cookie);
if (uartCookie == nullptr) { if (uartCookie == nullptr) {
FSFW_LOGWT("{}", "readReceivedMessage: Invalid uart cookie"); FSFW_FLOGWT("{}", "readReceivedMessage: Invalid uart cookie");
return NULLPOINTER; return NULLPOINTER;
} }
deviceFile = uartCookie->getDeviceFile(); deviceFile = uartCookie->getDeviceFile();
uartDeviceMapIter = uartDeviceMap.find(deviceFile); uartDeviceMapIter = uartDeviceMap.find(deviceFile);
if (uartDeviceMapIter == uartDeviceMap.end()) { if (uartDeviceMapIter == uartDeviceMap.end()) {
FSFW_LOGW("UartComIF::readReceivedMessage: Device file {} not in UART map\n", deviceFile); FSFW_FLOGW("UartComIF::readReceivedMessage: Device file {} not in UART map\n", deviceFile);
return RETURN_FAILED; return RETURN_FAILED;
} }
@ -471,7 +472,7 @@ ReturnValue_t UartComIF::flushUartRxBuffer(CookieIF* cookie) {
UartDeviceMapIter uartDeviceMapIter; UartDeviceMapIter uartDeviceMapIter;
auto* uartCookie = dynamic_cast<UartCookie*>(cookie); auto* uartCookie = dynamic_cast<UartCookie*>(cookie);
if (uartCookie == nullptr) { if (uartCookie == nullptr) {
FSFW_LOGWT("{}", "flushUartRxBuffer: Invalid UART cookie\n"); FSFW_FLOGWT("{}", "flushUartRxBuffer: Invalid UART cookie\n");
return NULLPOINTER; return NULLPOINTER;
} }
deviceFile = uartCookie->getDeviceFile(); deviceFile = uartCookie->getDeviceFile();
@ -489,7 +490,7 @@ ReturnValue_t UartComIF::flushUartTxBuffer(CookieIF* cookie) {
UartDeviceMapIter uartDeviceMapIter; UartDeviceMapIter uartDeviceMapIter;
auto* uartCookie = dynamic_cast<UartCookie*>(cookie); auto* uartCookie = dynamic_cast<UartCookie*>(cookie);
if (uartCookie == nullptr) { if (uartCookie == nullptr) {
FSFW_LOGWT("{}", "flushUartTxBuffer: Invalid uart cookie\n"); FSFW_FLOGWT("{}", "flushUartTxBuffer: Invalid uart cookie\n");
return NULLPOINTER; return NULLPOINTER;
} }
deviceFile = uartCookie->getDeviceFile(); deviceFile = uartCookie->getDeviceFile();
@ -507,7 +508,7 @@ ReturnValue_t UartComIF::flushUartTxAndRxBuf(CookieIF* cookie) {
UartDeviceMapIter uartDeviceMapIter; UartDeviceMapIter uartDeviceMapIter;
auto* uartCookie = dynamic_cast<UartCookie*>(cookie); auto* uartCookie = dynamic_cast<UartCookie*>(cookie);
if (uartCookie == nullptr) { if (uartCookie == nullptr) {
FSFW_LOGWT("{}", "flushUartTxAndRxBuf: Invalid UART cookie\n"); FSFW_FLOGWT("{}", "flushUartTxAndRxBuf: Invalid UART cookie\n");
return NULLPOINTER; return NULLPOINTER;
} }
deviceFile = uartCookie->getDeviceFile(); deviceFile = uartCookie->getDeviceFile();

View File

@ -3,21 +3,11 @@
#include <cerrno> #include <cerrno>
#include <cstring> #include <cstring>
#include "fsfw/FSFW.h" #include "fsfw/serviceinterface.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
void utility::handleIoctlError(const char* const customPrintout) { void utility::handleIoctlError(const char* const customPrintout) {
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
if (customPrintout != nullptr) { if (customPrintout != nullptr) {
sif::warning << customPrintout << std::endl; FSFW_LOGW(customPrintout);
} }
sif::warning << "handleIoctlError: Error code " << errno << ", " << strerror(errno) << std::endl; FSFW_LOGW("Error code {} | {}\n", errno, strerror(errno));
#else
if (customPrintout != nullptr) {
sif::printWarning("%s\n", customPrintout);
}
sif::printWarning("handleIoctlError: Error code %d, %s\n", errno, strerror(errno));
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
} }

View File

@ -28,7 +28,7 @@ ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) {
} }
if (queueToUse == nullptr) { if (queueToUse == nullptr) {
FSFW_LOGW("{}", "initialize: No queue set\n"); FSFW_FLOGW("{}", "initialize: No queue set\n");
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
@ -90,7 +90,7 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t rep
size_t size = 0; size_t size = 0;
ReturnValue_t result = ipcStore->getFreeElement(&storeAddress, maxSize, &dataPtr); ReturnValue_t result = ipcStore->getFreeElement(&storeAddress, maxSize, &dataPtr);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
FSFW_LOGWT("{}", "reportData: Getting free element from IPC store failed\n"); FSFW_FLOGWT("{}", "reportData: Getting free element from IPC store failed\n");
return result; return result;
} }
result = data->serialize(&dataPtr, &size, maxSize, SerializeIF::Endianness::BIG); result = data->serialize(&dataPtr, &size, maxSize, SerializeIF::Endianness::BIG);
@ -125,7 +125,7 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t rep
store_address_t storeAddress; store_address_t storeAddress;
ReturnValue_t result = ipcStore->addData(&storeAddress, data, dataSize); ReturnValue_t result = ipcStore->addData(&storeAddress, data, dataSize);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
FSFW_LOGWT("{}", "reportData: Adding data to IPC store failed\n"); FSFW_FLOGWT("{}", "reportData: Adding data to IPC store failed\n");
return result; return result;
} }

View File

@ -29,7 +29,7 @@ ReturnValue_t CFDPHandler::initialize() {
} }
ReturnValue_t CFDPHandler::handleRequest(store_address_t storeId) { ReturnValue_t CFDPHandler::handleRequest(store_address_t storeId) {
FSFW_LOGDT("{}", "CFDPHandler::handleRequest\n"); FSFW_FLOGDT("{}", "CFDPHandler::handleRequest\n");
// TODO read out packet from store using storeId // TODO read out packet from store using storeId

View File

@ -50,9 +50,9 @@ ReturnValue_t EofPduDeserializer::parseData() {
if (info.getConditionCode() != cfdp::ConditionCode::NO_ERROR) { if (info.getConditionCode() != cfdp::ConditionCode::NO_ERROR) {
EntityIdTlv* tlvPtr = info.getFaultLoc(); EntityIdTlv* tlvPtr = info.getFaultLoc();
if (tlvPtr == nullptr) { if (tlvPtr == nullptr) {
FSFW_LOGW("{}", FSFW_FLOGW("{}",
"parseData: Ca not deserialize fault location," "parseData: Ca not deserialize fault location,"
" given TLV pointer invalid\n"); " given TLV pointer invalid\n");
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
result = tlvPtr->deSerialize(&bufPtr, &deserLen, endianness); result = tlvPtr->deSerialize(&bufPtr, &deserLen, endianness);

View File

@ -7,7 +7,7 @@
cfdp::VarLenField::VarLenField(cfdp::WidthInBytes width, size_t value) : VarLenField() { cfdp::VarLenField::VarLenField(cfdp::WidthInBytes width, size_t value) : VarLenField() {
ReturnValue_t result = this->setValue(width, value); ReturnValue_t result = this->setValue(width, value);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
FSFW_LOGW("{}", "cfdp::VarLenField: Setting value failed\n"); FSFW_FLOGW("{}", "cfdp::VarLenField: Setting value failed\n");
} }
} }

View File

@ -128,7 +128,7 @@ class FilestoreTlvBase : public TlvIF {
} }
void secondFileNameMissing() const { void secondFileNameMissing() const {
FSFW_LOGWT("{}", "secondFileNameMissing: Second file name required but TLV pointer not set\n"); FSFW_FLOGWT("{}", "secondFileNameMissing: Second file name required but TLV pointer not set\n");
} }
FilestoreActionCode getActionCode() const { return actionCode; } FilestoreActionCode getActionCode() const { return actionCode; }

View File

@ -17,15 +17,15 @@ ReturnValue_t PoolDataSetBase::registerVariable(PoolVariableIF* variable) {
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
if (state != States::STATE_SET_UNINITIALISED) { if (state != States::STATE_SET_UNINITIALISED) {
FSFW_LOGW("{}", "registerVariable: Call made in wrong position\n"); FSFW_FLOGW("{}", "registerVariable: Call made in wrong position\n");
return DataSetIF::DATA_SET_UNINITIALISED; return DataSetIF::DATA_SET_UNINITIALISED;
} }
if (variable == nullptr) { if (variable == nullptr) {
FSFW_LOGW("{}", "registerVariable: Pool variable is nullptr\n"); FSFW_FLOGW("{}", "registerVariable: Pool variable is nullptr\n");
return DataSetIF::POOL_VAR_NULL; return DataSetIF::POOL_VAR_NULL;
} }
if (fillCount >= maxFillCount) { if (fillCount >= maxFillCount) {
FSFW_LOGW("{}", "registerVariable: DataSet is full\n"); FSFW_FLOGW("{}", "registerVariable: DataSet is full\n");
return DataSetIF::DATA_SET_FULL; return DataSetIF::DATA_SET_FULL;
} }
registeredVariables[fillCount] = variable; registeredVariables[fillCount] = variable;
@ -47,7 +47,7 @@ ReturnValue_t PoolDataSetBase::read(MutexIF::TimeoutType timeoutType, uint32_t l
state = States::STATE_SET_WAS_READ; state = States::STATE_SET_WAS_READ;
unlockDataPool(); unlockDataPool();
} else { } else {
FSFW_LOGWT("{}", "read: Call made in wrong position. commit call might be missing\n"); FSFW_FLOGWT("{}", "read: Call made in wrong position. commit call might be missing\n");
result = SET_WAS_ALREADY_READ; result = SET_WAS_ALREADY_READ;
} }

View File

@ -68,7 +68,7 @@ void PoolEntry<T>::print() {
} else { } else {
validString = "Invalid"; validString = "Invalid";
} }
FSFW_LOGI("PoolEntry Info. Validity {}\n", validString); FSFW_FLOGI("PoolEntry Info. Validity {}\n", validString);
arrayprinter::print(reinterpret_cast<uint8_t*>(address), getByteSize()); arrayprinter::print(reinterpret_cast<uint8_t*>(address), getByteSize());
} }

View File

@ -17,7 +17,7 @@ class PoolReadGuard {
if (readObject != nullptr) { if (readObject != nullptr) {
readResult = readObject->read(timeoutType, mutexTimeout); readResult = readObject->read(timeoutType, mutexTimeout);
if (readResult != HasReturnvaluesIF::RETURN_OK) { if (readResult != HasReturnvaluesIF::RETURN_OK) {
FSFW_LOGW("{}", "ctor: Read failed\n"); FSFW_FLOGW("{}", "ctor: Read failed\n");
} }
} }
} }

View File

@ -166,7 +166,7 @@ class HasLocalDataPoolIF {
* @return * @return
*/ */
virtual LocalPoolObjectBase* getPoolObjectHandle(lp_id_t localPoolId) { virtual LocalPoolObjectBase* getPoolObjectHandle(lp_id_t localPoolId) {
FSFW_LOGW("{}", "HasLocalDataPoolIF::getPoolObjectHandle: Not overriden. Returning nullptr\n"); FSFW_FLOGW("{}", "HasLocalDataPoolIF::getPoolObjectHandle: Not overriden. Returning nullptr\n");
return nullptr; return nullptr;
} }
}; };

View File

@ -695,7 +695,7 @@ void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver& receiver) {
ReturnValue_t result = generateHousekeepingPacket(sid, dataSet, true); ReturnValue_t result = generateHousekeepingPacket(sid, dataSet, true);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
/* Configuration error */ /* Configuration error */
FSFW_LOGWT("{}", "performHkOperation: HK generation failed"); FSFW_FLOGWT("{}", "performHkOperation: HK generation failed");
} }
} }
@ -852,23 +852,9 @@ void LocalDataPoolManager::printWarningOrError(sif::OutputTypes outputType,
} }
if (outputType == sif::OutputTypes::OUT_WARNING) { if (outputType == sif::OutputTypes::OUT_WARNING) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGWT("{} | Object ID {} | {}\n", functionName, objectId, errorPrint);
sif::warning << "LocalDataPoolManager::" << functionName << ": Object ID 0x" << std::setw(8)
<< std::setfill('0') << std::hex << objectId << " | " << errorPrint << std::dec
<< std::setfill(' ') << std::endl;
#else
sif::printWarning("LocalDataPoolManager::%s: Object ID 0x%08x | %s\n", functionName, objectId,
errorPrint);
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
} else if (outputType == sif::OutputTypes::OUT_ERROR) { } else if (outputType == sif::OutputTypes::OUT_ERROR) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGET("{} | Object ID {} | {}\n", functionName, objectId, errorPrint);
sif::error << "LocalDataPoolManager::" << functionName << ": Object ID 0x" << std::setw(8)
<< std::setfill('0') << std::hex << objectId << " | " << errorPrint << std::dec
<< std::setfill(' ') << std::endl;
#else
sif::printError("LocalDataPoolManager::%s: Object ID 0x%08x | %s\n", functionName, objectId,
errorPrint);
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
} }
#endif /* #if FSFW_VERBOSE_LEVEL >= 1 */ #endif /* #if FSFW_VERBOSE_LEVEL >= 1 */
} }

View File

@ -16,7 +16,7 @@ LocalPoolDataSetBase::LocalPoolDataSetBase(HasLocalDataPoolIF *hkOwner, uint32_t
: PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) { : PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) {
if (hkOwner == nullptr) { if (hkOwner == nullptr) {
// Configuration error. // Configuration error.
FSFW_LOGW("{}", "LocalPoolDataSetBase::LocalPoolDataSetBase: Owner invalid\n"); FSFW_FLOGW("{}", "LocalPoolDataSetBase::LocalPoolDataSetBase: Owner invalid\n");
return; return;
} }
AccessPoolManagerIF *accessor = HasLocalDpIFUserAttorney::getAccessorHandle(hkOwner); AccessPoolManagerIF *accessor = HasLocalDpIFUserAttorney::getAccessorHandle(hkOwner);
@ -179,7 +179,7 @@ ReturnValue_t LocalPoolDataSetBase::serializeLocalPoolIds(uint8_t **buffer, size
auto result = auto result =
SerializeAdapter::serialize(&currentPoolId, buffer, size, maxSize, streamEndianness); SerializeAdapter::serialize(&currentPoolId, buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
FSFW_LOGW("{}", "serializeLocalPoolIds: Serialization error\n"); FSFW_FLOGW("{}", "serializeLocalPoolIds: Serialization error\n");
return result; return result;
} }
} }

View File

@ -11,10 +11,10 @@ LocalPoolObjectBase::LocalPoolObjectBase(lp_id_t poolId, HasLocalDataPoolIF* hkO
DataSetIF* dataSet, pool_rwm_t setReadWriteMode) DataSetIF* dataSet, pool_rwm_t setReadWriteMode)
: localPoolId(poolId), readWriteMode(setReadWriteMode) { : localPoolId(poolId), readWriteMode(setReadWriteMode) {
if (poolId == PoolVariableIF::NO_PARAMETER) { if (poolId == PoolVariableIF::NO_PARAMETER) {
FSFW_LOGWT("{}", "ctor: Invalid pool ID, has NO_PARAMETER value\n"); FSFW_FLOGWT("{}", "ctor: Invalid pool ID, has NO_PARAMETER value\n");
} }
if (hkOwner == nullptr) { if (hkOwner == nullptr) {
FSFW_LOGET("{}", "ctor: Supplied pool owner is a invalid\n"); FSFW_FLOGET("{}", "ctor: Supplied pool owner is a invalid\n");
return; return;
} }
AccessPoolManagerIF* poolManAccessor = HasLocalDpIFUserAttorney::getAccessorHandle(hkOwner); AccessPoolManagerIF* poolManAccessor = HasLocalDpIFUserAttorney::getAccessorHandle(hkOwner);
@ -29,11 +29,11 @@ LocalPoolObjectBase::LocalPoolObjectBase(object_id_t poolOwner, lp_id_t poolId,
pool_rwm_t setReadWriteMode) pool_rwm_t setReadWriteMode)
: localPoolId(poolId), readWriteMode(setReadWriteMode) { : localPoolId(poolId), readWriteMode(setReadWriteMode) {
if (poolId == PoolVariableIF::NO_PARAMETER) { if (poolId == PoolVariableIF::NO_PARAMETER) {
FSFW_LOGWT("{}", "ctor: Invalid pool ID, has NO_PARAMETER value\n"); FSFW_FLOGWT("{}", "ctor: Invalid pool ID, has NO_PARAMETER value\n");
} }
auto* hkOwner = ObjectManager::instance()->get<HasLocalDataPoolIF>(poolOwner); auto* hkOwner = ObjectManager::instance()->get<HasLocalDataPoolIF>(poolOwner);
if (hkOwner == nullptr) { if (hkOwner == nullptr) {
FSFW_LOGWT( FSFW_FLOGWT(
"ctor: The supplied pool owner {:#08x} did not implement the correct interface " "ctor: The supplied pool owner {:#08x} did not implement the correct interface "
"HasLocalDataPoolIF\n", "HasLocalDataPoolIF\n",
poolOwner); poolOwner);
@ -94,6 +94,6 @@ void LocalPoolObjectBase::reportReadCommitError(const char* variableType, Return
errMsg = "Unknown error code"; errMsg = "Unknown error code";
} }
FSFW_LOGW("{}: {} call | {} | Owner: {:#08x} | LPID: \n", variablePrintout, type, errMsg, FSFW_FLOGW("{}: {} call | {} | Owner: {:#08x} | LPID: \n", variablePrintout, type, errMsg,
objectId, lpId); objectId, lpId);
} }

View File

@ -98,7 +98,7 @@ inline T& LocalPoolVector<T, vectorSize>::operator [](size_t i) {
} }
// If this happens, I have to set some value. I consider this // If this happens, I have to set some value. I consider this
// a configuration error, but I wont exit here. // a configuration error, but I wont exit here.
FSFW_LOGWT("{}", "operator[]: Invalid index. Setting or returning last value\n"); FSFW_FLOGWT("{}", "operator[]: Invalid index. Setting or returning last value\n");
return value[vectorSize - 1]; return value[vectorSize - 1];
} }
@ -109,7 +109,7 @@ inline const T& LocalPoolVector<T, vectorSize>::operator [](size_t i) const {
} }
// If this happens, I have to set some value. I consider this // If this happens, I have to set some value. I consider this
// a configuration error, but I wont exit here. // a configuration error, but I wont exit here.
FSFW_LOGWT("{}", "operator[]: Invalid index. Setting or returning last value\n"); FSFW_FLOGWT("{}", "operator[]: Invalid index. Setting or returning last value\n");
return value[vectorSize - 1]; return value[vectorSize - 1];
} }

View File

@ -156,9 +156,9 @@ ReturnValue_t DeviceHandlerBase::initialize() {
printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize", printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize",
ObjectManagerIF::CHILD_INIT_FAILED, ObjectManagerIF::CHILD_INIT_FAILED,
"Raw receiver object ID set but no valid object found."); "Raw receiver object ID set but no valid object found.");
FSFW_LOGE("{}", FSFW_FLOGE("{}",
"Make sure the raw receiver object is set up properly " "Make sure the raw receiver object is set up properly "
"and implements AcceptsDeviceResponsesIF"); "and implements AcceptsDeviceResponsesIF");
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
defaultRawReceiver = rawReceiver->getDeviceQueue(); defaultRawReceiver = rawReceiver->getDeviceQueue();
@ -170,9 +170,9 @@ ReturnValue_t DeviceHandlerBase::initialize() {
printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize", printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize",
ObjectManagerIF::CHILD_INIT_FAILED, ObjectManagerIF::CHILD_INIT_FAILED,
"Power switcher set but no valid object found."); "Power switcher set but no valid object found.");
FSFW_LOGE("{}", FSFW_FLOGE("{}",
"Make sure the power switcher object is set up " "Make sure the power switcher object is set up "
"properly and implements PowerSwitchIF\n"); "properly and implements PowerSwitchIF\n");
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
} }
@ -755,9 +755,9 @@ void DeviceHandlerBase::parseReply(const uint8_t* receivedData, size_t receivedD
printWarningOrError(sif::OutputTypes::OUT_ERROR, "parseReply", printWarningOrError(sif::OutputTypes::OUT_ERROR, "parseReply",
ObjectManagerIF::CHILD_INIT_FAILED, ObjectManagerIF::CHILD_INIT_FAILED,
"Power switcher set but no valid object found."); "Power switcher set but no valid object found.");
FSFW_LOGW("{}", FSFW_FLOGW("{}",
"DeviceHandlerBase::parseReply: foundLen is 0! " "DeviceHandlerBase::parseReply: foundLen is 0! "
"Packet parsing will be stuck\n"); "Packet parsing will be stuck\n");
} }
break; break;
} }
@ -1462,11 +1462,11 @@ void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType, const ch
} }
if (errorType == sif::OutputTypes::OUT_WARNING) { if (errorType == sif::OutputTypes::OUT_WARNING) {
FSFW_LOGWT("{} | Object ID {:#08x} | {}", functionName, SystemObject::getObjectId(), FSFW_FLOGWT("{} | Object ID {:#08x} | {}", functionName, SystemObject::getObjectId(),
errorPrint); errorPrint);
} else if (errorType == sif::OutputTypes::OUT_ERROR) { } else if (errorType == sif::OutputTypes::OUT_ERROR) {
FSFW_LOGET("{} | Object ID {:#08x} | {}", functionName, SystemObject::getObjectId(), FSFW_FLOGET("{} | Object ID {:#08x} | {}", functionName, SystemObject::getObjectId(),
errorPrint); errorPrint);
} }
} }

View File

@ -163,7 +163,7 @@ void DeviceHandlerFailureIsolation::clearFaultCounters() {
ReturnValue_t DeviceHandlerFailureIsolation::initialize() { ReturnValue_t DeviceHandlerFailureIsolation::initialize() {
ReturnValue_t result = FailureIsolationBase::initialize(); ReturnValue_t result = FailureIsolationBase::initialize();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
FSFW_LOGE("{}", "initialize: Could not initialize FailureIsolationBase\n"); FSFW_FLOGE("{}", "initialize: Could not initialize FailureIsolationBase\n");
return result; return result;
} }
auto* power = ObjectManager::instance()->get<ConfirmsFailuresIF>(powerConfirmationId); auto* power = ObjectManager::instance()->get<ConfirmsFailuresIF>(powerConfirmationId);
@ -239,10 +239,7 @@ bool DeviceHandlerFailureIsolation::isFdirInActionOrAreWeFaulty(EventMessage* ev
if (owner == nullptr) { if (owner == nullptr) {
// Configuration error. // Configuration error.
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE("isFdirInActionOrAreWeFaulty: Owner not set\n");
sif::error << "DeviceHandlerFailureIsolation::"
<< "isFdirInActionOrAreWeFaulty: Owner not set!" << std::endl;
#endif
return false; return false;
} }

View File

@ -41,7 +41,7 @@ class EventManagerIF {
if (eventmanagerQueue == MessageQueueIF::NO_QUEUE) { if (eventmanagerQueue == MessageQueueIF::NO_QUEUE) {
auto* eventmanager = ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER); auto* eventmanager = ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
if (eventmanager == nullptr) { if (eventmanager == nullptr) {
FSFW_LOGW("{}", "EventManagerIF::triggerEvent: EventManager invalid or not found\n"); FSFW_FLOGW("{}", "EventManagerIF::triggerEvent: EventManager invalid or not found\n");
return; return;
} }
eventmanagerQueue = eventmanager->getEventReportQueue(); eventmanagerQueue = eventmanager->getEventReportQueue();

View File

@ -20,7 +20,7 @@ FailureIsolationBase::~FailureIsolationBase() {
ReturnValue_t FailureIsolationBase::initialize() { ReturnValue_t FailureIsolationBase::initialize() {
auto* manager = ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER); auto* manager = ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
if (manager == nullptr) { if (manager == nullptr) {
FSFW_LOGE("{}", "initialize: Event Manager has not been initialized\n"); FSFW_FLOGE("{}", "initialize: Event Manager has not been initialized\n");
return RETURN_FAILED; return RETURN_FAILED;
} }
ReturnValue_t result = manager->registerListener(eventQueue->getId()); ReturnValue_t result = manager->registerListener(eventQueue->getId());
@ -34,7 +34,7 @@ ReturnValue_t FailureIsolationBase::initialize() {
} }
owner = ObjectManager::instance()->get<HasHealthIF>(ownerId); owner = ObjectManager::instance()->get<HasHealthIF>(ownerId);
if (owner == nullptr) { if (owner == nullptr) {
FSFW_LOGE( FSFW_FLOGE(
"FailureIsolationBase::intialize: Owner object {:#08x} invalid. " "FailureIsolationBase::intialize: Owner object {:#08x} invalid. "
"Does it implement HasHealthIF?\n", "Does it implement HasHealthIF?\n",
ownerId); ownerId);
@ -44,8 +44,9 @@ ReturnValue_t FailureIsolationBase::initialize() {
if (faultTreeParent != objects::NO_OBJECT) { if (faultTreeParent != objects::NO_OBJECT) {
auto* parentIF = ObjectManager::instance()->get<ConfirmsFailuresIF>(faultTreeParent); auto* parentIF = ObjectManager::instance()->get<ConfirmsFailuresIF>(faultTreeParent);
if (parentIF == nullptr) { if (parentIF == nullptr) {
FSFW_LOGW("intialize: Parent object {:#08x} invalid. Does it implement ConfirmsFailuresIF?\n", FSFW_FLOGW(
faultTreeParent); "intialize: Parent object {:#08x} invalid. Does it implement ConfirmsFailuresIF?\n",
faultTreeParent);
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
eventQueue->setDefaultDestination(parentIF->getEventReceptionQueue()); eventQueue->setDefaultDestination(parentIF->getEventReceptionQueue());

View File

@ -8,11 +8,11 @@
void arrayprinter::print(const uint8_t *data, size_t size, OutputType type, bool printInfo, void arrayprinter::print(const uint8_t *data, size_t size, OutputType type, bool printInfo,
size_t maxCharPerLine) { size_t maxCharPerLine) {
if (size == 0) { if (size == 0) {
FSFW_LOGI("{}", "Size is zero, nothing to print\n"); FSFW_FLOGI("{}", "Size is zero, nothing to print\n");
return; return;
} }
FSFW_LOGI("Printing data with size {}:\n", size); FSFW_FLOGI("Printing data with size {}:\n", size);
if (type == OutputType::HEX) { if (type == OutputType::HEX) {
arrayprinter::printHex(data, size, maxCharPerLine); arrayprinter::printHex(data, size, maxCharPerLine);
} else if (type == OutputType::DEC) { } else if (type == OutputType::DEC) {

View File

@ -35,12 +35,12 @@ ReturnValue_t HealthHelper::initialize() {
eventSender = ObjectManager::instance()->get<EventReportingProxyIF>(objectId); eventSender = ObjectManager::instance()->get<EventReportingProxyIF>(objectId);
if (healthTable == nullptr) { if (healthTable == nullptr) {
FSFW_LOGE("{}", "initialize: Health table object needs to be created in factory\n"); FSFW_FLOGE("{}", "initialize: Health table object needs to be created in factory\n");
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
if (eventSender == nullptr) { if (eventSender == nullptr) {
FSFW_LOGE("{}", "initialize: Owner has to implement ReportingProxyIF\n"); FSFW_FLOGE("{}", "initialize: Owner has to implement ReportingProxyIF\n");
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
@ -69,7 +69,7 @@ void HealthHelper::informParent(HasHealthIF::HealthState health,
HealthMessage::setHealthMessage(&information, HealthMessage::HEALTH_INFO, health, oldHealth); HealthMessage::setHealthMessage(&information, HealthMessage::HEALTH_INFO, health, oldHealth);
if (MessageQueueSenderIF::sendMessage(parentQueue, &information, owner->getCommandQueue()) != if (MessageQueueSenderIF::sendMessage(parentQueue, &information, owner->getCommandQueue()) !=
HasReturnvaluesIF::RETURN_OK) { HasReturnvaluesIF::RETURN_OK) {
FSFW_LOGWT("informParent: Object ID {:#08x} | Sending health reply failed\n", objectId); FSFW_FLOGWT("informParent: Object ID {:#08x} | Sending health reply failed\n", objectId);
} }
} }
@ -86,7 +86,7 @@ void HealthHelper::handleSetHealthCommand(CommandMessage* command) {
} }
if (MessageQueueSenderIF::sendMessage(command->getSender(), &reply, owner->getCommandQueue()) != if (MessageQueueSenderIF::sendMessage(command->getSender(), &reply, owner->getCommandQueue()) !=
HasReturnvaluesIF::RETURN_OK) { HasReturnvaluesIF::RETURN_OK) {
FSFW_LOGWT("handleSetHealthCommand: Object ID {:#08x} | Sending health reply failed\n", FSFW_FLOGWT("handleSetHealthCommand: Object ID {:#08x} | Sending health reply failed\n",
objectId); objectId);
} }
} }

View File

@ -69,7 +69,7 @@ void HealthTable::printAll(uint8_t* pointer, size_t maxSize) {
ReturnValue_t result = ReturnValue_t result =
SerializeAdapter::serialize(&count, &pointer, &size, maxSize, SerializeIF::Endianness::BIG); SerializeAdapter::serialize(&count, &pointer, &size, maxSize, SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
FSFW_LOGW("{}", "printAll: Serialization of health table failed\n"); FSFW_FLOGW("{}", "printAll: Serialization of health table failed\n");
return; return;
} }
for (const auto& health : healthMap) { for (const auto& health : healthMap) {

View File

@ -34,18 +34,8 @@ ReturnValue_t InternalErrorReporter::performOperation(uint8_t opCode) {
#if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_VERBOSE_LEVEL >= 1
if (diagnosticPrintout) { if (diagnosticPrintout) {
if ((newQueueHits > 0) or (newTmHits > 0) or (newStoreHits > 0)) { if ((newQueueHits > 0) or (newTmHits > 0) or (newStoreHits > 0)) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGW("performOperation: Errors occured\nQueue {} | TM {} | Store {}\n", newQueueHits,
sif::debug << "InternalErrorReporter::performOperation: Errors " newTmHits, newStoreHits);
<< "occured!" << std::endl;
sif::debug << "Queue errors: " << newQueueHits << std::endl;
sif::debug << "TM errors: " << newTmHits << std::endl;
sif::debug << "Store errors: " << newStoreHits << std::endl;
#else
sif::printDebug("InternalErrorReporter::performOperation: Errors occured!\n");
sif::printDebug("Queue errors: %lu\n", static_cast<unsigned int>(newQueueHits));
sif::printDebug("TM errors: %lu\n", static_cast<unsigned int>(newTmHits));
sif::printDebug("Store errors: %lu\n", static_cast<unsigned int>(newStoreHits));
#endif
} }
} }
#endif #endif

View File

@ -15,7 +15,7 @@ MessageQueueMessage::MessageQueueMessage(uint8_t* data, size_t size)
memcpy(this->getData(), data, size); memcpy(this->getData(), data, size);
this->messageSize = this->HEADER_SIZE + size; this->messageSize = this->HEADER_SIZE + size;
} else { } else {
FSFW_LOGW("{}", "ctor: Passed size larger than maximum allowed size! Setting content to 0\n"); FSFW_FLOGW("{}", "ctor: Passed size larger than maximum allowed size! Setting content to 0\n");
memset(this->internalBuffer, 0, sizeof(this->internalBuffer)); memset(this->internalBuffer, 0, sizeof(this->internalBuffer));
this->messageSize = this->HEADER_SIZE; this->messageSize = this->HEADER_SIZE;
} }

View File

@ -17,7 +17,7 @@ ReturnValue_t MemoryHelper::handleMemoryCommand(CommandMessage* message) {
lastSender = message->getSender(); lastSender = message->getSender();
lastCommand = message->getCommand(); lastCommand = message->getCommand();
if (busy) { if (busy) {
FSFW_LOGW("{}", "MemoryHelper: Busy\n"); FSFW_FLOGW("{}", "MemoryHelper: Busy\n");
} }
switch (lastCommand) { switch (lastCommand) {
case MemoryMessage::CMD_MEMORY_DUMP: case MemoryMessage::CMD_MEMORY_DUMP:

View File

@ -81,7 +81,7 @@ class MonitoringReportContent : public SerialLinkedListAdapter<SerializeIF> {
if (timeStamper == nullptr) { if (timeStamper == nullptr) {
timeStamper = ObjectManager::instance()->get<TimeStamperIF>(timeStamperId); timeStamper = ObjectManager::instance()->get<TimeStamperIF>(timeStamperId);
if (timeStamper == nullptr) { if (timeStamper == nullptr) {
FSFW_LOGET("{}", "checkAndSetStamper: Stamper not found\n"); FSFW_FLOGET("{}", "checkAndSetStamper: Stamper not found\n");
return false; return false;
} }
} }

View File

@ -38,8 +38,8 @@ ReturnValue_t ObjectManager::insert(object_id_t id, SystemObjectIF* object) {
#endif #endif
return this->RETURN_OK; return this->RETURN_OK;
} else { } else {
FSFW_LOGET("ObjectManager::insert: Object ID {:#08x} is already in use\nTerminating program\n", FSFW_FLOGET("ObjectManager::insert: Object ID {:#08x} is already in use\nTerminating program\n",
static_cast<uint32_t>(id)); static_cast<uint32_t>(id));
// This is very severe and difficult to handle in other places. // This is very severe and difficult to handle in other places.
std::exit(INSERTION_FAILED); std::exit(INSERTION_FAILED);
} }
@ -54,7 +54,7 @@ ReturnValue_t ObjectManager::remove(object_id_t id) {
#endif #endif
return RETURN_OK; return RETURN_OK;
} else { } else {
FSFW_LOGW("removeObject: Requested object {:#08x} not found\n", id); FSFW_FLOGW("removeObject: Requested object {:#08x} not found\n", id);
return NOT_FOUND; return NOT_FOUND;
} }
} }
@ -78,27 +78,27 @@ void ObjectManager::initialize() {
result = it.second->initialize(); result = it.second->initialize();
if (result != RETURN_OK) { if (result != RETURN_OK) {
object_id_t var = it.first; object_id_t var = it.first;
FSFW_LOGWT("initialize: Object {:#08x} failed to initialize with code {:#04x}\n", var, FSFW_FLOGWT("initialize: Object {:#08x} failed to initialize with code {:#04x}\n", var,
result); result);
errorCount++; errorCount++;
} }
} }
if (errorCount > 0) { if (errorCount > 0) {
FSFW_LOGWT("{}", "initialize: Counted failed initializations\n"); FSFW_FLOGWT("{}", "initialize: Counted failed initializations\n");
} }
// Init was successful. Now check successful interconnections. // Init was successful. Now check successful interconnections.
errorCount = 0; errorCount = 0;
for (auto const& it : objectList) { for (auto const& it : objectList) {
result = it.second->checkObjectConnections(); result = it.second->checkObjectConnections();
if (result != RETURN_OK) { if (result != RETURN_OK) {
FSFW_LOGE("initialize: Object {:#08x} connection check failed with code {:#04x}\n", it.first, FSFW_FLOGE("initialize: Object {:#08x} connection check failed with code {:#04x}\n", it.first,
result); result);
errorCount++; errorCount++;
} }
} }
if (errorCount > 0) { if (errorCount > 0) {
FSFW_LOGE("{}", "ObjectManager::ObjectManager: Counted {} failed connection checks\n", FSFW_FLOGE("{}", "ObjectManager::ObjectManager: Counted {} failed connection checks\n",
errorCount); errorCount);
} }
} }
@ -106,7 +106,7 @@ void ObjectManager::printList() {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info("ObjectManager: Object List contains:\n"); sif::info("ObjectManager: Object List contains:\n");
for (auto const& it : objectList) { for (auto const& it : objectList) {
sif::info("{:#08x} | {:#08x}\n", it.first, it.second); sif::info("{:#08x} | {:#08x}\n", it.first, fmt::ptr(it.second));
} }
#endif #endif
} }

View File

@ -21,17 +21,13 @@ TcpTmTcBridge::TcpTmTcBridge(object_id_t objectId, object_id_t tcDestination, ob
: TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) { : TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
mutex = MutexFactory::instance()->createMutex(); mutex = MutexFactory::instance()->createMutex();
// Connection is always up, TM is requested by connecting to server and receiving packets // Connection is always up, TM is requested by connecting to server and receiving packets
registerCommConnect(); TmTcBridge::registerCommConnect();
} }
ReturnValue_t TcpTmTcBridge::initialize() { ReturnValue_t TcpTmTcBridge::initialize() {
ReturnValue_t result = TmTcBridge::initialize(); ReturnValue_t result = TmTcBridge::initialize();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE("TcpTmTcBridge::initialize: TmTcBridge initialization failed\n");
sif::error << "TcpTmTcBridge::initialize: TmTcBridge initialization failed!" << std::endl;
#else
sif::printError("TcpTmTcBridge::initialize: TmTcBridge initialization failed!\n");
#endif
return result; return result;
} }

View File

@ -8,7 +8,7 @@
#include "fsfw/ipc/MutexGuard.h" #include "fsfw/ipc/MutexGuard.h"
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/platform.h" #include "fsfw/platform.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
#include "fsfw/tasks/TaskFactory.h" #include "fsfw/tasks/TaskFactory.h"
#include "fsfw/tmtcservices/SpacePacketParser.h" #include "fsfw/tmtcservices/SpacePacketParser.h"
#include "fsfw/tmtcservices/TmTcMessage.h" #include "fsfw/tmtcservices/TmTcMessage.h"
@ -54,11 +54,7 @@ ReturnValue_t TcpTmTcServer::initialize() {
} }
tcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE); tcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
if (tcStore == nullptr) { if (tcStore == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE("TcpTmTcServer::initialize: TC store uninitialized\n");
sif::error << "TcpTmTcServer::initialize: TC store uninitialized!" << std::endl;
#else
sif::printError("TcpTmTcServer::initialize: TC store uninitialized!\n");
#endif
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
@ -204,11 +200,7 @@ void TcpTmTcServer::handleServerOperation(socket_t& connSocket) {
ReturnValue_t TcpTmTcServer::handleTcReception(uint8_t* spacePacket, size_t packetSize) { ReturnValue_t TcpTmTcServer::handleTcReception(uint8_t* spacePacket, size_t packetSize) {
if (wiretappingEnabled) { if (wiretappingEnabled) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGI("Received TC:\n");
sif::info << "Received TC:" << std::endl;
#else
sif::printInfo("Received TC:\n");
#endif
arrayprinter::print(spacePacket, packetSize); arrayprinter::print(spacePacket, packetSize);
} }
@ -218,17 +210,7 @@ ReturnValue_t TcpTmTcServer::handleTcReception(uint8_t* spacePacket, size_t pack
store_address_t storeId; store_address_t storeId;
ReturnValue_t result = tcStore->addData(&storeId, spacePacket, packetSize); ReturnValue_t result = tcStore->addData(&storeId, spacePacket, packetSize);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_VERBOSE_LEVEL >= 1 FSFW_FLOGWT("handleTcReception: Data storage with packet size {} failed\n", packetSize);
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "TcpTmTcServer::handleServerOperation: Data storage with packet size"
<< packetSize << " failed" << std::endl;
#else
sif::printWarning(
"TcpTmTcServer::handleServerOperation: Data storage with packet size %d "
"failed\n",
packetSize);
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
return result; return result;
} }
@ -236,17 +218,7 @@ ReturnValue_t TcpTmTcServer::handleTcReception(uint8_t* spacePacket, size_t pack
result = MessageQueueSenderIF::sendMessage(targetTcDestination, &message); result = MessageQueueSenderIF::sendMessage(targetTcDestination, &message);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_VERBOSE_LEVEL >= 1 FSFW_LOGWT("handleTcReception: Sending message to queue failed\n");
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "TcpTmTcServer::handleServerOperation: "
" Sending message to queue failed"
<< std::endl;
#else
sif::printWarning(
"TcpTmTcServer::handleServerOperation: "
" Sending message to queue failed\n");
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
tcStore->deleteData(storeId); tcStore->deleteData(storeId);
} }
return result; return result;
@ -254,15 +226,15 @@ ReturnValue_t TcpTmTcServer::handleTcReception(uint8_t* spacePacket, size_t pack
std::string TcpTmTcServer::getTcpPort() const { return tcpConfig.tcpPort; } std::string TcpTmTcServer::getTcpPort() const { return tcpConfig.tcpPort; }
void TcpTmTcServer::setSpacePacketParsingOptions(std::vector<uint16_t> validPacketIds) { void TcpTmTcServer::setSpacePacketParsingOptions(std::vector<uint16_t> validPacketIds_) {
this->validPacketIds = validPacketIds; this->validPacketIds = std::move(validPacketIds_);
} }
TcpTmTcServer::TcpConfig& TcpTmTcServer::getTcpConfigStruct() { return tcpConfig; } TcpTmTcServer::TcpConfig& TcpTmTcServer::getTcpConfigStruct() { return tcpConfig; }
ReturnValue_t TcpTmTcServer::handleTmSending(socket_t connSocket, bool& tmSent) { ReturnValue_t TcpTmTcServer::handleTmSending(socket_t connSocket, bool& tmSent) {
// Access to the FIFO is mutex protected because it is filled by the bridge // Access to the FIFO is mutex protected because it is filled by the bridge
MutexGuard(tmtcBridge->mutex, tmtcBridge->timeoutType, tmtcBridge->mutexTimeoutMs); MutexGuard mg(tmtcBridge->mutex, tmtcBridge->timeoutType, tmtcBridge->mutexTimeoutMs);
store_address_t storeId; store_address_t storeId;
while ((not tmtcBridge->tmFifo->empty()) and while ((not tmtcBridge->tmFifo->empty()) and
(tmtcBridge->packetSentCounter < tmtcBridge->sentPacketsPerCycle)) { (tmtcBridge->packetSentCounter < tmtcBridge->sentPacketsPerCycle)) {
@ -276,15 +248,11 @@ ReturnValue_t TcpTmTcServer::handleTmSending(socket_t connSocket, bool& tmSent)
return result; return result;
} }
if (wiretappingEnabled) { if (wiretappingEnabled) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGI("Sending TM:");
sif::info << "Sending TM:" << std::endl;
#else
sif::printInfo("Sending TM:\n");
#endif
arrayprinter::print(storeAccessor.data(), storeAccessor.size()); arrayprinter::print(storeAccessor.data(), storeAccessor.size());
} }
int retval = send(connSocket, reinterpret_cast<const char*>(storeAccessor.data()), ssize_t retval = send(connSocket, reinterpret_cast<const char*>(storeAccessor.data()),
storeAccessor.size(), tcpConfig.tcpTmFlags); storeAccessor.size(), tcpConfig.tcpTmFlags);
if (retval == static_cast<int>(storeAccessor.size())) { if (retval == static_cast<int>(storeAccessor.size())) {
// Packet sent, clear FIFO entry // Packet sent, clear FIFO entry
tmtcBridge->tmFifo->pop(); tmtcBridge->tmFifo->pop();
@ -305,31 +273,14 @@ ReturnValue_t TcpTmTcServer::handleTcRingBufferData(size_t availableReadData) {
size_t readAmount = availableReadData; size_t readAmount = availableReadData;
lastRingBufferSize = availableReadData; lastRingBufferSize = availableReadData;
if (readAmount >= ringBuffer.getMaxSize()) { if (readAmount >= ringBuffer.getMaxSize()) {
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
// Possible configuration error, too much data or/and data coming in too fast, // Possible configuration error, too much data or/and data coming in too fast,
// requiring larger buffers // requiring larger buffers
sif::warning << "TcpTmTcServer::handleServerOperation: Ring buffer reached " FSFW_LOGWT("handleTcRingBufferData: Ring buffer reached fill count\n");
<< "fill count" << std::endl;
#else
sif::printWarning(
"TcpTmTcServer::handleServerOperation: Ring buffer reached "
"fill count");
#endif
#endif
} }
if (readAmount >= receptionBuffer.size()) { if (readAmount >= receptionBuffer.size()) {
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
// Possible configuration error, too much data or/and data coming in too fast, // Possible configuration error, too much data or/and data coming in too fast,
// requiring larger buffers // requiring larger buffers
sif::warning << "TcpTmTcServer::handleServerOperation: " FSFW_LOGWT("handleTcRingBufferData: Reception buffer too small\n");
"Reception buffer too small "
<< std::endl;
#else
sif::printWarning("TcpTmTcServer::handleServerOperation: Reception buffer too small\n");
#endif
#endif
readAmount = receptionBuffer.size(); readAmount = receptionBuffer.size();
} }
ringBuffer.readData(receptionBuffer.data(), readAmount, true); ringBuffer.readData(receptionBuffer.data(), readAmount, true);

View File

@ -4,7 +4,7 @@
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/osal/common/tcpipHelpers.h" #include "fsfw/osal/common/tcpipHelpers.h"
#include "fsfw/platform.h" #include "fsfw/platform.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
#ifdef PLATFORM_WIN #ifdef PLATFORM_WIN
#include <winsock2.h> #include <winsock2.h>
@ -51,9 +51,7 @@ UdpTcPollingTask::UdpTcPollingTask(object_id_t objectId, object_id_t tmtcUdpBrid
receptionFlags, &senderAddress, &senderAddressSize); receptionFlags, &senderAddress, &senderAddressSize);
if (bytesReceived == SOCKET_ERROR) { if (bytesReceived == SOCKET_ERROR) {
/* Handle error */ /* Handle error */
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGW("performOperation: Reception error\n");
sif::error << "UdpTcPollingTask::performOperation: Reception error." << std::endl;
#endif
tcpip::handleError(tcpip::Protocol::UDP, tcpip::ErrorSources::RECVFROM_CALL, 1000); tcpip::handleError(tcpip::Protocol::UDP, tcpip::ErrorSources::RECVFROM_CALL, 1000);
continue; continue;
} }
@ -81,12 +79,7 @@ ReturnValue_t UdpTcPollingTask::handleSuccessfullTcRead(size_t bytesRead) {
ReturnValue_t result = tcStore->addData(&storeId, receptionBuffer.data(), bytesRead); ReturnValue_t result = tcStore->addData(&storeId, receptionBuffer.data(), bytesRead);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_VERBOSE_LEVEL >= 1 FSFW_LOGWT("handleSuccessfullTcRead: Data storage failed. Packet size {}\n", bytesRead);
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "UdpTcPollingTask::transferPusToSoftwareBus: Data storage failed." << std::endl;
sif::warning << "Packet size: " << bytesRead << std::endl;
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
@ -94,13 +87,7 @@ ReturnValue_t UdpTcPollingTask::handleSuccessfullTcRead(size_t bytesRead) {
result = MessageQueueSenderIF::sendMessage(targetTcDestination, &message); result = MessageQueueSenderIF::sendMessage(targetTcDestination, &message);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_VERBOSE_LEVEL >= 1 FSFW_LOGWT("handleSuccessfullTcRead: Sending message to queue failed\n");
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "UdpTcPollingTask::handleSuccessfullTcRead: "
" Sending message to queue failed"
<< std::endl;
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
tcStore->deleteData(storeId); tcStore->deleteData(storeId);
} }
return result; return result;
@ -109,17 +96,13 @@ ReturnValue_t UdpTcPollingTask::handleSuccessfullTcRead(size_t bytesRead) {
ReturnValue_t UdpTcPollingTask::initialize() { ReturnValue_t UdpTcPollingTask::initialize() {
tcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE); tcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
if (tcStore == nullptr) { if (tcStore == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE("initialize: TC store uninitialized\n");
sif::error << "UdpTcPollingTask::initialize: TC store uninitialized!" << std::endl;
#endif
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
tmtcBridge = ObjectManager::instance()->get<UdpTmTcBridge>(tmtcBridgeId); tmtcBridge = ObjectManager::instance()->get<UdpTmTcBridge>(tmtcBridgeId);
if (tmtcBridge == nullptr) { if (tmtcBridge == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE("initialize: Invalid TMTC bridge object\n");
sif::error << "UdpTcPollingTask::initialize: Invalid TMTC bridge object!" << std::endl;
#endif
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
@ -158,11 +141,7 @@ void UdpTcPollingTask::setTimeout(double timeoutSeconds) {
tval = timevalOperations::toTimeval(timeoutSeconds); tval = timevalOperations::toTimeval(timeoutSeconds);
int result = setsockopt(serverSocket, SOL_SOCKET, SO_RCVTIMEO, &tval, sizeof(receptionTimeout)); int result = setsockopt(serverSocket, SOL_SOCKET, SO_RCVTIMEO, &tval, sizeof(receptionTimeout));
if (result == -1) { if (result == -1) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGW("setTimeout: Setting receive timeout failed with {} | {}", errno, strerror(errno));
sif::error << "TcSocketPollingTask::TcSocketPollingTask: Setting "
"receive timeout failed with "
<< strerror(errno) << std::endl;
#endif
} }
#endif #endif
} }

View File

@ -36,13 +36,11 @@ UdpTmTcBridge::UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
ReturnValue_t UdpTmTcBridge::initialize() { ReturnValue_t UdpTmTcBridge::initialize() {
ReturnValue_t result = TmTcBridge::initialize(); ReturnValue_t result = TmTcBridge::initialize();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE("initialize: TmTcBridge initialization failed\n");
sif::error << "UdpTmTcBridge::initialize: TmTcBridge initialization failed!" << std::endl;
#endif
return result; return result;
} }
#ifdef _WIN32 #ifdef PLATFORM_WIN
/* Initiates Winsock DLL. */ /* Initiates Winsock DLL. */
WSAData wsaData; WSAData wsaData;
WORD wVersionRequested = MAKEWORD(2, 2); WORD wVersionRequested = MAKEWORD(2, 2);
@ -120,9 +118,7 @@ ReturnValue_t UdpTmTcBridge::sendTm(const uint8_t *data, size_t dataLen) {
ssize_t bytesSent = sendto(serverSocket, reinterpret_cast<const char *>(data), dataLen, flags, ssize_t bytesSent = sendto(serverSocket, reinterpret_cast<const char *>(data), dataLen, flags,
&clientAddress, clientAddressLen); &clientAddress, clientAddressLen);
if (bytesSent == SOCKET_ERROR) { if (bytesSent == SOCKET_ERROR) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGWT("sendTm: Send operation failed\n");
sif::warning << "TmTcUdpBridge::sendTm: Send operation failed." << std::endl;
#endif
tcpip::handleError(tcpip::Protocol::UDP, tcpip::ErrorSources::SENDTO_CALL); tcpip::handleError(tcpip::Protocol::UDP, tcpip::ErrorSources::SENDTO_CALL);
} }
#if FSFW_CPP_OSTREAM_ENABLED == 1 && FSFW_UDP_SEND_WIRETAPPING_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 && FSFW_UDP_SEND_WIRETAPPING_ENABLED == 1

View File

@ -1,7 +1,9 @@
#include "fsfw/osal/common/tcpipCommon.h" #include "fsfw/osal/common/tcpipCommon.h"
#include <cerrno>
#include "fsfw/platform.h" #include "fsfw/platform.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
#ifdef PLATFORM_WIN #ifdef PLATFORM_WIN
#include <ws2tcpip.h> #include <ws2tcpip.h>
@ -48,28 +50,20 @@ void tcpip::printAddress(struct sockaddr *addr) {
const char *stringPtr = NULL; const char *stringPtr = NULL;
switch (addr->sa_family) { switch (addr->sa_family) {
case AF_INET: { case AF_INET: {
struct sockaddr_in *addrIn = reinterpret_cast<struct sockaddr_in *>(addr); auto *addrIn = reinterpret_cast<struct sockaddr_in *>(addr);
stringPtr = inet_ntop(AF_INET, &(addrIn->sin_addr), ipAddress, INET_ADDRSTRLEN); stringPtr = inet_ntop(AF_INET, &(addrIn->sin_addr), ipAddress, INET_ADDRSTRLEN);
break; break;
} }
case AF_INET6: { case AF_INET6: {
struct sockaddr_in6 *addrIn = reinterpret_cast<struct sockaddr_in6 *>(addr); auto *addrIn = reinterpret_cast<struct sockaddr_in6 *>(addr);
stringPtr = inet_ntop(AF_INET6, &(addrIn->sin6_addr), ipAddress, INET6_ADDRSTRLEN); stringPtr = inet_ntop(AF_INET6, &(addrIn->sin6_addr), ipAddress, INET6_ADDRSTRLEN);
break; break;
} }
} }
#if FSFW_CPP_OSTREAM_ENABLED == 1 if (stringPtr == nullptr) {
if (stringPtr == NULL) { FSFW_FLOGDT("Could not convert IP address to text representation, error code {} | {}", errno,
sif::debug << "Could not convert IP address to text representation, error code " << errno strerror(errno));
<< std::endl;
} else { } else {
sif::debug << "IP Address Sender: " << ipAddress << std::endl; FSFW_FLOGDT("IP Address Sender {}\n", ipAddress);
} }
#else
if (stringPtr == NULL) {
sif::printDebug("Could not convert IP address to text representation, error code %d\n", errno);
} else {
sif::printDebug("IP Address Sender: %s\n", ipAddress);
}
#endif
} }

View File

@ -14,36 +14,24 @@
using SystemClock = std::chrono::system_clock; using SystemClock = std::chrono::system_clock;
uint32_t Clock::getTicksPerSecond(void) { uint32_t Clock::getTicksPerSecond() {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGW("getTicksPerSecond: Not implemented for host OSAL\n");
sif::warning << "Clock::getTicksPerSecond: Not implemented for host OSAL" << std::endl;
#else
sif::printWarning("Clock::getTicksPerSecond: Not implemented for host OSAL\n");
#endif
/* To avoid division by zero */ /* To avoid division by zero */
return 1; return 1;
} }
ReturnValue_t Clock::setClock(const TimeOfDay_t* time) { ReturnValue_t Clock::setClock(const TimeOfDay_t* time) {
/* I don't know why someone would need to set a clock which is probably perfectly fine on a // I don't know why someone would need to set a clock which is probably perfectly fine on a
host system with internet access so this is not implemented for now. */ // host system with internet access so this is not implemented for now.
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGI("Clock::setClock: Not implemented for host OSAL\n");
sif::warning << "Clock::setClock: Not implemented for host OSAL" << std::endl; return HasReturnvaluesIF::RETURN_FAILED;
#else
sif::printWarning("Clock::setClock: Not implemented for host OSAL\n");
#endif
return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t Clock::setClock(const timeval* time) { ReturnValue_t Clock::setClock(const timeval* time) {
/* I don't know why someone would need to set a clock which is probably perfectly fine on a // I don't know why someone would need to set a clock which is probably perfectly fine on a
host system with internet access so this is not implemented for now. */ // host system with internet access so this is not implemented for now.
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGI("Clock::setClock: Not implemented for host OSAL\n");
sif::warning << "Clock::setClock: Not implemented for host OSAL" << std::endl; return HasReturnvaluesIF::RETURN_FAILED;
#else
sif::printWarning("Clock::setClock: Not implemented for host OSAL\n");
#endif
return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t Clock::getClock_timeval(timeval* time) { ReturnValue_t Clock::getClock_timeval(timeval* time) {

View File

@ -9,7 +9,7 @@
#include "fsfw/osal/host/Mutex.h" #include "fsfw/osal/host/Mutex.h"
#include "fsfw/osal/host/taskHelpers.h" #include "fsfw/osal/host/taskHelpers.h"
#include "fsfw/platform.h" #include "fsfw/platform.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
#include "fsfw/tasks/ExecutableObjectIF.h" #include "fsfw/tasks/ExecutableObjectIF.h"
#if defined(PLATFORM_WIN) #if defined(PLATFORM_WIN)
@ -48,7 +48,7 @@ FixedTimeslotTask::~FixedTimeslotTask(void) {
} }
void FixedTimeslotTask::taskEntryPoint(void* argument) { void FixedTimeslotTask::taskEntryPoint(void* argument) {
FixedTimeslotTask* originalTask(reinterpret_cast<FixedTimeslotTask*>(argument)); auto* originalTask(reinterpret_cast<FixedTimeslotTask*>(argument));
if (not originalTask->started) { if (not originalTask->started) {
// we have to suspend/block here until the task is started. // we have to suspend/block here until the task is started.
@ -58,11 +58,7 @@ void FixedTimeslotTask::taskEntryPoint(void* argument) {
} }
this->taskFunctionality(); this->taskFunctionality();
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGET("taskEntryPoint: Returned from taskFunctionality\n");
sif::debug << "FixedTimeslotTask::taskEntryPoint: "
"Returned from taskFunctionality."
<< std::endl;
#endif
} }
ReturnValue_t FixedTimeslotTask::startTask() { ReturnValue_t FixedTimeslotTask::startTask() {
@ -114,22 +110,13 @@ void FixedTimeslotTask::taskFunctionality() {
ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId, uint32_t slotTimeMs, ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId, uint32_t slotTimeMs,
int8_t executionStep) { int8_t executionStep) {
ExecutableObjectIF* executableObject = auto* executableObject = ObjectManager::instance()->get<ExecutableObjectIF>(componentId);
ObjectManager::instance()->get<ExecutableObjectIF>(componentId);
if (executableObject != nullptr) { if (executableObject != nullptr) {
pollingSeqTable.addSlot(componentId, slotTimeMs, executionStep, executableObject, this); pollingSeqTable.addSlot(componentId, slotTimeMs, executionStep, executableObject, this);
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGE("addSlot: Component {:#08x} not found, not adding it to PST\n", componentId);
sif::error << "Component " << std::hex << "0x" << componentId
<< "not found, "
"not adding it to PST.."
<< std::dec << std::endl;
#else
sif::printError("Component 0x%08x not found, not adding it to PST..\n",
static_cast<unsigned int>(componentId));
#endif
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }

View File

@ -15,11 +15,7 @@ MessageQueue::MessageQueue(size_t messageDepth, size_t maxMessageSize, MqArgs* a
queueLock = MutexFactory::instance()->createMutex(); queueLock = MutexFactory::instance()->createMutex();
auto result = QueueMapManager::instance()->addMessageQueue(this, &id); auto result = QueueMapManager::instance()->addMessageQueue(this, &id);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGET("ctor: Could not be created\n");
sif::error << "MessageQueue::MessageQueue: Could not be created" << std::endl;
#else
sif::printError("MessageQueue::MessageQueue: Could not be created\n");
#endif
} }
} }

View File

@ -8,7 +8,7 @@
#include "fsfw/osal/host/Mutex.h" #include "fsfw/osal/host/Mutex.h"
#include "fsfw/osal/host/taskHelpers.h" #include "fsfw/osal/host/taskHelpers.h"
#include "fsfw/platform.h" #include "fsfw/platform.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
#include "fsfw/tasks/ExecutableObjectIF.h" #include "fsfw/tasks/ExecutableObjectIF.h"
#if defined(PLATFORM_WIN) #if defined(PLATFORM_WIN)
@ -42,7 +42,7 @@ PeriodicTask::~PeriodicTask(void) {
} }
void PeriodicTask::taskEntryPoint(void* argument) { void PeriodicTask::taskEntryPoint(void* argument) {
PeriodicTask* originalTask(reinterpret_cast<PeriodicTask*>(argument)); auto* originalTask(reinterpret_cast<PeriodicTask*>(argument));
if (not originalTask->started) { if (not originalTask->started) {
// we have to suspend/block here until the task is started. // we have to suspend/block here until the task is started.
@ -52,11 +52,7 @@ void PeriodicTask::taskEntryPoint(void* argument) {
} }
this->taskFunctionality(); this->taskFunctionality();
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE("taskEntryPoint: Returned from taskFunctionality\n");
sif::debug << "PeriodicTask::taskEntryPoint: "
"Returned from taskFunctionality."
<< std::endl;
#endif
} }
ReturnValue_t PeriodicTask::startTask() { ReturnValue_t PeriodicTask::startTask() {

View File

@ -30,15 +30,10 @@ ReturnValue_t QueueMapManager::addMessageQueue(MessageQueueIF* queueToInsert,
auto returnPair = queueMap.emplace(currentId, queueToInsert); auto returnPair = queueMap.emplace(currentId, queueToInsert);
if (not returnPair.second) { if (not returnPair.second) {
/* This should never happen for the atomic variable. */ /* This should never happen for the atomic variable. */
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE(
sif::error << "QueueMapManager::addMessageQueue This ID is already " "QueueMapManager::addMessageQueue The ID {} is already "
"inside the map!" "inside the map\n",
<< std::endl; currentId);
#else
sif::printError(
"QueueMapManager::addMessageQueue This ID is already "
"inside the map!\n");
#endif
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
if (id != nullptr) { if (id != nullptr) {
@ -52,13 +47,7 @@ MessageQueueIF* QueueMapManager::getMessageQueue(MessageQueueId_t messageQueueId
if (queueIter != queueMap.end()) { if (queueIter != queueMap.end()) {
return queueIter->second; return queueIter->second;
} else { } else {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGWT("getMessageQueue: The ID does not exists in the map\n");
sif::warning << "QueueMapManager::getQueueHandle: The ID " << messageQueueId
<< " does not exists in the map!" << std::endl;
#else
sif::printWarning("QueueMapManager::getQueueHandle: The ID %d does not exist in the map!\n",
messageQueueId);
#endif
} }
return nullptr; return nullptr;
} }

View File

@ -1,6 +1,6 @@
#include "fsfw/tasks/SemaphoreFactory.h" #include "fsfw/tasks/SemaphoreFactory.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr; SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr;
@ -17,22 +17,14 @@ SemaphoreFactory* SemaphoreFactory::instance() {
SemaphoreIF* SemaphoreFactory::createBinarySemaphore(uint32_t arguments) { SemaphoreIF* SemaphoreFactory::createBinarySemaphore(uint32_t arguments) {
// Just gonna wait for full C++20 for now. // Just gonna wait for full C++20 for now.
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE("SemaphoreFactory: Binary Semaphore not implemented yet. Returning nullptr!\n");
sif::error << "SemaphoreFactory: Binary Semaphore not implemented yet."
" Returning nullptr!\n"
<< std::flush;
#endif
return nullptr; return nullptr;
} }
SemaphoreIF* SemaphoreFactory::createCountingSemaphore(const uint8_t maxCount, uint8_t initCount, SemaphoreIF* SemaphoreFactory::createCountingSemaphore(const uint8_t maxCount, uint8_t initCount,
uint32_t arguments) { uint32_t arguments) {
// Just gonna wait for full C++20 for now. // Just gonna wait for full C++20 for now.
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE("SemaphoreFactory: Counting Semaphore not implemented yet. Returning nullptr!\n");
sif::error << "SemaphoreFactory: Counting Semaphore not implemented yet."
" Returning nullptr!\n"
<< std::flush;
#endif
return nullptr; return nullptr;
} }

View File

@ -6,7 +6,7 @@
#include "fsfw/osal/host/PeriodicTask.h" #include "fsfw/osal/host/PeriodicTask.h"
#include "fsfw/osal/host/taskHelpers.h" #include "fsfw/osal/host/taskHelpers.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
#include "fsfw/tasks/PeriodicTaskIF.h" #include "fsfw/tasks/PeriodicTaskIF.h"
TaskFactory* TaskFactory::factoryInstance = new TaskFactory(); TaskFactory* TaskFactory::factoryInstance = new TaskFactory();
@ -47,9 +47,5 @@ ReturnValue_t TaskFactory::delayTask(uint32_t delayMs) {
void TaskFactory::printMissedDeadline() { void TaskFactory::printMissedDeadline() {
std::string name = tasks::getTaskName(std::this_thread::get_id()); std::string name = tasks::getTaskName(std::this_thread::get_id());
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGW("printMissedDeadline: {}\n", name);
sif::warning << "TaskFactory::printMissedDeadline: " << name << std::endl;
#else
sif::printWarning("TaskFactory::printMissedDeadline: %s\n", name);
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
} }

View File

@ -96,7 +96,7 @@ void tcpip::handleError(Protocol protocol, ErrorSources errorSrc, dur_millis_t s
} }
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
FSFW_LOGWT("tcpip::handleError: {} | {} | {}\n", protocolString, errorSrcString, infoString); FSFW_FLOGWT("tcpip::handleError: {} | {} | {}\n", protocolString, errorSrcString, infoString);
#else #else
sif::printWarning("tcpip::handleError: %s | %s | %s\n", protocolString.c_str(), sif::printWarning("tcpip::handleError: %s | %s | %s\n", protocolString.c_str(),
errorSrcString.c_str(), infoString.c_str()); errorSrcString.c_str(), infoString.c_str());

View File

@ -44,9 +44,9 @@ ReturnValue_t ParameterHelper::handleParameterMessage(CommandMessage* message) {
ConstStorageAccessor accessor(storeId); ConstStorageAccessor accessor(storeId);
result = storage->getData(storeId, accessor); result = storage->getData(storeId, accessor);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
FSFW_LOGE("{}", FSFW_FLOGE("{}",
"ParameterHelper::handleParameterMessage: Getting store data failed for " "ParameterHelper::handleParameterMessage: Getting store data failed for "
"load command\n"); "load command\n");
break; break;
} }

View File

@ -209,23 +209,23 @@ ReturnValue_t ParameterWrapper::set(const uint8_t *stream, size_t streamSize,
ReturnValue_t ParameterWrapper::copyFrom(const ParameterWrapper *from, ReturnValue_t ParameterWrapper::copyFrom(const ParameterWrapper *from,
uint16_t startWritingAtIndex) { uint16_t startWritingAtIndex) {
if (data == nullptr) { if (data == nullptr) {
FSFW_LOGWT("{}", "copyFrom: Called on read-only variable\n"); FSFW_FLOGWT("{}", "copyFrom: Called on read-only variable\n");
return READONLY; return READONLY;
} }
if (from->readonlyData == nullptr) { if (from->readonlyData == nullptr) {
FSFW_LOGWT("{}", "copyFrom: Source not set\n"); FSFW_FLOGWT("{}", "copyFrom: Source not set\n");
return SOURCE_NOT_SET; return SOURCE_NOT_SET;
} }
if (type != from->type) { if (type != from->type) {
FSFW_LOGW("{}", "copyFrom: Datatype missmatch\n"); FSFW_FLOGW("{}", "copyFrom: Datatype missmatch\n");
return DATATYPE_MISSMATCH; return DATATYPE_MISSMATCH;
} }
// The smallest allowed value for rows and columns is one. // The smallest allowed value for rows and columns is one.
if (rows == 0 or columns == 0) { if (rows == 0 or columns == 0) {
FSFW_LOGW("{}", "ParameterWrapper::copyFrom: Columns or rows zero\n"); FSFW_FLOGW("{}", "ParameterWrapper::copyFrom: Columns or rows zero\n");
return COLUMN_OR_ROWS_ZERO; return COLUMN_OR_ROWS_ZERO;
} }

View File

@ -4,7 +4,7 @@
#include "fsfw/health/HealthMessage.h" #include "fsfw/health/HealthMessage.h"
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/pus/servicepackets/Service201Packets.h" #include "fsfw/pus/servicepackets/Service201Packets.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
CService201HealthCommanding::CService201HealthCommanding(object_id_t objectId, uint16_t apid, CService201HealthCommanding::CService201HealthCommanding(object_id_t objectId, uint16_t apid,
uint8_t serviceId, uint8_t serviceId,
@ -22,9 +22,7 @@ ReturnValue_t CService201HealthCommanding::isValidSubservice(uint8_t subservice)
case (Subservice::COMMAND_ANNOUNCE_HEALTH_ALL): case (Subservice::COMMAND_ANNOUNCE_HEALTH_ALL):
return RETURN_OK; return RETURN_OK;
default: default:
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGWT("Invalid Subservice\n");
sif::error << "Invalid Subservice" << std::endl;
#endif
return AcceptsTelecommandsIF::INVALID_SUBSERVICE; return AcceptsTelecommandsIF::INVALID_SUBSERVICE;
} }
} }
@ -43,8 +41,8 @@ ReturnValue_t CService201HealthCommanding::getMessageQueueAndObject(uint8_t subs
} }
ReturnValue_t CService201HealthCommanding::checkInterfaceAndAcquireMessageQueue( ReturnValue_t CService201HealthCommanding::checkInterfaceAndAcquireMessageQueue(
MessageQueueId_t *messageQueueToSet, object_id_t *objectId) { MessageQueueId_t *messageQueueToSet, const object_id_t *objectId) {
HasHealthIF *destination = ObjectManager::instance()->get<HasHealthIF>(*objectId); auto *destination = ObjectManager::instance()->get<HasHealthIF>(*objectId);
if (destination == nullptr) { if (destination == nullptr) {
return CommandingServiceBase::INVALID_OBJECT; return CommandingServiceBase::INVALID_OBJECT;
} }
@ -96,9 +94,8 @@ ReturnValue_t CService201HealthCommanding::handleReply(const CommandMessage *rep
// Not used for now, health state already reported by event // Not used for now, health state already reported by event
ReturnValue_t CService201HealthCommanding::prepareHealthSetReply(const CommandMessage *reply) { ReturnValue_t CService201HealthCommanding::prepareHealthSetReply(const CommandMessage *reply) {
prepareHealthSetReply(reply); auto health = static_cast<uint8_t>(HealthMessage::getHealth(reply));
uint8_t health = static_cast<uint8_t>(HealthMessage::getHealth(reply)); auto oldHealth = static_cast<uint8_t>(HealthMessage::getOldHealth(reply));
uint8_t oldHealth = static_cast<uint8_t>(HealthMessage::getOldHealth(reply));
HealthSetReply healthSetReply(health, oldHealth); HealthSetReply healthSetReply(health, oldHealth);
return sendTmPacket(Subservice::REPLY_HEALTH_SET, &healthSetReply); return sendTmPacket(Subservice::REPLY_HEALTH_SET, &healthSetReply);
} }

View File

@ -41,7 +41,7 @@ class CService201HealthCommanding : public CommandingServiceBase {
ReturnValue_t checkAndAcquireTargetID(object_id_t *objectIdToSet, const uint8_t *tcData, ReturnValue_t checkAndAcquireTargetID(object_id_t *objectIdToSet, const uint8_t *tcData,
size_t tcDataLen); size_t tcDataLen);
ReturnValue_t checkInterfaceAndAcquireMessageQueue(MessageQueueId_t *MessageQueueToSet, ReturnValue_t checkInterfaceAndAcquireMessageQueue(MessageQueueId_t *MessageQueueToSet,
object_id_t *objectId); const object_id_t *objectId);
ReturnValue_t prepareHealthSetReply(const CommandMessage *reply); ReturnValue_t prepareHealthSetReply(const CommandMessage *reply);

View File

@ -3,7 +3,7 @@
#include "fsfw/ipc/QueueFactory.h" #include "fsfw/ipc/QueueFactory.h"
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/pus/servicepackets/Service1Packets.h" #include "fsfw/pus/servicepackets/Service1Packets.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
#include "fsfw/tmtcpacket/pus/tm/TmPacketStored.h" #include "fsfw/tmtcpacket/pus/tm/TmPacketStored.h"
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h" #include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
#include "fsfw/tmtcservices/PusVerificationReport.h" #include "fsfw/tmtcservices/PusVerificationReport.h"
@ -53,11 +53,9 @@ ReturnValue_t Service1TelecommandVerification::sendVerificationReport(
result = generateSuccessReport(message); result = generateSuccessReport(message);
} }
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE(
sif::error << "Service1TelecommandVerification::sendVerificationReport: " "Service1TelecommandVerification::sendVerificationReport: "
"Sending verification packet failed !" "Sending verification packet failed\n");
<< std::endl;
#endif
} }
return result; return result;
} }
@ -91,15 +89,9 @@ ReturnValue_t Service1TelecommandVerification::generateSuccessReport(
ReturnValue_t Service1TelecommandVerification::initialize() { ReturnValue_t Service1TelecommandVerification::initialize() {
// Get target object for TC verification messages // Get target object for TC verification messages
AcceptsTelemetryIF* funnel = auto* funnel = ObjectManager::instance()->get<AcceptsTelemetryIF>(targetDestination);
ObjectManager::instance()->get<AcceptsTelemetryIF>(targetDestination);
if (funnel == nullptr) { if (funnel == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE("initialize: Specified TM funnel invalid. Does it implement AcceptsTelemetryIF?\n");
sif::error << "Service1TelecommandVerification::initialize: Specified"
" TM funnel invalid. Make sure it is set up and implements"
" AcceptsTelemetryIF."
<< std::endl;
#endif
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
tmQueue->setDefaultDestination(funnel->getReportReceptionQueue()); tmQueue->setDefaultDestination(funnel->getReportReceptionQueue());

View File

@ -14,7 +14,7 @@ Service20ParameterManagement::Service20ParameterManagement(object_id_t objectId,
: CommandingServiceBase(objectId, apid, serviceId, numberOfParallelCommands, : CommandingServiceBase(objectId, apid, serviceId, numberOfParallelCommands,
commandTimeoutSeconds) {} commandTimeoutSeconds) {}
Service20ParameterManagement::~Service20ParameterManagement() {} Service20ParameterManagement::~Service20ParameterManagement() = default;
ReturnValue_t Service20ParameterManagement::isValidSubservice(uint8_t subservice) { ReturnValue_t Service20ParameterManagement::isValidSubservice(uint8_t subservice) {
switch (static_cast<Subservice>(subservice)) { switch (static_cast<Subservice>(subservice)) {
@ -22,11 +22,7 @@ ReturnValue_t Service20ParameterManagement::isValidSubservice(uint8_t subservice
case Subservice::PARAMETER_DUMP: case Subservice::PARAMETER_DUMP:
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
default: default:
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGE("Invalid Subservice {} for Service 20\n", subservice);
sif::error << "Invalid Subservice for Service 20" << std::endl;
#else
sif::printError("Invalid Subservice for Service 20\n");
#endif
return AcceptsTelecommandsIF::INVALID_SUBSERVICE; return AcceptsTelecommandsIF::INVALID_SUBSERVICE;
} }
} }
@ -48,38 +44,21 @@ ReturnValue_t Service20ParameterManagement::checkAndAcquireTargetID(object_id_t*
size_t tcDataLen) { size_t tcDataLen) {
if (SerializeAdapter::deSerialize(objectIdToSet, &tcData, &tcDataLen, if (SerializeAdapter::deSerialize(objectIdToSet, &tcData, &tcDataLen,
SerializeIF::Endianness::BIG) != HasReturnvaluesIF::RETURN_OK) { SerializeIF::Endianness::BIG) != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE("checkAndAcquireTargetID: Invalid data\n");
sif::error << "Service20ParameterManagement::checkAndAcquireTargetID: "
<< "Invalid data." << std::endl;
#else
sif::printError(
"Service20ParameterManagement::"
"checkAndAcquireTargetID: Invalid data.\n");
#endif
return CommandingServiceBase::INVALID_TC; return CommandingServiceBase::INVALID_TC;
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t Service20ParameterManagement::checkInterfaceAndAcquireMessageQueue( ReturnValue_t Service20ParameterManagement::checkInterfaceAndAcquireMessageQueue(
MessageQueueId_t* messageQueueToSet, object_id_t* objectId) { MessageQueueId_t* messageQueueToSet, const object_id_t* objectId) {
// check ReceivesParameterMessagesIF property of target // check ReceivesParameterMessagesIF property of target
ReceivesParameterMessagesIF* possibleTarget = auto* possibleTarget = ObjectManager::instance()->get<ReceivesParameterMessagesIF>(*objectId);
ObjectManager::instance()->get<ReceivesParameterMessagesIF>(*objectId);
if (possibleTarget == nullptr) { if (possibleTarget == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGE(
sif::error << "Service20ParameterManagement::checkInterfaceAndAcquire" "checkInterfaceAndAcquire: Can't retrieve message queue | Object ID {:#08x}\n"
<< "MessageQueue: Can't access object" << std::endl; "Does it implement ReceivesParameterMessagesIF?\n",
sif::error << "Object ID: " << std::hex << objectId << std::dec << std::endl; *objectId);
sif::error << "Make sure it implements ReceivesParameterMessagesIF!" << std::endl;
#else
sif::printError(
"Service20ParameterManagement::checkInterfaceAndAcquire"
"MessageQueue: Can't access object\n");
sif::printError("Object ID: 0x%08x\n", *objectId);
sif::printError("Make sure it implements ReceivesParameterMessagesIF!\n");
#endif
return CommandingServiceBase::INVALID_OBJECT; return CommandingServiceBase::INVALID_OBJECT;
} }
*messageQueueToSet = possibleTarget->getCommandQueue(); *messageQueueToSet = possibleTarget->getCommandQueue();

View File

@ -37,7 +37,7 @@ class Service20ParameterManagement : public CommandingServiceBase {
ReturnValue_t checkAndAcquireTargetID(object_id_t* objectIdToSet, const uint8_t* tcData, ReturnValue_t checkAndAcquireTargetID(object_id_t* objectIdToSet, const uint8_t* tcData,
size_t tcDataLen); size_t tcDataLen);
ReturnValue_t checkInterfaceAndAcquireMessageQueue(MessageQueueId_t* messageQueueToSet, ReturnValue_t checkInterfaceAndAcquireMessageQueue(MessageQueueId_t* messageQueueToSet,
object_id_t* objectId); const object_id_t* objectId);
ReturnValue_t prepareDirectCommand(CommandMessage* message, const uint8_t* tcData, ReturnValue_t prepareDirectCommand(CommandMessage* message, const uint8_t* tcData,
size_t tcDataLen); size_t tcDataLen);

View File

@ -8,7 +8,7 @@
#include "fsfw/serialize/EndianConverter.h" #include "fsfw/serialize/EndianConverter.h"
#include "fsfw/serialize/SerialLinkedListAdapter.h" #include "fsfw/serialize/SerialLinkedListAdapter.h"
#include "fsfw/serialize/SerializeAdapter.h" #include "fsfw/serialize/SerializeAdapter.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
#include "fsfw/storagemanager/StorageManagerIF.h" #include "fsfw/storagemanager/StorageManagerIF.h"
Service2DeviceAccess::Service2DeviceAccess(object_id_t objectId, uint16_t apid, uint8_t serviceId, Service2DeviceAccess::Service2DeviceAccess(object_id_t objectId, uint16_t apid, uint8_t serviceId,
@ -25,9 +25,7 @@ ReturnValue_t Service2DeviceAccess::isValidSubservice(uint8_t subservice) {
case Subservice::COMMAND_TOGGLE_WIRETAPPING: case Subservice::COMMAND_TOGGLE_WIRETAPPING:
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
default: default:
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGW("Invalid Subservice {}\n", subservice);
sif::error << "Invalid Subservice" << std::endl;
#endif
return AcceptsTelecommandsIF::INVALID_SUBSERVICE; return AcceptsTelecommandsIF::INVALID_SUBSERVICE;
} }
} }
@ -118,11 +116,8 @@ void Service2DeviceAccess::handleUnrequestedReply(CommandMessage* reply) {
sendWiretappingTm(reply, static_cast<uint8_t>(Subservice::REPLY_RAW)); sendWiretappingTm(reply, static_cast<uint8_t>(Subservice::REPLY_RAW));
break; break;
default: default:
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGET("handleUnrequestedReply: Unknown message with command ID {}\n",
sif::error << "Unknown message in Service2DeviceAccess::" reply->getCommand());
"handleUnrequestedReply with command ID "
<< reply->getCommand() << std::endl;
#endif
break; break;
} }
// Must be reached by all cases to clear message // Must be reached by all cases to clear message
@ -137,11 +132,8 @@ void Service2DeviceAccess::sendWiretappingTm(CommandMessage* reply, uint8_t subs
size_t size = 0; size_t size = 0;
ReturnValue_t result = IPCStore->getData(storeAddress, &data, &size); ReturnValue_t result = IPCStore->getData(storeAddress, &data, &size);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGW("sendWiretappingTm: Data Lost in handleUnrequestedReply with failure ID {:#04x}\n",
sif::error << "Service2DeviceAccess::sendWiretappingTm: Data Lost in " result);
"handleUnrequestedReply with failure ID "
<< result << std::endl;
#endif
return; return;
} }

View File

@ -212,15 +212,7 @@ ReturnValue_t Service3Housekeeping::handleReply(const CommandMessage* reply,
} }
default: default:
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGW("handleReply: Invalid reply with reply command {}\n", command);
sif::warning << "Service3Housekeeping::handleReply: Invalid reply with "
<< "reply command " << command << "!" << std::endl;
#else
sif::printWarning(
"Service3Housekeeping::handleReply: Invalid reply with "
"reply command %hu!\n",
command);
#endif
return CommandingServiceBase::INVALID_REPLY; return CommandingServiceBase::INVALID_REPLY;
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
@ -241,39 +233,20 @@ void Service3Housekeeping::handleUnrequestedReply(CommandMessage* reply) {
break; break;
} }
case (HousekeepingMessage::HK_REQUEST_SUCCESS): { case (HousekeepingMessage::HK_REQUEST_SUCCESS):
break;
}
case (HousekeepingMessage::HK_REQUEST_FAILURE): { case (HousekeepingMessage::HK_REQUEST_FAILURE): {
break; break;
} }
default: { default: {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGW("handleUnrequestedReply: Invalid reply with reply command {}\n", command);
sif::warning << "Service3Housekeeping::handleUnrequestedReply: Invalid reply with reply "
"command "
<< command << "!" << std::endl;
#else
sif::printWarning(
"Service3Housekeeping::handleUnrequestedReply: Invalid reply with "
"reply command %hu!\n",
command);
#endif
return; return;
} }
} }
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
/* Configuration error */ /* Configuration error */
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGWT("handleUnrequestedReply: Could not generate reply\n");
sif::warning << "Service3Housekeeping::handleUnrequestedReply: Could not generate reply!"
<< std::endl;
#else
sif::printWarning(
"Service3Housekeeping::handleUnrequestedReply: "
"Could not generate reply!\n");
#endif
} }
} }

View File

@ -36,9 +36,7 @@ ReturnValue_t Service5EventReporting::performService() {
} }
} }
} }
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGWT("generateEventReport: Too many events\n");
sif::warning << "Service5EventReporting::generateEventReport: Too many events" << std::endl;
#endif
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
@ -55,15 +53,7 @@ ReturnValue_t Service5EventReporting::generateEventReport(EventMessage message)
ReturnValue_t result = ReturnValue_t result =
tmPacket.sendPacket(requestQueue->getDefaultDestination(), requestQueue->getId()); tmPacket.sendPacket(requestQueue->getDefaultDestination(), requestQueue->getId());
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGW("generateEventReport: Could not send TM packet\n");
sif::warning << "Service5EventReporting::generateEventReport: "
"Could not send TM packet"
<< std::endl;
#else
sif::printWarning(
"Service5EventReporting::generateEventReport: "
"Could not send TM packet\n");
#endif
} }
return result; return result;
} }

View File

@ -6,7 +6,7 @@
#include "fsfw/objectmanager/SystemObjectIF.h" #include "fsfw/objectmanager/SystemObjectIF.h"
#include "fsfw/pus/servicepackets/Service8Packets.h" #include "fsfw/pus/servicepackets/Service8Packets.h"
#include "fsfw/serialize/SerializeAdapter.h" #include "fsfw/serialize/SerializeAdapter.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
Service8FunctionManagement::Service8FunctionManagement(object_id_t objectId, uint16_t apid, Service8FunctionManagement::Service8FunctionManagement(object_id_t objectId, uint16_t apid,
uint8_t serviceId, uint8_t serviceId,
@ -65,10 +65,7 @@ ReturnValue_t Service8FunctionManagement::prepareDirectCommand(CommandMessage* m
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
if (tcDataLen < sizeof(object_id_t) + sizeof(ActionId_t)) { if (tcDataLen < sizeof(object_id_t) + sizeof(ActionId_t)) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGWT("prepareDirectCommand: TC size smaller thant minimum size of direct command\n");
sif::debug << "Service8FunctionManagement::prepareDirectCommand:"
<< " TC size smaller thant minimum size of direct command." << std::endl;
#endif
return CommandingServiceBase::INVALID_TC; return CommandingServiceBase::INVALID_TC;
} }
@ -132,9 +129,7 @@ ReturnValue_t Service8FunctionManagement::handleDataReply(const CommandMessage*
const uint8_t* buffer = nullptr; const uint8_t* buffer = nullptr;
ReturnValue_t result = IPCStore->getData(storeId, &buffer, &size); ReturnValue_t result = IPCStore->getData(storeId, &buffer, &size);
if (result != RETURN_OK) { if (result != RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGWT("Service 8: Could not retrieve data for data reply\n");
sif::error << "Service 8: Could not retrieve data for data reply" << std::endl;
#endif
return result; return result;
} }
DataReply dataReply(objectId, actionId, buffer, size); DataReply dataReply(objectId, actionId, buffer, size);
@ -142,10 +137,7 @@ ReturnValue_t Service8FunctionManagement::handleDataReply(const CommandMessage*
auto deletionResult = IPCStore->deleteData(storeId); auto deletionResult = IPCStore->deleteData(storeId);
if (deletionResult != HasReturnvaluesIF::RETURN_OK) { if (deletionResult != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGWT("Service8FunctionManagement::handleReply: Deletion of data in pool failed\n");
sif::warning << "Service8FunctionManagement::handleReply: Deletion"
<< " of data in pool failed." << std::endl;
#endif
} }
return result; return result;
} }

View File

@ -1,12 +1,13 @@
#ifndef FSFW_PUS_SERVICEPACKETS_SERVICE20PACKETS_H_ #ifndef FSFW_PUS_SERVICEPACKETS_SERVICE20PACKETS_H_
#define FSFW_PUS_SERVICEPACKETS_SERVICE20PACKETS_H_ #define FSFW_PUS_SERVICEPACKETS_SERVICE20PACKETS_H_
#include <FSFWConfig.h>
#include <fsfw/parameters/HasParametersIF.h> #include <fsfw/parameters/HasParametersIF.h>
#include <fsfw/serialize/SerialBufferAdapter.h> #include <fsfw/serialize/SerialBufferAdapter.h>
#include <fsfw/serialize/SerialLinkedListAdapter.h> #include <fsfw/serialize/SerialLinkedListAdapter.h>
#include <fsfw/serialize/SerializeElement.h> #include <fsfw/serialize/SerializeElement.h>
#include <fsfw/serviceinterface/ServiceInterface.h>
#include "fsfw/FSFW.h"
#include "fsfw/serviceinterface.h"
/** /**
* @brief This class encapsulates the packets sent to the PUS service 20 or sent by the * @brief This class encapsulates the packets sent to the PUS service 20 or sent by the
@ -26,15 +27,9 @@ class ParameterCommand
*/ */
ParameterCommand(uint8_t* storePointer, size_t parameterDataLen) ParameterCommand(uint8_t* storePointer, size_t parameterDataLen)
: parameterBuffer(storePointer, parameterDataLen) { : parameterBuffer(storePointer, parameterDataLen) {
#if FSFW_VERBOSE_LEVEL >= 1
if (parameterDataLen == 0) { if (parameterDataLen == 0) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGWT("ParameterCommand: Parameter data length is 0\n");
sif::warning << "ParameterCommand: Parameter data length is 0" << std::endl;
#else
sif::printWarning("ParameterCommand: Parameter data length is 0!\n");
#endif
} }
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
setLoadLinks(); setLoadLinks();
} }

View File

@ -95,7 +95,7 @@ ReturnValue_t SerialBufferAdapter<count_t>::deSerialize(const uint8_t** buffer,
template <typename count_t> template <typename count_t>
uint8_t* SerialBufferAdapter<count_t>::getBuffer() { uint8_t* SerialBufferAdapter<count_t>::getBuffer() {
if (buffer == nullptr) { if (buffer == nullptr) {
FSFW_LOGW("{}", "getBuffer: Wrong access function for stored type. Use getConstBuffer\n"); FSFW_FLOGW("{}", "getBuffer: Wrong access function for stored type. Use getConstBuffer\n");
return nullptr; return nullptr;
} }
return buffer; return buffer;
@ -104,7 +104,7 @@ uint8_t* SerialBufferAdapter<count_t>::getBuffer() {
template <typename count_t> template <typename count_t>
const uint8_t* SerialBufferAdapter<count_t>::getConstBuffer() const { const uint8_t* SerialBufferAdapter<count_t>::getConstBuffer() const {
if (constBuffer == nullptr) { if (constBuffer == nullptr) {
FSFW_LOGE("{}", "getConstBuffer: Buffers are unitialized\n"); FSFW_FLOGE("{}", "getConstBuffer: Buffers are unitialized\n");
return nullptr; return nullptr;
} }
return constBuffer; return constBuffer;

View File

@ -123,17 +123,26 @@ void debug(const char* file, unsigned int line, fmt::format_string<T...> fmt,
logTraced(LogLevel::DEBUG, file, line, false, fmt, args...); logTraced(LogLevel::DEBUG, file, line, false, fmt, args...);
} }
/**
* Debug logger with timestamp and file/line number prefix
*/
template <typename... T> template <typename... T>
void debug_t(const char* file, unsigned int line, fmt::format_string<T...> fmt, void debug_t(const char* file, unsigned int line, fmt::format_string<T...> fmt,
T&&... args) noexcept { T&&... args) noexcept {
logTraced(LogLevel::DEBUG, file, line, true, fmt, args...); logTraced(LogLevel::DEBUG, file, line, true, fmt, args...);
} }
/**
* Info logger with time stamp
*/
template <typename... T> template <typename... T>
void info_t(fmt::format_string<T...> fmt, T&&... args) { void info_t(fmt::format_string<T...> fmt, T&&... args) {
log(LogLevel::INFO, true, fmt, args...); log(LogLevel::INFO, true, fmt, args...);
} }
/**
* Info logger
*/
template <typename... T> template <typename... T>
void info(fmt::format_string<T...> fmt, T&&... args) { void info(fmt::format_string<T...> fmt, T&&... args) {
log(LogLevel::INFO, false, fmt, args...); log(LogLevel::INFO, false, fmt, args...);
@ -144,18 +153,27 @@ void warning(fmt::format_string<T...> fmt, T&&... args) {
log(LogLevel::ERROR, false, fmt, args...); log(LogLevel::ERROR, false, fmt, args...);
} }
/**
* Warning logger with time stamp
*/
template <typename... T> template <typename... T>
void warning_t(fmt::format_string<T...> fmt, T&&... args) { void warning_t(fmt::format_string<T...> fmt, T&&... args) {
log(LogLevel::ERROR, true, fmt, args...); log(LogLevel::ERROR, true, fmt, args...);
} }
/**
* Warning logger with file/line number prefix
*/
template <typename... T> template <typename... T>
void warning_f(const char* file, unsigned int line, fmt::format_string<T...> fmt, T&&... args) { void warning_s(const char* file, unsigned int line, fmt::format_string<T...> fmt, T&&... args) {
logTraced(LogLevel::WARNING, file, line, false, fmt, args...); logTraced(LogLevel::WARNING, file, line, false, fmt, args...);
} }
/**
* Warning logger with timestamp and source file information
*/
template <typename... T> template <typename... T>
void warning_ft(const char* file, unsigned int line, fmt::format_string<T...> fmt, T&&... args) { void warning_st(const char* file, unsigned int line, fmt::format_string<T...> fmt, T&&... args) {
logTraced(LogLevel::WARNING, file, line, true, fmt, args...); logTraced(LogLevel::WARNING, file, line, true, fmt, args...);
} }
@ -164,39 +182,61 @@ void error(fmt::format_string<T...> fmt, T&&... args) {
log(LogLevel::ERROR, false, fmt, args...); log(LogLevel::ERROR, false, fmt, args...);
} }
/**
* Error logger with timestamp
*/
template <typename... T> template <typename... T>
void error_t(fmt::format_string<T...> fmt, T&&... args) { void error_t(fmt::format_string<T...> fmt, T&&... args) {
log(LogLevel::ERROR, true, fmt, args...); log(LogLevel::ERROR, true, fmt, args...);
} }
/**
* Error logger with source file information
*/
template <typename... T> template <typename... T>
void error_f(const char* file, unsigned int line, fmt::format_string<T...> fmt, T&&... args) { void error_s(const char* file, unsigned int line, fmt::format_string<T...> fmt, T&&... args) {
logTraced(LogLevel::ERROR, file, line, false, fmt, args...); logTraced(LogLevel::ERROR, file, line, false, fmt, args...);
} }
/**
* Error logger with timestamp and source file information
*/
template <typename... T> template <typename... T>
void error_ft(const char* file, unsigned int line, fmt::format_string<T...> fmt, T&&... args) { void error_st(const char* file, unsigned int line, fmt::format_string<T...> fmt, T&&... args) {
logTraced(LogLevel::ERROR, file, line, true, fmt, args...); logTraced(LogLevel::ERROR, file, line, true, fmt, args...);
} }
} // namespace sif } // namespace sif
#define FSFW_LOGI(format, ...) sif::info(FMT_STRING(format), __VA_ARGS__) // Helper macros to simplify calling the logger functions
// The macros prefixed with F can be used to print formatted output
// The macros postfixed with T are the log variant with timing information
#define FSFW_LOGIT(format, ...) sif::info_t(FMT_STRING(format), __VA_ARGS__) #define FSFW_LOGI(...) sif::info(__VA_ARGS__)
#define FSFW_FLOGI(format, ...) sif::info(FMT_STRING(format), __VA_ARGS__)
#define FSFW_LOGD(format, ...) sif::debug(__FILENAME__, __LINE__, FMT_STRING(format), __VA_ARGS__) #define FSFW_LOGIT(...) sif::info_t(__VA_ARGS__)
#define FSFW_FLOGIT(format, ...) sif::info_t(FMT_STRING(format), __VA_ARGS__)
#define FSFW_LOGDT(format, ...) \ #define FSFW_LOGD(...) sif::debug(__FILENAME__, __LINE__, __VA_ARGS__)
#define FSFW_FLOGD(format, ...) sif::debug(__FILENAME__, __LINE__, FMT_STRING(format), __VA_ARGS__)
#define FSFW_LOGDT(...) sif::debug_t(__FILENAME__, __LINE__, __VA_ARGS__)
#define FSFW_FLOGDT(format, ...) \
sif::debug_t(__FILENAME__, __LINE__, FMT_STRING(format), __VA_ARGS__) sif::debug_t(__FILENAME__, __LINE__, FMT_STRING(format), __VA_ARGS__)
#define FSFW_LOGW(format, ...) \ #define FSFW_LOGW(...) sif::warning_s(__FILENAME__, __LINE__, __VA_ARGS__)
sif::warning_f(__FILENAME__, __LINE__, FMT_STRING(format), __VA_ARGS__) #define FSFW_FLOGW(format, ...) \
sif::warning_s(__FILENAME__, __LINE__, FMT_STRING(format), __VA_ARGS__)
#define FSFW_LOGWT(format, ...) \ #define FSFW_LOGWT(...) sif::warning_st(__FILENAME__, __LINE__, __VA_ARGS__)
sif::warning_ft(__FILENAME__, __LINE__, FMT_STRING(format), __VA_ARGS__) #define FSFW_FLOGWT(format, ...) \
sif::warning_st(__FILENAME__, __LINE__, FMT_STRING(format), __VA_ARGS__)
#define FSFW_LOGE(format, ...) sif::error_f(__FILENAME__, __LINE__, FMT_STRING(format), __VA_ARGS__) #define FSFW_LOGE(...) sif::error_s(__FILENAME__, __LINE__, __VA_ARGS__)
#define FSFW_FLOGE(format, ...) \
sif::error_s(__FILENAME__, __LINE__, FMT_STRING(format), __VA_ARGS__)
#define FSFW_LOGET(format, ...) \ #define FSFW_LOGET(...) sif::error_st(__FILENAME__, __LINE__, __VA_ARGS__)
sif::error_ft(__FILENAME__, __LINE__, FMT_STRING(format), __VA_ARGS__) #define FSFW_FLOGET(format, ...) \
sif::error_st(__FILENAME__, __LINE__, FMT_STRING(format), __VA_ARGS__)

View File

@ -46,14 +46,14 @@ const uint8_t* ConstStorageAccessor::data() const { return constDataPointer; }
size_t ConstStorageAccessor::size() const { size_t ConstStorageAccessor::size() const {
if (internalState == AccessState::UNINIT) { if (internalState == AccessState::UNINIT) {
FSFW_LOGW("{}", "size: Not initialized\n"); FSFW_FLOGW("{}", "size: Not initialized\n");
} }
return size_; return size_;
} }
ReturnValue_t ConstStorageAccessor::getDataCopy(uint8_t* pointer, size_t maxSize) { ReturnValue_t ConstStorageAccessor::getDataCopy(uint8_t* pointer, size_t maxSize) {
if (internalState == AccessState::UNINIT) { if (internalState == AccessState::UNINIT) {
FSFW_LOGW("{}", "getDataCopy: Not initialized\n"); FSFW_FLOGW("{}", "getDataCopy: Not initialized\n");
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
if (size_ > maxSize) { if (size_ > maxSize) {

View File

@ -12,7 +12,7 @@ LocalPool::LocalPool(object_id_t setObjectId, const LocalPoolConfig& poolConfig,
NUMBER_OF_SUBPOOLS(poolConfig.size()), NUMBER_OF_SUBPOOLS(poolConfig.size()),
spillsToHigherPools(spillsToHigherPools) { spillsToHigherPools(spillsToHigherPools) {
if (NUMBER_OF_SUBPOOLS == 0) { if (NUMBER_OF_SUBPOOLS == 0) {
FSFW_LOGW("{}", "ctor: Passed pool configuration is invalid, 0 subpools\n"); FSFW_FLOGW("{}", "ctor: Passed pool configuration is invalid, 0 subpools\n");
} }
max_subpools_t index = 0; max_subpools_t index = 0;
for (const auto& currentPoolConfig : poolConfig) { for (const auto& currentPoolConfig : poolConfig) {
@ -125,8 +125,8 @@ ReturnValue_t LocalPool::deleteData(store_address_t storeId) {
sizeLists[storeId.poolIndex][storeId.packetIndex] = STORAGE_FREE; sizeLists[storeId.poolIndex][storeId.packetIndex] = STORAGE_FREE;
} else { } else {
// pool_index or packet_index is too large // pool_index or packet_index is too large
FSFW_LOGWT("Object ID {} | deleteData: Illegal store ID, no deletion\n", FSFW_FLOGWT("Object ID {} | deleteData: Illegal store ID, no deletion\n",
SystemObject::getObjectId()); SystemObject::getObjectId());
status = ILLEGAL_STORAGE_ID; status = ILLEGAL_STORAGE_ID;
} }
return status; return status;
@ -175,7 +175,7 @@ ReturnValue_t LocalPool::initialize() {
// Check if any pool size is large than the maximum allowed. // Check if any pool size is large than the maximum allowed.
for (uint8_t count = 0; count < NUMBER_OF_SUBPOOLS; count++) { for (uint8_t count = 0; count < NUMBER_OF_SUBPOOLS; count++) {
if (elementSizes[count] >= STORAGE_FREE) { if (elementSizes[count] >= STORAGE_FREE) {
FSFW_LOGW( FSFW_FLOGW(
"LocalPool::initialize: Pool is too large- " "LocalPool::initialize: Pool is too large- "
"Max. allowed size is: {}\n", "Max. allowed size is: {}\n",
STORAGE_FREE - 1); STORAGE_FREE - 1);
@ -199,7 +199,7 @@ ReturnValue_t LocalPool::reserveSpace(const size_t size, store_address_t* storeI
bool ignoreFault) { bool ignoreFault) {
ReturnValue_t status = getSubPoolIndex(size, &storeId->poolIndex); ReturnValue_t status = getSubPoolIndex(size, &storeId->poolIndex);
if (status != RETURN_OK) { if (status != RETURN_OK) {
FSFW_LOGW("ID {:#08x} | reserveSpace: Packet too large\n", SystemObject::getObjectId()); FSFW_FLOGW("ID {:#08x} | reserveSpace: Packet too large\n", SystemObject::getObjectId());
return status; return status;
} }
status = findEmpty(storeId->poolIndex, &storeId->packetIndex); status = findEmpty(storeId->poolIndex, &storeId->packetIndex);

View File

@ -23,7 +23,7 @@ StorageAccessor::StorageAccessor(StorageAccessor&& other)
ReturnValue_t StorageAccessor::getDataCopy(uint8_t* pointer, size_t maxSize) { ReturnValue_t StorageAccessor::getDataCopy(uint8_t* pointer, size_t maxSize) {
if (internalState == AccessState::UNINIT) { if (internalState == AccessState::UNINIT) {
FSFW_LOGW("{}", "getDataCopy: Not initialized\n"); FSFW_FLOGW("{}", "getDataCopy: Not initialized\n");
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
if (size_ > maxSize) { if (size_ > maxSize) {

View File

@ -83,9 +83,7 @@ void SubsystemBase::executeTable(HybridIterator<ModeListEntry> tableIter, Submod
object_id_t object = tableIter.value->getObject(); object_id_t object = tableIter.value->getObject();
if ((iter = childrenMap.find(object)) == childrenMap.end()) { if ((iter = childrenMap.find(object)) == childrenMap.end()) {
// illegal table entry, should only happen due to misconfigured mode table // illegal table entry, should only happen due to misconfigured mode table
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGD("{}: Invalid mode table entry\n");
sif::debug << std::hex << getObjectId() << ": invalid mode table entry" << std::endl;
#endif
continue; continue;
} }

View File

@ -90,7 +90,7 @@ void FixedSlotSequence::addSlot(object_id_t componentId, uint32_t slotTimeMs, in
ReturnValue_t FixedSlotSequence::checkSequence() const { ReturnValue_t FixedSlotSequence::checkSequence() const {
if (slotList.empty()) { if (slotList.empty()) {
FSFW_LOGW("{}", "FixedSlotSequence::checkSequence: Slot list is empty\n"); FSFW_FLOGW("{}", "FixedSlotSequence::checkSequence: Slot list is empty\n");
return FixedTimeslotTaskIF::SLOT_LIST_EMPTY; return FixedTimeslotTaskIF::SLOT_LIST_EMPTY;
} }
@ -98,7 +98,7 @@ ReturnValue_t FixedSlotSequence::checkSequence() const {
ReturnValue_t result = customCheckFunction(slotList); ReturnValue_t result = customCheckFunction(slotList);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
// Continue for now but print error output. // Continue for now but print error output.
FSFW_LOGW("FixedSlotSequence::checkSequence: Custom check failed with result {}", result); FSFW_FLOGW("FixedSlotSequence::checkSequence: Custom check failed with result {}", result);
} }
} }
@ -108,8 +108,8 @@ ReturnValue_t FixedSlotSequence::checkSequence() const {
if (slot.executableObject == nullptr) { if (slot.executableObject == nullptr) {
errorCount++; errorCount++;
} else if (slot.pollingTimeMs < time) { } else if (slot.pollingTimeMs < time) {
FSFW_LOGET("FixedSlotSequence::checkSequence: Time {} is smaller than previous with {}\n", FSFW_FLOGET("FixedSlotSequence::checkSequence: Time {} is smaller than previous with {}\n",
slot.pollingTimeMs, time); slot.pollingTimeMs, time);
errorCount++; errorCount++;
} else { } else {
// All ok, print slot. // All ok, print slot.
@ -144,7 +144,7 @@ ReturnValue_t FixedSlotSequence::intializeSequenceAfterTaskCreation() const {
} }
} }
if (count > 0) { if (count > 0) {
FSFW_LOGE( FSFW_FLOGE(
"FixedSlotSequence::intializeSequenceAfterTaskCreation: Counted {} " "FixedSlotSequence::intializeSequenceAfterTaskCreation: Counted {} "
"failed initializations\n", "failed initializations\n",
count); count);

View File

@ -27,7 +27,7 @@ TcDistributor::TcMqMapIter CCSDSDistributor::selectDestination() {
size_t size = 0; size_t size = 0;
ReturnValue_t result = this->tcStore->getData(currentMessage.getStorageId(), &packet, &size); ReturnValue_t result = this->tcStore->getData(currentMessage.getStorageId(), &packet, &size);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
FSFW_LOGWT("{}", "selectDestination: Getting data from store failed"); FSFW_FLOGWT("{}", "selectDestination: Getting data from store failed");
} }
SpacePacketBase currentPacket(packet); SpacePacketBase currentPacket(packet);
@ -72,17 +72,7 @@ ReturnValue_t CCSDSDistributor::initialize() {
ReturnValue_t status = this->TcDistributor::initialize(); ReturnValue_t status = this->TcDistributor::initialize();
this->tcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE); this->tcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
if (this->tcStore == nullptr) { if (this->tcStore == nullptr) {
#if FSFW_VERBOSE_LEVEL >= 1 FSFW_LOGE("CCSDSDistributor::initialize: Could not initialize TC store\n");
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "CCSDSDistributor::initialize: Could not initialize"
" TC store!"
<< std::endl;
#else
sif::printError(
"CCSDSDistributor::initialize: Could not initialize"
" TC store!\n");
#endif
#endif
status = RETURN_FAILED; status = RETURN_FAILED;
} }
return status; return status;

View File

@ -1,6 +1,7 @@
#include "fsfw/tcdistribution/CFDPDistributor.h" #include "fsfw/tcdistribution/CFDPDistributor.h"
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serviceinterface.h"
#include "fsfw/tcdistribution/CCSDSDistributorIF.h" #include "fsfw/tcdistribution/CCSDSDistributorIF.h"
#include "fsfw/tmtcpacket/cfdp/CFDPPacketStored.h" #include "fsfw/tmtcpacket/cfdp/CFDPPacketStored.h"
@ -21,8 +22,8 @@ CFDPDistributor::~CFDPDistributor() {}
CFDPDistributor::TcMqMapIter CFDPDistributor::selectDestination() { CFDPDistributor::TcMqMapIter CFDPDistributor::selectDestination() {
#if FSFW_CFDP_DISTRIBUTOR_DEBUGGING == 1 #if FSFW_CFDP_DISTRIBUTOR_DEBUGGING == 1
store_address_t storeId = this->currentMessage.getStorageId(); store_address_t storeId = this->currentMessage.getStorageId();
FSFW_LOGI("selectDestination: Recie" << storeId.poolIndex << ", " FSFW_FLOGI("selectDestination was called with pool index {} and packet index {}\n",
<< storeId.packetIndex << std::endl; storeId.poolIndex, storeId.packetIndex);
#endif #endif
TcMqMapIter queueMapIt = this->queueMap.end(); TcMqMapIter queueMapIt = this->queueMap.end();
if (this->currentPacket == nullptr) { if (this->currentPacket == nullptr) {
@ -32,15 +33,8 @@ CFDPDistributor::TcMqMapIter CFDPDistributor::selectDestination() {
if (currentPacket->getWholeData() != nullptr) { if (currentPacket->getWholeData() != nullptr) {
tcStatus = checker.checkPacket(currentPacket); tcStatus = checker.checkPacket(currentPacket);
if (tcStatus != HasReturnvaluesIF::RETURN_OK) { if (tcStatus != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_VERBOSE_LEVEL >= 1 FSFW_FLOGWT("selectDestination: Packet format invalid, code {}\n",
#if FSFW_CPP_OSTREAM_ENABLED == 1 static_cast<int>(tcStatus));
sif::debug << "CFDPDistributor::handlePacket: Packet format invalid, code "
<< static_cast<int>(tcStatus) << std::endl;
#else
sif::printDebug("CFDPDistributor::handlePacket: Packet format invalid, code %d\n",
static_cast<int>(tcStatus));
#endif
#endif
} }
queueMapIt = this->queueMap.find(0); queueMapIt = this->queueMap.find(0);
} else { } else {
@ -49,13 +43,7 @@ CFDPDistributor::TcMqMapIter CFDPDistributor::selectDestination() {
if (queueMapIt == this->queueMap.end()) { if (queueMapIt == this->queueMap.end()) {
tcStatus = DESTINATION_NOT_FOUND; tcStatus = DESTINATION_NOT_FOUND;
#if FSFW_VERBOSE_LEVEL >= 1 FSFW_FLOGWT("{}", "handlePacket: Destination not found\n");
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "CFDPDistributor::handlePacket: Destination not found" << std::endl;
#else
sif::printDebug("CFDPDistributor::handlePacket: Destination not found\n");
#endif /* !FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif
} }
if (tcStatus != RETURN_OK) { if (tcStatus != RETURN_OK) {
@ -68,26 +56,11 @@ CFDPDistributor::TcMqMapIter CFDPDistributor::selectDestination() {
ReturnValue_t CFDPDistributor::registerHandler(AcceptsTelecommandsIF* handler) { ReturnValue_t CFDPDistributor::registerHandler(AcceptsTelecommandsIF* handler) {
uint16_t handlerId = uint16_t handlerId =
handler->getIdentifier(); // should be 0, because CFDPHandler does not set a set a service-ID handler->getIdentifier(); // should be 0, because CFDPHandler does not set a set a service-ID
#if FSFW_CFDP_DISTRIBUTOR_DEBUGGING == 1 FSFW_FLOGIT("CFDPDistributor::registerHandler: Handler ID {}\n", static_cast<int>(handlerId));
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "CFDPDistributor::registerHandler: Handler ID: " << static_cast<int>(handlerId)
<< std::endl;
#else
sif::printInfo("CFDPDistributor::registerHandler: Handler ID: %d\n", static_cast<int>(handlerId));
#endif
#endif
MessageQueueId_t queue = handler->getRequestQueue(); MessageQueueId_t queue = handler->getRequestQueue();
auto returnPair = queueMap.emplace(handlerId, queue); auto returnPair = queueMap.emplace(handlerId, queue);
if (not returnPair.second) { if (not returnPair.second) {
#if FSFW_VERBOSE_LEVEL >= 1 FSFW_FLOGE("{}", "CFDPDistributor::registerHandler: Service ID already exists in map\n");
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "CFDPDistributor::registerHandler: Service ID already"
" exists in map"
<< std::endl;
#else
sif::printError("CFDPDistributor::registerHandler: Service ID already exists in map\n");
#endif
#endif
return SERVICE_ID_ALREADY_EXISTS; return SERVICE_ID_ALREADY_EXISTS;
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
@ -122,16 +95,9 @@ ReturnValue_t CFDPDistributor::initialize() {
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
CCSDSDistributorIF* ccsdsDistributor = auto* ccsdsDistributor = ObjectManager::instance()->get<CCSDSDistributorIF>(packetSource);
ObjectManager::instance()->get<CCSDSDistributorIF>(packetSource);
if (ccsdsDistributor == nullptr) { if (ccsdsDistributor == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGE("{}", "initialize: Packet source invalid. Does it implement CCSDSDistributorIF?\n");
sif::error << "CFDPDistributor::initialize: Packet source invalid" << std::endl;
sif::error << " Make sure it exists and implements CCSDSDistributorIF!" << std::endl;
#else
sif::printError("CFDPDistributor::initialize: Packet source invalid\n");
sif::printError("Make sure it exists and implements CCSDSDistributorIF\n");
#endif
return RETURN_FAILED; return RETURN_FAILED;
} }
return ccsdsDistributor->registerApplication(this); return ccsdsDistributor->registerApplication(this);

View File

@ -1,7 +1,7 @@
#include "fsfw/tcdistribution/PUSDistributor.h" #include "fsfw/tcdistribution/PUSDistributor.h"
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
#include "fsfw/tcdistribution/CCSDSDistributorIF.h" #include "fsfw/tcdistribution/CCSDSDistributorIF.h"
#include "fsfw/tmtcservices/PusVerificationReport.h" #include "fsfw/tmtcservices/PusVerificationReport.h"
@ -44,15 +44,7 @@ PUSDistributor::TcMqMapIter PUSDistributor::selectDestination() {
} else if (tcStatus == TcPacketCheckPUS::INCOMPLETE_PACKET) { } else if (tcStatus == TcPacketCheckPUS::INCOMPLETE_PACKET) {
keyword = "incomplete packet"; keyword = "incomplete packet";
} }
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGWT("selectDestination: Packet format invalid, {} error\n", keyword);
sif::warning << "PUSDistributor::handlePacket: Packet format invalid, " << keyword
<< " error" << std::endl;
#else
sif::printWarning(
"PUSDistributor::handlePacket: Packet format invalid, "
"%s error\n",
keyword);
#endif
#endif #endif
} }
uint32_t queue_id = currentPacket->getService(); uint32_t queue_id = currentPacket->getService();
@ -63,13 +55,7 @@ PUSDistributor::TcMqMapIter PUSDistributor::selectDestination() {
if (queueMapIt == this->queueMap.end()) { if (queueMapIt == this->queueMap.end()) {
tcStatus = DESTINATION_NOT_FOUND; tcStatus = DESTINATION_NOT_FOUND;
#if FSFW_VERBOSE_LEVEL >= 1 FSFW_LOGW("selectDestination: Destination not found\n");
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "PUSDistributor::handlePacket: Destination not found" << std::endl;
#else
sif::printDebug("PUSDistributor::handlePacket: Destination not found\n");
#endif /* !FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif
} }
if (tcStatus != RETURN_OK) { if (tcStatus != RETURN_OK) {
@ -91,15 +77,7 @@ ReturnValue_t PUSDistributor::registerService(AcceptsTelecommandsIF* service) {
MessageQueueId_t queue = service->getRequestQueue(); MessageQueueId_t queue = service->getRequestQueue();
auto returnPair = queueMap.emplace(serviceId, queue); auto returnPair = queueMap.emplace(serviceId, queue);
if (not returnPair.second) { if (not returnPair.second) {
#if FSFW_VERBOSE_LEVEL >= 1 FSFW_LOGW("registerService: Service ID already exists in map\n");
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "PUSDistributor::registerService: Service ID already"
" exists in map"
<< std::endl;
#else
sif::printError("PUSDistributor::registerService: Service ID already exists in map\n");
#endif
#endif
return SERVICE_ID_ALREADY_EXISTS; return SERVICE_ID_ALREADY_EXISTS;
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
@ -133,16 +111,11 @@ ReturnValue_t PUSDistributor::initialize() {
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
CCSDSDistributorIF* ccsdsDistributor = auto* ccsdsDistributor = ObjectManager::instance()->get<CCSDSDistributorIF>(packetSource);
ObjectManager::instance()->get<CCSDSDistributorIF>(packetSource);
if (ccsdsDistributor == nullptr) { if (ccsdsDistributor == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGWT(
sif::error << "PUSDistributor::initialize: Packet source invalid" << std::endl; "initialize: Packet source invalid\n Make sure it exists and implements "
sif::error << " Make sure it exists and implements CCSDSDistributorIF!" << std::endl; "CCSDSDistributorIF\n");
#else
sif::printError("PUSDistributor::initialize: Packet source invalid\n");
sif::printError("Make sure it exists and implements CCSDSDistributorIF\n");
#endif
return RETURN_FAILED; return RETURN_FAILED;
} }
return ccsdsDistributor->registerApplication(this); return ccsdsDistributor->registerApplication(this);

View File

@ -33,9 +33,9 @@ ReturnValue_t TcDistributor::handlePacket() {
} }
void TcDistributor::print() { void TcDistributor::print() {
FSFW_LOGI("{}", "Distributor content is:\nID\t| Message Queue ID"); FSFW_FLOGI("{}", "Distributor content is:\nID\t| Message Queue ID");
for (const auto& queueMapIter : queueMap) { for (const auto& queueMapIter : queueMap) {
FSFW_LOGI("{} \t| {:#08x}", queueMapIter.first, queueMapIter.second); FSFW_FLOGI("{} \t| {:#08x}", queueMapIter.first, queueMapIter.second);
} }
} }

View File

@ -31,10 +31,10 @@ void Stopwatch::display() {
if (displayMode == StopwatchDisplayMode::MILLIS) { if (displayMode == StopwatchDisplayMode::MILLIS) {
auto timeMillis = auto timeMillis =
static_cast<dur_millis_t>(elapsedTime.tv_sec * 1000 + elapsedTime.tv_usec / 1000); static_cast<dur_millis_t>(elapsedTime.tv_sec * 1000 + elapsedTime.tv_usec / 1000);
FSFW_LOGIT("Stopwatch::display: {} ms elapsed\n", timeMillis); FSFW_FLOGIT("Stopwatch::display: {} ms elapsed\n", timeMillis);
} else if (displayMode == StopwatchDisplayMode::SECONDS) { } else if (displayMode == StopwatchDisplayMode::SECONDS) {
FSFW_LOGIT("Stopwatch::display: {} seconds elapsed\n", FSFW_FLOGIT("Stopwatch::display: {} seconds elapsed\n",
static_cast<float>(timevalOperations::toDouble(elapsedTime))); static_cast<float>(timevalOperations::toDouble(elapsedTime)));
} }
} }

View File

@ -18,7 +18,7 @@ uint8_t SpacePacketBase::getPacketVersionNumber(void) {
ReturnValue_t SpacePacketBase::initSpacePacketHeader(bool isTelecommand, bool hasSecondaryHeader, ReturnValue_t SpacePacketBase::initSpacePacketHeader(bool isTelecommand, bool hasSecondaryHeader,
uint16_t apid, uint16_t sequenceCount) { uint16_t apid, uint16_t sequenceCount) {
if (data == nullptr) { if (data == nullptr) {
FSFW_LOGWT("{}", "initSpacePacketHeader: Data pointer is invalid\n"); FSFW_FLOGWT("{}", "initSpacePacketHeader: Data pointer is invalid\n");
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
// reset header to zero: // reset header to zero:

View File

@ -11,6 +11,6 @@ CFDPPacket::CFDPPacket(const uint8_t* setData) : SpacePacketBase(setData) {}
CFDPPacket::~CFDPPacket() {} CFDPPacket::~CFDPPacket() {}
void CFDPPacket::print() { void CFDPPacket::print() {
FSFW_LOGI("{}", "CFDPPacket::print:\n"); FSFW_FLOGI("{}", "CFDPPacket::print:\n");
arrayprinter::print(getWholeData(), getFullSize()); arrayprinter::print(getWholeData(), getFullSize());
} }

View File

@ -1,8 +1,9 @@
#include "fsfw/tmtcpacket/cfdp/CFDPPacketStored.h" #include "fsfw/tmtcpacket/cfdp/CFDPPacketStored.h"
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serviceinterface.h"
StorageManagerIF* CFDPPacketStored::store = nullptr; StorageManagerIF* CFDPPacketStored::STORE = nullptr;
CFDPPacketStored::CFDPPacketStored() : CFDPPacket(nullptr) {} CFDPPacketStored::CFDPPacketStored() : CFDPPacket(nullptr) {}
@ -15,19 +16,19 @@ CFDPPacketStored::CFDPPacketStored(const uint8_t* data, size_t size) : CFDPPacke
return; return;
} }
if (this->checkAndSetStore()) { if (this->checkAndSetStore()) {
ReturnValue_t status = store->addData(&storeAddress, data, size); ReturnValue_t status = STORE->addData(&storeAddress, data, size);
if (status != HasReturnvaluesIF::RETURN_OK) { if (status != HasReturnvaluesIF::RETURN_OK) {
this->setData(nullptr, -1); this->setData(nullptr, -1);
} }
const uint8_t* storePtr = nullptr; const uint8_t* storePtr = nullptr;
// Repoint base data pointer to the data in the store. // Repoint base data pointer to the data in the store.
store->getData(storeAddress, &storePtr, &size); STORE->getData(storeAddress, &storePtr, &size);
this->setData(const_cast<uint8_t*>(storePtr), size); this->setData(const_cast<uint8_t*>(storePtr), size);
} }
} }
ReturnValue_t CFDPPacketStored::deletePacket() { ReturnValue_t CFDPPacketStored::deletePacket() {
ReturnValue_t result = this->store->deleteData(this->storeAddress); ReturnValue_t result = CFDPPacketStored::STORE->deleteData(this->storeAddress);
this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
// To circumvent size checks // To circumvent size checks
this->setData(nullptr, -1); this->setData(nullptr, -1);
@ -43,7 +44,7 @@ void CFDPPacketStored::setStoreAddress(store_address_t setAddress) {
size_t tempSize; size_t tempSize;
ReturnValue_t status = StorageManagerIF::RETURN_FAILED; ReturnValue_t status = StorageManagerIF::RETURN_FAILED;
if (this->checkAndSetStore()) { if (this->checkAndSetStore()) {
status = this->store->getData(this->storeAddress, &tempData, &tempSize); status = CFDPPacketStored::STORE->getData(this->storeAddress, &tempData, &tempSize);
} }
if (status == StorageManagerIF::RETURN_OK) { if (status == StorageManagerIF::RETURN_OK) {
this->setData(const_cast<uint8_t*>(tempData), tempSize); this->setData(const_cast<uint8_t*>(tempData), tempSize);
@ -67,12 +68,10 @@ ReturnValue_t CFDPPacketStored::getData(const uint8_t** dataPtr, size_t* dataSiz
// } // }
bool CFDPPacketStored::checkAndSetStore() { bool CFDPPacketStored::checkAndSetStore() {
if (this->store == nullptr) { if (CFDPPacketStored::STORE == nullptr) {
this->store = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE); CFDPPacketStored::STORE = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
if (this->store == nullptr) { if (CFDPPacketStored::STORE == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE("CFDPPacketStored::CFDPPacketStored: TC Store not found\n");
sif::error << "CFDPPacketStored::CFDPPacketStored: TC Store not found!" << std::endl;
#endif
return false; return false;
} }
} }
@ -82,7 +81,8 @@ bool CFDPPacketStored::checkAndSetStore() {
bool CFDPPacketStored::isSizeCorrect() { bool CFDPPacketStored::isSizeCorrect() {
const uint8_t* temp_data = nullptr; const uint8_t* temp_data = nullptr;
size_t temp_size; size_t temp_size;
ReturnValue_t status = this->store->getData(this->storeAddress, &temp_data, &temp_size); ReturnValue_t status =
CFDPPacketStored::STORE->getData(this->storeAddress, &temp_data, &temp_size);
if (status == StorageManagerIF::RETURN_OK) { if (status == StorageManagerIF::RETURN_OK) {
if (this->getFullSize() == temp_size) { if (this->getFullSize() == temp_size) {
return true; return true;

View File

@ -45,7 +45,7 @@ class CFDPPacketStored : public CFDPPacket, public TcPacketStoredBase {
* call tries to set it and throws an error message in case of failures. * call tries to set it and throws an error message in case of failures.
* The default store is objects::TC_STORE. * The default store is objects::TC_STORE.
*/ */
static StorageManagerIF* store; static StorageManagerIF* STORE;
/** /**
* The address where the packet data of the object instance is stored. * The address where the packet data of the object instance is stored.
*/ */

View File

@ -4,17 +4,13 @@
#include "fsfw/globalfunctions/CRC.h" #include "fsfw/globalfunctions/CRC.h"
#include "fsfw/globalfunctions/arrayprinter.h" #include "fsfw/globalfunctions/arrayprinter.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
TcPacketPusBase::TcPacketPusBase(const uint8_t* setData) : SpacePacketBase(setData) {} TcPacketPusBase::TcPacketPusBase(const uint8_t* setData) : SpacePacketBase(setData) {}
TcPacketPusBase::~TcPacketPusBase() {} TcPacketPusBase::~TcPacketPusBase() {}
void TcPacketPusBase::print() { void TcPacketPusBase::print() {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGI("TcPacketBase::print:\n");
sif::info << "TcPacketBase::print:" << std::endl;
#else
sif::printInfo("TcPacketBase::print:\n");
#endif
arrayprinter::print(getWholeData(), getFullSize()); arrayprinter::print(getWholeData(), getFullSize());
} }

View File

@ -4,9 +4,9 @@
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/objectmanager/frameworkObjects.h" #include "fsfw/objectmanager/frameworkObjects.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
StorageManagerIF* TcPacketStoredBase::store = nullptr; StorageManagerIF* TcPacketStoredBase::STORE = nullptr;
TcPacketStoredBase::TcPacketStoredBase() { TcPacketStoredBase::TcPacketStoredBase() {
this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
@ -16,24 +16,18 @@ TcPacketStoredBase::TcPacketStoredBase() {
TcPacketStoredBase::~TcPacketStoredBase() {} TcPacketStoredBase::~TcPacketStoredBase() {}
ReturnValue_t TcPacketStoredBase::getData(const uint8_t** dataPtr, size_t* dataSize) { ReturnValue_t TcPacketStoredBase::getData(const uint8_t** dataPtr, size_t* dataSize) {
auto result = this->store->getData(storeAddress, dataPtr, dataSize); auto result = TcPacketStoredBase::STORE->getData(storeAddress, dataPtr, dataSize);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGW("TcPacketStoredBase: Could not get data\n");
sif::warning << "TcPacketStoredBase: Could not get data!" << std::endl;
#else
sif::printWarning("TcPacketStoredBase: Could not get data!\n");
#endif
} }
return result; return result;
} }
bool TcPacketStoredBase::checkAndSetStore() { bool TcPacketStoredBase::checkAndSetStore() {
if (this->store == nullptr) { if (TcPacketStoredBase::STORE == nullptr) {
this->store = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE); TcPacketStoredBase::STORE = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
if (this->store == nullptr) { if (TcPacketStoredBase::STORE == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE("TcPacketStoredBase::TcPacketStoredBase: TC Store not found\n");
sif::error << "TcPacketStoredBase::TcPacketStoredBase: TC Store not found!" << std::endl;
#endif
return false; return false;
} }
} }
@ -47,7 +41,7 @@ void TcPacketStoredBase::setStoreAddress(store_address_t setAddress,
size_t tempSize; size_t tempSize;
ReturnValue_t status = StorageManagerIF::RETURN_FAILED; ReturnValue_t status = StorageManagerIF::RETURN_FAILED;
if (this->checkAndSetStore()) { if (this->checkAndSetStore()) {
status = this->store->getData(this->storeAddress, &tempData, &tempSize); status = TcPacketStoredBase::STORE->getData(this->storeAddress, &tempData, &tempSize);
} }
if (status == StorageManagerIF::RETURN_OK) { if (status == StorageManagerIF::RETURN_OK) {

View File

@ -65,7 +65,7 @@ class TcPacketStoredBase : public TcPacketStoredIF {
* call tries to set it and throws an error message in case of failures. * call tries to set it and throws an error message in case of failures.
* The default store is objects::TC_STORE. * The default store is objects::TC_STORE.
*/ */
static StorageManagerIF* store; static StorageManagerIF* STORE;
/** /**
* The address where the packet data of the object instance is stored. * The address where the packet data of the object instance is stored.
*/ */

View File

@ -2,7 +2,7 @@
#include <cstring> #include <cstring>
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
TcPacketStoredPus::TcPacketStoredPus(uint16_t apid, uint8_t service, uint8_t subservice, TcPacketStoredPus::TcPacketStoredPus(uint16_t apid, uint8_t service, uint8_t subservice,
uint8_t sequenceCount, const uint8_t* data, size_t size, uint8_t sequenceCount, const uint8_t* data, size_t size,
@ -13,12 +13,10 @@ TcPacketStoredPus::TcPacketStoredPus(uint16_t apid, uint8_t service, uint8_t sub
return; return;
} }
uint8_t* pData = nullptr; uint8_t* pData = nullptr;
ReturnValue_t returnValue = ReturnValue_t returnValue = TcPacketStoredPus::STORE->getFreeElement(
this->store->getFreeElement(&this->storeAddress, (TC_PACKET_MIN_SIZE + size), &pData); &this->storeAddress, (TC_PACKET_MIN_SIZE + size), &pData);
if (returnValue != this->store->RETURN_OK) { if (returnValue != StorageManagerIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGW("TcPacketStoredBase: Could not get free element from store\n");
sif::warning << "TcPacketStoredBase: Could not get free element from store!" << std::endl;
#endif
return; return;
} }
this->setData(pData, TC_PACKET_MIN_SIZE + size); this->setData(pData, TC_PACKET_MIN_SIZE + size);
@ -44,19 +42,19 @@ TcPacketStoredPus::TcPacketStoredPus(const uint8_t* data, size_t size) : TcPacke
return; return;
} }
if (this->checkAndSetStore()) { if (this->checkAndSetStore()) {
ReturnValue_t status = store->addData(&storeAddress, data, size); ReturnValue_t status = STORE->addData(&storeAddress, data, size);
if (status != HasReturnvaluesIF::RETURN_OK) { if (status != HasReturnvaluesIF::RETURN_OK) {
this->setData(nullptr, size); this->setData(nullptr, size);
} }
const uint8_t* storePtr = nullptr; const uint8_t* storePtr = nullptr;
// Repoint base data pointer to the data in the store. // Repoint base data pointer to the data in the store.
store->getData(storeAddress, &storePtr, &size); STORE->getData(storeAddress, &storePtr, &size);
this->setData(const_cast<uint8_t*>(storePtr), size); this->setData(const_cast<uint8_t*>(storePtr), size);
} }
} }
ReturnValue_t TcPacketStoredPus::deletePacket() { ReturnValue_t TcPacketStoredPus::deletePacket() {
ReturnValue_t result = this->store->deleteData(this->storeAddress); ReturnValue_t result = this->STORE->deleteData(this->storeAddress);
this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
// To circumvent size checks // To circumvent size checks
this->setData(nullptr, -1); this->setData(nullptr, -1);
@ -68,7 +66,7 @@ TcPacketPusBase* TcPacketStoredPus::getPacketBase() { return this; }
bool TcPacketStoredPus::isSizeCorrect() { bool TcPacketStoredPus::isSizeCorrect() {
const uint8_t* temp_data = nullptr; const uint8_t* temp_data = nullptr;
size_t temp_size; size_t temp_size;
ReturnValue_t status = this->store->getData(this->storeAddress, &temp_data, &temp_size); ReturnValue_t status = this->STORE->getData(this->storeAddress, &temp_data, &temp_size);
if (status == StorageManagerIF::RETURN_OK) { if (status == StorageManagerIF::RETURN_OK) {
if (this->getFullSize() == temp_size) { if (this->getFullSize() == temp_size) {
return true; return true;

View File

@ -5,7 +5,7 @@
#include "fsfw/globalfunctions/CRC.h" #include "fsfw/globalfunctions/CRC.h"
#include "fsfw/globalfunctions/arrayprinter.h" #include "fsfw/globalfunctions/arrayprinter.h"
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
#include "fsfw/timemanager/CCSDSTime.h" #include "fsfw/timemanager/CCSDSTime.h"
TimeStamperIF* TmPacketBase::timeStamper = nullptr; TimeStamperIF* TmPacketBase::timeStamper = nullptr;
@ -41,14 +41,10 @@ ReturnValue_t TmPacketBase::getPacketTime(timeval* timestamp) const {
} }
bool TmPacketBase::checkAndSetStamper() { bool TmPacketBase::checkAndSetStamper() {
if (timeStamper == NULL) { if (timeStamper == nullptr) {
timeStamper = ObjectManager::instance()->get<TimeStamperIF>(timeStamperId); timeStamper = ObjectManager::instance()->get<TimeStamperIF>(timeStamperId);
if (timeStamper == NULL) { if (timeStamper == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGW("TmPacketBase::checkAndSetStamper: Stamper not found\n");
sif::warning << "TmPacketBase::checkAndSetStamper: Stamper not found!" << std::endl;
#else
sif::printWarning("TmPacketBase::checkAndSetStamper: Stamper not found!\n");
#endif
return false; return false;
} }
} }
@ -56,10 +52,6 @@ bool TmPacketBase::checkAndSetStamper() {
} }
void TmPacketBase::print() { void TmPacketBase::print() {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGI("TmPacketBase::print:\n");
sif::info << "TmPacketBase::print:" << std::endl;
#else
sif::printInfo("TmPacketBase::print:\n");
#endif
arrayprinter::print(getWholeData(), getFullSize()); arrayprinter::print(getWholeData(), getFullSize());
} }

View File

@ -3,7 +3,7 @@
#include <cstring> #include <cstring>
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
#include "fsfw/tmtcservices/TmTcMessage.h" #include "fsfw/tmtcservices/TmTcMessage.h"
StorageManagerIF *TmPacketStoredBase::store = nullptr; StorageManagerIF *TmPacketStoredBase::store = nullptr;
@ -45,9 +45,7 @@ bool TmPacketStoredBase::checkAndSetStore() {
if (store == nullptr) { if (store == nullptr) {
store = ObjectManager::instance()->get<StorageManagerIF>(objects::TM_STORE); store = ObjectManager::instance()->get<StorageManagerIF>(objects::TM_STORE);
if (store == nullptr) { if (store == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGW("TmPacketStored::TmPacketStored: TM Store not found\n");
sif::error << "TmPacketStored::TmPacketStored: TM Store not found!" << std::endl;
#endif
return false; return false;
} }
} }
@ -91,13 +89,13 @@ void TmPacketStoredBase::handleStoreFailure(const char *const packetType, Return
switch (result) { switch (result) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
case (StorageManagerIF::DATA_STORAGE_FULL): { case (StorageManagerIF::DATA_STORAGE_FULL): {
sif::warning << "TmPacketStoredPus" << packetType << ": " FSFW_FLOGWT("handleStoreFailure: {} | Store full for packet with size {}\n", packetType,
<< "Store full for packet with size" << sizeToReserve << std::endl; sizeToReserve);
break; break;
} }
case (StorageManagerIF::DATA_TOO_LARGE): { case (StorageManagerIF::DATA_TOO_LARGE): {
sif::warning << "TmPacketStoredPus" << packetType << ": Data with size " << sizeToReserve FSFW_FLOGWT("handleStoreFailure: {} | Data with size {} too large\n", packetType,
<< " too large" << std::endl; sizeToReserve);
break; break;
} }
#else #else

View File

@ -2,7 +2,7 @@
#include "fsfw/ipc/QueueFactory.h" #include "fsfw/ipc/QueueFactory.h"
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
#include "fsfw/tcdistribution/PUSDistributorIF.h" #include "fsfw/tcdistribution/PUSDistributorIF.h"
#include "fsfw/tmtcpacket/pus/tc.h" #include "fsfw/tmtcpacket/pus/tc.h"
#include "fsfw/tmtcpacket/pus/tm.h" #include "fsfw/tmtcpacket/pus/tm.h"
@ -58,20 +58,15 @@ ReturnValue_t CommandingServiceBase::initialize() {
if (packetDestination == objects::NO_OBJECT) { if (packetDestination == objects::NO_OBJECT) {
packetDestination = defaultPacketDestination; packetDestination = defaultPacketDestination;
} }
AcceptsTelemetryIF* packetForwarding = auto* packetForwarding = ObjectManager::instance()->get<AcceptsTelemetryIF>(packetDestination);
ObjectManager::instance()->get<AcceptsTelemetryIF>(packetDestination);
if (packetSource == objects::NO_OBJECT) { if (packetSource == objects::NO_OBJECT) {
packetSource = defaultPacketSource; packetSource = defaultPacketSource;
} }
PUSDistributorIF* distributor = ObjectManager::instance()->get<PUSDistributorIF>(packetSource); auto* distributor = ObjectManager::instance()->get<PUSDistributorIF>(packetSource);
if (packetForwarding == nullptr or distributor == nullptr) { if (packetForwarding == nullptr or distributor == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE("CommandingServiceBase::intialize: Packet source or packet destination invalid\n");
sif::error << "CommandingServiceBase::intialize: Packet source or "
"packet destination invalid!"
<< std::endl;
#endif
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
@ -82,11 +77,7 @@ ReturnValue_t CommandingServiceBase::initialize() {
TCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE); TCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
if (IPCStore == nullptr or TCStore == nullptr) { if (IPCStore == nullptr or TCStore == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE("CommandingServiceBase::intialize: IPC store or TC store not initialized yet\n");
sif::error << "CommandingServiceBase::intialize: IPC store or TC store "
"not initialized yet!"
<< std::endl;
#endif
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
@ -104,18 +95,10 @@ void CommandingServiceBase::handleCommandQueue() {
} else if (result == MessageQueueIF::EMPTY) { } else if (result == MessageQueueIF::EMPTY) {
break; break;
} else { } else {
#if FSFW_VERBOSE_LEVEL >= 1 FSFW_FLOGWT(
#if FSFW_CPP_OSTREAM_ENABLED == 1 "CommandingServiceBase::handleCommandQueue: Receiving message failed"
sif::warning << "CommandingServiceBase::handleCommandQueue: Receiving message failed" "with code {}",
"with code"
<< result << std::endl;
#else
sif::printWarning(
"CommandingServiceBase::handleCommandQueue: Receiving message "
"failed with code %d\n",
result); result);
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
break; break;
} }
} }

View File

@ -22,7 +22,7 @@ ReturnValue_t PusServiceBase::performOperation(uint8_t opCode) {
handleRequestQueue(); handleRequestQueue();
ReturnValue_t result = this->performService(); ReturnValue_t result = this->performService();
if (result != RETURN_OK) { if (result != RETURN_OK) {
FSFW_LOGWT("performOperation: PUS service {} return with error {}\n", serviceId, result); FSFW_FLOGWT("performOperation: PUS service {} return with error {}\n", serviceId, result);
return RETURN_FAILED; return RETURN_FAILED;
} }
return RETURN_OK; return RETURN_OK;
@ -71,8 +71,8 @@ void PusServiceBase::handleRequestQueue() {
// ": no new packet." << std::endl; // ": no new packet." << std::endl;
break; break;
} else { } else {
FSFW_LOGWT("performOperation: Service {}. Error receiving packed, code {}\n", serviceId, FSFW_FLOGWT("performOperation: Service {}. Error receiving packed, code {}\n", serviceId,
status); status);
} }
} }
} }
@ -89,7 +89,7 @@ ReturnValue_t PusServiceBase::initialize() {
auto* destService = ObjectManager::instance()->get<AcceptsTelemetryIF>(packetDestination); auto* destService = ObjectManager::instance()->get<AcceptsTelemetryIF>(packetDestination);
auto* distributor = ObjectManager::instance()->get<PUSDistributorIF>(packetSource); auto* distributor = ObjectManager::instance()->get<PUSDistributorIF>(packetSource);
if (destService == nullptr or distributor == nullptr) { if (destService == nullptr or distributor == nullptr) {
FSFW_LOGWT( FSFW_FLOGWT(
"ctor: Service {} | Make sure static packetSource and packetDestination " "ctor: Service {} | Make sure static packetSource and packetDestination "
"are defined correctly\n", "are defined correctly\n",
serviceId); serviceId);

View File

@ -1,10 +1,12 @@
#include <fsfw/serviceinterface/ServiceInterface.h> #include "SpacePacketParser.h"
#include <fsfw/tmtcservices/SpacePacketParser.h>
#include <algorithm> #include <algorithm>
#include <utility>
#include "fsfw/serviceinterface.h"
SpacePacketParser::SpacePacketParser(std::vector<uint16_t> validPacketIds) SpacePacketParser::SpacePacketParser(std::vector<uint16_t> validPacketIds)
: validPacketIds(validPacketIds) {} : validPacketIds(std::move(validPacketIds)) {}
ReturnValue_t SpacePacketParser::parseSpacePackets(const uint8_t* buffer, const size_t maxSize, ReturnValue_t SpacePacketParser::parseSpacePackets(const uint8_t* buffer, const size_t maxSize,
size_t& startIndex, size_t& foundSize) { size_t& startIndex, size_t& foundSize) {
@ -17,11 +19,7 @@ ReturnValue_t SpacePacketParser::parseSpacePackets(const uint8_t** buffer, const
size_t& startIndex, size_t& foundSize, size_t& startIndex, size_t& foundSize,
size_t& readLen) { size_t& readLen) {
if (buffer == nullptr or maxSize < 5) { if (buffer == nullptr or maxSize < 5) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGW("SpacePacketParser::parseSpacePackets: Frame invalid\n");
sif::warning << "SpacePacketParser::parseSpacePackets: Frame invalid" << std::endl;
#else
sif::printWarning("SpacePacketParser::parseSpacePackets: Frame invalid\n");
#endif
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
const uint8_t* bufPtr = *buffer; const uint8_t* bufPtr = *buffer;
@ -49,7 +47,7 @@ ReturnValue_t SpacePacketParser::parseSpacePackets(const uint8_t** buffer, const
size_t idx = 0; size_t idx = 0;
// Space packet ID as start marker // Space packet ID as start marker
if (validPacketIds.size() > 0) { if (!validPacketIds.empty()) {
while (idx < maxSize - 5) { while (idx < maxSize - 5) {
uint16_t currentPacketId = bufPtr[idx] << 8 | bufPtr[idx + 1]; uint16_t currentPacketId = bufPtr[idx] << 8 | bufPtr[idx + 1];
if (std::find(validPacketIds.begin(), validPacketIds.end(), currentPacketId) != if (std::find(validPacketIds.begin(), validPacketIds.end(), currentPacketId) !=

View File

@ -33,7 +33,7 @@ class SpacePacketParser {
* If an empty vector is passed, the parser will assume that the start of the given stream * If an empty vector is passed, the parser will assume that the start of the given stream
* contains the start of a new space packet. * contains the start of a new space packet.
*/ */
SpacePacketParser(std::vector<uint16_t> validPacketIds); explicit SpacePacketParser(std::vector<uint16_t> validPacketIds);
/** /**
* Parse a given frame for space packets but also increment the given buffer and assign the * Parse a given frame for space packets but also increment the given buffer and assign the
@ -53,7 +53,7 @@ class SpacePacketParser {
* will be assigned. * will be assigned.
* -@c RETURN_OK if a packet was found * -@c RETURN_OK if a packet was found
*/ */
ReturnValue_t parseSpacePackets(const uint8_t** buffer, const size_t maxSize, size_t& startIndex, ReturnValue_t parseSpacePackets(const uint8_t** buffer, size_t maxSize, size_t& startIndex,
size_t& foundSize, size_t& readLen); size_t& foundSize, size_t& readLen);
/** /**

View File

@ -3,7 +3,7 @@
#include "fsfw/globalfunctions/arrayprinter.h" #include "fsfw/globalfunctions/arrayprinter.h"
#include "fsfw/ipc/QueueFactory.h" #include "fsfw/ipc/QueueFactory.h"
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
#define TMTCBRIDGE_WIRETAPPING 0 #define TMTCBRIDGE_WIRETAPPING 0
@ -20,30 +20,27 @@ TmTcBridge::TmTcBridge(object_id_t objectId, object_id_t tcDestination, object_i
TmTcBridge::~TmTcBridge() { QueueFactory::instance()->deleteMessageQueue(tmTcReceptionQueue); } TmTcBridge::~TmTcBridge() { QueueFactory::instance()->deleteMessageQueue(tmTcReceptionQueue); }
ReturnValue_t TmTcBridge::setNumberOfSentPacketsPerCycle(uint8_t sentPacketsPerCycle) { ReturnValue_t TmTcBridge::setNumberOfSentPacketsPerCycle(uint8_t sentPacketsPerCycle_) {
if (sentPacketsPerCycle <= LIMIT_STORED_DATA_SENT_PER_CYCLE) { if (sentPacketsPerCycle <= LIMIT_STORED_DATA_SENT_PER_CYCLE) {
this->sentPacketsPerCycle = sentPacketsPerCycle; this->sentPacketsPerCycle = sentPacketsPerCycle_;
return RETURN_OK; return RETURN_OK;
} else { } else {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGW(
sif::warning << "TmTcBridge::setNumberOfSentPacketsPerCycle: Number of " "setNumberOfSentPacketsPerCycle: Number of packets sent per cycle exceeds limits. "
<< "packets sent per cycle exceeds limits. " "Keeping default value\n");
<< "Keeping default value." << std::endl;
#endif
return RETURN_FAILED; return RETURN_FAILED;
} }
} }
ReturnValue_t TmTcBridge::setMaxNumberOfPacketsStored(uint8_t maxNumberOfPacketsStored) { ReturnValue_t TmTcBridge::setMaxNumberOfPacketsStored(uint8_t maxNumberOfPacketsStored_) {
if (maxNumberOfPacketsStored <= LIMIT_DOWNLINK_PACKETS_STORED) { if (maxNumberOfPacketsStored <= LIMIT_DOWNLINK_PACKETS_STORED) {
this->maxNumberOfPacketsStored = maxNumberOfPacketsStored; this->maxNumberOfPacketsStored = maxNumberOfPacketsStored_;
return RETURN_OK; return RETURN_OK;
} else { } else {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGW(
sif::warning << "TmTcBridge::setMaxNumberOfPacketsStored: Number of " "setMaxNumberOfPacketsStored: Passed number of packets {} stored exceeds "
<< "packets stored exceeds limits. " "limit {}\nKeeping default value\n",
<< "Keeping default value." << std::endl; maxNumberOfPacketsStored_, LIMIT_DOWNLINK_PACKETS_STORED);
#endif
return RETURN_FAILED; return RETURN_FAILED;
} }
} }
@ -51,28 +48,17 @@ ReturnValue_t TmTcBridge::setMaxNumberOfPacketsStored(uint8_t maxNumberOfPackets
ReturnValue_t TmTcBridge::initialize() { ReturnValue_t TmTcBridge::initialize() {
tcStore = ObjectManager::instance()->get<StorageManagerIF>(tcStoreId); tcStore = ObjectManager::instance()->get<StorageManagerIF>(tcStoreId);
if (tcStore == nullptr) { if (tcStore == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE("initialize: TC store invalid. Make sure it is created and set up properly\n");
sif::error << "TmTcBridge::initialize: TC store invalid. Make sure"
"it is created and set up properly."
<< std::endl;
#endif
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
tmStore = ObjectManager::instance()->get<StorageManagerIF>(tmStoreId); tmStore = ObjectManager::instance()->get<StorageManagerIF>(tmStoreId);
if (tmStore == nullptr) { if (tmStore == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE("initialize: TM store invalid. Make sure it is created and set up properly\n");
sif::error << "TmTcBridge::initialize: TM store invalid. Make sure"
"it is created and set up properly."
<< std::endl;
#endif
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
AcceptsTelecommandsIF* tcDistributor = auto* tcDistributor = ObjectManager::instance()->get<AcceptsTelecommandsIF>(tcDestination);
ObjectManager::instance()->get<AcceptsTelecommandsIF>(tcDestination);
if (tcDistributor == nullptr) { if (tcDistributor == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE("initialize: TC Distributor invalid\n");
sif::error << "TmTcBridge::initialize: TC Distributor invalid" << std::endl;
#endif
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
@ -86,17 +72,11 @@ ReturnValue_t TmTcBridge::performOperation(uint8_t operationCode) {
ReturnValue_t result; ReturnValue_t result;
result = handleTc(); result = handleTc();
if (result != RETURN_OK) { if (result != RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGWT("performOperation: Error handling TCs, code {}\n", result);
sif::debug << "TmTcBridge::performOperation: "
<< "Error handling TCs" << std::endl;
#endif
} }
result = handleTm(); result = handleTm();
if (result != RETURN_OK) { if (result != RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGWT("performOperation: Error handling TMs, code {}\n", result);
sif::debug << "TmTcBridge::performOperation: "
<< "Error handling TMs" << std::endl;
#endif
} }
return result; return result;
} }
@ -107,19 +87,14 @@ ReturnValue_t TmTcBridge::handleTm() {
ReturnValue_t status = HasReturnvaluesIF::RETURN_OK; ReturnValue_t status = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = handleTmQueue(); ReturnValue_t result = handleTmQueue();
if (result != RETURN_OK) { if (result != RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGET("handleTm: Error handling TM queue with error code {:#04x}\n", result);
sif::error << "TmTcBridge::handleTm: Error handling TM queue with error code 0x" << std::hex
<< result << std::dec << "!" << std::endl;
#endif
status = result; status = result;
} }
if (tmStored and communicationLinkUp and (packetSentCounter < sentPacketsPerCycle)) { if (tmStored and communicationLinkUp and (packetSentCounter < sentPacketsPerCycle)) {
result = handleStoredTm(); result = handleStoredTm();
if (result != RETURN_OK) { if (result != RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE("handleTm: Error handling stored TMs\n");
sif::error << "TmTcBridge::handleTm: Error handling stored TMs!" << std::endl;
#endif
status = result; status = result;
} }
} }
@ -143,7 +118,7 @@ ReturnValue_t TmTcBridge::handleTmQueue() {
#endif #endif
#endif /* FSFW_VERBOSE_LEVEL >= 3 */ #endif /* FSFW_VERBOSE_LEVEL >= 3 */
if (communicationLinkUp == false or packetSentCounter >= sentPacketsPerCycle) { if (!communicationLinkUp or packetSentCounter >= sentPacketsPerCycle) {
storeDownlinkData(&message); storeDownlinkData(&message);
continue; continue;
} }
@ -172,15 +147,9 @@ ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage* message) {
} }
if (tmFifo->full()) { if (tmFifo->full()) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGWT(
sif::warning << "TmTcBridge::storeDownlinkData: TM downlink max. number " "storeDownlinkData: TM downlink max. number "
"of stored packet IDs reached!" "of stored packet IDs reached\n");
<< std::endl;
#else
sif::printWarning(
"TmTcBridge::storeDownlinkData: TM downlink max. number "
"of stored packet IDs reached!\n");
#endif
if (overwriteOld) { if (overwriteOld) {
tmFifo->retrieve(&storeId); tmFifo->retrieve(&storeId);
tmStore->deleteData(storeId); tmStore->deleteData(storeId);
@ -214,9 +183,7 @@ ReturnValue_t TmTcBridge::handleStoredTm() {
result = sendTm(data, size); result = sendTm(data, size);
if (result != RETURN_OK) { if (result != RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGW("handleStoredTm: Could not send stored downlink data, code {:#04x}\n", result);
sif::error << "TMTC Bridge: Could not send stored downlink data" << std::endl;
#endif
status = result; status = result;
} }
packetSentCounter++; packetSentCounter++;

View File

@ -58,19 +58,19 @@ class TmTcBridge : public AcceptsTelemetryIF,
* Initializes necessary FSFW components for the TMTC Bridge * Initializes necessary FSFW components for the TMTC Bridge
* @return * @return
*/ */
virtual ReturnValue_t initialize() override; ReturnValue_t initialize() override;
/** /**
* @brief Handles TMTC reception * @brief Handles TMTC reception
*/ */
virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override; ReturnValue_t performOperation(uint8_t operationCode) override;
/** AcceptsTelemetryIF override */ /** AcceptsTelemetryIF override */
virtual MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) override; MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel) override;
/** AcceptsTelecommandsIF override */ /** AcceptsTelecommandsIF override */
virtual uint16_t getIdentifier() override; uint16_t getIdentifier() override;
virtual MessageQueueId_t getRequestQueue() override; MessageQueueId_t getRequestQueue() override;
protected: protected:
//! Cached for initialize function. //! Cached for initialize function.

View File

@ -3,7 +3,7 @@
#include "fsfw/ipc/MessageQueueIF.h" #include "fsfw/ipc/MessageQueueIF.h"
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/objectmanager/frameworkObjects.h" #include "fsfw/objectmanager/frameworkObjects.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface.h"
#include "fsfw/tmtcservices/AcceptsVerifyMessageIF.h" #include "fsfw/tmtcservices/AcceptsVerifyMessageIF.h"
#include "fsfw/tmtcservices/PusVerificationReport.h" #include "fsfw/tmtcservices/PusVerificationReport.h"
@ -26,10 +26,8 @@ void VerificationReporter::sendSuccessReport(uint8_t set_report_id, TcPacketPusB
currentPacket->getPacketSequenceControl(), 0, set_step); currentPacket->getPacketSequenceControl(), 0, set_step);
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message); ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message);
if (status != HasReturnvaluesIF::RETURN_OK) { if (status != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGET("VerificationReporter::sendSuccessReport: Error writing to queue. Code: {}\n",
sif::error << "VerificationReporter::sendSuccessReport: Error writing " status);
<< "to queue. Code: " << std::hex << status << std::dec << std::endl;
#endif
} }
} }
@ -43,10 +41,10 @@ void VerificationReporter::sendSuccessReport(uint8_t set_report_id, uint8_t ackF
set_step); set_step);
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message); ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message);
if (status != HasReturnvaluesIF::RETURN_OK) { if (status != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGET(
sif::error << "VerificationReporter::sendSuccessReport: Error writing " "VerificationReporter::sendSuccessReport: Error writing "
<< "to queue. Code: " << std::hex << status << std::dec << std::endl; "to queue. Code: {}\n",
#endif status);
} }
} }
@ -64,10 +62,10 @@ void VerificationReporter::sendFailureReport(uint8_t report_id, TcPacketPusBase*
currentPacket->getPacketSequenceControl(), error_code, step, parameter1, parameter2); currentPacket->getPacketSequenceControl(), error_code, step, parameter1, parameter2);
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message); ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message);
if (status != HasReturnvaluesIF::RETURN_OK) { if (status != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGET(
sif::error << "VerificationReporter::sendFailureReport: Error writing " "VerificationReporter::sendFailureReport: Error writing "
<< "to queue. Code: " << std::hex << "0x" << status << std::dec << std::endl; "to queue. Code: {}\n",
#endif status);
} }
} }
@ -82,30 +80,22 @@ void VerificationReporter::sendFailureReport(uint8_t report_id, uint8_t ackFlags
step, parameter1, parameter2); step, parameter1, parameter2);
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message); ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message);
if (status != HasReturnvaluesIF::RETURN_OK) { if (status != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE("sendFailureReport: Error writing to queue. Code {:#04x}\n", status);
sif::error << "VerificationReporter::sendFailureReport: Error writing "
<< "to queue. Code: " << std::hex << "0x" << status << std::dec << std::endl;
#endif
} }
} }
void VerificationReporter::initialize() { void VerificationReporter::initialize() {
if (messageReceiver == objects::NO_OBJECT) { if (messageReceiver == objects::NO_OBJECT) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGW(
sif::warning << "VerificationReporter::initialize: Verification message" "initialize: Verification message "
" receiver object ID not set yet in Factory!" "receiver object ID not set yet in Factory\n");
<< std::endl;
#endif
return; return;
} }
AcceptsVerifyMessageIF* temp = auto* temp = ObjectManager::instance()->get<AcceptsVerifyMessageIF>(messageReceiver);
ObjectManager::instance()->get<AcceptsVerifyMessageIF>(messageReceiver);
if (temp == nullptr) { if (temp == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGE(
sif::error << "VerificationReporter::initialize: Message " "VerificationReporter::initialize: Message receiver invalid. "
<< "receiver invalid. Make sure it is set up properly and " "Does it implement AcceptsVerifyMessageIF?\n");
<< "implementsAcceptsVerifyMessageIF" << std::endl;
#endif
return; return;
} }
this->acknowledgeQueue = temp->getVerificationQueue(); this->acknowledgeQueue = temp->getVerificationQueue();

View File

@ -21,15 +21,10 @@ TestAssembly::TestAssembly(object_id_t objectId, object_id_t parentId, object_id
commandTable.insert(newModeListEntry); commandTable.insert(newModeListEntry);
} }
TestAssembly::~TestAssembly() {} TestAssembly::~TestAssembly() = default;
ReturnValue_t TestAssembly::commandChildren(Mode_t mode, Submode_t submode) { ReturnValue_t TestAssembly::commandChildren(Mode_t mode, Submode_t submode) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGI("TestAssembly: Received command to go to mode {} submode {}", mode, submode);
sif::info << "TestAssembly: Received command to go to mode " << mode << " submode "
<< (int)submode << std::endl;
#else
sif::printInfo("TestAssembly: Received command to go to mode %d submode %d\n", mode, submode);
#endif
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
if (mode == MODE_OFF) { if (mode == MODE_OFF) {
commandTable[0].setMode(MODE_OFF); commandTable[0].setMode(MODE_OFF);

View File

@ -17,11 +17,7 @@ TestDevice::~TestDevice() {}
void TestDevice::performOperationHook() { void TestDevice::performOperationHook() {
if (periodicPrintout) { if (periodicPrintout) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGI("TestDevice {} | performOperationHook: Alive!\n", deviceIdx);
sif::info << "TestDevice" << deviceIdx << "::performOperationHook: Alive!" << std::endl;
#else
sif::printInfo("TestDevice%d::performOperationHook: Alive!", deviceIdx);
#endif
} }
if (oneShot) { if (oneShot) {
@ -31,28 +27,18 @@ void TestDevice::performOperationHook() {
void TestDevice::doStartUp() { void TestDevice::doStartUp() {
if (fullInfoPrintout) { if (fullInfoPrintout) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGI("TestDevice {} | doStartUp: Switching On\n", deviceIdx);
sif::info << "TestDevice" << deviceIdx << "::doStartUp: Switching On" << std::endl;
#else
sif::printInfo("TestDevice%d::doStartUp: Switching On\n", static_cast<int>(deviceIdx));
#endif
} }
setMode(_MODE_TO_ON); setMode(_MODE_TO_ON);
return;
} }
void TestDevice::doShutDown() { void TestDevice::doShutDown() {
if (fullInfoPrintout) { if (fullInfoPrintout) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGI("TestDevice {} | doShutDown: Switching Off\n", deviceIdx);
sif::info << "TestDevice" << deviceIdx << "::doShutDown: Switching Off" << std::endl;
#else
sif::printInfo("TestDevice%d::doShutDown: Switching Off\n", static_cast<int>(deviceIdx));
#endif
} }
setMode(_MODE_SHUT_DOWN); setMode(_MODE_SHUT_DOWN);
return;
} }
ReturnValue_t TestDevice::buildNormalDeviceCommand(DeviceCommandId_t* id) { ReturnValue_t TestDevice::buildNormalDeviceCommand(DeviceCommandId_t* id) {
@ -67,49 +53,28 @@ ReturnValue_t TestDevice::buildNormalDeviceCommand(DeviceCommandId_t* id) {
ReturnValue_t TestDevice::buildTransitionDeviceCommand(DeviceCommandId_t* id) { ReturnValue_t TestDevice::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
if (mode == _MODE_TO_ON) { if (mode == _MODE_TO_ON) {
if (fullInfoPrintout) { if (fullInfoPrintout) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGI(
sif::info << "TestDevice" << deviceIdx "TestDevice {} | buildTransitionDeviceCommand: Was called"
<< "::buildTransitionDeviceCommand: Was called" " from _MODE_TO_ON mode\n",
" from _MODE_TO_ON mode"
<< std::endl;
#else
sif::printInfo(
"TestDevice%d::buildTransitionDeviceCommand: "
"Was called from _MODE_TO_ON mode\n",
deviceIdx); deviceIdx);
#endif
} }
} }
if (mode == _MODE_TO_NORMAL) { if (mode == _MODE_TO_NORMAL) {
if (fullInfoPrintout) { if (fullInfoPrintout) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGI(
sif::info << "TestDevice" << deviceIdx "TestDevice {} | buildTransitionDeviceCommand: Was called "
<< "::buildTransitionDeviceCommand: Was called " "from _MODE_TO_NORMAL mode\n",
"from _MODE_TO_NORMAL mode"
<< std::endl;
#else
sif::printInfo(
"TestDevice%d::buildTransitionDeviceCommand: Was called from "
" _MODE_TO_NORMAL mode\n",
deviceIdx); deviceIdx);
#endif
} }
setMode(MODE_NORMAL); setMode(MODE_NORMAL);
} }
if (mode == _MODE_SHUT_DOWN) { if (mode == _MODE_SHUT_DOWN) {
if (fullInfoPrintout) { if (fullInfoPrintout) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGI(
sif::info << "TestDevice" << deviceIdx "TestDevice {} | buildTransitionDeviceCommand: Was called "
<< "::buildTransitionDeviceCommand: Was called " "from _MODE_SHUT_DOWN mode\n",
"from _MODE_SHUT_DOWN mode"
<< std::endl;
#else
sif::printInfo(
"TestDevice%d::buildTransitionDeviceCommand: Was called from "
"_MODE_SHUT_DOWN mode\n",
deviceIdx); deviceIdx);
#endif
} }
setMode(MODE_OFF); setMode(MODE_OFF);
@ -120,14 +85,10 @@ ReturnValue_t TestDevice::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
void TestDevice::doTransition(Mode_t modeFrom, Submode_t submodeFrom) { void TestDevice::doTransition(Mode_t modeFrom, Submode_t submodeFrom) {
if (mode == _MODE_TO_NORMAL) { if (mode == _MODE_TO_NORMAL) {
if (fullInfoPrintout) { if (fullInfoPrintout) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_FLOGI(
sif::info << "TestDevice" << deviceIdx "TestDevice {} | doTransition: Custom transition to "
<< "::doTransition: Custom transition to " "normal mode\n",
"normal mode" deviceIdx);
<< std::endl;
#else
sif::printInfo("TestDevice%d::doTransition: Custom transition to normal mode\n", deviceIdx);
#endif
} }
} else { } else {
@ -229,17 +190,10 @@ ReturnValue_t TestDevice::buildTestCommand0(DeviceCommandId_t deviceCommand,
const uint8_t* commandData, size_t commandDataLen) { const uint8_t* commandData, size_t commandDataLen) {
using namespace testdevice; using namespace testdevice;
if (fullInfoPrintout) { if (fullInfoPrintout) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGI(
sif::info << "TestDevice" << deviceIdx "TestDevice {} | buildTestCommand0: Executing simple command "
<< "::buildTestCommand0: Executing simple command " "with completion reply\n",
" with completion reply"
<< std::endl;
#else
sif::printInfo(
"TestDevice%d::buildTestCommand0: Executing simple command with "
"completion reply\n",
deviceIdx); deviceIdx);
#endif
} }
if (commandDataLen > MAX_BUFFER_SIZE - sizeof(DeviceCommandId_t)) { if (commandDataLen > MAX_BUFFER_SIZE - sizeof(DeviceCommandId_t)) {
@ -258,15 +212,10 @@ ReturnValue_t TestDevice::buildTestCommand1(DeviceCommandId_t deviceCommand,
return DeviceHandlerIF::INVALID_NUMBER_OR_LENGTH_OF_PARAMETERS; return DeviceHandlerIF::INVALID_NUMBER_OR_LENGTH_OF_PARAMETERS;
} }
if (fullInfoPrintout) { if (fullInfoPrintout) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGI(
sif::info << "TestDevice" << deviceIdx "TestDevice {} | buildTestCommand1: Executing command "
<< "::buildTestCommand1: Executing command with " "with data reply\n",
"data reply" deviceIdx);
<< std::endl;
#else
sif::printInfo("TestDevice%d:buildTestCommand1: Executing command with data reply\n",
deviceIdx);
#endif
} }
deviceCommand = EndianConverter::convertBigEndian(deviceCommand); deviceCommand = EndianConverter::convertBigEndian(deviceCommand);
@ -374,17 +323,8 @@ ReturnValue_t TestDevice::scanForReply(const uint8_t* start, size_t len, DeviceC
return DeviceHandlerIF::LENGTH_MISSMATCH; return DeviceHandlerIF::LENGTH_MISSMATCH;
} }
if (fullInfoPrintout) { if (fullInfoPrintout) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGIT("TestDevice {} | scanForReply: Reply for simple command (ID {}) received!\n",
sif::info << "TestDevice" << deviceIdx deviceIdx, TEST_COMMAND_0);
<< "::scanForReply: Reply for simple command "
"(ID "
<< TEST_COMMAND_0 << ") received!" << std::endl;
#else
sif::printInfo(
"TestDevice%d::scanForReply: Reply for simple command (ID %d) "
"received!\n",
deviceIdx, TEST_COMMAND_0);
#endif
} }
*foundLen = TEST_COMMAND_0_SIZE; *foundLen = TEST_COMMAND_0_SIZE;
@ -394,17 +334,8 @@ ReturnValue_t TestDevice::scanForReply(const uint8_t* start, size_t len, DeviceC
case (TEST_COMMAND_1): { case (TEST_COMMAND_1): {
if (fullInfoPrintout) { if (fullInfoPrintout) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGIT("TestDevice {} | scanForReply: Reply for data command (ID {}) received\n",
sif::info << "TestDevice" << deviceIdx deviceIdx, TEST_COMMAND_1);
<< "::scanForReply: Reply for data command "
"(ID "
<< TEST_COMMAND_1 << ") received!" << std::endl;
#else
sif::printInfo(
"TestDevice%d::scanForReply: Reply for data command (ID %d) "
"received\n",
deviceIdx, TEST_COMMAND_1);
#endif
} }
*foundLen = len; *foundLen = len;
@ -576,12 +507,7 @@ ReturnValue_t TestDevice::interpretingNormalModeReply() {
ReturnValue_t TestDevice::interpretingTestReply0(DeviceCommandId_t id, const uint8_t* packet) { ReturnValue_t TestDevice::interpretingTestReply0(DeviceCommandId_t id, const uint8_t* packet) {
CommandMessage commandMessage; CommandMessage commandMessage;
if (fullInfoPrintout) { if (fullInfoPrintout) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGI("interpretingTestReply0: Generating step and finish reply\n");
sif::info << "TestDevice::interpretingTestReply0: Generating step and finish reply"
<< std::endl;
#else
sif::printInfo("TestDevice::interpretingTestReply0: Generating step and finish reply\n");
#endif
} }
MessageQueueId_t commander = getCommanderQueueId(id); MessageQueueId_t commander = getCommanderQueueId(id);
@ -595,12 +521,7 @@ ReturnValue_t TestDevice::interpretingTestReply0(DeviceCommandId_t id, const uin
ReturnValue_t TestDevice::interpretingTestReply1(DeviceCommandId_t id, const uint8_t* packet) { ReturnValue_t TestDevice::interpretingTestReply1(DeviceCommandId_t id, const uint8_t* packet) {
CommandMessage directReplyMessage; CommandMessage directReplyMessage;
if (fullInfoPrintout) { if (fullInfoPrintout) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGIT("TestDevice {} | interpretingReply1: Setting data reply\n", deviceIdx);
sif::info << "TestDevice" << deviceIdx << "::interpretingReply1: Setting data reply"
<< std::endl;
#else
sif::printInfo("TestDevice%d::interpretingReply1: Setting data reply\n", deviceIdx);
#endif
} }
MessageQueueId_t commander = getCommanderQueueId(id); MessageQueueId_t commander = getCommanderQueueId(id);
@ -609,25 +530,14 @@ ReturnValue_t TestDevice::interpretingTestReply1(DeviceCommandId_t id, const uin
actionHelper.reportData(commander, id, packet, testdevice::TEST_COMMAND_1_SIZE, false); actionHelper.reportData(commander, id, packet, testdevice::TEST_COMMAND_1_SIZE, false);
if (result != RETURN_OK) { if (result != RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGWT("TestDevice {} | interpretingReply1: Sending data reply failed\n", deviceIdx);
sif::error << "TestDevice" << deviceIdx /* Finish reply */
<< "::interpretingReply1: Sending data " actionHelper.finish(false, commander, id, result);
"reply failed!"
<< std::endl;
#else
sif::printError("TestDevice%d::interpretingReply1: Sending data reply failed!\n", deviceIdx);
#endif
return result; return result;
} }
if (result == HasReturnvaluesIF::RETURN_OK) { /* Finish reply */
/* Finish reply */ actionHelper.finish(true, commander, id);
actionHelper.finish(true, commander, id);
} else {
/* Finish reply */
actionHelper.finish(false, commander, id, result);
}
return RETURN_OK; return RETURN_OK;
} }
@ -659,15 +569,8 @@ ReturnValue_t TestDevice::getParameter(uint8_t domainId, uint8_t uniqueId,
uint32_t newValue = 0; uint32_t newValue = 0;
ReturnValue_t result = newValues->getElement<uint32_t>(&newValue, 0, 0); ReturnValue_t result = newValues->getElement<uint32_t>(&newValue, 0, 0);
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGIT("TestDevice {} | getParameter: Setting parameter 0 to new value {}\n",
sif::info << "TestDevice" << deviceIdx newValue);
<< "::getParameter: Setting parameter 0 to "
"new value "
<< newValue << std::endl;
#else
sif::printInfo("TestDevice%d::getParameter: Setting parameter 0 to new value %lu\n",
deviceIdx, static_cast<unsigned long>(newValue));
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
} }
} }
parameterWrapper->set(testParameter0); parameterWrapper->set(testParameter0);
@ -678,15 +581,8 @@ ReturnValue_t TestDevice::getParameter(uint8_t domainId, uint8_t uniqueId,
int32_t newValue = 0; int32_t newValue = 0;
ReturnValue_t result = newValues->getElement<int32_t>(&newValue, 0, 0); ReturnValue_t result = newValues->getElement<int32_t>(&newValue, 0, 0);
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGIT("TestDevice {} | getParameter: Setting parameter 1 to new value {}\n",
sif::info << "TestDevice" << deviceIdx newValue);
<< "::getParameter: Setting parameter 1 to "
"new value "
<< newValue << std::endl;
#else
sif::printInfo("TestDevice%d::getParameter: Setting parameter 1 to new value %lu\n",
deviceIdx, static_cast<unsigned long>(newValue));
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
} }
} }
parameterWrapper->set(testParameter1); parameterWrapper->set(testParameter1);
@ -700,18 +596,10 @@ ReturnValue_t TestDevice::getParameter(uint8_t domainId, uint8_t uniqueId,
newValues->getElement<float>(newVector + 2, 0, 2) != RETURN_OK) { newValues->getElement<float>(newVector + 2, 0, 2) != RETURN_OK) {
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGIT(
sif::info << "TestDevice" << deviceIdx "TestDevice {} | getParameter: Setting parameter 3 (float vec with 3 entries) "
<< "::getParameter: Setting parameter 3 to " "to new values 0 {}, 1 {}, 2 {}\n",
"(float vector with 3 entries) to new values [" newVector[0], newVector[1], newVector[2]);
<< newVector[0] << ", " << newVector[1] << ", " << newVector[2] << "]"
<< std::endl;
#else
sif::printInfo(
"TestDevice%d::getParameter: Setting parameter 3 to new values "
"[%f, %f, %f]\n",
deviceIdx, newVector[0], newVector[1], newVector[2]);
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
} }
parameterWrapper->setVector(vectorFloatParams2); parameterWrapper->setVector(vectorFloatParams2);
break; break;
@ -729,12 +617,7 @@ ReturnValue_t TestDevice::getParameter(uint8_t domainId, uint8_t uniqueId,
} else { } else {
printout = "disabled"; printout = "disabled";
} }
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGIT("TestDevice {} | getParameter: Periodic printout {}\n", deviceIdx, printout);
sif::info << "TestDevice" << deviceIdx << "::getParameter: Periodic printout " << printout
<< std::endl;
#else
sif::printInfo("TestDevice%d::getParameter: Periodic printout %s", printout);
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
} }
parameterWrapper->set(periodicPrintout); parameterWrapper->set(periodicPrintout);
@ -762,12 +645,7 @@ ReturnValue_t TestDevice::getParameter(uint8_t domainId, uint8_t uniqueId,
} else { } else {
printout = "disabled"; printout = "disabled";
} }
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGI("TestDevice {} | getParameter: Changing datasets {}\n", deviceIdx, printout);
sif::info << "TestDevice" << deviceIdx << "::getParameter: Changing datasets " << printout
<< std::endl;
#else
sif::printInfo("TestDevice%d::getParameter: Changing datasets %s", printout);
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
} }
parameterWrapper->set(changingDatasets); parameterWrapper->set(changingDatasets);

View File

@ -1,24 +1,20 @@
#include "TestEchoComIF.h" #include "TestEchoComIF.h"
#include <fsfw/serialize/SerializeAdapter.h> #include <fsfw/serialize/SerializeAdapter.h>
#include <fsfw/serviceinterface/ServiceInterface.h>
#include <fsfw/tmtcpacket/pus/tm.h> #include <fsfw/tmtcpacket/pus/tm.h>
#include <fsfw/tmtcservices/CommandingServiceBase.h> #include <fsfw/tmtcservices/CommandingServiceBase.h>
#include "TestCookie.h" #include "TestCookie.h"
#include "fsfw/serviceinterface.h"
TestEchoComIF::TestEchoComIF(object_id_t objectId) : SystemObject(objectId) {} TestEchoComIF::TestEchoComIF(object_id_t objectId) : SystemObject(objectId) {}
TestEchoComIF::~TestEchoComIF() {} TestEchoComIF::~TestEchoComIF() = default;
ReturnValue_t TestEchoComIF::initializeInterface(CookieIF *cookie) { ReturnValue_t TestEchoComIF::initializeInterface(CookieIF *cookie) {
TestCookie *dummyCookie = dynamic_cast<TestCookie *>(cookie); auto *dummyCookie = dynamic_cast<TestCookie *>(cookie);
if (dummyCookie == nullptr) { if (dummyCookie == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGW("TestEchoComIF::initializeInterface: Invalid cookie\n");
sif::warning << "TestEchoComIF::initializeInterface: Invalid cookie!" << std::endl;
#else
sif::printWarning("TestEchoComIF::initializeInterface: Invalid cookie!\n");
#endif
return NULLPOINTER; return NULLPOINTER;
} }
@ -32,24 +28,14 @@ ReturnValue_t TestEchoComIF::initializeInterface(CookieIF *cookie) {
ReturnValue_t TestEchoComIF::sendMessage(CookieIF *cookie, const uint8_t *sendData, ReturnValue_t TestEchoComIF::sendMessage(CookieIF *cookie, const uint8_t *sendData,
size_t sendLen) { size_t sendLen) {
TestCookie *dummyCookie = dynamic_cast<TestCookie *>(cookie); auto *dummyCookie = dynamic_cast<TestCookie *>(cookie);
if (dummyCookie == nullptr) { if (dummyCookie == nullptr) {
return NULLPOINTER; return NULLPOINTER;
} }
ReplyBuffer &replyBuffer = replyMap.find(dummyCookie->getAddress())->second; ReplyBuffer &replyBuffer = replyMap.find(dummyCookie->getAddress())->second;
if (sendLen > replyBuffer.capacity()) { if (sendLen > replyBuffer.capacity()) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGWT("sendMessage: Send length larger than current reply buffer length\n");
sif::warning << "TestEchoComIF::sendMessage: Send length " << sendLen
<< " larger than "
"current reply buffer length!"
<< std::endl;
#else
sif::printWarning(
"TestEchoComIF::sendMessage: Send length %d larger than current "
"reply buffer length!\n",
sendLen);
#endif
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
replyBuffer.resize(sendLen); replyBuffer.resize(sendLen);
@ -64,7 +50,7 @@ ReturnValue_t TestEchoComIF::requestReceiveMessage(CookieIF *cookie, size_t requ
} }
ReturnValue_t TestEchoComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) { ReturnValue_t TestEchoComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) {
TestCookie *dummyCookie = dynamic_cast<TestCookie *>(cookie); auto *dummyCookie = dynamic_cast<TestCookie *>(cookie);
if (dummyCookie == nullptr) { if (dummyCookie == nullptr) {
return NULLPOINTER; return NULLPOINTER;
} }

View File

@ -2,6 +2,7 @@
#include <cstdlib> #include <cstdlib>
#include "fsfw/serviceinterface.h"
#include "fsfw_tests/internal/UnittDefinitions.h" #include "fsfw_tests/internal/UnittDefinitions.h"
#include "fsfw_tests/internal/globalfunctions/TestArrayPrinter.h" #include "fsfw_tests/internal/globalfunctions/TestArrayPrinter.h"
#include "fsfw_tests/internal/osal/testMq.h" #include "fsfw_tests/internal/osal/testMq.h"
@ -15,11 +16,7 @@ InternalUnitTester::~InternalUnitTester() {}
ReturnValue_t InternalUnitTester::performTests( ReturnValue_t InternalUnitTester::performTests(
const struct InternalUnitTester::TestConfig& testConfig) { const struct InternalUnitTester::TestConfig& testConfig) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGI("Running internal unit tests.. Error messages might follow\n");
sif::info << "Running internal unit tests.. Error messages might follow" << std::endl;
#else
sif::printInfo("Running internal unit tests..\n");
#endif
testserialize::test_serialization(); testserialize::test_serialization();
testmq::testMq(); testmq::testMq();
@ -32,10 +29,6 @@ ReturnValue_t InternalUnitTester::performTests(
arrayprinter::testArrayPrinter(); arrayprinter::testArrayPrinter();
} }
#if FSFW_CPP_OSTREAM_ENABLED == 1 FSFW_LOGI("Internal unit tests finished\n");
sif::info << "Internal unit tests finished." << std::endl;
#else
sif::printInfo("Internal unit tests finished.\n");
#endif
return RETURN_OK; return RETURN_OK;
} }

View File

@ -1,10 +1,8 @@
#include "fsfw_tests/internal/UnittDefinitions.h" #include "fsfw_tests/internal/UnittDefinitions.h"
ReturnValue_t unitt::put_error(std::string errorId) { #include "fsfw/serviceinterface.h"
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Unit Tester error: Failed at test ID " << errorId << std::endl; ReturnValue_t unitt::put_error(const std::string& errorId) {
#else FSFW_FLOGET("Unit Tester error: Failed at test ID {}\n", errorId);
sif::printError("Unit Tester error: Failed at test ID %s\n", errorId.c_str());
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }

View File

@ -27,7 +27,7 @@ static const double tv_sdouble{-2.2421e19};
} // namespace tv } // namespace tv
namespace unitt { namespace unitt {
ReturnValue_t put_error(std::string errorId); ReturnValue_t put_error(const std::string& errorId);
} }
#endif /* UNITTEST_INTERNAL_UNITTDEFINITIONS_H_ */ #endif /* UNITTEST_INTERNAL_UNITTDEFINITIONS_H_ */