updates for tmtcbridge

This commit is contained in:
Robin Müller 2020-06-23 10:47:31 +02:00
parent c0beef4463
commit e27310da40
2 changed files with 11 additions and 17 deletions

View File

@ -3,6 +3,7 @@
#include <framework/ipc/QueueFactory.h> #include <framework/ipc/QueueFactory.h>
#include <framework/tmtcservices/AcceptsTelecommandsIF.h> #include <framework/tmtcservices/AcceptsTelecommandsIF.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h> #include <framework/serviceinterface/ServiceInterfaceStream.h>
#include <framework/globalfunctions/arrayprinter.h>
TmTcBridge::TmTcBridge(object_id_t objectId_, TmTcBridge::TmTcBridge(object_id_t objectId_,
object_id_t ccsdsPacketDistributor_): SystemObject(objectId_), object_id_t ccsdsPacketDistributor_): SystemObject(objectId_),
@ -85,7 +86,7 @@ ReturnValue_t TmTcBridge::handleTm() {
return RETURN_FAILED; return RETURN_FAILED;
} }
if(tmStored && communicationLinkUp) { if(tmStored and communicationLinkUp) {
result = handleStoredTm(); result = handleStoredTm();
} }
return result; return result;
@ -141,11 +142,11 @@ ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage *message) {
ReturnValue_t TmTcBridge::handleStoredTm() { ReturnValue_t TmTcBridge::handleStoredTm() {
uint8_t counter = 0; uint8_t counter = 0;
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
while(not tmFifo.empty() && counter < sentPacketsPerCycle) { while(not tmFifo.empty() and counter < sentPacketsPerCycle) {
//info << "TMTC Bridge: Sending stored TM data. There are " //info << "TMTC Bridge: Sending stored TM data. There are "
// << (int) fifo.size() << " left to send\r\n" << std::flush; // << (int) fifo.size() << " left to send\r\n" << std::flush;
store_address_t storeId; store_address_t storeId;
const uint8_t* data = NULL; const uint8_t* data = nullptr;
size_t size = 0; size_t size = 0;
tmFifo.retrieve(&storeId); tmFifo.retrieve(&storeId);
result = tmStore->getData(storeId, &data, &size); result = tmStore->getData(storeId, &data, &size);
@ -186,14 +187,6 @@ MessageQueueId_t TmTcBridge::getReportReceptionQueue(uint8_t virtualChannel) {
} }
void TmTcBridge::printData(uint8_t * data, size_t dataLen) { void TmTcBridge::printData(uint8_t * data, size_t dataLen) {
sif::info << "TMTC Bridge: Printing data: ["; arrayprinter::print(data, dataLen);
for(uint32_t i = 0; i < dataLen; i++) {
sif::info << std::hex << (int)data[i];
if(i < dataLen-1){
sif::info << " , ";
}
}
sif::info << " ] " << std::endl;
} }

View File

@ -43,26 +43,27 @@ public:
*/ */
ReturnValue_t setMaxNumberOfPacketsStored(uint8_t maxNumberOfPacketsStored); ReturnValue_t setMaxNumberOfPacketsStored(uint8_t maxNumberOfPacketsStored);
void registerCommConnect(); virtual void registerCommConnect();
void registerCommDisconnect(); virtual void registerCommDisconnect();
/** /**
* Initializes necessary FSFW components for the TMTC Bridge * Initializes necessary FSFW components for the TMTC Bridge
* @return * @return
*/ */
ReturnValue_t initialize() override; virtual ReturnValue_t initialize() override;
/** /**
* @brief Handles TMTC reception * @brief Handles TMTC reception
*/ */
ReturnValue_t performOperation(uint8_t operationCode = 0) override; virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override;
/** /**
* Return TMTC Reception Queue * Return TMTC Reception Queue
* @param virtualChannel * @param virtualChannel
* @return * @return
*/ */
MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) override; MessageQueueId_t getReportReceptionQueue(
uint8_t virtualChannel = 0) override;
protected: protected:
//! Used to send and receive TMTC messages. //! Used to send and receive TMTC messages.
//! TmTcMessage is used to transport messages between tasks. //! TmTcMessage is used to transport messages between tasks.