updates for new API

This commit is contained in:
2022-08-15 11:57:57 +02:00
parent 751ae6062e
commit 4a28f79e3a
23 changed files with 89 additions and 52 deletions

View File

@ -1,6 +1,7 @@
#include <fsfw/ipc/QueueFactory.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/timemanager/CdsShortTimeStamper.h>
#include <fsfw/tmtcpacket/pus/tm.h>
#include <mission/tmtc/TmFunnel.h>
@ -9,8 +10,9 @@
object_id_t TmFunnel::downlinkDestination = objects::NO_OBJECT;
object_id_t TmFunnel::storageDestination = objects::NO_OBJECT;
TmFunnel::TmFunnel(object_id_t objectId, uint32_t messageDepth, uint8_t reportReceptionVc)
: SystemObject(objectId), messageDepth(messageDepth), reportReceptionVc(reportReceptionVc) {
TmFunnel::TmFunnel(object_id_t objectId, CdsShortTimeStamper& timeReader, uint32_t messageDepth,
uint8_t reportReceptionVc)
: SystemObject(objectId), timeReader(timeReader), messageDepth(messageDepth), reportReceptionVc(reportReceptionVc) {
auto mqArgs = MqArgs(objectId, static_cast<void*>(this));
tmQueue = QueueFactory::instance()->createMessageQueue(
messageDepth, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs);
@ -49,11 +51,16 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage* message) {
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
TmPacketPusC packet(packetData);
packet.setPacketSequenceCount(this->sourceSequenceCount);
sourceSequenceCount++;
sourceSequenceCount = sourceSequenceCount % SpacePacketBase::LIMIT_SEQUENCE_COUNT;
packet.setErrorControl();
PusTmZeroCopyWriter packet(timeReader, packetData, size);
result = packet.parseDataWithoutCrcCheck();
if(result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
packet.setSequenceCount(sourceSequenceCount++);
sourceSequenceCount = sourceSequenceCount % ccsds::LIMIT_SEQUENCE_COUNT;
packet.updateErrorControl();
result = tmQueue->sendToDefault(message);
if (result != HasReturnvaluesIF::RETURN_OK) {
@ -107,7 +114,7 @@ ReturnValue_t TmFunnel::initialize() {
AcceptsTelemetryIF* storageTarget =
ObjectManager::instance()->get<AcceptsTelemetryIF>(storageDestination);
if (storageTarget != nullptr) {
storageQueue->setDefaultDestination(storageTarget->getReportReceptionQueue());
storageQueue->setDefaultDestination(storageTarget->getReportReceptionQueue(0));
}
return SystemObject::initialize();