more similar to example now

This commit is contained in:
2020-09-30 17:17:01 +02:00
parent ffcb6e0213
commit 7ce3e7dd1a
21 changed files with 456 additions and 454 deletions

View File

@ -1,23 +0,0 @@
#include <fsfw/timemanager/Clock.h>
#include <mission/utility/TimeStamper.h>
#include <cstring>
TimeStamper::TimeStamper(object_id_t objectId): SystemObject(objectId) {}
ReturnValue_t TimeStamper::addTimeStamp(uint8_t* buffer,
const uint8_t maxSize) {
if(maxSize < TimeStamperIF::MISSION_TIMESTAMP_SIZE) {
return HasReturnvaluesIF::RETURN_FAILED;
}
timeval now;
Clock::getClock_timeval(&now);
CCSDSTime::CDS_short cds;
ReturnValue_t result = CCSDSTime::convertToCcsds(&cds,&now);
if(result != HasReturnvaluesIF::RETURN_OK){
return result;
}
std::memcpy(buffer,&cds,sizeof(cds));
return result;
}

View File

@ -1,18 +0,0 @@
#ifndef MISSION_UTILITY_TIMESTAMPER_H_
#define MISSION_UTILITY_TIMESTAMPER_H_
#include <fsfw/timemanager/TimeStamperIF.h>
#include <fsfw/timemanager/CCSDSTime.h>
#include <fsfw/objectmanager/SystemObject.h>
/**
* @brief
* @ingroup utility
*/
class TimeStamper: public TimeStamperIF, public SystemObject {
public:
TimeStamper(object_id_t objectId);
virtual ReturnValue_t addTimeStamp(uint8_t* buffer, const uint8_t maxSize);
};
#endif /* MISSION_UTILITY_TIMESTAMPER_H_ */

View File

@ -1,15 +1,14 @@
#include <mission/utility/TmFunnel.h>
#include <fsfw/ipc/QueueFactory.h>
#include <fsfw/tmtcpacket/pus/TmPacketBase.h>
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <mission/utility/TmFunnel.h>
object_id_t TmFunnel::downlinkDestination = objects::NO_OBJECT;
object_id_t TmFunnel::storageDestination = objects::NO_OBJECT;
TmFunnel::TmFunnel(object_id_t objectId_): SystemObject(objectId_),
sourceSequenceCount(0), storageTargetSet(false) {
TmFunnel::TmFunnel(object_id_t objectId, uint32_t messageDepth):
SystemObject(objectId), messageDepth(messageDepth) {
tmQueue = QueueFactory::instance()->createMessageQueue(messageDepth,
MessageQueueMessage::MAX_MESSAGE_SIZE);
storageQueue = QueueFactory::instance()->createMessageQueue(messageDepth,
@ -66,7 +65,7 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage* message) {
return result;
}
if(storageTargetSet) {
if(storageDestination != objects::NO_OBJECT) {
result = storageQueue->sendToDefault(message);
if(result != HasReturnvaluesIF::RETURN_OK){
tmPool->deleteData(message->getStorageId());
@ -100,10 +99,14 @@ ReturnValue_t TmFunnel::initialize() {
}
tmQueue->setDefaultDestination(tmTarget->getReportReceptionQueue());
// Storage destination is optional.
if(storageDestination == objects::NO_OBJECT) {
return SystemObject::initialize();
}
AcceptsTelemetryIF* storageTarget =
objectManager->get<AcceptsTelemetryIF>(storageDestination);
if(storageTarget != nullptr) {
storageTargetSet = true;
storageQueue->setDefaultDestination(
storageTarget->getReportReceptionQueue());
}

View File

@ -24,7 +24,7 @@ class TmFunnel: public AcceptsTelemetryIF,
public SystemObject {
friend void (Factory::setStaticFrameworkObjectIds)();
public:
TmFunnel(object_id_t objectId);
TmFunnel(object_id_t objectId, uint32_t messageDepth = 20);
virtual ~TmFunnel();
virtual MessageQueueId_t getReportReceptionQueue(
@ -37,14 +37,12 @@ protected:
static object_id_t storageDestination;
private:
uint16_t sourceSequenceCount;
bool storageTargetSet;
uint16_t sourceSequenceCount = 0;
MessageQueueIF* tmQueue = nullptr;
MessageQueueIF* storageQueue = nullptr;
StorageManagerIF* tmPool = nullptr;
uint32_t messageDepth = 10;
uint32_t messageDepth = 0;
ReturnValue_t handlePacket(TmTcMessage* message);
};