Merge pull request 'TM storage convergence' (#327) from KSat/fsfw:mueller/tmstorage into development

Reviewed-on: fsfw/fsfw#327
This commit is contained in:
Steffen Gaisser 2021-01-12 15:09:14 +01:00
commit b42535dd2d
5 changed files with 54 additions and 23 deletions

View File

@ -1,5 +1,5 @@
#ifndef PLATFORM_TMTCSERVICES_TMSTOREBACKENDIF_H_ #ifndef FSFW_TMTCSERVICES_TMSTOREBACKENDIF_H_
#define PLATFORM_TMTCSERVICES_TMSTOREBACKENDIF_H_ #define FSFW_TMTCSERVICES_TMSTOREBACKENDIF_H_
#include "../returnvalues/HasReturnvaluesIF.h" #include "../returnvalues/HasReturnvaluesIF.h"
#include "../objectmanager/SystemObjectIF.h" #include "../objectmanager/SystemObjectIF.h"
@ -49,14 +49,33 @@ public:
static const Event AUTO_CATALOGS_SENDING_FAILED = MAKE_EVENT(15, severity::INFO);//!< Info that the a auto catalog report failed static const Event AUTO_CATALOGS_SENDING_FAILED = MAKE_EVENT(15, severity::INFO);//!< Info that the a auto catalog report failed
virtual ~TmStoreBackendIF() {} virtual ~TmStoreBackendIF() {}
/**
* SHOULDDO: Specification on what has to be implemented here
* @param opCode
* @return
*/
virtual ReturnValue_t performOperation(uint8_t opCode) = 0; virtual ReturnValue_t performOperation(uint8_t opCode) = 0;
virtual ReturnValue_t initialize() = 0; virtual ReturnValue_t initialize() = 0;
/**
* Implement the storage of TM packets to mass memory
* @param tmPacket
* @return
*/
virtual ReturnValue_t storePacket(TmPacketMinimal* tmPacket) = 0; virtual ReturnValue_t storePacket(TmPacketMinimal* tmPacket) = 0;
virtual ReturnValue_t setFetchLimitTime(const timeval* loverLimit, const timeval* upperLimit) = 0; virtual ReturnValue_t setFetchLimitTime(const timeval* loverLimit, const timeval* upperLimit) = 0;
virtual ReturnValue_t setFetchLimitBlocks(uint32_t startAddress, uint32_t endAddress) = 0; virtual ReturnValue_t setFetchLimitBlocks(uint32_t startAddress, uint32_t endAddress) = 0;
virtual ReturnValue_t fetchPackets(bool fromBegin = false) = 0; virtual ReturnValue_t fetchPackets(bool fromBegin = false) = 0;
virtual ReturnValue_t initializeStore(object_id_t dumpTarget) = 0; virtual ReturnValue_t initializeStore(object_id_t dumpTarget) = 0;
virtual ReturnValue_t dumpIndex(store_address_t* storeId) = 0; virtual ReturnValue_t dumpIndex(store_address_t* storeId) = 0;
/**
* SHOULDDO: Adapt for file management system?
* @param startAddress
* @param endAddress
* @return
*/
virtual ReturnValue_t deleteBlocks(uint32_t startAddress, uint32_t endAddress) = 0; virtual ReturnValue_t deleteBlocks(uint32_t startAddress, uint32_t endAddress) = 0;
virtual ReturnValue_t deleteTime(const timeval* timeUntil, virtual ReturnValue_t deleteTime(const timeval* timeUntil,
uint32_t* deletedPackets) = 0; uint32_t* deletedPackets) = 0;
@ -73,4 +92,4 @@ public:
#endif /* PLATFORM_TMTCSERVICES_TMSTOREBACKENDIF_H_ */ #endif /* FSFW_TMTCSERVICES_TMSTOREBACKENDIF_H_ */

View File

@ -1,9 +1,10 @@
#ifndef PLATFORM_TMTCSERVICES_TMSTOREFRONTENDIF_H_ #ifndef FSFW_TMTCSERVICES_TMSTOREFRONTENDIF_H_
#define PLATFORM_TMTCSERVICES_TMSTOREFRONTENDIF_H_ #define FSFW_TMTCSERVICES_TMSTOREFRONTENDIF_H_
#include "../returnvalues/HasReturnvaluesIF.h"
#include "TmStorePackets.h" #include "TmStorePackets.h"
#include "../returnvalues/HasReturnvaluesIF.h"
#include "../ipc/MessageQueueSenderIF.h" #include "../ipc/MessageQueueSenderIF.h"
class TmPacketMinimal; class TmPacketMinimal;
class SpacePacketBase; class SpacePacketBase;
class TmStoreBackendIF; class TmStoreBackendIF;
@ -11,6 +12,14 @@ class TmStoreBackendIF;
class TmStoreFrontendIF { class TmStoreFrontendIF {
public: public:
virtual TmStoreBackendIF* getBackend() const = 0; virtual TmStoreBackendIF* getBackend() const = 0;
/**
* What do I need to implement here?
* This is propably used by PUS Service 15 so we should propably check for messages..
* Provide base implementation?
* @param opCode
* @return
*/
virtual ReturnValue_t performOperation(uint8_t opCode) = 0; virtual ReturnValue_t performOperation(uint8_t opCode) = 0;
/** /**
* Callback from the back-end to indicate a certain packet was received. * Callback from the back-end to indicate a certain packet was received.
@ -52,4 +61,4 @@ public:
#endif /* PLATFORM_TMTCSERVICES_TMSTOREFRONTENDIF_H_ */ #endif /* FSFW_TMTCSERVICES_TMSTOREFRONTENDIF_H_ */

View File

@ -1,5 +1,5 @@
#include "../objectmanager/ObjectManagerIF.h"
#include "TmStoreMessage.h" #include "TmStoreMessage.h"
#include "../objectmanager/ObjectManagerIF.h"
TmStoreMessage::~TmStoreMessage() { TmStoreMessage::~TmStoreMessage() {
@ -74,7 +74,7 @@ void TmStoreMessage::clear(CommandMessage* cmd) {
case DELETE_STORE_CONTENT_BLOCKS: case DELETE_STORE_CONTENT_BLOCKS:
case DOWNLINK_STORE_CONTENT_BLOCKS: case DOWNLINK_STORE_CONTENT_BLOCKS:
case REPORT_INDEX_REQUEST: case REPORT_INDEX_REQUEST:
cmd->setCommand(UNKNOWN_COMMAND); cmd->setCommand(CommandMessage::UNKNOWN_COMMAND);
cmd->setParameter(0); cmd->setParameter(0);
cmd->setParameter2(0); cmd->setParameter2(0);
break; break;

View File

@ -1,11 +1,12 @@
#ifndef FRAMEWORK_TMSTORAGE_TMSTOREMESSAGE_H_ #ifndef FSFW_TMSTORAGE_TMSTOREMESSAGE_H_
#define FRAMEWORK_TMSTORAGE_TMSTOREMESSAGE_H_ #define FSFW_TMSTORAGE_TMSTOREMESSAGE_H_
#include "TmStorePackets.h"
#include "../ipc/CommandMessage.h" #include "../ipc/CommandMessage.h"
#include "../storagemanager/StorageManagerIF.h" #include "../storagemanager/StorageManagerIF.h"
#include "TmStorePackets.h"
#include "../objectmanager/SystemObjectIF.h" #include "../objectmanager/SystemObjectIF.h"
class TmStoreMessage: public CommandMessage {
class TmStoreMessage {
public: public:
static ReturnValue_t setEnableStoringMessage(CommandMessage* cmd, static ReturnValue_t setEnableStoringMessage(CommandMessage* cmd,
bool setEnabled); bool setEnabled);
@ -25,8 +26,10 @@ public:
static void setDownlinkContentTimeMessage(CommandMessage* cmd, static void setDownlinkContentTimeMessage(CommandMessage* cmd,
store_address_t storeId); store_address_t storeId);
static void setIndexReportMessage(CommandMessage* cmd, store_address_t storeId); static void setIndexReportMessage(CommandMessage* cmd, store_address_t storeId);
static ReturnValue_t setDeleteBlocksMessage(CommandMessage* cmd, uint32_t addressLow, uint32_t addressHigh); static ReturnValue_t setDeleteBlocksMessage(CommandMessage* cmd,
static ReturnValue_t setDownlinkBlocksMessage(CommandMessage* cmd, uint32_t addressLow, uint32_t addressHigh); uint32_t addressLow, uint32_t addressHigh);
static ReturnValue_t setDownlinkBlocksMessage(CommandMessage* cmd,
uint32_t addressLow, uint32_t addressHigh);
static ReturnValue_t setIndexRequestMessage(CommandMessage* cmd); static ReturnValue_t setIndexRequestMessage(CommandMessage* cmd);
static void setDeleteContentTimeMessage(CommandMessage* cmd, static void setDeleteContentTimeMessage(CommandMessage* cmd,
store_address_t storeId); store_address_t storeId);
@ -60,4 +63,4 @@ private:
TmStoreMessage(); TmStoreMessage();
}; };
#endif /* FRAMEWORK_TMSTORAGE_TMSTOREMESSAGE_H_ */ #endif /* FSFW_TMSTORAGE_TMSTOREMESSAGE_H_ */

View File

@ -1,5 +1,5 @@
#ifndef FRAMEWORK_TMSTORAGE_TMSTOREPACKETS_H_ #ifndef FSFW_TMSTORAGE_TMSTOREPACKETS_H_
#define FRAMEWORK_TMSTORAGE_TMSTOREPACKETS_H_ #define FSFW_TMSTORAGE_TMSTOREPACKETS_H_
#include "../serialize/SerialFixedArrayListAdapter.h" #include "../serialize/SerialFixedArrayListAdapter.h"
#include "../serialize/SerializeElement.h" #include "../serialize/SerializeElement.h"
@ -140,8 +140,8 @@ public:
if(packet->isValid()){ if(packet->isValid()){
timeval packetTime = {0,0}; timeval packetTime = {0,0};
size_t foundlen = 0; size_t foundlen = 0;
CCSDSTime::convertFromCcsds(&packetTime, CCSDSTime::convertFromCcsds(&packetTime,&packet->rawTimestamp[0],
&packet->rawTimestamp[0],&foundlen,sizeof(rawTimestamp)); &foundlen,sizeof(rawTimestamp));
if(packetTime <= *cmpTime){ if(packetTime <= *cmpTime){
return true; return true;
} }
@ -300,4 +300,4 @@ private:
uint8_t rawTimestamp[TimeStamperIF::MISSION_TIMESTAMP_SIZE]; uint8_t rawTimestamp[TimeStamperIF::MISSION_TIMESTAMP_SIZE];
}; };
#endif /* FRAMEWORK_TMSTORAGE_TMSTOREPACKETS_H_ */ #endif /* FSFW_TMSTORAGE_TMSTOREPACKETS_H_ */