From 021b9b8c50e15adfdd0705663ea447ff7fdf10ab Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 22 Dec 2020 15:57:43 +0100 Subject: [PATCH 1/2] improvements --- tmstorage/TmStoreBackendIF.h | 25 ++++++++++++++++++++++--- tmstorage/TmStoreFrontendIF.h | 17 +++++++++++++---- tmstorage/TmStoreMessage.cpp | 4 ++-- tmstorage/TmStoreMessage.h | 4 ++-- tmstorage/TmStorePackets.h | 8 ++++---- 5 files changed, 43 insertions(+), 15 deletions(-) diff --git a/tmstorage/TmStoreBackendIF.h b/tmstorage/TmStoreBackendIF.h index 4b2a8836..4ae77609 100644 --- a/tmstorage/TmStoreBackendIF.h +++ b/tmstorage/TmStoreBackendIF.h @@ -1,5 +1,5 @@ -#ifndef PLATFORM_TMTCSERVICES_TMSTOREBACKENDIF_H_ -#define PLATFORM_TMTCSERVICES_TMSTOREBACKENDIF_H_ +#ifndef FSFW_TMTCSERVICES_TMSTOREBACKENDIF_H_ +#define FSFW_TMTCSERVICES_TMSTOREBACKENDIF_H_ #include "../returnvalues/HasReturnvaluesIF.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 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 initialize() = 0; + + /** + * Implement the storage of TM packets to mass memory + * @param tmPacket + * @return + */ virtual ReturnValue_t storePacket(TmPacketMinimal* tmPacket) = 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 fetchPackets(bool fromBegin = false) = 0; virtual ReturnValue_t initializeStore(object_id_t dumpTarget) = 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 deleteTime(const timeval* timeUntil, uint32_t* deletedPackets) = 0; @@ -73,4 +92,4 @@ public: -#endif /* PLATFORM_TMTCSERVICES_TMSTOREBACKENDIF_H_ */ +#endif /* FSFW_TMTCSERVICES_TMSTOREBACKENDIF_H_ */ diff --git a/tmstorage/TmStoreFrontendIF.h b/tmstorage/TmStoreFrontendIF.h index e1bc3a14..beee7ede 100644 --- a/tmstorage/TmStoreFrontendIF.h +++ b/tmstorage/TmStoreFrontendIF.h @@ -1,9 +1,10 @@ -#ifndef PLATFORM_TMTCSERVICES_TMSTOREFRONTENDIF_H_ -#define PLATFORM_TMTCSERVICES_TMSTOREFRONTENDIF_H_ +#ifndef FSFW_TMTCSERVICES_TMSTOREFRONTENDIF_H_ +#define FSFW_TMTCSERVICES_TMSTOREFRONTENDIF_H_ -#include "../returnvalues/HasReturnvaluesIF.h" #include "TmStorePackets.h" +#include "../returnvalues/HasReturnvaluesIF.h" #include "../ipc/MessageQueueSenderIF.h" + class TmPacketMinimal; class SpacePacketBase; class TmStoreBackendIF; @@ -11,6 +12,14 @@ class TmStoreBackendIF; class TmStoreFrontendIF { public: 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; /** * 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_ */ diff --git a/tmstorage/TmStoreMessage.cpp b/tmstorage/TmStoreMessage.cpp index d2efd403..753ac1b7 100644 --- a/tmstorage/TmStoreMessage.cpp +++ b/tmstorage/TmStoreMessage.cpp @@ -1,5 +1,5 @@ #include "../objectmanager/ObjectManagerIF.h" -#include "TmStoreMessage.h" +#include "../tmstorage/TmStoreMessage.h" TmStoreMessage::~TmStoreMessage() { @@ -74,7 +74,7 @@ void TmStoreMessage::clear(CommandMessage* cmd) { case DELETE_STORE_CONTENT_BLOCKS: case DOWNLINK_STORE_CONTENT_BLOCKS: case REPORT_INDEX_REQUEST: - cmd->setCommand(UNKNOWN_COMMAND); + cmd->setCommand(CommandMessage::UNKNOWN_COMMAND); cmd->setParameter(0); cmd->setParameter2(0); break; diff --git a/tmstorage/TmStoreMessage.h b/tmstorage/TmStoreMessage.h index 5b928569..59354a20 100644 --- a/tmstorage/TmStoreMessage.h +++ b/tmstorage/TmStoreMessage.h @@ -3,9 +3,9 @@ #include "../ipc/CommandMessage.h" #include "../storagemanager/StorageManagerIF.h" -#include "TmStorePackets.h" +#include "../tmstorage/TmStorePackets.h" #include "../objectmanager/SystemObjectIF.h" -class TmStoreMessage: public CommandMessage { +class TmStoreMessage { public: static ReturnValue_t setEnableStoringMessage(CommandMessage* cmd, bool setEnabled); diff --git a/tmstorage/TmStorePackets.h b/tmstorage/TmStorePackets.h index b46ae6f6..0312a998 100644 --- a/tmstorage/TmStorePackets.h +++ b/tmstorage/TmStorePackets.h @@ -140,8 +140,8 @@ public: if(packet->isValid()){ timeval packetTime = {0,0}; size_t foundlen = 0; - CCSDSTime::convertFromCcsds(&packetTime, - &packet->rawTimestamp[0],&foundlen,sizeof(rawTimestamp)); + CCSDSTime::convertFromCcsds(&packetTime,&packet->rawTimestamp[0], + &foundlen,sizeof(rawTimestamp)); if(packetTime <= *cmpTime){ return true; } @@ -154,7 +154,7 @@ public: timeval packetTime = {0,0}; size_t foundlen = 0; CCSDSTime::convertFromCcsds(&packetTime,&packet->rawTimestamp[0], - &foundlen,sizeof(rawTimestamp)); + &foundlen,sizeof(rawTimestamp)); if(packetTime >= *cmpTime){ return true; } @@ -208,7 +208,7 @@ public: timeval packetTime = {0,0}; size_t foundlen = 0; CCSDSTime::convertFromCcsds(&packetTime, &this->rawTimestamp[0], - &foundlen,sizeof(rawTimestamp)); + &foundlen, sizeof(rawTimestamp)); return packetTime; } From 09161f22d070089265202a7fb67a11ac53990c26 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 22 Dec 2020 15:58:52 +0100 Subject: [PATCH 2/2] updated tm storage --- tmstorage/TmStoreMessage.cpp | 2 +- tmstorage/TmStoreMessage.h | 15 +++++++++------ tmstorage/TmStorePackets.h | 6 +++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/tmstorage/TmStoreMessage.cpp b/tmstorage/TmStoreMessage.cpp index 753ac1b7..033cbb1d 100644 --- a/tmstorage/TmStoreMessage.cpp +++ b/tmstorage/TmStoreMessage.cpp @@ -1,5 +1,5 @@ +#include "TmStoreMessage.h" #include "../objectmanager/ObjectManagerIF.h" -#include "../tmstorage/TmStoreMessage.h" TmStoreMessage::~TmStoreMessage() { diff --git a/tmstorage/TmStoreMessage.h b/tmstorage/TmStoreMessage.h index 59354a20..d0178920 100644 --- a/tmstorage/TmStoreMessage.h +++ b/tmstorage/TmStoreMessage.h @@ -1,10 +1,11 @@ -#ifndef FRAMEWORK_TMSTORAGE_TMSTOREMESSAGE_H_ -#define FRAMEWORK_TMSTORAGE_TMSTOREMESSAGE_H_ +#ifndef FSFW_TMSTORAGE_TMSTOREMESSAGE_H_ +#define FSFW_TMSTORAGE_TMSTOREMESSAGE_H_ +#include "TmStorePackets.h" #include "../ipc/CommandMessage.h" #include "../storagemanager/StorageManagerIF.h" -#include "../tmstorage/TmStorePackets.h" #include "../objectmanager/SystemObjectIF.h" + class TmStoreMessage { public: static ReturnValue_t setEnableStoringMessage(CommandMessage* cmd, @@ -25,8 +26,10 @@ public: static void setDownlinkContentTimeMessage(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 setDownlinkBlocksMessage(CommandMessage* cmd, uint32_t addressLow, uint32_t addressHigh); + static ReturnValue_t setDeleteBlocksMessage(CommandMessage* cmd, + 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 void setDeleteContentTimeMessage(CommandMessage* cmd, store_address_t storeId); @@ -60,4 +63,4 @@ private: TmStoreMessage(); }; -#endif /* FRAMEWORK_TMSTORAGE_TMSTOREMESSAGE_H_ */ +#endif /* FSFW_TMSTORAGE_TMSTOREMESSAGE_H_ */ diff --git a/tmstorage/TmStorePackets.h b/tmstorage/TmStorePackets.h index 0312a998..3abd0c1c 100644 --- a/tmstorage/TmStorePackets.h +++ b/tmstorage/TmStorePackets.h @@ -1,5 +1,5 @@ -#ifndef FRAMEWORK_TMSTORAGE_TMSTOREPACKETS_H_ -#define FRAMEWORK_TMSTORAGE_TMSTOREPACKETS_H_ +#ifndef FSFW_TMSTORAGE_TMSTOREPACKETS_H_ +#define FSFW_TMSTORAGE_TMSTOREPACKETS_H_ #include "../serialize/SerialFixedArrayListAdapter.h" #include "../serialize/SerializeElement.h" @@ -300,4 +300,4 @@ private: uint8_t rawTimestamp[TimeStamperIF::MISSION_TIMESTAMP_SIZE]; }; -#endif /* FRAMEWORK_TMSTORAGE_TMSTOREPACKETS_H_ */ +#endif /* FSFW_TMSTORAGE_TMSTOREPACKETS_H_ */