From 9e7d92b387249a6156a889e277cefc80fd53d667 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Sun, 9 Aug 2020 19:46:37 +0200 Subject: [PATCH] some renaming , hk packets finished --- housekeeping/HousekeepingPacketDownlink.h | 75 +++++++++++++++++++ ...ingPacket.h => HousekeepingPacketUpdate.h} | 10 +-- 2 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 housekeeping/HousekeepingPacketDownlink.h rename housekeeping/{InternalHousekeepingPacket.h => HousekeepingPacketUpdate.h} (86%) diff --git a/housekeeping/HousekeepingPacketDownlink.h b/housekeeping/HousekeepingPacketDownlink.h new file mode 100644 index 00000000..d386bfdf --- /dev/null +++ b/housekeeping/HousekeepingPacketDownlink.h @@ -0,0 +1,75 @@ +#ifndef FRAMEWORK_HOUSEKEEPING_HOUSEKEEPINGPACKETDOWNLINK_H_ +#define FRAMEWORK_HOUSEKEEPING_HOUSEKEEPINGPACKETDOWNLINK_H_ +#include +#include +#include +#include + +/** + * @brief This class will be used to serialize general housekeeping packets + * which are destined to be downlinked into the store. + * @details + * The housekeeping packets are stored into the IPC store and forwarded + * to the designated housekeeping handler. + */ +class HousekeepingPacketDownlink: public SerialLinkedListAdapter { +public: + HousekeepingPacketDownlink(sid_t sid, float collectionInterval, uint8_t + numberOfParameters, LocalPoolDataSetBase* dataSetPtr): + sourceId(sid.objectId), setId(sid.ownerSetId), + collectionInterval(collectionInterval), + numberOfParameters(numberOfParameters), dataSetPtr(dataSetPtr), + hkData(dataSetPtr) { + setLinks(); + } + +// virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size, +// size_t maxSize, Endianness streamEndianness) const override { +// ReturnValue_t result = SerialLinkedListAdapter::serialize(buffer, size, +// maxSize, streamEndianness); +// if(result != HasReturnvaluesIF::RETURN_OK) { +// return result; +// } +// return dataSetPtr->serialize(buffer, size, maxSize, streamEndianness); +// } +// +// virtual size_t getSerializedSize() const override { +// +// } + + virtual ReturnValue_t moveToOtherStore(StorageManagerIF* formerStore, + store_address_t storeId, StorageManagerIF* otherStore, + store_address_t* newStoreId, uint8_t** buffer, size_t size) { + const uint8_t* dataPtr = nullptr; + size_t hkDataSize = 0; + ReturnValue_t result = formerStore->getData(storeId, &dataPtr, &hkDataSize); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + + otherStore->addData(newStoreId, dataPtrgetSerializedSize(), + buffer); + std::memcpy + + } + +private: + void setLinks() { + setStart(&sourceId); + sourceId.setNext(&setId); + setId.setNext(&collectionInterval); + collectionInterval.setNext(&numberOfParameters); + numberOfParameters.setNext(&hkData); + } + + SerializeElement sourceId; + SerializeElement setId; + SerializeElement collectionInterval; + SerializeElement numberOfParameters; + LinkedElement hkData; + LocalPoolDataSetBase* dataSetPtr; +}; + + + +#endif /* FRAMEWORK_HOUSEKEEPING_HOUSEKEEPINGPACKETDOWNLINK_H_ */ diff --git a/housekeeping/InternalHousekeepingPacket.h b/housekeeping/HousekeepingPacketUpdate.h similarity index 86% rename from housekeeping/InternalHousekeepingPacket.h rename to housekeeping/HousekeepingPacketUpdate.h index 2a9a5564..bfdcde99 100644 --- a/housekeeping/InternalHousekeepingPacket.h +++ b/housekeeping/HousekeepingPacketUpdate.h @@ -1,5 +1,5 @@ -#ifndef FRAMEWORK_HOUSEKEEPING_INTERNALHOUSEKEEPINGPACKET_H_ -#define FRAMEWORK_HOUSEKEEPING_INTERNALHOUSEKEEPINGPACKET_H_ +#ifndef FRAMEWORK_HOUSEKEEPING_HOUSEKEEPINGPACKETUPDATE_H_ +#define FRAMEWORK_HOUSEKEEPING_HOUSEKEEPINGPACKETUPDATE_H_ #include #include @@ -9,7 +9,7 @@ * @brief This helper class will be used to serialize and deserialize * internal housekeeping packets into the store. */ -class InternalHousekeepingPacket: public SerializeIF { +class HousekeepingPacketUpdate: public SerializeIF { public: /** * @param timeStamp @@ -17,7 +17,7 @@ public: * @param hkData * @param hkDataSize */ - InternalHousekeepingPacket(uint8_t* timeStamp, size_t timeStampSize, + HousekeepingPacketUpdate(uint8_t* timeStamp, size_t timeStampSize, LocalPoolDataSetBase* dataSetPtr): timeStamp(timeStamp), timeStampSize(timeStampSize), dataSetPtr(dataSetPtr) {}; @@ -70,4 +70,4 @@ private: -#endif /* FRAMEWORK_HOUSEKEEPING_INTERNALHOUSEKEEPINGPACKET_H_ */ +#endif /* FRAMEWORK_HOUSEKEEPING_HOUSEKEEPINGPACKETUPDATE_H_ */