Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
ECSS Services
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AcubeSat-OBC
ECSS Services
Commits
8eb0a44b
Unverified
Commit
8eb0a44b
authored
6 years ago
by
Dimitrios Stoupis
Browse files
Options
Downloads
Patches
Plain Diff
Implement the service in a better way
parent
d834dc4c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
inc/Services/MemMangService.hpp
+37
-5
37 additions, 5 deletions
inc/Services/MemMangService.hpp
src/Services/MemMangService.cpp
+30
-3
30 additions, 3 deletions
src/Services/MemMangService.cpp
src/main.cpp
+9
-0
9 additions, 0 deletions
src/main.cpp
with
76 additions
and
8 deletions
inc/Services/MemMangService.hpp
+
37
−
5
View file @
8eb0a44b
...
@@ -2,18 +2,50 @@
...
@@ -2,18 +2,50 @@
#define ECSS_SERVICES_MEMMANGSERVICE_HPP
#define ECSS_SERVICES_MEMMANGSERVICE_HPP
#include
"Service.hpp"
#include
"Service.hpp"
#include
<memory>
class
Mem
Mang
Service
:
public
Service
{
class
Mem
oryManagement
Service
:
public
Service
{
public:
public:
Mem
Mang
Service
()
{
Mem
oryManagement
Service
()
{
serviceType
=
6
;
serviceType
=
6
;
}
}
void
loadRawMemData
(
Message
&
requset
);
// Memory type ID's
enum
MemoryID
{
RAM
=
0
,
FLASH
=
1
,
EXTERNAL
=
2
};
void
dumpRawMemData
(
Message
&
request
);
class
RawDataMemoryManagement
{
private:
/**
* TM[6,6] dumped raw memory data report
*
* @details This report is triggered through TC[6,5]
*/
void
dumpedRawDataReport
();
MemoryManagementService
*
mainService
;
// Used to access main class's members
uint32_t
dumpedRawMemData
();
public:
/**
* TC[6,2] load raw values to memory
*
* @details This function loads new values to memory data areas
* specified in the request
* @param request: Provide the received message as a parameter
*/
void
loadRawData
(
Message
&
request
);
/**
* TC[6,5] read raw memory values
*
* @details This function reads the raw data from the RAM memory and
* triggers a TM[6,6] report
* @param request: Provide the received message as a parameter
*/
void
dumpRawData
(
Message
&
request
);
};
};
};
#endif //ECSS_SERVICES_MEMMANGSERVICE_HPP
#endif //ECSS_SERVICES_MEMMANGSERVICE_HPP
This diff is collapsed.
Click to expand it.
src/Services/MemMangService.cpp
+
30
−
3
View file @
8eb0a44b
#include
"Services/MemMangService.hpp"
#include
"Services/MemMangService.hpp"
#include
<iostream>
void
Mem
MangService
::
loadRaw
Mem
Data
(
Message
&
requ
s
et
)
{
void
Mem
oryManagementService
::
RawDataMemoryManagement
::
loadRawData
(
Message
&
reque
s
t
)
{
}
}
void
MemMangService
::
dumpRawMemData
(
Message
&
request
)
{
void
MemoryManagementService
::
RawDataMemoryManagement
::
dumpRawData
(
Message
&
request
)
{
Message
report
=
mainService
->
createTM
(
6
);
// Create the report message object of telemetry message subtype 6
uint8_t
iterationCount
=
0
;
// Get the iteration count
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)
// Read the packet's values
iterationCount
=
request
.
readUint8
();
startAddress
=
request
.
readUint32
();
readLength
=
request
.
readUint16
();
readData
=
(
uint8_t
*
)
malloc
(
static_cast
<
std
::
size_t
>
(
readLength
+
1
));
for
(
std
::
size_t
i
=
0
;
i
<
readLength
;
i
++
)
{
readData
[
i
]
=
*
(
uint8_t
*
)(
startAddress
+
i
);
}
readData
[
readLength
]
=
'\0'
;
report
.
appendUint8
(
iterationCount
);
// Iteration count
report
.
appendUint32
(
startAddress
);
// Start address
report
.
appendUint16
(
readLength
);
// Data read length
//report.appendString(readLength, static_cast<const char *>(readData));
// todo: add the rest of data fields
// todo: complete the function and fully specify it
mainService
->
storeMessage
(
report
);
}
}
uint32_t
MemMangService
::
dumpedRaw
Mem
Data
()
{
void
MemoryManagementService
::
RawDataMemoryManagement
::
dumpedRawData
Report
()
{
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main.cpp
+
9
−
0
View file @
8eb0a44b
#include
<iostream>
#include
<iostream>
#include
<Services/TestService.hpp>
#include
<Services/TestService.hpp>
#include
"Message.hpp"
#include
"Message.hpp"
#include
"Services/MemMangService.hpp"
int
main
()
{
int
main
()
{
Message
packet
=
Message
(
0
,
0
,
Message
::
TC
,
1
);
Message
packet
=
Message
(
0
,
0
,
Message
::
TC
,
1
);
...
@@ -27,5 +28,13 @@ int main() {
...
@@ -27,5 +28,13 @@ int main() {
receivedPacket
.
appendUint16
(
7
);
receivedPacket
.
appendUint16
(
7
);
testService
.
onBoardConnection
(
receivedPacket
);
testService
.
onBoardConnection
(
receivedPacket
);
// ST[06] testing
MemoryManagementService
::
RawDataMemoryManagement
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
);
return
0
;
return
0
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment