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

View File

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

View File

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

View File

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

View File

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

View File

@ -93,7 +93,7 @@ class CommandExecutor {
States getCurrentState() 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

View File

@ -14,15 +14,8 @@ UnixFileGuard::UnixFileGuard(std::string device, int* fileDescriptor, int flags,
}
*fileDescriptor = open(device.c_str(), flags);
if (*fileDescriptor < 0) {
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
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 */
FSFW_LOGW("{} | Opening device failed with error code {} | {}\n", diagnosticPrefix, errno,
strerror(errno));
openStatus = OPEN_FILE_FAILED;
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -28,7 +28,7 @@ ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) {
}
if (queueToUse == nullptr) {
FSFW_LOGW("{}", "initialize: No queue set\n");
FSFW_FLOGW("{}", "initialize: No queue set\n");
return HasReturnvaluesIF::RETURN_FAILED;
}
@ -90,7 +90,7 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t rep
size_t size = 0;
ReturnValue_t result = ipcStore->getFreeElement(&storeAddress, maxSize, &dataPtr);
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;
}
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;
ReturnValue_t result = ipcStore->addData(&storeAddress, data, dataSize);
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;
}

View File

@ -29,7 +29,7 @@ ReturnValue_t CFDPHandler::initialize() {
}
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

View File

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

View File

@ -7,7 +7,7 @@
cfdp::VarLenField::VarLenField(cfdp::WidthInBytes width, size_t value) : VarLenField() {
ReturnValue_t result = this->setValue(width, value);
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 {
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; }

View File

@ -17,15 +17,15 @@ ReturnValue_t PoolDataSetBase::registerVariable(PoolVariableIF* variable) {
return HasReturnvaluesIF::RETURN_FAILED;
}
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;
}
if (variable == nullptr) {
FSFW_LOGW("{}", "registerVariable: Pool variable is nullptr\n");
FSFW_FLOGW("{}", "registerVariable: Pool variable is nullptr\n");
return DataSetIF::POOL_VAR_NULL;
}
if (fillCount >= maxFillCount) {
FSFW_LOGW("{}", "registerVariable: DataSet is full\n");
FSFW_FLOGW("{}", "registerVariable: DataSet is full\n");
return DataSetIF::DATA_SET_FULL;
}
registeredVariables[fillCount] = variable;
@ -47,7 +47,7 @@ ReturnValue_t PoolDataSetBase::read(MutexIF::TimeoutType timeoutType, uint32_t l
state = States::STATE_SET_WAS_READ;
unlockDataPool();
} 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;
}

View File

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

View File

@ -17,7 +17,7 @@ class PoolReadGuard {
if (readObject != nullptr) {
readResult = readObject->read(timeoutType, mutexTimeout);
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
*/
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;
}
};

View File

@ -695,7 +695,7 @@ void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver& receiver) {
ReturnValue_t result = generateHousekeepingPacket(sid, dataSet, true);
if (result != HasReturnvaluesIF::RETURN_OK) {
/* 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 FSFW_CPP_OSTREAM_ENABLED == 1
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 */
FSFW_FLOGWT("{} | Object ID {} | {}\n", functionName, objectId, errorPrint);
} else if (outputType == sif::OutputTypes::OUT_ERROR) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
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 */
FSFW_FLOGET("{} | Object ID {} | {}\n", functionName, objectId, errorPrint);
}
#endif /* #if FSFW_VERBOSE_LEVEL >= 1 */
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -35,12 +35,12 @@ ReturnValue_t HealthHelper::initialize() {
eventSender = ObjectManager::instance()->get<EventReportingProxyIF>(objectId);
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;
}
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;
}
@ -69,7 +69,7 @@ void HealthHelper::informParent(HasHealthIF::HealthState health,
HealthMessage::setHealthMessage(&information, HealthMessage::HEALTH_INFO, health, oldHealth);
if (MessageQueueSenderIF::sendMessage(parentQueue, &information, owner->getCommandQueue()) !=
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()) !=
HasReturnvaluesIF::RETURN_OK) {
FSFW_LOGWT("handleSetHealthCommand: Object ID {:#08x} | Sending health reply failed\n",
objectId);
FSFW_FLOGWT("handleSetHealthCommand: Object ID {:#08x} | Sending health reply failed\n",
objectId);
}
}

View File

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

View File

@ -34,18 +34,8 @@ ReturnValue_t InternalErrorReporter::performOperation(uint8_t opCode) {
#if FSFW_VERBOSE_LEVEL >= 1
if (diagnosticPrintout) {
if ((newQueueHits > 0) or (newTmHits > 0) or (newStoreHits > 0)) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "InternalErrorReporter::performOperation: Errors "
<< "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
FSFW_LOGW("performOperation: Errors occured\nQueue {} | TM {} | Store {}\n", newQueueHits,
newTmHits, newStoreHits);
}
}
#endif

View File

@ -15,7 +15,7 @@ MessageQueueMessage::MessageQueueMessage(uint8_t* data, size_t size)
memcpy(this->getData(), data, size);
this->messageSize = this->HEADER_SIZE + size;
} 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));
this->messageSize = this->HEADER_SIZE;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -36,13 +36,11 @@ UdpTmTcBridge::UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
ReturnValue_t UdpTmTcBridge::initialize() {
ReturnValue_t result = TmTcBridge::initialize();
if (result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "UdpTmTcBridge::initialize: TmTcBridge initialization failed!" << std::endl;
#endif
FSFW_LOGE("initialize: TmTcBridge initialization failed\n");
return result;
}
#ifdef _WIN32
#ifdef PLATFORM_WIN
/* Initiates Winsock DLL. */
WSAData wsaData;
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,
&clientAddress, clientAddressLen);
if (bytesSent == SOCKET_ERROR) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "TmTcUdpBridge::sendTm: Send operation failed." << std::endl;
#endif
FSFW_LOGWT("sendTm: Send operation failed\n");
tcpip::handleError(tcpip::Protocol::UDP, tcpip::ErrorSources::SENDTO_CALL);
}
#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 <cerrno>
#include "fsfw/platform.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/serviceinterface.h"
#ifdef PLATFORM_WIN
#include <ws2tcpip.h>
@ -48,28 +50,20 @@ void tcpip::printAddress(struct sockaddr *addr) {
const char *stringPtr = NULL;
switch (addr->sa_family) {
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);
break;
}
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);
break;
}
}
#if FSFW_CPP_OSTREAM_ENABLED == 1
if (stringPtr == NULL) {
sif::debug << "Could not convert IP address to text representation, error code " << errno
<< std::endl;
if (stringPtr == nullptr) {
FSFW_FLOGDT("Could not convert IP address to text representation, error code {} | {}", errno,
strerror(errno));
} 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;
uint32_t Clock::getTicksPerSecond(void) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "Clock::getTicksPerSecond: Not implemented for host OSAL" << std::endl;
#else
sif::printWarning("Clock::getTicksPerSecond: Not implemented for host OSAL\n");
#endif
uint32_t Clock::getTicksPerSecond() {
FSFW_LOGW("getTicksPerSecond: Not implemented for host OSAL\n");
/* To avoid division by zero */
return 1;
}
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
host system with internet access so this is not implemented for now. */
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "Clock::setClock: Not implemented for host OSAL" << std::endl;
#else
sif::printWarning("Clock::setClock: Not implemented for host OSAL\n");
#endif
return HasReturnvaluesIF::RETURN_OK;
// 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.
FSFW_LOGI("Clock::setClock: Not implemented for host OSAL\n");
return HasReturnvaluesIF::RETURN_FAILED;
}
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
host system with internet access so this is not implemented for now. */
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "Clock::setClock: Not implemented for host OSAL" << std::endl;
#else
sif::printWarning("Clock::setClock: Not implemented for host OSAL\n");
#endif
return HasReturnvaluesIF::RETURN_OK;
// 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.
FSFW_LOGI("Clock::setClock: Not implemented for host OSAL\n");
return HasReturnvaluesIF::RETURN_FAILED;
}
ReturnValue_t Clock::getClock_timeval(timeval* time) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -44,9 +44,9 @@ ReturnValue_t ParameterHelper::handleParameterMessage(CommandMessage* message) {
ConstStorageAccessor accessor(storeId);
result = storage->getData(storeId, accessor);
if (result != HasReturnvaluesIF::RETURN_OK) {
FSFW_LOGE("{}",
"ParameterHelper::handleParameterMessage: Getting store data failed for "
"load command\n");
FSFW_FLOGE("{}",
"ParameterHelper::handleParameterMessage: Getting store data failed for "
"load command\n");
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,
uint16_t startWritingAtIndex) {
if (data == nullptr) {
FSFW_LOGWT("{}", "copyFrom: Called on read-only variable\n");
FSFW_FLOGWT("{}", "copyFrom: Called on read-only variable\n");
return READONLY;
}
if (from->readonlyData == nullptr) {
FSFW_LOGWT("{}", "copyFrom: Source not set\n");
FSFW_FLOGWT("{}", "copyFrom: Source not set\n");
return SOURCE_NOT_SET;
}
if (type != from->type) {
FSFW_LOGW("{}", "copyFrom: Datatype missmatch\n");
FSFW_FLOGW("{}", "copyFrom: Datatype missmatch\n");
return DATATYPE_MISSMATCH;
}
// The smallest allowed value for rows and columns is one.
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;
}

View File

@ -4,7 +4,7 @@
#include "fsfw/health/HealthMessage.h"
#include "fsfw/objectmanager/ObjectManager.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,
uint8_t serviceId,
@ -22,9 +22,7 @@ ReturnValue_t CService201HealthCommanding::isValidSubservice(uint8_t subservice)
case (Subservice::COMMAND_ANNOUNCE_HEALTH_ALL):
return RETURN_OK;
default:
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Invalid Subservice" << std::endl;
#endif
FSFW_LOGWT("Invalid Subservice\n");
return AcceptsTelecommandsIF::INVALID_SUBSERVICE;
}
}
@ -43,8 +41,8 @@ ReturnValue_t CService201HealthCommanding::getMessageQueueAndObject(uint8_t subs
}
ReturnValue_t CService201HealthCommanding::checkInterfaceAndAcquireMessageQueue(
MessageQueueId_t *messageQueueToSet, object_id_t *objectId) {
HasHealthIF *destination = ObjectManager::instance()->get<HasHealthIF>(*objectId);
MessageQueueId_t *messageQueueToSet, const object_id_t *objectId) {
auto *destination = ObjectManager::instance()->get<HasHealthIF>(*objectId);
if (destination == nullptr) {
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
ReturnValue_t CService201HealthCommanding::prepareHealthSetReply(const CommandMessage *reply) {
prepareHealthSetReply(reply);
uint8_t health = static_cast<uint8_t>(HealthMessage::getHealth(reply));
uint8_t oldHealth = static_cast<uint8_t>(HealthMessage::getOldHealth(reply));
auto health = static_cast<uint8_t>(HealthMessage::getHealth(reply));
auto oldHealth = static_cast<uint8_t>(HealthMessage::getOldHealth(reply));
HealthSetReply healthSetReply(health, oldHealth);
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,
size_t tcDataLen);
ReturnValue_t checkInterfaceAndAcquireMessageQueue(MessageQueueId_t *MessageQueueToSet,
object_id_t *objectId);
const object_id_t *objectId);
ReturnValue_t prepareHealthSetReply(const CommandMessage *reply);

View File

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

View File

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

View File

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

View File

@ -8,7 +8,7 @@
#include "fsfw/serialize/EndianConverter.h"
#include "fsfw/serialize/SerialLinkedListAdapter.h"
#include "fsfw/serialize/SerializeAdapter.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/serviceinterface.h"
#include "fsfw/storagemanager/StorageManagerIF.h"
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:
return HasReturnvaluesIF::RETURN_OK;
default:
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Invalid Subservice" << std::endl;
#endif
FSFW_FLOGW("Invalid Subservice {}\n", subservice);
return AcceptsTelecommandsIF::INVALID_SUBSERVICE;
}
}
@ -118,11 +116,8 @@ void Service2DeviceAccess::handleUnrequestedReply(CommandMessage* reply) {
sendWiretappingTm(reply, static_cast<uint8_t>(Subservice::REPLY_RAW));
break;
default:
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Unknown message in Service2DeviceAccess::"
"handleUnrequestedReply with command ID "
<< reply->getCommand() << std::endl;
#endif
FSFW_FLOGET("handleUnrequestedReply: Unknown message with command ID {}\n",
reply->getCommand());
break;
}
// 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;
ReturnValue_t result = IPCStore->getData(storeAddress, &data, &size);
if (result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Service2DeviceAccess::sendWiretappingTm: Data Lost in "
"handleUnrequestedReply with failure ID "
<< result << std::endl;
#endif
FSFW_LOGW("sendWiretappingTm: Data Lost in handleUnrequestedReply with failure ID {:#04x}\n",
result);
return;
}

View File

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

View File

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

View File

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

View File

@ -1,12 +1,13 @@
#ifndef FSFW_PUS_SERVICEPACKETS_SERVICE20PACKETS_H_
#define FSFW_PUS_SERVICEPACKETS_SERVICE20PACKETS_H_
#include <FSFWConfig.h>
#include <fsfw/parameters/HasParametersIF.h>
#include <fsfw/serialize/SerialBufferAdapter.h>
#include <fsfw/serialize/SerialLinkedListAdapter.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
@ -26,15 +27,9 @@ class ParameterCommand
*/
ParameterCommand(uint8_t* storePointer, size_t parameterDataLen)
: parameterBuffer(storePointer, parameterDataLen) {
#if FSFW_VERBOSE_LEVEL >= 1
if (parameterDataLen == 0) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "ParameterCommand: Parameter data length is 0" << std::endl;
#else
sif::printWarning("ParameterCommand: Parameter data length is 0!\n");
#endif
FSFW_LOGWT("ParameterCommand: Parameter data length is 0\n");
}
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
setLoadLinks();
}

View File

@ -95,7 +95,7 @@ ReturnValue_t SerialBufferAdapter<count_t>::deSerialize(const uint8_t** buffer,
template <typename count_t>
uint8_t* SerialBufferAdapter<count_t>::getBuffer() {
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 buffer;
@ -104,7 +104,7 @@ uint8_t* SerialBufferAdapter<count_t>::getBuffer() {
template <typename count_t>
const uint8_t* SerialBufferAdapter<count_t>::getConstBuffer() const {
if (constBuffer == nullptr) {
FSFW_LOGE("{}", "getConstBuffer: Buffers are unitialized\n");
FSFW_FLOGE("{}", "getConstBuffer: Buffers are unitialized\n");
return nullptr;
}
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...);
}
/**
* Debug logger with timestamp and file/line number prefix
*/
template <typename... T>
void debug_t(const char* file, unsigned int line, fmt::format_string<T...> fmt,
T&&... args) noexcept {
logTraced(LogLevel::DEBUG, file, line, true, fmt, args...);
}
/**
* Info logger with time stamp
*/
template <typename... T>
void info_t(fmt::format_string<T...> fmt, T&&... args) {
log(LogLevel::INFO, true, fmt, args...);
}
/**
* Info logger
*/
template <typename... T>
void info(fmt::format_string<T...> fmt, T&&... 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...);
}
/**
* Warning logger with time stamp
*/
template <typename... T>
void warning_t(fmt::format_string<T...> fmt, T&&... args) {
log(LogLevel::ERROR, true, fmt, args...);
}
/**
* Warning logger with file/line number prefix
*/
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...);
}
/**
* Warning logger with timestamp and source file information
*/
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...);
}
@ -164,39 +182,61 @@ void error(fmt::format_string<T...> fmt, T&&... args) {
log(LogLevel::ERROR, false, fmt, args...);
}
/**
* Error logger with timestamp
*/
template <typename... T>
void error_t(fmt::format_string<T...> fmt, T&&... args) {
log(LogLevel::ERROR, true, fmt, args...);
}
/**
* Error logger with source file information
*/
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...);
}
/**
* Error logger with timestamp and source file information
*/
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...);
}
} // 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__)
#define FSFW_LOGW(format, ...) \
sif::warning_f(__FILENAME__, __LINE__, FMT_STRING(format), __VA_ARGS__)
#define FSFW_LOGW(...) sif::warning_s(__FILENAME__, __LINE__, __VA_ARGS__)
#define FSFW_FLOGW(format, ...) \
sif::warning_s(__FILENAME__, __LINE__, FMT_STRING(format), __VA_ARGS__)
#define FSFW_LOGWT(format, ...) \
sif::warning_ft(__FILENAME__, __LINE__, FMT_STRING(format), __VA_ARGS__)
#define FSFW_LOGWT(...) sif::warning_st(__FILENAME__, __LINE__, __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, ...) \
sif::error_ft(__FILENAME__, __LINE__, FMT_STRING(format), __VA_ARGS__)
#define FSFW_LOGET(...) sif::error_st(__FILENAME__, __LINE__, __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 {
if (internalState == AccessState::UNINIT) {
FSFW_LOGW("{}", "size: Not initialized\n");
FSFW_FLOGW("{}", "size: Not initialized\n");
}
return size_;
}
ReturnValue_t ConstStorageAccessor::getDataCopy(uint8_t* pointer, size_t maxSize) {
if (internalState == AccessState::UNINIT) {
FSFW_LOGW("{}", "getDataCopy: Not initialized\n");
FSFW_FLOGW("{}", "getDataCopy: Not initialized\n");
return HasReturnvaluesIF::RETURN_FAILED;
}
if (size_ > maxSize) {

View File

@ -12,7 +12,7 @@ LocalPool::LocalPool(object_id_t setObjectId, const LocalPoolConfig& poolConfig,
NUMBER_OF_SUBPOOLS(poolConfig.size()),
spillsToHigherPools(spillsToHigherPools) {
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;
for (const auto& currentPoolConfig : poolConfig) {
@ -125,8 +125,8 @@ ReturnValue_t LocalPool::deleteData(store_address_t storeId) {
sizeLists[storeId.poolIndex][storeId.packetIndex] = STORAGE_FREE;
} else {
// pool_index or packet_index is too large
FSFW_LOGWT("Object ID {} | deleteData: Illegal store ID, no deletion\n",
SystemObject::getObjectId());
FSFW_FLOGWT("Object ID {} | deleteData: Illegal store ID, no deletion\n",
SystemObject::getObjectId());
status = ILLEGAL_STORAGE_ID;
}
return status;
@ -175,7 +175,7 @@ ReturnValue_t LocalPool::initialize() {
// Check if any pool size is large than the maximum allowed.
for (uint8_t count = 0; count < NUMBER_OF_SUBPOOLS; count++) {
if (elementSizes[count] >= STORAGE_FREE) {
FSFW_LOGW(
FSFW_FLOGW(
"LocalPool::initialize: Pool is too large- "
"Max. allowed size is: {}\n",
STORAGE_FREE - 1);
@ -199,7 +199,7 @@ ReturnValue_t LocalPool::reserveSpace(const size_t size, store_address_t* storeI
bool ignoreFault) {
ReturnValue_t status = getSubPoolIndex(size, &storeId->poolIndex);
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;
}
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) {
if (internalState == AccessState::UNINIT) {
FSFW_LOGW("{}", "getDataCopy: Not initialized\n");
FSFW_FLOGW("{}", "getDataCopy: Not initialized\n");
return HasReturnvaluesIF::RETURN_FAILED;
}
if (size_ > maxSize) {

View File

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

View File

@ -90,7 +90,7 @@ void FixedSlotSequence::addSlot(object_id_t componentId, uint32_t slotTimeMs, in
ReturnValue_t FixedSlotSequence::checkSequence() const {
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;
}
@ -98,7 +98,7 @@ ReturnValue_t FixedSlotSequence::checkSequence() const {
ReturnValue_t result = customCheckFunction(slotList);
if (result != HasReturnvaluesIF::RETURN_OK) {
// 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) {
errorCount++;
} else if (slot.pollingTimeMs < time) {
FSFW_LOGET("FixedSlotSequence::checkSequence: Time {} is smaller than previous with {}\n",
slot.pollingTimeMs, time);
FSFW_FLOGET("FixedSlotSequence::checkSequence: Time {} is smaller than previous with {}\n",
slot.pollingTimeMs, time);
errorCount++;
} else {
// All ok, print slot.
@ -144,7 +144,7 @@ ReturnValue_t FixedSlotSequence::intializeSequenceAfterTaskCreation() const {
}
}
if (count > 0) {
FSFW_LOGE(
FSFW_FLOGE(
"FixedSlotSequence::intializeSequenceAfterTaskCreation: Counted {} "
"failed initializations\n",
count);

View File

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

View File

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

View File

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

View File

@ -33,9 +33,9 @@ ReturnValue_t TcDistributor::handlePacket() {
}
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) {
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) {
auto timeMillis =
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) {
FSFW_LOGIT("Stopwatch::display: {} seconds elapsed\n",
static_cast<float>(timevalOperations::toDouble(elapsedTime)));
FSFW_FLOGIT("Stopwatch::display: {} seconds elapsed\n",
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,
uint16_t apid, uint16_t sequenceCount) {
if (data == nullptr) {
FSFW_LOGWT("{}", "initSpacePacketHeader: Data pointer is invalid\n");
FSFW_FLOGWT("{}", "initSpacePacketHeader: Data pointer is invalid\n");
return HasReturnvaluesIF::RETURN_FAILED;
}
// reset header to zero:

View File

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

View File

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

View File

@ -4,17 +4,13 @@
#include "fsfw/globalfunctions/CRC.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() {}
void TcPacketPusBase::print() {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "TcPacketBase::print:" << std::endl;
#else
sif::printInfo("TcPacketBase::print:\n");
#endif
FSFW_LOGI("TcPacketBase::print:\n");
arrayprinter::print(getWholeData(), getFullSize());
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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