Skip to content
Snippets Groups Projects
Unverified Commit 8516a915 authored by Dimitrios Stoupis's avatar Dimitrios Stoupis
Browse files

Better compliance with the standard

parent 8eb0a44b
No related branches found
No related tags found
No related merge requests found
...@@ -3,13 +3,10 @@ ...@@ -3,13 +3,10 @@
#include "Service.hpp" #include "Service.hpp"
#include <memory> #include <memory>
#include <iostream>
class MemoryManagementService : public Service { class MemoryManagementService : public Service {
public: public:
MemoryManagementService() {
serviceType = 6;
}
// Memory type ID's // Memory type ID's
enum MemoryID { enum MemoryID {
RAM = 0, RAM = 0,
...@@ -17,6 +14,15 @@ public: ...@@ -17,6 +14,15 @@ public:
EXTERNAL = 2 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 { class RawDataMemoryManagement {
private: private:
/** /**
...@@ -28,6 +34,7 @@ public: ...@@ -28,6 +34,7 @@ public:
MemoryManagementService *mainService; // Used to access main class's members MemoryManagementService *mainService; // Used to access main class's members
public: public:
explicit RawDataMemoryManagement(MemoryManagementService *parent);
/** /**
* TC[6,2] load raw values to memory * TC[6,2] load raw values to memory
* *
...@@ -45,7 +52,7 @@ public: ...@@ -45,7 +52,7 @@ public:
* @param request: Provide the received message as a parameter * @param request: Provide the received message as a parameter
*/ */
void dumpRawData(Message &request); void dumpRawData(Message &request);
}; } rawDataMemorySubservice;
}; };
#endif //ECSS_SERVICES_MEMMANGSERVICE_HPP #endif //ECSS_SERVICES_MEMMANGSERVICE_HPP
#include "Services/MemMangService.hpp" #include "Services/MemMangService.hpp"
#include <iostream> #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) { void MemoryManagementService::RawDataMemoryManagement::loadRawData(Message &request) {
} }
...@@ -12,6 +23,7 @@ void MemoryManagementService::RawDataMemoryManagement::dumpRawData(Message &requ ...@@ -12,6 +23,7 @@ void MemoryManagementService::RawDataMemoryManagement::dumpRawData(Message &requ
uint8_t *readData = nullptr; // Pointer to store the data read from the memory 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) 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) uint32_t startAddress = 0; // Start address for the memory read (updated in each new iteration)
MemoryManagementService::MemoryID meId;
// Read the packet's values // Read the packet's values
iterationCount = request.readUint8(); iterationCount = request.readUint8();
......
...@@ -29,12 +29,12 @@ int main() { ...@@ -29,12 +29,12 @@ int main() {
testService.onBoardConnection(receivedPacket); testService.onBoardConnection(receivedPacket);
// ST[06] testing // ST[06] testing
MemoryManagementService::RawDataMemoryManagement memMangService; MemoryManagementService memMangService;
Message rcvPack = Message(6, 2, Message::TC, 1); Message rcvPack = Message(6, 2, Message::TC, 1);
rcvPack.appendUint8(1); // Iteration count rcvPack.appendUint8(1); // Iteration count
rcvPack.appendUint32(0x45327845); // Start address rcvPack.appendUint32(0x45327845); // Start address
rcvPack.appendUint16(0); // Data read length rcvPack.appendUint16(0); // Data read length
memMangService.dumpRawData(rcvPack); memMangService.rawDataMemorySubservice.dumpRawData(rcvPack);
return 0; return 0;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment