adapting tmtc bridge
This commit is contained in:
parent
d0ce075e0d
commit
d7278c4493
@ -7,8 +7,8 @@
|
||||
|
||||
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,11 +17,26 @@ 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;
|
||||
}
|
||||
}
|
||||
@ -72,7 +87,7 @@ ReturnValue_t TmTcBridge::handleTm() {
|
||||
}
|
||||
|
||||
if(tmStored && communicationLinkUp) {
|
||||
result = sendStoredTm();
|
||||
result = handleStoredTm();
|
||||
}
|
||||
return result;
|
||||
|
||||
@ -124,7 +139,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 +186,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();
|
||||
@ -33,6 +36,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();
|
||||
|
||||
@ -98,6 +110,12 @@ protected:
|
||||
*/
|
||||
virtual ReturnValue_t readTmQueue();
|
||||
|
||||
/**
|
||||
* Send stored data if communication link is active
|
||||
* @return
|
||||
*/
|
||||
virtual ReturnValue_t handleStoredTm();
|
||||
|
||||
/**
|
||||
* Implemented by child class. Perform sending of Telemetry by implementing
|
||||
* communication drivers or wrappers, e.g. UART communication or lwIP stack.
|
||||
@ -114,11 +132,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
|
||||
@ -128,8 +141,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