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
835cd321
Unverified
Commit
835cd321
authored
6 years ago
by
Dimitrios Stoupis
Browse files
Options
Downloads
Patches
Plain Diff
Add checksum checks and complete the checkData function
parent
0554b8a4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Services/MemoryManagementService.cpp
+18
-11
18 additions, 11 deletions
src/Services/MemoryManagementService.cpp
with
18 additions
and
11 deletions
src/Services/MemoryManagementService.cpp
+
18
−
11
View file @
835cd321
...
...
@@ -40,7 +40,16 @@ void MemoryManagementService::RawDataMemoryManagement::loadRawData(Message &requ
for
(
std
::
size_t
j
=
0
;
j
<
iterationCount
;
j
++
)
{
uint64_t
startAddress
=
request
.
readUint64
();
// Start address of the memory
uint16_t
dataLength
=
request
.
readOctetString
(
readData
);
// Data length to load
// todo: Continue only if the checksum passes (when the checksum will be implemented)
uint16_t
checksum
=
request
.
readBits
(
16
);
// Get the CRC checksum from the message
// Continue only if the checksum passes
if
(
checksum
!=
CRCHelper
::
validateCRC
(
readData
,
dataLength
))
{
// todo: Send a failed of execution report
// todo: Remove the print statements in the final version
// todo: The final implementation of exit on failure has to be well defined
std
::
cout
<<
"We encountered a problem validating CRC!"
<<
std
::
endl
;
return
;
// Make sure we get out of the loop and no other command is executed
}
if
(
mainService
.
addressValidator
(
memoryID
,
startAddress
)
&&
mainService
.
addressValidator
(
memoryID
,
startAddress
+
dataLength
))
{
...
...
@@ -51,12 +60,12 @@ void MemoryManagementService::RawDataMemoryManagement::loadRawData(Message &requ
// todo: Implement the fail report the correct way when we know all parameters
mainService
.
requestVerificationService
.
failExecutionVerification
(
request
.
packetType
,
true
,
1
,
1
,
10
,
6
);
/
*
Send failed
completion
of execution
*/
/
/ todo:
Send
a
failed of execution
report
}
}
}
}
else
{
/
* Generate
a fa
lse
start
report */
/
/ todo: Send
a fa
iled
start
of execution
}
}
...
...
@@ -96,18 +105,18 @@ void MemoryManagementService::RawDataMemoryManagement::dumpRawData(Message &requ
// This part is repeated N-times (N = iteration count)
report
.
appendUint64
(
startAddress
);
// Start address
report
.
appendOctetString
(
readLength
,
readData
);
// Save the read data
report
.
appendBits
(
16
,
CRCHelper
::
calculateCRC
(
readData
,
readLength
));
}
else
{
mainService
.
requestVerificationService
.
failExecutionVerification
(
request
.
packetType
,
true
,
1
,
1
,
10
,
6
);
/
* Send wrong address failure
report
*/
/
/ todo: Send a failed of execution
report
}
}
// todo: implement and append the checksum part of the reporting packet
mainService
.
storeMessage
(
report
);
// Save the report message
request
.
resetRead
();
// Reset the reading count
}
else
{
/
* Generate
a fa
lse
start
report */
/
/ todo: Send
a fa
iled
start
of execution
}
}
...
...
@@ -147,20 +156,18 @@ void MemoryManagementService::RawDataMemoryManagement::checkRawData(Message &req
// This part is repeated N-times (N = iteration count)
report
.
appendUint64
(
startAddress
);
// Start address
report
.
appendUint16
(
readLength
);
// Save the read data
// todo: Calculate and append checksum in the report
//report.appendBits(16, /* checksum bits */);
report
.
appendBits
(
16
,
CRCHelper
::
calculateCRC
(
readData
,
readLength
));
// Append CRC
}
else
{
mainService
.
requestVerificationService
.
failExecutionVerification
(
request
.
packetType
,
true
,
1
,
1
,
10
,
6
);
/
* Failure
of execution
*/
/
/ todo: Send a failed
of execution
report
}
}
// todo: implement and append the checksum part of the reporting packet
mainService
.
storeMessage
(
report
);
// Save the report message
request
.
resetRead
();
// Reset the reading count
}
else
{
/
* F
ailed start of execution
*/
/
/ todo: Send a f
ailed start of execution
report
}
}
...
...
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