1
0
forked from fsfw/fsfw

all cstdout uses wrapped in preprocessor defines

This commit is contained in:
2021-01-03 13:58:18 +01:00
parent 61fc6cac97
commit c19e628d79
96 changed files with 715 additions and 14 deletions

View File

@ -23,9 +23,11 @@ ReturnValue_t TmTcBridge::setNumberOfSentPacketsPerCycle(
return RETURN_OK;
}
else {
#if CPP_OSTREAM_ENABLED == 1
sif::warning << "TmTcBridge::setNumberOfSentPacketsPerCycle: Number of "
<< "packets sent per cycle exceeds limits. "
<< "Keeping default value." << std::endl;
#endif
return RETURN_FAILED;
}
}
@ -37,9 +39,11 @@ ReturnValue_t TmTcBridge::setMaxNumberOfPacketsStored(
return RETURN_OK;
}
else {
#if CPP_OSTREAM_ENABLED == 1
sif::warning << "TmTcBridge::setMaxNumberOfPacketsStored: Number of "
<< "packets stored exceeds limits. "
<< "Keeping default value." << std::endl;
#endif
return RETURN_FAILED;
}
}
@ -47,21 +51,27 @@ ReturnValue_t TmTcBridge::setMaxNumberOfPacketsStored(
ReturnValue_t TmTcBridge::initialize() {
tcStore = objectManager->get<StorageManagerIF>(tcStoreId);
if (tcStore == nullptr) {
#if CPP_OSTREAM_ENABLED == 1
sif::error << "TmTcBridge::initialize: TC store invalid. Make sure"
"it is created and set up properly." << std::endl;
#endif
return ObjectManagerIF::CHILD_INIT_FAILED;
}
tmStore = objectManager->get<StorageManagerIF>(tmStoreId);
if (tmStore == nullptr) {
#if CPP_OSTREAM_ENABLED == 1
sif::error << "TmTcBridge::initialize: TM store invalid. Make sure"
"it is created and set up properly." << std::endl;
#endif
return ObjectManagerIF::CHILD_INIT_FAILED;
}
AcceptsTelecommandsIF* tcDistributor =
objectManager->get<AcceptsTelecommandsIF>(tcDestination);
if (tcDistributor == nullptr) {
#if CPP_OSTREAM_ENABLED == 1
sif::error << "TmTcBridge::initialize: TC Distributor invalid"
<< std::endl;
#endif
return ObjectManagerIF::CHILD_INIT_FAILED;
}
@ -75,13 +85,17 @@ ReturnValue_t TmTcBridge::performOperation(uint8_t operationCode) {
ReturnValue_t result;
result = handleTc();
if(result != RETURN_OK) {
#if CPP_OSTREAM_ENABLED == 1
sif::debug << "TmTcBridge::performOperation: "
<< "Error handling TCs" << std::endl;
#endif
}
result = handleTm();
if (result != RETURN_OK) {
#if CPP_OSTREAM_ENABLED == 1
sif::debug << "TmTcBridge::performOperation: "
<< "Error handling TMs" << std::endl;
#endif
}
return result;
}
@ -94,9 +108,11 @@ ReturnValue_t TmTcBridge::handleTm() {
ReturnValue_t status = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = handleTmQueue();
if(result != RETURN_OK) {
#if CPP_OSTREAM_ENABLED == 1
sif::error << "TmTcBridge::handleTm: Error handling TM queue with "
<< "error code 0x" << std::hex << result << std::dec
<< "!" << std::endl;
#endif
status = result;
}
@ -104,8 +120,10 @@ ReturnValue_t TmTcBridge::handleTm() {
(packetSentCounter < sentPacketsPerCycle)) {
result = handleStoredTm();
if(result != RETURN_OK) {
#if CPP_OSTREAM_ENABLED == 1
sif::error << "TmTcBridge::handleTm: Error handling stored TMs!"
<< std::endl;
#endif
status = result;
}
}
@ -122,7 +140,9 @@ ReturnValue_t TmTcBridge::handleTmQueue() {
result == HasReturnvaluesIF::RETURN_OK;
result = tmTcReceptionQueue->receiveMessage(&message))
{
#if CPP_OSTREAM_ENABLED == 1
//sif::info << (int) packetSentCounter << std::endl;
#endif
if(communicationLinkUp == false or
packetSentCounter >= sentPacketsPerCycle) {
storeDownlinkData(&message);
@ -151,8 +171,10 @@ ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage *message) {
store_address_t storeId = 0;
if(tmFifo->full()) {
#if CPP_OSTREAM_ENABLED == 1
sif::debug << "TmTcBridge::storeDownlinkData: TM downlink max. number "
<< "of stored packet IDs reached! " << std::endl;
#endif
if(overwriteOld) {
tmFifo->retrieve(&storeId);
tmStore->deleteData(storeId);
@ -171,8 +193,10 @@ ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage *message) {
ReturnValue_t TmTcBridge::handleStoredTm() {
ReturnValue_t status = RETURN_OK;
while(not tmFifo->empty() and packetSentCounter < sentPacketsPerCycle) {
#if CPP_OSTREAM_ENABLED == 1
//sif::info << "TMTC Bridge: Sending stored TM data. There are "
// << (int) tmFifo->size() << " left to send\r\n" << std::flush;
#endif
store_address_t storeId;
const uint8_t* data = nullptr;
@ -185,8 +209,10 @@ ReturnValue_t TmTcBridge::handleStoredTm() {
result = sendTm(data,size);
if(result != RETURN_OK) {
#if CPP_OSTREAM_ENABLED == 1
sif::error << "TMTC Bridge: Could not send stored downlink data"
<< std::endl;
#endif
status = result;
}
packetSentCounter ++;
@ -201,13 +227,17 @@ ReturnValue_t TmTcBridge::handleStoredTm() {
void TmTcBridge::registerCommConnect() {
if(not communicationLinkUp) {
#if CPP_OSTREAM_ENABLED == 1
//sif::info << "TMTC Bridge: Registered Comm Link Connect" << std::endl;
#endif
communicationLinkUp = true;
}
}
void TmTcBridge::registerCommDisconnect() {
#if CPP_OSTREAM_ENABLED == 1
//sif::info << "TMTC Bridge: Registered Comm Link Disconnect" << std::endl;
#endif
if(communicationLinkUp) {
communicationLinkUp = false;
}