tmtc bridge formatting improvements

This commit is contained in:
Robin Müller 2020-07-09 19:41:52 +02:00
parent ceb6197904
commit ad049cc634
2 changed files with 22 additions and 16 deletions

View File

@ -24,8 +24,9 @@ ReturnValue_t TmTcBridge::setNumberOfSentPacketsPerCycle(
return RETURN_OK; return RETURN_OK;
} }
else { else {
sif::warning << "TmTcBridge: Number of packets sent per cycle " sif::warning << "TmTcBridge::setNumberOfSentPacketsPerCycle: Number of "
"exceeds limits. Keeping default value." << std::endl; << "packets sent per cycle exceeds limits. "
<< "Keeping default value." << std::endl;
return RETURN_FAILED; return RETURN_FAILED;
} }
} }
@ -37,8 +38,9 @@ ReturnValue_t TmTcBridge::setMaxNumberOfPacketsStored(
return RETURN_OK; return RETURN_OK;
} }
else { else {
sif::warning << "TmTcBridge: Number of packets stored " sif::warning << "TmTcBridge::setMaxNumberOfPacketsStored: Number of "
"exceeds limits. Keeping default value." << std::endl; << "packets stored exceeds limits. "
<< "Keeping default value." << std::endl;
return RETURN_FAILED; return RETURN_FAILED;
} }
} }
@ -72,11 +74,13 @@ ReturnValue_t TmTcBridge::performOperation(uint8_t operationCode) {
ReturnValue_t result; ReturnValue_t result;
result = handleTc(); result = handleTc();
if(result != RETURN_OK) { if(result != RETURN_OK) {
sif::error << "TMTC Bridge: Error handling TCs" << std::endl; sif::debug << "TmTcBridge::performOperation: "
<< "Error handling TCs" << std::endl;
} }
result = handleTm(); result = handleTm();
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::error << "TMTC Bridge: Error handling TMs" << std::endl; sif::debug << "TmTcBridge::performOperation: "
<< "Error handling TMs" << std::endl;
} }
return result; return result;
} }
@ -88,7 +92,7 @@ ReturnValue_t TmTcBridge::handleTc() {
ReturnValue_t TmTcBridge::handleTm() { ReturnValue_t TmTcBridge::handleTm() {
ReturnValue_t result = handleTmQueue(); ReturnValue_t result = handleTmQueue();
if(result != RETURN_OK) { if(result != RETURN_OK) {
sif::error << "TMTC Bridge: Reading TM Queue failed" << std::endl; sif::warning << "TmTcBridge: Reading TM Queue failed" << std::endl;
return RETURN_FAILED; return RETURN_FAILED;
} }
@ -118,7 +122,7 @@ ReturnValue_t TmTcBridge::handleTmQueue() {
result = sendTm(data, size); result = sendTm(data, size);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::error << "TMTC Bridge: Could not send TM packet"<< std::endl; sif::warning << "TmTcBridge: Could not send TM packet" << std::endl;
tmStore->deleteData(message.getStorageId()); tmStore->deleteData(message.getStorageId());
return result; return result;
@ -129,13 +133,12 @@ ReturnValue_t TmTcBridge::handleTmQueue() {
} }
ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage *message) { ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage *message) {
//debug << "TMTC Bridge: Comm Link down. "
// "Saving packet ID to be sent later\r\n" << std::flush;
store_address_t storeId = 0; store_address_t storeId = 0;
if(tmFifo.full()) { if(tmFifo.full()) {
sif::error << "TMTC Bridge: TM downlink max. number of stored packet IDs " sif::error << "TmTcBridge::storeDownlinkData: TM downlink max. number "
"reached! Overwriting old data" << std::endl; << "of stored packet IDs reached! "
<< "Overwriting old data" << std::endl;
tmFifo.retrieve(&storeId); tmFifo.retrieve(&storeId);
tmStore->deleteData(storeId); tmStore->deleteData(storeId);
} }

View File

@ -76,13 +76,14 @@ protected:
object_id_t tcDestination = objects::NO_OBJECT; object_id_t tcDestination = objects::NO_OBJECT;
//! Used to send and receive TMTC messages. //! Used to send and receive TMTC messages.
//! TmTcMessage is used to transport messages between tasks. //! The TmTcMessage class is used to transport messages between tasks.
MessageQueueIF* tmTcReceptionQueue = nullptr; MessageQueueIF* tmTcReceptionQueue = nullptr;
StorageManagerIF* tmStore = nullptr; StorageManagerIF* tmStore = nullptr;
StorageManagerIF* tcStore = nullptr; StorageManagerIF* tcStore = nullptr;
//! Used to specify whether communication link is up by default. //! Used to specify whether communication link is up. Will be true
//! by default, so telemetry will be handled immediately.
bool communicationLinkUp = true; bool communicationLinkUp = true;
bool tmStored = false; bool tmStored = false;
@ -103,7 +104,8 @@ protected:
virtual ReturnValue_t handleTm(); virtual ReturnValue_t handleTm();
/** /**
* Read the TM Queue and send TM if necessary. Default implementation provided * Read the TM Queue and send TM if necessary.
* Default implementation provided
* @return * @return
*/ */
virtual ReturnValue_t handleTmQueue(); virtual ReturnValue_t handleTmQueue();
@ -116,7 +118,8 @@ protected:
/** /**
* Implemented by child class. Perform sending of Telemetry by implementing * Implemented by child class. Perform sending of Telemetry by implementing
* communication drivers or wrappers, e.g. UART communication or lwIP stack. * communication drivers or wrappers, e.g. serial communication or a socket
* call.
* @param data * @param data
* @param dataLen * @param dataLen
* @return * @return