adapting tmtc bridge
This commit is contained in:
parent
db535e25f2
commit
c075e1bf23
@ -6,8 +6,7 @@
|
||||
|
||||
TmTcBridge::TmTcBridge(object_id_t objectId_,
|
||||
object_id_t ccsdsPacketDistributor_): SystemObject(objectId_),
|
||||
ccsdsPacketDistributor(ccsdsPacketDistributor_),
|
||||
sentPacketsPerCycle(5)
|
||||
ccsdsPacketDistributor(ccsdsPacketDistributor_)
|
||||
{
|
||||
TmTcReceptionQueue = QueueFactory::instance()->
|
||||
createMessageQueue(TMTC_RECEPTION_QUEUE_DEPTH);
|
||||
@ -17,15 +16,30 @@ TmTcBridge::~TmTcBridge() {}
|
||||
|
||||
ReturnValue_t TmTcBridge::setNumberOfSentPacketsPerCycle(
|
||||
uint8_t sentPacketsPerCycle) {
|
||||
if(sentPacketsPerCycle <= MAX_STORED_DATA_SENT_PER_CYCLE) {
|
||||
if(sentPacketsPerCycle <= LIMIT_STORED_DATA_SENT_PER_CYCLE) {
|
||||
this->sentPacketsPerCycle = sentPacketsPerCycle;
|
||||
return RETURN_OK;
|
||||
}
|
||||
else {
|
||||
warning << "TmTcBridge: Number of packets sent per cycle "
|
||||
"exceeds limits" << std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t TmTcBridge::setMaxNumberOfPacketsStored(
|
||||
uint8_t maxNumberOfPacketsStored) {
|
||||
if(maxNumberOfPacketsStored <= LIMIT_DOWNLINK_PACKETS_STORED) {
|
||||
this->maxNumberOfPacketsStored = maxNumberOfPacketsStored;
|
||||
return RETURN_OK;
|
||||
}
|
||||
else {
|
||||
warning << "TmTcBridge: Number of packets stored "
|
||||
"exceeds limits" << std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t TmTcBridge::initialize() {
|
||||
tcStore = objectManager->get<StorageManagerIF>(objects::TC_STORE);
|
||||
if (tcStore == NULL) {
|
||||
@ -72,7 +86,7 @@ ReturnValue_t TmTcBridge::handleTm() {
|
||||
}
|
||||
|
||||
if(tmStored && communicationLinkUp) {
|
||||
result = sendStoredTm();
|
||||
result = handleStoredTm();
|
||||
}
|
||||
return result;
|
||||
|
||||
@ -124,7 +138,7 @@ ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage *message) {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t TmTcBridge::sendStoredTm() {
|
||||
ReturnValue_t TmTcBridge::handleStoredTm() {
|
||||
uint8_t counter = 0;
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
while(!fifo.empty() && counter < sentPacketsPerCycle) {
|
||||
@ -171,6 +185,8 @@ MessageQueueId_t TmTcBridge::getReportReceptionQueue(uint8_t virtualChannel) {
|
||||
return TmTcReceptionQueue->getId();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TmTcBridge::printData(uint8_t * data, size_t dataLen) {
|
||||
info << "TMTC Bridge: Printing data: [";
|
||||
for(uint32_t i=0;i<dataLen;i++) {
|
||||
|
@ -16,8 +16,11 @@ class TmTcBridge : public AcceptsTelemetryIF,
|
||||
public SystemObject {
|
||||
public:
|
||||
static constexpr uint8_t TMTC_RECEPTION_QUEUE_DEPTH = 20;
|
||||
static constexpr uint8_t MAX_STORED_DATA_SENT_PER_CYCLE = 10;
|
||||
static constexpr uint8_t MAX_DOWNLINK_PACKETS_STORED = 15;
|
||||
static constexpr uint8_t LIMIT_STORED_DATA_SENT_PER_CYCLE = 15;
|
||||
static constexpr uint8_t LIMIT_DOWNLINK_PACKETS_STORED = 20;
|
||||
|
||||
static constexpr uint8_t DEFAULT_STORED_DATA_SENT_PER_CYCLE = 5;
|
||||
static constexpr uint8_t DEFAULT_DOWNLINK_PACKETS_STORED = 10;
|
||||
|
||||
TmTcBridge(object_id_t objectId_, object_id_t ccsdsPacketDistributor_);
|
||||
virtual ~TmTcBridge();
|
||||
@ -31,6 +34,15 @@ public:
|
||||
*/
|
||||
ReturnValue_t setNumberOfSentPacketsPerCycle(uint8_t sentPacketsPerCycle);
|
||||
|
||||
/**
|
||||
* Set number of packets sent per performOperation().Please note that this
|
||||
* value must be smaller than MAX_DOWNLINK_PACKETS_STORED
|
||||
* @param sentPacketsPerCycle
|
||||
* @return -@c RETURN_OK if value was set successfully
|
||||
* -@c RETURN_FAILED otherwise, stored value stays the same
|
||||
*/
|
||||
ReturnValue_t setMaxNumberOfPacketsStored(uint8_t maxNumberOfPacketsStored);
|
||||
|
||||
void registerCommConnect();
|
||||
void registerCommDisconnect();
|
||||
|
||||
@ -94,7 +106,13 @@ protected:
|
||||
* Read the TM Queue and send TM if necessary. Default implementation provided
|
||||
* @return
|
||||
*/
|
||||
virtual ReturnValue_t readTmQueue();
|
||||
virtual ReturnValue_t handleTmQueue();
|
||||
|
||||
/**
|
||||
* Send stored data if communication link is active
|
||||
* @return
|
||||
*/
|
||||
virtual ReturnValue_t handleStoredTm();
|
||||
|
||||
/**
|
||||
* Implemented by child class. Perform sending of Telemetry by implementing
|
||||
@ -112,11 +130,6 @@ protected:
|
||||
*/
|
||||
virtual ReturnValue_t storeDownlinkData(TmTcMessage * message);
|
||||
|
||||
/**
|
||||
* Send stored data if communication link is active
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t sendStoredTm();
|
||||
|
||||
/**
|
||||
* Print data as hexidecimal array
|
||||
@ -126,8 +139,9 @@ protected:
|
||||
void printData(uint8_t * data, size_t dataLen);
|
||||
|
||||
private:
|
||||
FIFO<store_address_t, MAX_DOWNLINK_PACKETS_STORED> fifo;
|
||||
uint8_t sentPacketsPerCycle = 10;
|
||||
FIFO<store_address_t, LIMIT_DOWNLINK_PACKETS_STORED> fifo;
|
||||
uint8_t sentPacketsPerCycle = DEFAULT_STORED_DATA_SENT_PER_CYCLE;
|
||||
uint8_t maxNumberOfPacketsStored = DEFAULT_DOWNLINK_PACKETS_STORED;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user