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
c9535888
Commit
c9535888
authored
5 years ago
by
Grigoris Pavlakis
Committed by
kongr45gpen
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add missing underscores
parent
cf00ec09
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
inc/Services/FunctionManagementService.hpp
+9
-9
9 additions, 9 deletions
inc/Services/FunctionManagementService.hpp
src/Services/FunctionManagementService.cpp
+10
-10
10 additions, 10 deletions
src/Services/FunctionManagementService.cpp
with
19 additions
and
19 deletions
inc/Services/FunctionManagementService.hpp
+
9
−
9
View file @
c9535888
...
@@ -42,22 +42,22 @@
...
@@ -42,22 +42,22 @@
* Usage of the include() function:
* Usage of the include() function:
*
*
* @code
* @code
* void foo(String<MAXARGLENGTH> b) {
* void foo(String<MAX
_
ARG
_
LENGTH> b) {
* std::cout << "SPAAAACE!" << std::endl;
* std::cout << "SPAAAACE!" << std::endl;
* }
* }
*
*
* void bar(String<MAXARGLENGTH> b) {
* void bar(String<MAX
_
ARG
_
LENGTH> b) {
* std::cout << "I HAZ A CUBESAT THAT SNAPS PIX!" << std::endl;
* std::cout << "I HAZ A CUBESAT THAT SNAPS PIX!" << std::endl;
* }
* }
*
*
* void baz(String<MAXARGLENGTH> b) {
* void baz(String<MAX
_
ARG
_
LENGTH> b) {
* std::cout << "QWERTYUIOP" << std::endl;
* std::cout << "QWERTYUIOP" << std::endl;
* }
* }
*
*
* FunctionManagementService::FunctionManagementService() {
* FunctionManagementService::FunctionManagementService() {
* include(String<FUNCNAMELENGTH>("foo"), &foo);
* include(String<FUNC
_
NAME
_
LENGTH>("foo"), &foo);
* include(String<FUNCNAMELENGTH>("bar"), &bar);
* include(String<FUNC
_
NAME
_
LENGTH>("bar"), &bar);
* include(String<FUNCNAMELENGTH>("baz"), &baz);
* include(String<FUNC
_
NAME
_
LENGTH>("baz"), &baz);
* }
* }
*/
*/
...
@@ -97,11 +97,11 @@ public:
...
@@ -97,11 +97,11 @@ public:
* TC [8,1] message. After inclusion it returns an unneeded int signalling insertion success
* TC [8,1] message. After inclusion it returns an unneeded int signalling insertion success
* (0) or failure (2). These returns are there for testing purposes only.
* (0) or failure (2). These returns are there for testing purposes only.
*
*
* @param funcName the function's name. Max. length is
MAX
FUNCNAMELENGTH bytes.
* @param funcName the function's name. Max. length is FUNC
_
NAME
_
LENGTH bytes.
* @param ptr pointer to a function of void return type and a MAXARGLENGTH-lengthed byte
* @param ptr pointer to a function of void return type and a MAX
_
ARG
_
LENGTH-lengthed byte
* string as argument (which contains the actual arguments of the function)
* string as argument (which contains the actual arguments of the function)
*/
*/
int
include
(
String
<
FUNCNAMELENGTH
>
funcName
,
void
(
*
ptr
)(
String
<
MAXARGLENGTH
>
));
int
include
(
String
<
FUNC
_
NAME
_
LENGTH
>
funcName
,
void
(
*
ptr
)(
String
<
MAX
_
ARG
_
LENGTH
>
));
};
};
#endif //ECSS_SERVICES_FUNCTIONMANAGEMENTSERVICE_HPP
#endif //ECSS_SERVICES_FUNCTIONMANAGEMENTSERVICE_HPP
This diff is collapsed.
Click to expand it.
src/Services/FunctionManagementService.cpp
+
10
−
10
View file @
c9535888
...
@@ -9,13 +9,13 @@ int FunctionManagementService::call(Message& msg) {
...
@@ -9,13 +9,13 @@ int FunctionManagementService::call(Message& msg) {
ErrorHandler
::
assertInternal
(
msg
.
messageType
==
1
&&
msg
.
serviceType
==
8
,
ErrorHandler
::
assertInternal
(
msg
.
messageType
==
1
&&
msg
.
serviceType
==
8
,
ErrorHandler
::
InternalErrorType
::
UnacceptablePacket
);
ErrorHandler
::
InternalErrorType
::
UnacceptablePacket
);
uint8_t
funcName
[
FUNCNAMELENGTH
];
// the function's name
uint8_t
funcName
[
FUNC
_
NAME
_
LENGTH
];
// the function's name
uint8_t
funcArgs
[
MAXARGLENGTH
];
// arguments for the function
uint8_t
funcArgs
[
MAX
_
ARG
_
LENGTH
];
// arguments for the function
msg
.
readString
(
funcName
,
FUNCNAMELENGTH
);
msg
.
readString
(
funcName
,
FUNC
_
NAME
_
LENGTH
);
msg
.
readString
(
funcArgs
,
MAXARGLENGTH
);
msg
.
readString
(
funcArgs
,
MAX
_
ARG
_
LENGTH
);
if
(
msg
.
dataSize
>
FUNCNAMELENGTH
+
MAXARGLENGTH
)
{
if
(
msg
.
dataSize
>
FUNC
_
NAME
_
LENGTH
+
MAX
_
ARG
_
LENGTH
)
{
/**
/**
* @todo Send failed start of execution (too long message)
* @todo Send failed start of execution (too long message)
*/
*/
...
@@ -23,9 +23,9 @@ int FunctionManagementService::call(Message& msg) {
...
@@ -23,9 +23,9 @@ int FunctionManagementService::call(Message& msg) {
}
}
// locate the appropriate function pointer
// locate the appropriate function pointer
String
<
FUNCNAMELENGTH
>
name
(
funcName
);
String
<
FUNC
_
NAME
_
LENGTH
>
name
(
funcName
);
FunctionMap
::
iterator
iter
=
funcPtrIndex
.
find
(
name
);
FunctionMap
::
iterator
iter
=
funcPtrIndex
.
find
(
name
);
void
(
*
selected
)(
String
<
MAXARGLENGTH
>
);
void
(
*
selected
)(
String
<
MAX
_
ARG
_
LENGTH
>
);
if
(
iter
!=
funcPtrIndex
.
end
())
{
if
(
iter
!=
funcPtrIndex
.
end
())
{
selected
=
*
iter
->
second
;
selected
=
*
iter
->
second
;
...
@@ -41,8 +41,8 @@ int FunctionManagementService::call(Message& msg) {
...
@@ -41,8 +41,8 @@ int FunctionManagementService::call(Message& msg) {
return
0
;
return
0
;
}
}
int
FunctionManagementService
::
include
(
String
<
FUNCNAMELENGTH
>
funcName
,
void
(
*
ptr
)
int
FunctionManagementService
::
include
(
String
<
FUNC
_
NAME
_
LENGTH
>
funcName
,
void
(
*
ptr
)
(
String
<
MAXARGLENGTH
>
))
{
(
String
<
MAX
_
ARG
_
LENGTH
>
))
{
if
(
funcPtrIndex
.
full
())
{
if
(
funcPtrIndex
.
full
())
{
/**
/**
...
@@ -51,7 +51,7 @@ int FunctionManagementService::include(String<FUNCNAMELENGTH> funcName, void(*pt
...
@@ -51,7 +51,7 @@ int FunctionManagementService::include(String<FUNCNAMELENGTH> funcName, void(*pt
return
2
;
// arbitrary, for testing purposes
return
2
;
// arbitrary, for testing purposes
}
}
funcName
.
append
(
FUNCNAMELENGTH
-
funcName
.
length
(),
'\0'
);
funcName
.
append
(
FUNC
_
NAME
_
LENGTH
-
funcName
.
length
(),
'\0'
);
funcPtrIndex
.
insert
(
std
::
make_pair
(
funcName
,
ptr
));
funcPtrIndex
.
insert
(
std
::
make_pair
(
funcName
,
ptr
));
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