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
cbb82edc
Commit
cbb82edc
authored
6 years ago
by
athatheocsd
Browse files
Options
Downloads
Patches
Plain Diff
Removed stateOfEventAction into a boolean
parent
2d6343dd
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/EventActionService.hpp
+2
-3
2 additions, 3 deletions
inc/Services/EventActionService.hpp
src/Services/EventActionService.cpp
+16
-13
16 additions, 13 deletions
src/Services/EventActionService.cpp
with
18 additions
and
16 deletions
inc/Services/EventActionService.hpp
+
2
−
3
View file @
cbb82edc
...
@@ -26,12 +26,12 @@
...
@@ -26,12 +26,12 @@
class
EventActionService
:
public
Service
{
class
EventActionService
:
public
Service
{
public:
public:
uint8_t
eventActionFunctionStatus
;
// Indicates if actions are enabled
uint8_t
eventActionFunctionStatus
;
// Indicates if actions are enabled
std
::
bitset
<
256
>
stateOfEventAction
;
struct
EventActionDefinition
{
struct
EventActionDefinition
{
uint8_t
empty
=
1
;
// 1 means empty, 0 means full
bool
empty
=
true
;
// 1 means empty, 0 means full
uint16_t
applicationId
=
0
;
uint16_t
applicationId
=
0
;
uint16_t
eventDefinitionID
=
65535
;
uint16_t
eventDefinitionID
=
65535
;
String
<
64
>
request
=
""
;
String
<
64
>
request
=
""
;
bool
enabled
=
false
;
};
};
// If the size is changed maybe then indexOfAvailableSlots as well as the initiating loop in the
// If the size is changed maybe then indexOfAvailableSlots as well as the initiating loop in the
// constructor should be changed from uint16_t
// constructor should be changed from uint16_t
...
@@ -40,7 +40,6 @@ public:
...
@@ -40,7 +40,6 @@ public:
EventActionService
()
{
EventActionService
()
{
serviceType
=
19
;
serviceType
=
19
;
eventActionFunctionStatus
=
enabledFunction
;
eventActionFunctionStatus
=
enabledFunction
;
stateOfEventAction
.
set
();
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
src/Services/EventActionService.cpp
+
16
−
13
View file @
cbb82edc
...
@@ -14,7 +14,7 @@ void EventActionService::addEventActionDefinitions(Message message) {
...
@@ -14,7 +14,7 @@ void EventActionService::addEventActionDefinitions(Message message) {
19
)
{
19
)
{
uint16_t
index
=
0
;
uint16_t
index
=
0
;
uint8_t
flag
=
0
;
// used as boolean 0 is false, 1 is true
uint8_t
flag
=
0
;
// used as boolean 0 is false, 1 is true
while
(
eventActionDefinitionArray
[
index
].
empty
==
0
)
{
while
(
eventActionDefinitionArray
[
index
].
empty
==
false
)
{
if
(
index
==
255
)
{
// 255 should be changed depending on size of the array
if
(
index
==
255
)
{
// 255 should be changed depending on size of the array
flag
=
1
;
flag
=
1
;
break
;
break
;
...
@@ -23,14 +23,14 @@ void EventActionService::addEventActionDefinitions(Message message) {
...
@@ -23,14 +23,14 @@ void EventActionService::addEventActionDefinitions(Message message) {
}
}
if
(
flag
==
0
)
{
if
(
flag
==
0
)
{
char
data
[
128
];
char
data
[
128
];
eventActionDefinitionArray
[
index
].
empty
=
0
;
eventActionDefinitionArray
[
index
].
empty
=
false
;
eventActionDefinitionArray
[
index
].
enabled
=
true
;
eventActionDefinitionArray
[
index
].
applicationId
=
message
.
readEnum16
();
eventActionDefinitionArray
[
index
].
applicationId
=
message
.
readEnum16
();
eventActionDefinitionArray
[
index
].
eventDefinitionID
=
message
.
readEnum16
();
eventActionDefinitionArray
[
index
].
eventDefinitionID
=
message
.
readEnum16
();
// Tests pass with message.dataSize - 3, message.dataSize - 4, but not
// Tests pass with message.dataSize - 3, message.dataSize - 4, but not
// message.dataSize - 5
// message.dataSize - 5
message
.
readString
(
data
,
message
.
dataSize
);
message
.
readString
(
data
,
message
.
dataSize
);
eventActionDefinitionArray
[
index
].
request
=
String
<
64
>
(
data
);
eventActionDefinitionArray
[
index
].
request
=
String
<
64
>
(
data
);
stateOfEventAction
[
index
]
=
1
;
}
}
}
}
}
}
...
@@ -47,11 +47,11 @@ void EventActionService::deleteEventActionDefinitions(Message message) {
...
@@ -47,11 +47,11 @@ void EventActionService::deleteEventActionDefinitions(Message message) {
while
(
index
<
255
)
{
while
(
index
<
255
)
{
if
(
eventActionDefinitionArray
[
index
].
applicationId
==
applicationID
&&
if
(
eventActionDefinitionArray
[
index
].
applicationId
==
applicationID
&&
eventActionDefinitionArray
[
index
].
eventDefinitionID
==
eventDefinitionID
)
{
eventActionDefinitionArray
[
index
].
eventDefinitionID
==
eventDefinitionID
)
{
eventActionDefinitionArray
[
index
].
empty
=
1
;
eventActionDefinitionArray
[
index
].
empty
=
true
;
eventActionDefinitionArray
[
index
].
eventDefinitionID
=
65535
;
eventActionDefinitionArray
[
index
].
eventDefinitionID
=
65535
;
eventActionDefinitionArray
[
index
].
request
=
""
;
eventActionDefinitionArray
[
index
].
request
=
""
;
eventActionDefinitionArray
[
index
].
applicationId
=
0
;
eventActionDefinitionArray
[
index
].
applicationId
=
0
;
stateOfE
ventAction
[
index
]
=
0
;
e
ventAction
DefinitionArray
[
index
].
enabled
=
false
;
}
}
index
++
;
index
++
;
}
}
...
@@ -66,8 +66,9 @@ void EventActionService::deleteAllEventActionDefinitions(Message message) {
...
@@ -66,8 +66,9 @@ void EventActionService::deleteAllEventActionDefinitions(Message message) {
if
(
message
.
messageType
==
3
&&
message
.
packetType
==
Message
::
TC
&&
message
.
serviceType
if
(
message
.
messageType
==
3
&&
message
.
packetType
==
Message
::
TC
&&
message
.
serviceType
==
19
)
{
==
19
)
{
for
(
uint16_t
index
=
0
;
index
<
256
;
index
++
)
{
for
(
uint16_t
index
=
0
;
index
<
256
;
index
++
)
{
if
(
eventActionDefinitionArray
[
index
].
empty
==
0
)
{
if
(
eventActionDefinitionArray
[
index
].
empty
==
false
)
{
eventActionDefinitionArray
[
index
].
empty
=
1
;
eventActionDefinitionArray
[
index
].
empty
=
true
;
eventActionDefinitionArray
[
index
].
enabled
=
false
;
eventActionDefinitionArray
[
index
].
eventDefinitionID
=
65535
;
eventActionDefinitionArray
[
index
].
eventDefinitionID
=
65535
;
eventActionDefinitionArray
[
index
].
request
=
""
;
eventActionDefinitionArray
[
index
].
request
=
""
;
eventActionDefinitionArray
[
index
].
applicationId
=
0
;
eventActionDefinitionArray
[
index
].
applicationId
=
0
;
...
@@ -88,7 +89,7 @@ void EventActionService::enableEventActionDefinitions(Message message) {
...
@@ -88,7 +89,7 @@ void EventActionService::enableEventActionDefinitions(Message message) {
while
(
index
<
255
)
{
while
(
index
<
255
)
{
if
(
eventActionDefinitionArray
[
index
].
applicationId
==
applicationID
&&
if
(
eventActionDefinitionArray
[
index
].
applicationId
==
applicationID
&&
eventActionDefinitionArray
[
index
].
eventDefinitionID
==
eventDefinitionID
)
{
eventActionDefinitionArray
[
index
].
eventDefinitionID
==
eventDefinitionID
)
{
stateOfE
ventAction
[
index
]
=
1
;
e
ventAction
DefinitionArray
[
index
].
enabled
=
true
;
}
}
index
++
;
index
++
;
}
}
...
@@ -109,7 +110,7 @@ void EventActionService::disableEventActionDefinitions(Message message) {
...
@@ -109,7 +110,7 @@ void EventActionService::disableEventActionDefinitions(Message message) {
while
(
index
<
256
)
{
while
(
index
<
256
)
{
if
(
eventActionDefinitionArray
[
index
].
applicationId
==
applicationID
&&
if
(
eventActionDefinitionArray
[
index
].
applicationId
==
applicationID
&&
eventActionDefinitionArray
[
index
].
eventDefinitionID
==
eventDefinitionID
)
{
eventActionDefinitionArray
[
index
].
eventDefinitionID
==
eventDefinitionID
)
{
stateOfE
ventAction
[
index
]
=
0
;
e
ventAction
DefinitionArray
[
index
].
enabled
=
false
;
}
}
index
++
;
index
++
;
}
}
...
@@ -131,16 +132,16 @@ void EventActionService::eventActionStatusReport() {
...
@@ -131,16 +132,16 @@ void EventActionService::eventActionStatusReport() {
Message
report
=
createTM
(
7
);
Message
report
=
createTM
(
7
);
uint8_t
count
=
0
;
uint8_t
count
=
0
;
for
(
uint16_t
i
=
0
;
i
<
256
;
i
++
)
{
for
(
uint16_t
i
=
0
;
i
<
256
;
i
++
)
{
if
(
eventActionDefinitionArray
[
i
].
empty
==
0
)
{
if
(
eventActionDefinitionArray
[
i
].
empty
==
false
)
{
count
++
;
count
++
;
}
}
}
}
report
.
appendUint8
(
count
);
report
.
appendUint8
(
count
);
for
(
uint16_t
i
=
0
;
i
<
256
;
i
++
)
{
for
(
uint16_t
i
=
0
;
i
<
256
;
i
++
)
{
if
(
eventActionDefinitionArray
[
i
].
empty
==
0
)
{
if
(
eventActionDefinitionArray
[
i
].
empty
==
false
)
{
report
.
appendEnum16
(
eventActionDefinitionArray
[
i
].
applicationId
);
report
.
appendEnum16
(
eventActionDefinitionArray
[
i
].
applicationId
);
report
.
appendEnum16
(
eventActionDefinitionArray
[
i
].
eventDefinitionID
);
report
.
appendEnum16
(
eventActionDefinitionArray
[
i
].
eventDefinitionID
);
report
.
append
Uint8
(
stateOfEventAction
[
i
]
);
report
.
append
Boolean
(
eventActionDefinitionArray
[
i
].
enabled
);
}
}
}
}
storeMessage
(
report
);
storeMessage
(
report
);
...
@@ -169,7 +170,9 @@ void EventActionService::executeAction(uint16_t eventID) {
...
@@ -169,7 +170,9 @@ void EventActionService::executeAction(uint16_t eventID) {
if
(
eventActionFunctionStatus
==
enabledFunction
)
{
if
(
eventActionFunctionStatus
==
enabledFunction
)
{
uint16_t
i
=
0
;
uint16_t
i
=
0
;
while
(
i
<
256
)
{
while
(
i
<
256
)
{
if
(
eventActionDefinitionArray
[
i
].
empty
==
0
)
{
if
(
eventActionDefinitionArray
[
i
].
empty
==
false
&&
eventActionDefinitionArray
[
i
].
enabled
==
true
)
{
if
(
eventActionDefinitionArray
[
i
].
eventDefinitionID
==
eventID
)
{
if
(
eventActionDefinitionArray
[
i
].
eventDefinitionID
==
eventID
)
{
MessageParser
messageParser
;
MessageParser
messageParser
;
Message
message
=
messageParser
.
parseRequestTC
(
Message
message
=
messageParser
.
parseRequestTC
(
...
...
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