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
7650a178
Commit
7650a178
authored
6 years ago
by
Grigoris Pavlakis
Browse files
Options
Downloads
Patches
Plain Diff
Update reportParameterIds() to be void and store the message instead of returning
parent
f7236902
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
inc/Services/ParameterService.hpp
+4
-5
4 additions, 5 deletions
inc/Services/ParameterService.hpp
src/Services/ParameterService.cpp
+1
-2
1 addition, 2 deletions
src/Services/ParameterService.cpp
test/Services/ParameterService.cpp
+6
-2
6 additions, 2 deletions
test/Services/ParameterService.cpp
with
11 additions
and
9 deletions
inc/Services/ParameterService.hpp
+
4
−
5
View file @
7650a178
...
@@ -35,7 +35,6 @@ struct Parameter {
...
@@ -35,7 +35,6 @@ struct Parameter {
* for parameter reporting and modification.
* for parameter reporting and modification.
*
*
* @todo Ensure that the parameter list is sorted by ID
* @todo Ensure that the parameter list is sorted by ID
* @todo Convert reportParameterIds() to void when storeMessage() stores and doesn't print
*/
*/
class
ParameterService
:
public
Service
{
class
ParameterService
:
public
Service
{
...
@@ -56,11 +55,11 @@ public:
...
@@ -56,11 +55,11 @@ public:
* **for the parameters specified in the carried valid IDs**.
* **for the parameters specified in the carried valid IDs**.
*
*
* No sophisticated error checking for now, just whether the package is of the correct type
* No sophisticated error checking for now, just whether the package is of the correct type
* and whether the requested IDs are valid, ignoring the invalid ones.
* and whether the requested IDs are valid, ignoring the invalid ones. If no IDs are correct,
* the returned message shall be empty.
*
*
* @param paramId: a valid TC[20, 1] packet carrying the requested parameter IDs
* @param paramId: a valid TC[20, 1] packet carrying the requested parameter IDs
* @return A TM[20, 2] packet containing the valid parameter IDs and their settings.
* @return None (messages are stored using storeMessage())
* @return Empty TM[20, 2] packet on wrong type.
*
*
* @todo Generate failure notifs where needed when ST[01] is ready
* @todo Generate failure notifs where needed when ST[01] is ready
*
*
...
@@ -70,7 +69,7 @@ public:
...
@@ -70,7 +69,7 @@ public:
*
*
* Everything apart from the setting data is uint16 (setting data are uint32 for now)
* Everything apart from the setting data is uint16 (setting data are uint32 for now)
*/
*/
Message
reportParameterIds
(
Message
paramIds
);
void
reportParameterIds
(
Message
paramIds
);
/**
/**
* This function receives a TC[20, 3] message and after checking whether its type is correct,
* This function receives a TC[20, 3] message and after checking whether its type is correct,
...
...
This diff is collapsed.
Click to expand it.
src/Services/ParameterService.cpp
+
1
−
2
View file @
7650a178
...
@@ -28,7 +28,7 @@ ParameterService::ParameterService() {
...
@@ -28,7 +28,7 @@ ParameterService::ParameterService() {
#endif
#endif
}
}
Message
ParameterService
::
reportParameterIds
(
Message
paramIds
)
{
void
ParameterService
::
reportParameterIds
(
Message
paramIds
)
{
Message
reqParam
(
20
,
2
,
Message
::
TM
,
1
);
// empty TM[20, 2] parameter report message
Message
reqParam
(
20
,
2
,
Message
::
TM
,
1
);
// empty TM[20, 2] parameter report message
if
(
paramIds
.
packetType
==
Message
::
TC
&&
paramIds
.
serviceType
==
20
&&
if
(
paramIds
.
packetType
==
Message
::
TC
&&
paramIds
.
serviceType
==
20
&&
...
@@ -50,7 +50,6 @@ Message ParameterService::reportParameterIds(Message paramIds) {
...
@@ -50,7 +50,6 @@ Message ParameterService::reportParameterIds(Message paramIds) {
}
}
storeMessage
(
reqParam
);
storeMessage
(
reqParam
);
return
reqParam
;
// this has to stay for now because no other way for testing
}
}
void
ParameterService
::
setParameterIds
(
Message
newParamValues
)
{
void
ParameterService
::
setParameterIds
(
Message
newParamValues
)
{
...
...
This diff is collapsed.
Click to expand it.
test/Services/ParameterService.cpp
+
6
−
2
View file @
7650a178
#include
"catch2/catch.hpp"
#include
"catch2/catch.hpp"
#include
"Services/ParameterService.hpp"
#include
"Services/ParameterService.hpp"
#include
"Message.hpp"
#include
"Message.hpp"
#include
"ServiceTests.hpp"
#define CATCH_CONFIG_MAIN
#define CATCH_CONFIG_MAIN
...
@@ -19,7 +20,8 @@ TEST_CASE("Parameter Report Subservice") {
...
@@ -19,7 +20,8 @@ TEST_CASE("Parameter Report Subservice") {
request
.
appendUint16
(
34672
);
// faulty ID in this context
request
.
appendUint16
(
34672
);
// faulty ID in this context
request
.
appendUint16
(
3
);
// valid
request
.
appendUint16
(
3
);
// valid
report
=
pserv
.
reportParameterIds
(
request
);
pserv
.
reportParameterIds
(
request
);
report
=
ServiceTests
::
get
(
0
);
request
.
resetRead
();
request
.
resetRead
();
uint16_t
repIdCount
=
report
.
readUint16
();
uint16_t
repIdCount
=
report
.
readUint16
();
...
@@ -33,7 +35,9 @@ TEST_CASE("Parameter Report Subservice") {
...
@@ -33,7 +35,9 @@ TEST_CASE("Parameter Report Subservice") {
SECTION
(
"Wrong Message Type Handling Test"
)
{
SECTION
(
"Wrong Message Type Handling Test"
)
{
Message
falseRequest
(
15
,
3
,
Message
::
TM
,
1
);
//a totally wrong message
Message
falseRequest
(
15
,
3
,
Message
::
TM
,
1
);
//a totally wrong message
Message
response
=
pserv
.
reportParameterIds
(
falseRequest
);
pserv
.
reportParameterIds
(
falseRequest
);
Message
response
=
ServiceTests
::
get
(
0
);
CHECK
(
response
.
messageType
==
2
);
CHECK
(
response
.
messageType
==
2
);
CHECK
(
response
.
serviceType
==
20
);
CHECK
(
response
.
serviceType
==
20
);
CHECK
(
response
.
packetType
==
Message
::
TM
);
CHECK
(
response
.
packetType
==
Message
::
TM
);
...
...
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