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
0d1fb7d6
Commit
0d1fb7d6
authored
6 years ago
by
Grigoris Pavlakis
Browse files
Options
Downloads
Patches
Plain Diff
Fix formatting
parent
c3d8dfec
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
+7
-4
7 additions, 4 deletions
inc/Services/ParameterService.hpp
src/Services/ParameterService.cpp
+7
-3
7 additions, 3 deletions
src/Services/ParameterService.cpp
src/main.cpp
+5
-5
5 additions, 5 deletions
src/main.cpp
with
19 additions
and
12 deletions
inc/Services/ParameterService.hpp
+
7
−
4
View file @
0d1fb7d6
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define ECSS_SERVICES_PARAMETERSERVICE_HPP
#define ECSS_SERVICES_PARAMETERSERVICE_HPP
#include
"Service.hpp"
#include
"Service.hpp"
#define CONFIGLENGTH 5
#define CONFIGLENGTH 5
/**
/**
...
@@ -40,10 +41,12 @@ class ParameterService : public Service {
...
@@ -40,10 +41,12 @@ class ParameterService : public Service {
Parameter
paramsList
[
CONFIGLENGTH
];
// CONFIGLENGTH is just a dummy number for now, this should be statically set
Parameter
paramsList
[
CONFIGLENGTH
];
// CONFIGLENGTH is just a dummy number for now, this should be statically set
public:
public:
ParameterService
();
ParameterService
();
Message
reportParameter
(
Message
paramId
);
void
setParamData
(
Message
newParamValues
);
Message
reportParameter
(
Message
paramId
);
void
setParamData
(
Message
newParamValues
);
};
};
...
...
This diff is collapsed.
Click to expand it.
src/Services/ParameterService.cpp
+
7
−
3
View file @
0d1fb7d6
#include
"Services/ParameterService.hpp"
#include
"Services/ParameterService.hpp"
#define DEMOMODE
#define DEMOMODE
#ifdef DEMOMODE
#ifdef DEMOMODE
#include
<ctime>
#include
<ctime>
#endif
#endif
ParameterService
::
ParameterService
()
{
ParameterService
::
ParameterService
()
{
...
@@ -23,10 +26,10 @@ ParameterService::ParameterService() {
...
@@ -23,10 +26,10 @@ ParameterService::ParameterService() {
// Test code, setting up one of the parameter fields
// Test code, setting up one of the parameter fields
time_t
currTime
=
time
(
nullptr
);
time_t
currTime
=
time
(
nullptr
);
struct
tm
*
today
=
localtime
(
&
currTime
);
struct
tm
*
today
=
localtime
(
&
currTime
);
paramsList
[
2
].
paramId
=
341
;
// random parameter ID
paramsList
[
2
].
paramId
=
341
;
// random parameter ID
paramsList
[
2
].
settingData
=
today
->
tm_min
;
// the minute of the current hour
paramsList
[
2
].
settingData
=
today
->
tm_min
;
// the minute of the current hour
paramsList
[
2
].
ptc
=
3
;
// unsigned int
paramsList
[
2
].
ptc
=
3
;
// unsigned int
paramsList
[
2
].
pfc
=
14
;
// 32 bits
paramsList
[
2
].
pfc
=
14
;
// 32 bits
#endif
#endif
...
@@ -47,7 +50,8 @@ Message ParameterService::reportParameter(Message paramId) {
...
@@ -47,7 +50,8 @@ Message ParameterService::reportParameter(Message paramId) {
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
uint16_t
reqParamId
=
paramId
.
readUint16
();
// parameter ID must be accessed only once
uint16_t
reqParamId
=
paramId
.
readUint16
();
// parameter ID must be accessed only once
if
(
paramId
.
packetType
==
Message
::
TC
&&
paramId
.
serviceType
==
20
&&
paramId
.
messageType
==
1
)
{
if
(
paramId
.
packetType
==
Message
::
TC
&&
paramId
.
serviceType
==
20
&&
paramId
.
messageType
==
1
)
{
for
(
int
i
=
0
;
i
<
CONFIGLENGTH
;
i
++
)
{
for
(
int
i
=
0
;
i
<
CONFIGLENGTH
;
i
++
)
{
...
...
This diff is collapsed.
Click to expand it.
src/main.cpp
+
5
−
5
View file @
0d1fb7d6
...
@@ -17,7 +17,8 @@ int main() {
...
@@ -17,7 +17,8 @@ int main() {
char
string
[
6
];
char
string
[
6
];
packet
.
readString
(
string
,
5
);
packet
.
readString
(
string
,
5
);
std
::
cout
<<
"Word: "
<<
string
<<
" "
<<
packet
.
readBits
(
15
)
<<
packet
.
readBits
(
1
)
<<
std
::
endl
;
std
::
cout
<<
"Word: "
<<
string
<<
" "
<<
packet
.
readBits
(
15
)
<<
packet
.
readBits
(
1
)
<<
std
::
endl
;
std
::
cout
<<
packet
.
readFloat
()
<<
" "
<<
std
::
dec
<<
packet
.
readSint32
()
<<
std
::
endl
;
std
::
cout
<<
packet
.
readFloat
()
<<
" "
<<
std
::
dec
<<
packet
.
readSint32
()
<<
std
::
endl
;
// ST[17] test
// ST[17] test
...
@@ -34,11 +35,10 @@ int main() {
...
@@ -34,11 +35,10 @@ int main() {
sentPacket
.
appendUint16
(
341
);
//the packet sent contains the ID of the desired parameter
sentPacket
.
appendUint16
(
341
);
//the packet sent contains the ID of the desired parameter
Message
returnedPacket
=
paramService
.
reportParameter
(
sentPacket
);
Message
returnedPacket
=
paramService
.
reportParameter
(
sentPacket
);
uint16_t
id
=
returnedPacket
.
readUint16
();
std
::
cout
<<
"Parameter ID: "
<<
std
::
dec
<<
returnedPacket
.
readUint16
()
<<
std
::
endl
uint32_t
val
=
returnedPacket
.
readUint32
();
<<
"Parameter value: "
<<
std
::
dec
<<
returnedPacket
.
readUint32
()
<<
std
::
endl
;
std
::
cout
<<
"Parameter ID: "
<<
std
::
dec
<<
id
<<
std
::
endl
;
//set
std
::
cout
<<
"Parameter value: "
<<
std
::
dec
<<
val
<<
std
::
endl
;
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