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
0557af72
Commit
0557af72
authored
6 years ago
by
kongr45gpen
Browse files
Options
Downloads
Patches
Plain Diff
Move implementations of Message functions to its header, so they can be inlined
parent
1f147c93
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
inc/Message.hpp
+35
-11
35 additions, 11 deletions
inc/Message.hpp
src/Message.cpp
+1
-47
1 addition, 47 deletions
src/Message.cpp
src/Services/TestService.cpp
+0
-3
0 additions, 3 deletions
src/Services/TestService.cpp
with
36 additions
and
61 deletions
inc/Message.hpp
+
35
−
11
View file @
0557af72
...
@@ -81,7 +81,9 @@ public:
...
@@ -81,7 +81,9 @@ public:
*
*
* PTC = 1, PFC = 0
* PTC = 1, PFC = 0
*/
*/
void
appendBoolean
(
bool
value
);
void
appendBoolean
(
bool
value
)
{
return
appendByte
(
static_cast
<
uint8_t
>
(
value
));
}
/**
/**
* Adds an enumerated parameter consisting of an arbitrary number of bits to the end of the
* Adds an enumerated parameter consisting of an arbitrary number of bits to the end of the
...
@@ -96,70 +98,92 @@ public:
...
@@ -96,70 +98,92 @@ public:
*
*
* PTC = 1, PFC = 8
* PTC = 1, PFC = 8
*/
*/
void
appendEnumerated
(
uint8_t
value
);
void
appendEnumerated
(
uint8_t
value
)
{
return
appendByte
(
value
);
};
/**
/**
* Adds an enumerated parameter consisting of 2 bytes to the end of the message
* Adds an enumerated parameter consisting of 2 bytes to the end of the message
*
*
* PTC = 1, PFC = 16
* PTC = 1, PFC = 16
*/
*/
void
appendEnumerated
(
uint16_t
value
);
void
appendEnumerated
(
uint16_t
value
)
{
return
appendHalfword
(
value
);
}
/**
/**
* Adds an enumerated parameter consisting of 4 bytes to the end of the message
* Adds an enumerated parameter consisting of 4 bytes to the end of the message
*
*
* PTC = 1, PFC = 32
* PTC = 1, PFC = 32
*/
*/
void
appendEnumerated
(
uint32_t
value
);
void
appendEnumerated
(
uint32_t
value
)
{
return
appendWord
(
value
);
}
/**
/**
* Adds a 1 byte unsigned integer to the end of the message
* Adds a 1 byte unsigned integer to the end of the message
*
*
* PTC = 2, PFC = 4
* PTC = 2, PFC = 4
*/
*/
void
appendInteger
(
uint8_t
value
);
void
appendInteger
(
uint8_t
value
)
{
return
appendByte
(
value
);
}
/**
/**
* Adds a 2 byte unsigned integer to the end of the message
* Adds a 2 byte unsigned integer to the end of the message
*
*
* PTC = 2, PFC = 8
* PTC = 2, PFC = 8
*/
*/
void
appendInteger
(
uint16_t
value
);
void
appendInteger
(
uint16_t
value
)
{
return
appendHalfword
(
value
);
}
/**
/**
* Adds a 4 byte unsigned integer to the end of the message
* Adds a 4 byte unsigned integer to the end of the message
*
*
* PTC = 2, PFC = 14
* PTC = 2, PFC = 14
*/
*/
void
appendInteger
(
uint32_t
value
);
void
appendInteger
(
uint32_t
value
)
{
return
appendWord
(
value
);
}
/**
/**
* Adds a 1 byte signed integer to the end of the message
* Adds a 1 byte signed integer to the end of the message
*
*
* PTC = 3, PFC = 4
* PTC = 3, PFC = 4
*/
*/
void
appendInteger
(
int8_t
value
);
void
appendInteger
(
int8_t
value
)
{
return
appendByte
(
reinterpret_cast
<
uint8_t
&>
(
value
));
}
/**
/**
* Adds a 2 byte signed integer to the end of the message
* Adds a 2 byte signed integer to the end of the message
*
*
* PTC = 3, PFC = 8
* PTC = 3, PFC = 8
*/
*/
void
appendInteger
(
int16_t
value
);
void
appendInteger
(
int16_t
value
)
{
return
appendHalfword
(
reinterpret_cast
<
uint16_t
&>
(
value
));
}
/**
/**
* Adds a 4 byte signed integer to the end of the message
* Adds a 4 byte signed integer to the end of the message
*
*
* PTC = 3, PFC = 14
* PTC = 3, PFC = 14
*/
*/
void
appendInteger
(
int32_t
value
);
void
appendInteger
(
int32_t
value
)
{
return
appendWord
(
reinterpret_cast
<
uint32_t
&>
(
value
));
}
/**
/**
* Adds a 4-byte single-precision floating point number to the end of the message
* Adds a 4-byte single-precision floating point number to the end of the message
*
*
* PTC = 5, PFC = 1
* PTC = 5, PFC = 1
*/
*/
void
appendReal
(
float
value
);
void
appendReal
(
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/Message.cpp
+
1
−
47
View file @
0557af72
...
@@ -65,59 +65,13 @@ void Message::appendString(uint8_t size, const char *value) {
...
@@ -65,59 +65,13 @@ void Message::appendString(uint8_t size, const char *value) {
dataSize
+=
size
;
dataSize
+=
size
;
}
}
void
Message
::
appendBoolean
(
bool
value
)
{
void
Message
::
appendEnumerated
(
uint8_t
bits
,
uint32_t
value
)
{
return
appendByte
(
static_cast
<
uint8_t
>
(
value
));
}
inline
void
Message
::
appendEnumerated
(
uint8_t
bits
,
uint32_t
value
)
{
// TODO: Implement 32-bit enums, if needed
// TODO: Implement 32-bit enums, if needed
assert
((
value
&
0xffff0000
)
!=
0
);
assert
((
value
&
0xffff0000
)
!=
0
);
return
appendBits
(
bits
,
value
);
return
appendBits
(
bits
,
value
);
}
}
inline
void
Message
::
appendEnumerated
(
uint8_t
value
)
{
return
appendByte
(
value
);
}
inline
void
Message
::
appendEnumerated
(
uint16_t
value
)
{
return
appendHalfword
(
value
);
}
inline
void
Message
::
appendEnumerated
(
uint32_t
value
)
{
return
appendWord
(
value
);
}
inline
void
Message
::
appendInteger
(
uint8_t
value
)
{
return
appendByte
(
value
);
}
inline
void
Message
::
appendInteger
(
uint16_t
value
)
{
return
appendHalfword
(
value
);
}
inline
void
Message
::
appendInteger
(
uint32_t
value
)
{
return
appendWord
(
value
);
}
inline
void
Message
::
appendInteger
(
int8_t
value
)
{
return
appendByte
(
static_cast
<
uint8_t
>
(
value
));
}
void
Message
::
appendInteger
(
int16_t
value
)
{
return
appendHalfword
(
static_cast
<
uint8_t
>
(
value
));
}
void
Message
::
appendInteger
(
int32_t
value
)
{
return
appendWord
(
static_cast
<
uint8_t
>
(
value
));
}
void
Message
::
appendReal
(
float
value
)
{
static_assert
(
sizeof
(
uint32_t
)
==
sizeof
(
value
),
"Floating point numbers must be 32 bits long"
);
return
appendWord
(
reinterpret_cast
<
uint32_t
&>
(
value
));
}
Message
::
Message
(
uint8_t
serviceType
,
uint8_t
messageType
,
Message
::
PacketType
packetType
,
Message
::
Message
(
uint8_t
serviceType
,
uint8_t
messageType
,
Message
::
PacketType
packetType
,
uint16_t
applicationId
)
:
serviceType
(
serviceType
),
messageType
(
messageType
),
uint16_t
applicationId
)
:
serviceType
(
serviceType
),
messageType
(
messageType
),
packetType
(
packetType
),
applicationId
(
applicationId
)
{}
packetType
(
packetType
),
applicationId
(
applicationId
)
{}
This diff is collapsed.
Click to expand it.
src/Services/TestService.cpp
+
0
−
3
View file @
0557af72
#include
<Services/TestService.hpp>
#include
"Services/TestService.hpp"
#include
"Services/TestService.hpp"
void
TestService
::
areYouAlive
(
const
Message
&
request
)
{
void
TestService
::
areYouAlive
(
const
Message
&
request
)
{
...
...
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