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
d6f44675
Unverified
Commit
d6f44675
authored
6 years ago
by
Dimitrios Stoupis
Browse files
Options
Downloads
Patches
Plain Diff
Added octet and uint64 functions
parent
23e55912
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
inc/Message.hpp
+47
-0
47 additions, 0 deletions
inc/Message.hpp
with
47 additions
and
0 deletions
inc/Message.hpp
+
47
−
0
View file @
d6f44675
...
...
@@ -187,6 +187,16 @@ public:
return
appendWord
(
value
);
}
/**
* Adds an 8 byte unsigned integer to the end of the message
*
* PTC = 3, PFC = 16
*/
void
appendUint64
(
uint64_t
value
)
{
appendWord
(
static_cast
<
uint32_t
>
(
value
>>
32
));
return
appendWord
(
static_cast
<
uint32_t
>
(
value
));
}
/**
* Adds a 1 byte signed integer to the end of the message
*
...
...
@@ -226,6 +236,20 @@ public:
return
appendWord
(
reinterpret_cast
<
uint32_t
&>
(
value
));
}
/**
* Adds a N-byte string to the end of the message
*
*
* PTC = 7, PFC = 0
*/
void
appendOctetString
(
uint16_t
size
,
uint8_t
*
byteString
)
{
assert
(
size
<
ECSS_MAX_STRING_SIZE
);
for
(
std
::
size_t
i
=
0
;
i
<
size
;
i
++
)
{
appendByte
(
byteString
[
i
]);
}
}
/**
* Fetches a single-byte boolean value from the current position in the message
*
...
...
@@ -301,6 +325,15 @@ public:
return
readWord
();
}
/**
* Fetches an 8-byte unsigned integer from the current position in the message
*
* PTC = 3, PFC = 16
*/
uint64_t
readUint64
()
{
return
((
uint64_t
)
readWord
()
<<
32
)
|
(
uint64_t
)
readWord
();
}
/**
* Fetches an 1-byte signed integer from the current position in the message
*
...
...
@@ -347,6 +380,20 @@ public:
return
reinterpret_cast
<
float
&>
(
value
);
}
/**
* Fetches a N-byte string from the current position in the message
*
*
* PTC = 7, PFC = 0
*/
void
readOctetString
(
uint8_t
*
byteString
,
uint16_t
size
)
{
assert
(
size
<
ECSS_MAX_STRING_SIZE
);
for
(
std
::
size_t
i
=
0
;
i
<
size
;
i
++
)
{
byteString
[
i
]
=
readByte
();
}
}
/**
* Reset the message reading status, and start reading data from it again
*/
...
...
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