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
b7d26d1a
Unverified
Commit
b7d26d1a
authored
6 years ago
by
Dimitrios Stoupis
Browse files
Options
Downloads
Patches
Plain Diff
Almost done with the timeshift function
parent
ced8f19a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Services/TimeBasedSchedulingService.cpp
+18
-12
18 additions, 12 deletions
src/Services/TimeBasedSchedulingService.cpp
with
18 additions
and
12 deletions
src/Services/TimeBasedSchedulingService.cpp
+
18
−
12
View file @
b7d26d1a
...
...
@@ -44,7 +44,7 @@ void TimeBasedSchedulingService::insertActivities(Message &request) {
// Temporary definitions until the Time helper is ready
uint32_t
releaseTime
=
0
;
// Temporary release time
uint32_t
currentTime
=
50
;
// Temporary current time
//
Message receivedPacket; // Temporary message field
Message
received
TC
Packet
;
// Temporary message field
if
((
currentNumberOfActivities
>=
MAX_NUMBER_OF_ACTIVITIES
)
||
(
releaseTime
<
(
currentTime
+
...
...
@@ -52,7 +52,7 @@ void TimeBasedSchedulingService::insertActivities(Message &request) {
// todo: Send a failed start of execution
}
else
{
ScheduledActivity
newActivity
;
//
newActivity.request = receivedTCPacket;
newActivity
.
request
=
receivedTCPacket
;
newActivity
.
requestReleaseTime
=
releaseTime
;
scheduledActivities
.
push_back
(
newActivity
);
// Insert the new activity into the schedule
...
...
@@ -71,15 +71,20 @@ void TimeBasedSchedulingService::timeShiftAllActivities(Message &request) {
assert
(
request
.
serviceType
==
11
);
assert
(
request
.
messageType
==
15
);
uint16_t
iterationCount
=
request
.
readUint16
();
// Get the iteration count, (N)
for
(
std
::
size_t
i
=
0
;
i
<
iterationCount
;
i
++
)
{
uint32_t
relativeOffset
=
request
.
readUint32
();
// todo: define the enumeration types for the source ID and application process ID
uint16_t
receivedSequenceCount
=
request
.
readUint16
();
// Get the sequence count
/*
* Perform a search in the vector containing the activity definitions to find a match for
* the received parameters
*/
// Temporary variables
uint32_t
current_time
=
0
;
const
auto
[
earliestRelease
,
latestRelease
]
=
etl
::
minmax_element
(
scheduledActivities
.
front
()
.
requestReleaseTime
,
scheduledActivities
.
back
().
requestReleaseTime
);
uint32_t
relativeOffset
=
request
.
readUint32
();
// Get the relative offset
if
((
earliestRelease
+
relativeOffset
)
<
(
current_time
+
TIME_MARGIN_FOR_ACTIVATION
))
{
// todo: generate a failed start of execution error
}
else
{
for
(
auto
&
activity
:
scheduledActivities
)
{
activity
.
requestReleaseTime
+=
relativeOffset
;
// Time shift each activity
}
}
}
...
...
@@ -122,12 +127,13 @@ void TimeBasedSchedulingService::detailReportAllActivities(Message &request) {
// todo: add an extra check for the vector size to make sure it matches with
// currentNumberOfActivities?
for
(
auto
const
&
activity
:
scheduledActivities
)
{
for
(
auto
const
&
activity
:
scheduledActivities
)
{
// Create the report message object of telemetry message subtype 10 for each activity
Message
report
=
createTM
(
10
);
// todo: append sub-schedule and group ID if they are defined
// todo: append the release time of the current activity "activity.requestReleaseTime;"
// todo: append the request contained in the activity "activity.request;"
// todo: important todo, implement append TC packet in the Message header
storeMessage
(
report
);
// Save the report
request
.
resetRead
();
// todo: define if this statement is required
}
...
...
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