diff --git a/inc/Services/MemMangService.hpp b/inc/Services/MemMangService.hpp index e58765b7f1f44262f8e5840d5680fb94bd748e63..fa3f18b9a75c5902d4fe83d8c56c25c29baef61b 100644 --- a/inc/Services/MemMangService.hpp +++ b/inc/Services/MemMangService.hpp @@ -3,13 +3,10 @@ #include "Service.hpp" #include <memory> +#include <iostream> class MemoryManagementService : public Service { public: - MemoryManagementService() { - serviceType = 6; - } - // Memory type ID's enum MemoryID { RAM = 0, @@ -17,6 +14,15 @@ public: EXTERNAL = 2 }; + MemoryManagementService(); + + /** + * Raw data memory management subservice class + * + * @details A class defining the raw data memory management subservice functions. + * As per the ECSS manual, each memory service has to have at most one raw memory + * data management subservice + */ class RawDataMemoryManagement { private: /** @@ -28,6 +34,7 @@ public: MemoryManagementService *mainService; // Used to access main class's members public: + explicit RawDataMemoryManagement(MemoryManagementService *parent); /** * TC[6,2] load raw values to memory * @@ -45,7 +52,7 @@ public: * @param request: Provide the received message as a parameter */ void dumpRawData(Message &request); - }; + } rawDataMemorySubservice; }; #endif //ECSS_SERVICES_MEMMANGSERVICE_HPP diff --git a/src/Services/MemMangService.cpp b/src/Services/MemMangService.cpp index 1ac3df71392401669f185ca4bec7c5a718aa9ba9..69fc97db234b7e555a5888a5068a97c464973abb 100644 --- a/src/Services/MemMangService.cpp +++ b/src/Services/MemMangService.cpp @@ -1,6 +1,17 @@ #include "Services/MemMangService.hpp" #include <iostream> +// Define the constructors for the classes +MemoryManagementService::MemoryManagementService() : rawDataMemorySubservice(this) { + serviceType = 6; + std::cout << "Constructor creation debuffing MemMeang Service" << std::endl; +} + +MemoryManagementService::RawDataMemoryManagement::RawDataMemoryManagement( + MemoryManagementService *parent) : mainService(parent) {} + + +// Function declarations for the raw data memory management subservice void MemoryManagementService::RawDataMemoryManagement::loadRawData(Message &request) { } @@ -12,6 +23,7 @@ void MemoryManagementService::RawDataMemoryManagement::dumpRawData(Message &requ uint8_t *readData = nullptr; // Pointer to store the data read from the memory uint16_t readLength = 0; // Data length to read (updated for each new iteration) uint32_t startAddress = 0; // Start address for the memory read (updated in each new iteration) + MemoryManagementService::MemoryID meId; // Read the packet's values iterationCount = request.readUint8(); diff --git a/src/main.cpp b/src/main.cpp index 9d72df8f242e6f04b0c81e46ed3b2f123373bebc..a9b0bbf1a0e6339c0029b33a8de50fae92bd1ea5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -29,12 +29,12 @@ int main() { testService.onBoardConnection(receivedPacket); // ST[06] testing - MemoryManagementService::RawDataMemoryManagement memMangService; + MemoryManagementService memMangService; Message rcvPack = Message(6, 2, Message::TC, 1); rcvPack.appendUint8(1); // Iteration count rcvPack.appendUint32(0x45327845); // Start address rcvPack.appendUint16(0); // Data read length - memMangService.dumpRawData(rcvPack); + memMangService.rawDataMemorySubservice.dumpRawData(rcvPack); return 0; }