adapting tmtc bridge
This commit is contained in:
parent
db535e25f2
commit
c075e1bf23
@ -6,8 +6,7 @@
|
|||||||
|
|
||||||
TmTcBridge::TmTcBridge(object_id_t objectId_,
|
TmTcBridge::TmTcBridge(object_id_t objectId_,
|
||||||
object_id_t ccsdsPacketDistributor_): SystemObject(objectId_),
|
object_id_t ccsdsPacketDistributor_): SystemObject(objectId_),
|
||||||
ccsdsPacketDistributor(ccsdsPacketDistributor_),
|
ccsdsPacketDistributor(ccsdsPacketDistributor_)
|
||||||
sentPacketsPerCycle(5)
|
|
||||||
{
|
{
|
||||||
TmTcReceptionQueue = QueueFactory::instance()->
|
TmTcReceptionQueue = QueueFactory::instance()->
|
||||||
createMessageQueue(TMTC_RECEPTION_QUEUE_DEPTH);
|
createMessageQueue(TMTC_RECEPTION_QUEUE_DEPTH);
|
||||||
@ -17,11 +16,26 @@ TmTcBridge::~TmTcBridge() {}
|
|||||||
|
|
||||||
ReturnValue_t TmTcBridge::setNumberOfSentPacketsPerCycle(
|
ReturnValue_t TmTcBridge::setNumberOfSentPacketsPerCycle(
|
||||||
uint8_t sentPacketsPerCycle) {
|
uint8_t sentPacketsPerCycle) {
|
||||||
if(sentPacketsPerCycle <= MAX_STORED_DATA_SENT_PER_CYCLE) {
|
if(sentPacketsPerCycle <= LIMIT_STORED_DATA_SENT_PER_CYCLE) {
|
||||||
this->sentPacketsPerCycle = sentPacketsPerCycle;
|
this->sentPacketsPerCycle = sentPacketsPerCycle;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
else {
|
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;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,7 +86,7 @@ ReturnValue_t TmTcBridge::handleTm() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(tmStored && communicationLinkUp) {
|
if(tmStored && communicationLinkUp) {
|
||||||
result = sendStoredTm();
|
result = handleStoredTm();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
@ -124,7 +138,7 @@ ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage *message) {
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t TmTcBridge::sendStoredTm() {
|
ReturnValue_t TmTcBridge::handleStoredTm() {
|
||||||
uint8_t counter = 0;
|
uint8_t counter = 0;
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
while(!fifo.empty() && counter < sentPacketsPerCycle) {
|
while(!fifo.empty() && counter < sentPacketsPerCycle) {
|
||||||
@ -171,6 +185,8 @@ MessageQueueId_t TmTcBridge::getReportReceptionQueue(uint8_t virtualChannel) {
|
|||||||
return TmTcReceptionQueue->getId();
|
return TmTcReceptionQueue->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void TmTcBridge::printData(uint8_t * data, size_t dataLen) {
|
void TmTcBridge::printData(uint8_t * data, size_t dataLen) {
|
||||||
info << "TMTC Bridge: Printing data: [";
|
info << "TMTC Bridge: Printing data: [";
|
||||||
for(uint32_t i=0;i<dataLen;i++) {
|
for(uint32_t i=0;i<dataLen;i++) {
|
||||||
|
@ -16,8 +16,11 @@ class TmTcBridge : public AcceptsTelemetryIF,
|
|||||||
public SystemObject {
|
public SystemObject {
|
||||||
public:
|
public:
|
||||||
static constexpr uint8_t TMTC_RECEPTION_QUEUE_DEPTH = 20;
|
static constexpr uint8_t TMTC_RECEPTION_QUEUE_DEPTH = 20;
|
||||||
static constexpr uint8_t MAX_STORED_DATA_SENT_PER_CYCLE = 10;
|
static constexpr uint8_t LIMIT_STORED_DATA_SENT_PER_CYCLE = 15;
|
||||||
static constexpr uint8_t MAX_DOWNLINK_PACKETS_STORED = 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_);
|
TmTcBridge(object_id_t objectId_, object_id_t ccsdsPacketDistributor_);
|
||||||
virtual ~TmTcBridge();
|
virtual ~TmTcBridge();
|
||||||
@ -31,6 +34,15 @@ public:
|
|||||||
*/
|
*/
|
||||||
ReturnValue_t setNumberOfSentPacketsPerCycle(uint8_t sentPacketsPerCycle);
|
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 registerCommConnect();
|
||||||
void registerCommDisconnect();
|
void registerCommDisconnect();
|
||||||
|
|
||||||
@ -94,7 +106,13 @@ protected:
|
|||||||
* 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 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
|
* Implemented by child class. Perform sending of Telemetry by implementing
|
||||||
@ -112,11 +130,6 @@ protected:
|
|||||||
*/
|
*/
|
||||||
virtual ReturnValue_t storeDownlinkData(TmTcMessage * message);
|
virtual ReturnValue_t storeDownlinkData(TmTcMessage * message);
|
||||||
|
|
||||||
/**
|
|
||||||
* Send stored data if communication link is active
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
ReturnValue_t sendStoredTm();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print data as hexidecimal array
|
* Print data as hexidecimal array
|
||||||
@ -126,8 +139,9 @@ protected:
|
|||||||
void printData(uint8_t * data, size_t dataLen);
|
void printData(uint8_t * data, size_t dataLen);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FIFO<store_address_t, MAX_DOWNLINK_PACKETS_STORED> fifo;
|
FIFO<store_address_t, LIMIT_DOWNLINK_PACKETS_STORED> fifo;
|
||||||
uint8_t sentPacketsPerCycle = 10;
|
uint8_t sentPacketsPerCycle = DEFAULT_STORED_DATA_SENT_PER_CYCLE;
|
||||||
|
uint8_t maxNumberOfPacketsStored = DEFAULT_DOWNLINK_PACKETS_STORED;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user