Merge remote-tracking branch 'upstream/mueller/master' into mueller/master

This commit is contained in:
Robin Müller 2021-01-12 15:04:00 +01:00
commit 3242264a77
20 changed files with 108 additions and 106 deletions

View File

@ -73,8 +73,8 @@ void PoolEntry<T>::print() {
sif::info << "PoolEntry information." << std::endl;
sif::info << "PoolEntry validity: " << validString << std::endl;
#else
fsfw::printInfo("PoolEntry information.\n");
fsfw::printInfo("PoolEntry validity: %s\n", validString);
sif::printInfo("PoolEntry information.\n");
sif::printInfo("PoolEntry validity: %s\n", validString);
#endif
arrayprinter::print(reinterpret_cast<uint8_t*>(address), getByteSize());
}

View File

@ -146,7 +146,7 @@ protected:
sif::warning << "HasLocalDataPoolIF::getPoolObjectHandle: Not overriden"
<< ". Returning nullptr!" << std::endl;
#else
fsfw::printWarning("HasLocalDataPoolIF::getPoolObjectHandle: "
sif::printWarning("HasLocalDataPoolIF::getPoolObjectHandle: "
"Not overriden. Returning nullptr!\n");
#endif
return nullptr;

View File

@ -21,7 +21,7 @@ LocalDataPoolManager::LocalDataPoolManager(HasLocalDataPoolIF* owner, MessageQue
bool appendValidityBuffer):
appendValidityBuffer(appendValidityBuffer) {
if(owner == nullptr) {
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
printWarningOrError(sif::OutputTypes::OUT_WARNING,
"LocalDataPoolManager", HasReturnvaluesIF::RETURN_FAILED,
"Invalid supplied owner");
return;
@ -29,7 +29,7 @@ LocalDataPoolManager::LocalDataPoolManager(HasLocalDataPoolIF* owner, MessageQue
this->owner = owner;
mutex = MutexFactory::instance()->createMutex();
if(mutex == nullptr) {
printWarningOrError(fsfw::OutputTypes::OUT_ERROR,
printWarningOrError(sif::OutputTypes::OUT_ERROR,
"LocalDataPoolManager", HasReturnvaluesIF::RETURN_FAILED,
"Could not create mutex");
}
@ -42,7 +42,7 @@ LocalDataPoolManager::~LocalDataPoolManager() {}
ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse) {
if(queueToUse == nullptr) {
// error, all destinations invalid
printWarningOrError(fsfw::OutputTypes::OUT_ERROR,
printWarningOrError(sif::OutputTypes::OUT_ERROR,
"initialize", QUEUE_OR_DESTINATION_INVALID);
}
hkQueue = queueToUse;
@ -50,7 +50,7 @@ ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse) {
ipcStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
if(ipcStore == nullptr) {
// error, all destinations invalid
printWarningOrError(fsfw::OutputTypes::OUT_ERROR,
printWarningOrError(sif::OutputTypes::OUT_ERROR,
"initialize", HasReturnvaluesIF::RETURN_FAILED,
"Could not set IPC store.");
return HasReturnvaluesIF::RETURN_FAILED;
@ -64,7 +64,7 @@ ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse) {
hkDestinationId = hkPacketReceiver->getHkQueue();
}
else {
printWarningOrError(fsfw::OutputTypes::OUT_ERROR,
printWarningOrError(sif::OutputTypes::OUT_ERROR,
"initialize", QUEUE_OR_DESTINATION_INVALID);
return QUEUE_OR_DESTINATION_INVALID;
}
@ -89,7 +89,7 @@ ReturnValue_t LocalDataPoolManager::initializeHousekeepingPoolEntriesOnce() {
return result;
}
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
printWarningOrError(sif::OutputTypes::OUT_WARNING,
"initialize", HasReturnvaluesIF::RETURN_FAILED,
"The map should only be initialized once");
return HasReturnvaluesIF::RETURN_OK;
@ -157,7 +157,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationUpdate(HkReceiver& receive
receiver.dataId.localPoolId);
//LocalPoolObjectBase* poolObj = owner->getPoolObjectHandle(receiver.dataId.localPoolId);
if(poolObj == nullptr) {
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
printWarningOrError(sif::OutputTypes::OUT_WARNING,
"handleNotificationUpdate", POOLOBJECT_NOT_FOUND);
return POOLOBJECT_NOT_FOUND;
}
@ -179,7 +179,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationUpdate(HkReceiver& receive
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner,
receiver.dataId.sid);
if(dataSet == nullptr) {
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
printWarningOrError(sif::OutputTypes::OUT_WARNING,
"handleNotificationUpdate", DATASET_NOT_FOUND);
return DATASET_NOT_FOUND;
}
@ -211,7 +211,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(
LocalPoolObjectBase* poolObj = HasLocalDpIFManagerAttorney::getPoolObjectHandle(owner,
receiver.dataId.localPoolId);
if(poolObj == nullptr) {
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
printWarningOrError(sif::OutputTypes::OUT_WARNING,
"handleNotificationSnapshot", POOLOBJECT_NOT_FOUND);
return POOLOBJECT_NOT_FOUND;
}
@ -249,7 +249,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner,
receiver.dataId.sid);
if(dataSet == nullptr) {
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
printWarningOrError(sif::OutputTypes::OUT_WARNING,
"handleNotificationSnapshot", DATASET_NOT_FOUND);
return DATASET_NOT_FOUND;
}
@ -358,7 +358,7 @@ ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(sid_t sid,
AcceptsHkPacketsIF* hkReceiverObject =
objectManager->get<AcceptsHkPacketsIF>(packetDestination);
if(hkReceiverObject == nullptr) {
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
printWarningOrError(sif::OutputTypes::OUT_WARNING,
"subscribeForPeriodicPacket", QUEUE_OR_DESTINATION_INVALID);
return QUEUE_OR_DESTINATION_INVALID;
}
@ -389,7 +389,7 @@ ReturnValue_t LocalDataPoolManager::subscribeForUpdatePackets(sid_t sid,
AcceptsHkPacketsIF* hkReceiverObject =
objectManager->get<AcceptsHkPacketsIF>(packetDestination);
if(hkReceiverObject == nullptr) {
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
printWarningOrError(sif::OutputTypes::OUT_WARNING,
"subscribeForPeriodicPacket", QUEUE_OR_DESTINATION_INVALID);
return QUEUE_OR_DESTINATION_INVALID;
}
@ -600,7 +600,7 @@ ReturnValue_t LocalDataPoolManager::printPoolEntry(
lp_id_t localPoolId) {
auto poolIter = localPoolMap.find(localPoolId);
if (poolIter == localPoolMap.end()) {
printWarningOrError(fsfw::OutputTypes::OUT_WARNING, "printPoolEntry",
printWarningOrError(sif::OutputTypes::OUT_WARNING, "printPoolEntry",
HasLocalDataPoolIF::POOL_ENTRY_NOT_FOUND);
return HasLocalDataPoolIF::POOL_ENTRY_NOT_FOUND;
}
@ -621,7 +621,7 @@ ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
MessageQueueId_t destination) {
if(dataSet == nullptr) {
// Configuration error.
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
printWarningOrError(sif::OutputTypes::OUT_WARNING,
"generateHousekeepingPacket",
DATASET_NOT_FOUND);
return DATASET_NOT_FOUND;
@ -647,7 +647,7 @@ ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
if(hkQueue == nullptr) {
// error, no queue available to send packet with.
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
printWarningOrError(sif::OutputTypes::OUT_WARNING,
"generateHousekeepingPacket",
QUEUE_OR_DESTINATION_INVALID);
return QUEUE_OR_DESTINATION_INVALID;
@ -655,7 +655,7 @@ ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
if(destination == MessageQueueIF::NO_QUEUE) {
if(hkDestinationId == MessageQueueIF::NO_QUEUE) {
// error, all destinations invalid
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
printWarningOrError(sif::OutputTypes::OUT_WARNING,
"generateHousekeepingPacket",
QUEUE_OR_DESTINATION_INVALID);
}
@ -695,7 +695,7 @@ void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver& receiver) {
//LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(sid);
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
if(dataSet == nullptr) {
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
printWarningOrError(sif::OutputTypes::OUT_WARNING,
"performPeriodicHkGeneration",
DATASET_NOT_FOUND);
return;
@ -725,7 +725,7 @@ void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver& receiver) {
sif::warning << "LocalDataPoolManager::performHkOperation: "
<< "HK generation failed." << std::endl;
#else
fsfw::printWarning("LocalDataPoolManager::performHkOperation: "
sif::printWarning("LocalDataPoolManager::performHkOperation: "
"HK generation failed.\n");
#endif
}
@ -778,7 +778,7 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid,
//LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(sid);
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
if(dataSet == nullptr) {
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
printWarningOrError(sif::OutputTypes::OUT_WARNING,
"performPeriodicHkGeneration",
DATASET_NOT_FOUND);
return DATASET_NOT_FOUND;
@ -805,7 +805,7 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid,
ReturnValue_t result = ipcStore->getFreeElement(&storeId,
expectedSize,&storePtr);
if(result != HasReturnvaluesIF::RETURN_OK) {
printWarningOrError(fsfw::OutputTypes::OUT_ERROR,
printWarningOrError(sif::OutputTypes::OUT_ERROR,
"generateSetStructurePacket", HasReturnvaluesIF::RETURN_FAILED,
"Could not get free element from IPC store.");
return result;
@ -816,7 +816,7 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid,
result = setPacket.serialize(&storePtr, &size, expectedSize,
SerializeIF::Endianness::BIG);
if(expectedSize != size) {
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
printWarningOrError(sif::OutputTypes::OUT_WARNING,
"generateSetStructurePacket", HasReturnvaluesIF::RETURN_FAILED,
"Expected size is not equal to serialized size");
}
@ -850,7 +850,7 @@ object_id_t LocalDataPoolManager::getCreatorObjectId() const {
//return owner->getObjectId();
}
void LocalDataPoolManager::printWarningOrError(fsfw::OutputTypes outputType,
void LocalDataPoolManager::printWarningOrError(sif::OutputTypes outputType,
const char* functionName, ReturnValue_t error, const char* errorPrint) {
if(errorPrint == nullptr) {
if(error == DATASET_NOT_FOUND) {
@ -860,7 +860,7 @@ void LocalDataPoolManager::printWarningOrError(fsfw::OutputTypes outputType,
errorPrint = "Pool Object not found";
}
else if(error == HasReturnvaluesIF::RETURN_FAILED) {
if(outputType == fsfw::OutputTypes::OUT_WARNING) {
if(outputType == sif::OutputTypes::OUT_WARNING) {
errorPrint = "Generic Warning";
}
else {
@ -881,25 +881,25 @@ void LocalDataPoolManager::printWarningOrError(fsfw::OutputTypes outputType,
}
}
if(outputType == fsfw::OutputTypes::OUT_WARNING) {
if(outputType == sif::OutputTypes::OUT_WARNING) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "LocalDataPoolManager::" << functionName
<< ": Object ID " << std::setw(8) << std::setfill('0')
<< std::hex << owner->getObjectId() << " | " << errorPrint
<< std::dec << std::setfill(' ') << std::endl;
#else
fsfw::printWarning("LocalDataPoolManager::%s: Object ID 0x%08x | %s\n",
sif::printWarning("LocalDataPoolManager::%s: Object ID 0x%08x | %s\n",
owner->getObjectId(), errorPrint);
#endif
}
else if(outputType == fsfw::OutputTypes::OUT_ERROR) {
else if(outputType == sif::OutputTypes::OUT_ERROR) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "LocalDataPoolManager::" << functionName
<< ": Object ID " << std::setw(8) << std::setfill('0')
<< std::hex << owner->getObjectId() << " | " << errorPrint
<< std::dec << std::setfill(' ') << std::endl;
#else
fsfw::printError("LocalDataPoolManager::%s: Object ID 0x%08x | %s\n",
sif::printError("LocalDataPoolManager::%s: Object ID 0x%08x | %s\n",
owner->getObjectId(), errorPrint);
#endif
}

View File

@ -387,7 +387,7 @@ private:
ReturnValue_t addUpdateToStore(HousekeepingPacketUpdate& updatePacket,
store_address_t& storeId);
void printWarningOrError(fsfw::OutputTypes outputType,
void printWarningOrError(sif::OutputTypes outputType,
const char* functionName,
ReturnValue_t errorCode = HasReturnvaluesIF::RETURN_FAILED,
const char* errorPrint = nullptr);
@ -399,14 +399,14 @@ ReturnValue_t LocalDataPoolManager::fetchPoolEntry(lp_id_t localPoolId,
PoolEntry<T> **poolEntry) {
auto poolIter = localPoolMap.find(localPoolId);
if (poolIter == localPoolMap.end()) {
printWarningOrError(fsfw::OutputTypes::OUT_ERROR, "fetchPoolEntry",
printWarningOrError(sif::OutputTypes::OUT_ERROR, "fetchPoolEntry",
HasLocalDataPoolIF::POOL_ENTRY_NOT_FOUND);
return HasLocalDataPoolIF::POOL_ENTRY_NOT_FOUND;
}
*poolEntry = dynamic_cast< PoolEntry<T>* >(poolIter->second);
if(*poolEntry == nullptr) {
printWarningOrError(fsfw::OutputTypes::OUT_ERROR, "fetchPoolEntry",
printWarningOrError(sif::OutputTypes::OUT_ERROR, "fetchPoolEntry",
HasLocalDataPoolIF::POOL_ENTRY_TYPE_CONFLICT);
return HasLocalDataPoolIF::POOL_ENTRY_TYPE_CONFLICT;
}

View File

@ -19,8 +19,8 @@ LocalPoolDataSetBase::LocalPoolDataSetBase(HasLocalDataPoolIF *hkOwner,
sif::error << "LocalPoolDataSetBase::LocalPoolDataSetBase: Owner "
<< "invalid!" << std::endl;
#else
fsfw::printError("LocalPoolDataSetBase::LocalPoolDataSetBase: Owner "
"invalid!\n");
sif::printError("LocalPoolDataSetBase::LocalPoolDataSetBase: Owner "
"invalid!\n\r");
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
return;
}
@ -176,7 +176,7 @@ ReturnValue_t LocalPoolDataSetBase::serializeLocalPoolIds(uint8_t** buffer,
sif::warning << "LocalPoolDataSetBase::serializeLocalPoolIds: "
<< "Serialization error!" << std::endl;
#else
fsfw::printWarning("LocalPoolDataSetBase::serializeLocalPoolIds: "
sif::printWarning("LocalPoolDataSetBase::serializeLocalPoolIds: "
"Serialization error!\n\r");
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
return result;
@ -240,7 +240,7 @@ void LocalPoolDataSetBase::bitSetter(uint8_t* byte, uint8_t position) const {
sif::warning << "LocalPoolDataSetBase::bitSetter: Invalid position!"
<< std::endl;
#else
fsfw::printWarning("LocalPoolDataSetBase::bitSetter: "
sif::printWarning("LocalPoolDataSetBase::bitSetter: "
"Invalid position!\n\r");
#endif
return;

View File

@ -118,7 +118,7 @@ void LocalPoolObjectBase::reportReadCommitError(const char* variableType,
<< std::hex << std::setw(8) << std::setfill('0') << objectId << std::dec
<< " LPID: " << lpId << std::endl;
#else
fsfw::printWarning("%s: %s call | %s | Owner: 0x%08x LPID: %lu\n",
sif::printWarning("%s: %s call | %s | Owner: 0x%08x LPID: %lu\n",
variableType, type, errMsg, objectId, lpId);
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif /* FSFW_DISABLE_PRINTOUT == 0 */

View File

@ -103,7 +103,7 @@ inline T& LocalPoolVector<T, vectorSize>::operator [](size_t i) {
sif::warning << "LocalPoolVector: Invalid index. Setting or returning"
" last value!" << std::endl;
#else
fsfw::printWarning("LocalPoolVector: Invalid index. Setting or returning"
sif::printWarning("LocalPoolVector: Invalid index. Setting or returning"
" last value!\n");
#endif
return value[vectorSize - 1];
@ -120,7 +120,7 @@ inline const T& LocalPoolVector<T, vectorSize>::operator [](size_t i) const {
sif::warning << "LocalPoolVector: Invalid index. Setting or returning"
" last value!" << std::endl;
#else
fsfw::printWarning("LocalPoolVector: Invalid index. Setting or returning"
sif::printWarning("LocalPoolVector: Invalid index. Setting or returning"
" last value!\n");
#endif
return value[vectorSize - 1];

View File

@ -36,7 +36,7 @@ DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId,
cookieInfo.state = COOKIE_UNUSED;
cookieInfo.pendingCommand = deviceCommandMap.end();
if (comCookie == nullptr) {
printWarningOrError(fsfw::OutputTypes::OUT_ERROR, "DeviceHandlerBase",
printWarningOrError(sif::OutputTypes::OUT_ERROR, "DeviceHandlerBase",
HasReturnvaluesIF::RETURN_FAILED, "Invalid cookie");
}
if (this->fdirInstance == nullptr) {
@ -124,7 +124,7 @@ ReturnValue_t DeviceHandlerBase::initialize() {
communicationInterface = objectManager->get<DeviceCommunicationIF>(
deviceCommunicationId);
if (communicationInterface == nullptr) {
printWarningOrError(fsfw::OutputTypes::OUT_ERROR, "initialize",
printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize",
ObjectManagerIF::CHILD_INIT_FAILED,
"Passed communication IF invalid");
return ObjectManagerIF::CHILD_INIT_FAILED;
@ -132,7 +132,7 @@ ReturnValue_t DeviceHandlerBase::initialize() {
result = communicationInterface->initializeInterface(comCookie);
if (result != RETURN_OK) {
printWarningOrError(fsfw::OutputTypes::OUT_ERROR, "initialize",
printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize",
ObjectManagerIF::CHILD_INIT_FAILED,
"ComIF initialization failed");
return result;
@ -140,7 +140,7 @@ ReturnValue_t DeviceHandlerBase::initialize() {
IPCStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
if (IPCStore == nullptr) {
printWarningOrError(fsfw::OutputTypes::OUT_ERROR, "initialize",
printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize",
ObjectManagerIF::CHILD_INIT_FAILED, "IPC Store not set up");
return ObjectManagerIF::CHILD_INIT_FAILED;
}
@ -150,14 +150,14 @@ ReturnValue_t DeviceHandlerBase::initialize() {
AcceptsDeviceResponsesIF>(rawDataReceiverId);
if (rawReceiver == nullptr) {
printWarningOrError(fsfw::OutputTypes::OUT_ERROR,
printWarningOrError(sif::OutputTypes::OUT_ERROR,
"initialize", ObjectManagerIF::CHILD_INIT_FAILED,
"Raw receiver object ID set but no valid object found.");
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Make sure the raw receiver object is set up properly"
" and implements AcceptsDeviceResponsesIF" << std::endl;
#else
fsfw::printError("Make sure the raw receiver object is set up "
sif::printError("Make sure the raw receiver object is set up "
"properly and implements AcceptsDeviceResponsesIF\n");
#endif
return ObjectManagerIF::CHILD_INIT_FAILED;
@ -168,14 +168,14 @@ ReturnValue_t DeviceHandlerBase::initialize() {
if(powerSwitcherId != objects::NO_OBJECT) {
powerSwitcher = objectManager->get<PowerSwitchIF>(powerSwitcherId);
if (powerSwitcher == nullptr) {
printWarningOrError(fsfw::OutputTypes::OUT_ERROR,
printWarningOrError(sif::OutputTypes::OUT_ERROR,
"initialize", ObjectManagerIF::CHILD_INIT_FAILED,
"Power switcher set but no valid object found.");
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Make sure the power switcher object is set up "
<< "properly and implements PowerSwitchIF" << std::endl;
#else
fsfw::printError("Make sure the power switcher object is set up "
sif::printError("Make sure the power switcher object is set up "
"properly and implements PowerSwitchIF\n");
#endif
return ObjectManagerIF::CHILD_INIT_FAILED;
@ -717,7 +717,7 @@ void DeviceHandlerBase::parseReply(const uint8_t* receivedData,
case RETURN_OK:
handleReply(receivedData, foundId, foundLen);
if(foundLen == 0) {
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
printWarningOrError(sif::OutputTypes::OUT_WARNING,
"parseReply", ObjectManagerIF::CHILD_INIT_FAILED,
"Found length is one, parsing might be stuck");
}
@ -730,7 +730,7 @@ void DeviceHandlerBase::parseReply(const uint8_t* receivedData,
foundId);
}
if(foundLen == 0) {
printWarningOrError(fsfw::OutputTypes::OUT_ERROR,
printWarningOrError(sif::OutputTypes::OUT_ERROR,
"parseReply", ObjectManagerIF::CHILD_INIT_FAILED,
"Power switcher set but no valid object found.");
#if FSFW_CPP_OSTREAM_ENABLED == 1
@ -1292,7 +1292,7 @@ void DeviceHandlerBase::buildInternalCommand(void) {
result = buildNormalDeviceCommand(&deviceCommandId);
if (result == BUSY) {
// so we can track misconfigurations
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
printWarningOrError(sif::OutputTypes::OUT_WARNING,
"buildInternalCommand",
HasReturnvaluesIF::RETURN_FAILED,
"Busy.");
@ -1324,7 +1324,7 @@ void DeviceHandlerBase::buildInternalCommand(void) {
sprintf(output, "Command 0x%08x is executing",
static_cast<unsigned int>(deviceCommandId));
// so we can track misconfigurations
printWarningOrError(fsfw::OutputTypes::OUT_WARNING,
printWarningOrError(sif::OutputTypes::OUT_WARNING,
"buildInternalCommand",
HasReturnvaluesIF::RETURN_FAILED,
output);
@ -1487,7 +1487,7 @@ AccessPoolManagerIF* DeviceHandlerBase::getAccessorHandle() {
return &hkManager;
}
void DeviceHandlerBase::printWarningOrError(fsfw::OutputTypes errorType,
void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType,
const char *functionName, ReturnValue_t errorCode,
const char *errorPrint) {
if(errorPrint == nullptr) {
@ -1495,7 +1495,7 @@ void DeviceHandlerBase::printWarningOrError(fsfw::OutputTypes errorType,
errorPrint = "Initialization error";
}
if(errorCode == HasReturnvaluesIF::RETURN_FAILED) {
if(errorType == fsfw::OutputTypes::OUT_WARNING) {
if(errorType == sif::OutputTypes::OUT_WARNING) {
errorPrint = "Generic Warning";
}
else {
@ -1507,25 +1507,25 @@ void DeviceHandlerBase::printWarningOrError(fsfw::OutputTypes errorType,
}
}
if(errorType == fsfw::OutputTypes::OUT_WARNING) {
if(errorType == sif::OutputTypes::OUT_WARNING) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "DeviceHandlerBase::" << functionName << ": Object ID "
<< std::hex << std::setw(8) << std::setfill('0')
<< this->getObjectId() << " | " << errorPrint << std::dec
<< std::setfill(' ') << std::endl;
#else
fsfw::printWarning("DeviceHandlerBase::%s: Object ID 0x%08x | %s\n",
sif::printWarning("DeviceHandlerBase::%s: Object ID 0x%08x | %s\n",
this->getObjectId(), errorPrint);
#endif
}
else if(errorType == fsfw::OutputTypes::OUT_ERROR) {
else if(errorType == sif::OutputTypes::OUT_ERROR) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "DeviceHandlerBase::" << functionName << ": Object ID "
<< std::hex << std::setw(8) << std::setfill('0')
<< this->getObjectId() << " | " << errorPrint << std::dec
<< std::setfill(' ') << std::endl;
#else
fsfw::printError("DeviceHandlerBase::%s: Object ID 0x%08x | %s\n",
sif::printError("DeviceHandlerBase::%s: Object ID 0x%08x | %s\n",
this->getObjectId(), errorPrint);
#endif
}

View File

@ -1256,7 +1256,7 @@ private:
void handleTransitionToOnMode(Mode_t commandedMode,
Submode_t commandedSubmode);
void printWarningOrError(fsfw::OutputTypes errorType,
void printWarningOrError(sif::OutputTypes errorType,
const char* functionName,
ReturnValue_t errorCode = HasReturnvaluesIF::RETURN_FAILED,
const char* errorPrint = nullptr);

View File

@ -10,7 +10,7 @@ void arrayprinter::print(const uint8_t *data, size_t size, OutputType type,
}
sif::info << "[";
#else
fsfw::printInfo("Printing data with size %zu: [", size);
sif::printInfo("Printing data with size %zu: [", size);
#endif
if(type == OutputType::HEX) {
arrayprinter::printHex(data, size, maxCharPerLine);

View File

@ -114,7 +114,7 @@ uint8_t BinarySemaphore::getSemaphoreCounter(sem_t *handle) {
}
else if(result != 0 and errno == EINVAL) {
// Could be called from interrupt, use lightweight printf
fsfw::printError("BinarySemaphore::getSemaphoreCounter: "
sif::printError("BinarySemaphore::getSemaphoreCounter: "
"Invalid semaphore\n");
return 0;
}
@ -136,7 +136,7 @@ void BinarySemaphore::initSemaphore(uint8_t initCount) {
sif::error << "BinarySemaphore: Init failed with "
<< strerror(errno) << std::endl;
#else
fsfw::printError("BinarySemaphore: Init failed with %s\n",
sif::printError("BinarySemaphore: Init failed with %s\n",
strerror(errno));
#endif
}

View File

@ -127,7 +127,7 @@ ReturnValue_t MessageQueue::handleError(mq_attr* attributes,
sif::error << "MessageQueue::MessageQueue: Creating Queue " << name
<< " failed with status: " << strerror(errno) << std::endl;
#else
fsfw::printError("MessageQueue::MessageQueue: Creating Queue %s"
sif::printError("MessageQueue::MessageQueue: Creating Queue %s"
" failed with status: %s\n", name, strerror(errno));
#endif
}

View File

@ -151,7 +151,7 @@ void PosixThread::createTask(void* (*fnc_)(void*), void* arg_) {
sif::error << "PosixThread::createTask: Insufficient memory for"
" the requested " << stackMb << " MB" << std::endl;
#else
fsfw::printError("PosixThread::createTask: Insufficient memory for "
sif::printError("PosixThread::createTask: Insufficient memory for "
"the requested %zu MB\n", stackMb);
#endif
}
@ -160,7 +160,7 @@ void PosixThread::createTask(void* (*fnc_)(void*), void* arg_) {
sif::error << "PosixThread::createTask: Wrong alignment argument!"
<< std::endl;
#else
fsfw::printError("PosixThread::createTask: "
sif::printError("PosixThread::createTask: "
"Wrong alignment argument!\n");
#endif
}

View File

@ -193,7 +193,7 @@ void TmTcUnixUdpBridge::handleSendError() {
sif::error << "TmTcUnixBridge::handleSendError: "
<< strerror(errno) << std::endl;
#else
fsfw::printError("TmTcUnixBridge::handleSendError: %s\n",
sif::printError("TmTcUnixBridge::handleSendError: %s\n",
strerror(errno));
#endif
}

View File

@ -29,19 +29,19 @@ ServiceInterfaceBuffer::ServiceInterfaceBuffer(std::string setMessage,
#if FSFW_COLORED_OUTPUT == 1
if(setMessage.find("DEBUG") != std::string::npos) {
colorPrefix = fsfw::ANSI_COLOR_MAGENTA;
colorPrefix = sif::ANSI_COLOR_MAGENTA;
}
else if(setMessage.find("INFO") != std::string::npos) {
colorPrefix = fsfw::ANSI_COLOR_GREEN;
colorPrefix = sif::ANSI_COLOR_GREEN;
}
else if(setMessage.find("WARNING") != std::string::npos) {
colorPrefix = fsfw::ANSI_COLOR_YELLOW;
colorPrefix = sif::ANSI_COLOR_YELLOW;
}
else if(setMessage.find("ERROR") != std::string::npos) {
colorPrefix = fsfw::ANSI_COLOR_RED;
colorPrefix = sif::ANSI_COLOR_RED;
}
else {
colorPrefix = fsfw::ANSI_COLOR_RESET;
colorPrefix = sif::ANSI_COLOR_RESET;
}
#ifdef WIN32

View File

@ -6,16 +6,18 @@
#include <cstdarg>
#include <cstdint>
static fsfw::PrintLevel printLevel = fsfw::PrintLevel::DEBUG_LEVEL;
static sif::PrintLevel printLevel = sif::PrintLevel::DEBUG_LEVEL;
#if defined(WIN32) && FSFW_COLORED_OUTPUT == 1
static bool consoleInitialized = false;
#endif /* defined(WIN32) && FSFW_COLORED_OUTPUT == 1 */
static bool addCrAtEnd = false;
#if FSFW_DISABLE_PRINTOUT == 0
static bool addCrAtEnd = false;
uint8_t printBuffer[fsfwconfig::FSFW_PRINT_BUFFER_SIZE];
void fsfwPrint(fsfw::PrintLevel printType, const char* fmt, va_list arg) {
void fsfwPrint(sif::PrintLevel printType, const char* fmt, va_list arg) {
#if defined(WIN32) && FSFW_COLORED_OUTPUT == 1
if(not consoleInitialized) {
@ -32,38 +34,38 @@ void fsfwPrint(fsfw::PrintLevel printType, const char* fmt, va_list arg) {
char* bufferPosition = reinterpret_cast<char*>(printBuffer);
/* Check logger level */
if(printType == fsfw::PrintLevel::NONE or printType > printLevel) {
if(printType == sif::PrintLevel::NONE or printType > printLevel) {
return;
}
/* Log message to terminal */
#if FSFW_COLORED_OUTPUT == 1
if(printType == fsfw::PrintLevel::INFO_LEVEL) {
len += sprintf(bufferPosition, fsfw::ANSI_COLOR_GREEN);
if(printType == sif::PrintLevel::INFO_LEVEL) {
len += sprintf(bufferPosition, sif::ANSI_COLOR_GREEN);
}
else if(printType == fsfw::PrintLevel::DEBUG_LEVEL) {
len += sprintf(bufferPosition, fsfw::ANSI_COLOR_MAGENTA);
else if(printType == sif::PrintLevel::DEBUG_LEVEL) {
len += sprintf(bufferPosition, sif::ANSI_COLOR_MAGENTA);
}
else if(printType == fsfw::PrintLevel::WARNING_LEVEL) {
len += sprintf(bufferPosition, fsfw::ANSI_COLOR_YELLOW);
else if(printType == sif::PrintLevel::WARNING_LEVEL) {
len += sprintf(bufferPosition, sif::ANSI_COLOR_YELLOW);
}
else if(printType == fsfw::PrintLevel::ERROR_LEVEL) {
len += sprintf(bufferPosition, fsfw::ANSI_COLOR_RED);
else if(printType == sif::PrintLevel::ERROR_LEVEL) {
len += sprintf(bufferPosition, sif::ANSI_COLOR_RED);
}
#endif
if (printType == fsfw::PrintLevel::INFO_LEVEL) {
if (printType == sif::PrintLevel::INFO_LEVEL) {
len += sprintf(bufferPosition + len, "INFO: ");
}
if(printType == fsfw::PrintLevel::DEBUG_LEVEL) {
if(printType == sif::PrintLevel::DEBUG_LEVEL) {
len += sprintf(bufferPosition + len, "DEBUG: ");
}
if(printType == fsfw::PrintLevel::WARNING_LEVEL) {
if(printType == sif::PrintLevel::WARNING_LEVEL) {
len += sprintf(bufferPosition + len, "WARNING: ");
}
if(printType == fsfw::PrintLevel::ERROR_LEVEL) {
if(printType == sif::PrintLevel::ERROR_LEVEL) {
len += sprintf(bufferPosition + len, "ERROR: ");
}
@ -88,51 +90,51 @@ void fsfwPrint(fsfw::PrintLevel printType, const char* fmt, va_list arg) {
}
void fsfw::printInfo(const char *fmt, ...) {
void sif::printInfo(const char *fmt, ...) {
va_list args;
va_start(args, fmt);
fsfwPrint(fsfw::PrintLevel::INFO_LEVEL, fmt, args);
fsfwPrint(sif::PrintLevel::INFO_LEVEL, fmt, args);
va_end(args);
}
void fsfw::printWarning(const char *fmt, ...) {
void sif::printWarning(const char *fmt, ...) {
va_list args;
va_start(args, fmt);
fsfwPrint(fsfw::PrintLevel::WARNING_LEVEL, fmt, args);
fsfwPrint(sif::PrintLevel::WARNING_LEVEL, fmt, args);
va_end(args);
}
void fsfw::printDebug(const char *fmt, ...) {
void sif::printDebug(const char *fmt, ...) {
va_list args;
va_start(args, fmt);
fsfwPrint(fsfw::PrintLevel::DEBUG_LEVEL, fmt, args);
fsfwPrint(sif::PrintLevel::DEBUG_LEVEL, fmt, args);
va_end(args);
}
void fsfw::setToAddCrAtEnd(bool addCrAtEnd_) {
void sif::setToAddCrAtEnd(bool addCrAtEnd_) {
addCrAtEnd = addCrAtEnd_;
}
void fsfw::printError(const char *fmt, ...) {
void sif::printError(const char *fmt, ...) {
va_list args;
va_start(args, fmt);
fsfwPrint(fsfw::PrintLevel::ERROR_LEVEL, fmt, args);
fsfwPrint(sif::PrintLevel::ERROR_LEVEL, fmt, args);
va_end(args);
}
#else
void fsfw::printInfo(const char *fmt, ...) {}
void fsfw::printWarning(const char *fmt, ...) {}
void fsfw::printDebug(const char *fmt, ...) {}
void fsfw::printError(const char *fmt, ...) {}
void sif::printInfo(const char *fmt, ...) {}
void sif::printWarning(const char *fmt, ...) {}
void sif::printDebug(const char *fmt, ...) {}
void sif::printError(const char *fmt, ...) {}
#endif /* FSFW_DISABLE_PRINTOUT == 0 */
void fsfw::setPrintLevel(PrintLevel printLevel_) {
void sif::setPrintLevel(PrintLevel printLevel_) {
printLevel = printLevel_;
}
fsfw::PrintLevel fsfw::getPrintLevel() {
sif::PrintLevel sif::getPrintLevel() {
return printLevel;
}

View File

@ -2,7 +2,7 @@
#include <cstdio>
#endif
namespace fsfw {
namespace sif {
enum PrintLevel {
NONE = 0,

View File

@ -1,7 +1,7 @@
#ifndef FSFW_SERVICEINTERFACE_SERVICEINTERFACEDEFINTIONS_H_
#define FSFW_SERVICEINTERFACE_SERVICEINTERFACEDEFINTIONS_H_
namespace fsfw {
namespace sif {
enum class OutputTypes {
OUT_INFO,

View File

@ -5,7 +5,7 @@
sif::error << "Unit Tester error: Failed at test ID "
<< errorId << std::endl;
#else
fsfw::printError("Unit Tester error: Failed at test ID 0x%08x", errorId);
sif::printError("Unit Tester error: Failed at test ID 0x%08x", errorId);
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
return HasReturnvaluesIF::RETURN_FAILED;
}

View File

@ -9,7 +9,7 @@ StorageManagerIF* tglob::getIpcStoreHandle() {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Global object manager uninitialized" << std::endl;
#else
fsfw::printError("Global object manager uninitialized\n\r");
sif::printError("Global object manager uninitialized\n\r");
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
return nullptr;
}