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
24fb3034
Commit
24fb3034
authored
6 years ago
by
kongr45gpen
Browse files
Options
Downloads
Patches
Plain Diff
Explicitly state the size of the message in `append()` functions to prevent ambiguity
Fixes #1
parent
0a12a293
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
inc/Message.hpp
+10
-10
10 additions, 10 deletions
inc/Message.hpp
src/Services/TestService.cpp
+1
-1
1 addition, 1 deletion
src/Services/TestService.cpp
src/main.cpp
+2
-2
2 additions, 2 deletions
src/main.cpp
with
13 additions
and
13 deletions
inc/Message.hpp
+
10
−
10
View file @
24fb3034
...
...
@@ -98,7 +98,7 @@ public:
*
* PTC = 1, PFC = 8
*/
void
appendEnum
erated
(
uint8_t
value
)
{
void
appendEnum
8
(
uint8_t
value
)
{
return
appendByte
(
value
);
};
...
...
@@ -107,7 +107,7 @@ public:
*
* PTC = 1, PFC = 16
*/
void
appendEnum
erated
(
uint16_t
value
)
{
void
appendEnum
16
(
uint16_t
value
)
{
return
appendHalfword
(
value
);
}
...
...
@@ -116,7 +116,7 @@ public:
*
* PTC = 1, PFC = 32
*/
void
appendEnum
erated
(
uint32_t
value
)
{
void
appendEnum
32
(
uint32_t
value
)
{
return
appendWord
(
value
);
}
...
...
@@ -125,7 +125,7 @@ public:
*
* PTC = 2, PFC = 4
*/
void
append
Integer
(
uint8_t
value
)
{
void
append
Uint8
(
uint8_t
value
)
{
return
appendByte
(
value
);
}
...
...
@@ -134,7 +134,7 @@ public:
*
* PTC = 2, PFC = 8
*/
void
append
Integer
(
uint16_t
value
)
{
void
append
Uint16
(
uint16_t
value
)
{
return
appendHalfword
(
value
);
}
...
...
@@ -143,7 +143,7 @@ public:
*
* PTC = 2, PFC = 14
*/
void
append
Integer
(
uint32_t
value
)
{
void
append
Uint32
(
uint32_t
value
)
{
return
appendWord
(
value
);
}
...
...
@@ -152,7 +152,7 @@ public:
*
* PTC = 3, PFC = 4
*/
void
append
Integer
(
int8_t
value
)
{
void
append
Sint8
(
int8_t
value
)
{
return
appendByte
(
reinterpret_cast
<
uint8_t
&>
(
value
));
}
...
...
@@ -161,7 +161,7 @@ public:
*
* PTC = 3, PFC = 8
*/
void
append
Integer
(
int16_t
value
)
{
void
append
Sint16
(
int16_t
value
)
{
return
appendHalfword
(
reinterpret_cast
<
uint16_t
&>
(
value
));
}
...
...
@@ -170,7 +170,7 @@ public:
*
* PTC = 3, PFC = 14
*/
void
append
Integer
(
int32_t
value
)
{
void
append
Sint32
(
int32_t
value
)
{
return
appendWord
(
reinterpret_cast
<
uint32_t
&>
(
value
));
}
...
...
@@ -179,7 +179,7 @@ public:
*
* PTC = 5, PFC = 1
*/
void
append
Real
(
float
value
)
{
void
append
Float
(
float
value
)
{
static_assert
(
sizeof
(
uint32_t
)
==
sizeof
(
value
),
"Floating point numbers must be 32 bits long"
);
return
appendWord
(
reinterpret_cast
<
uint32_t
&>
(
value
));
...
...
This diff is collapsed.
Click to expand it.
src/Services/TestService.cpp
+
1
−
1
View file @
24fb3034
...
...
@@ -12,7 +12,7 @@ void TestService::onBoardConnection(const Message &request) {
Message
report
=
createTM
(
4
);
// TODO: This is not the correct way to do this! Fetching functions will be added later
report
.
append
Integer
(
request
.
data
[
1
]);
report
.
append
Uint8
(
request
.
data
[
1
]);
storeMessage
(
report
);
}
This diff is collapsed.
Click to expand it.
src/main.cpp
+
2
−
2
View file @
24fb3034
...
...
@@ -8,7 +8,7 @@ int main() {
packet
.
appendString
(
5
,
"hello"
);
packet
.
appendBits
(
15
,
0x28a8
);
packet
.
appendBits
(
1
,
1
);
packet
.
append
Real
(
5.7
);
packet
.
append
Float
(
5.7
);
std
::
cout
<<
"Hello, World!"
<<
std
::
endl
;
std
::
cout
<<
std
::
hex
<<
packet
.
data
<<
std
::
endl
;
// packet data must be 'helloQQ'
...
...
@@ -19,7 +19,7 @@ int main() {
Message
receivedPacket
=
Message
(
17
,
1
,
Message
::
TC
,
1
);
testService
.
areYouAlive
(
receivedPacket
);
receivedPacket
=
Message
(
17
,
3
,
Message
::
TC
,
1
);
receivedPacket
.
append
Integer
(
static_cast
<
u
int16
_t
>
(
7
)
)
;
receivedPacket
.
append
U
int16
(
7
);
testService
.
onBoardConnection
(
receivedPacket
);
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