From f476caa050f162af5b8393468d93f682ecc7874e Mon Sep 17 00:00:00 2001 From: Dimitrios Stoupis <dimitris.apple@gmail.com> Date: Tue, 12 Mar 2019 20:52:40 +0000 Subject: [PATCH] Added time shift functions along with some narrative --- .../TimeBasedCommandSchedulingService.cpp | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/Services/TimeBasedCommandSchedulingService.cpp b/src/Services/TimeBasedCommandSchedulingService.cpp index 1fa26ca1..ca74ef9b 100644 --- a/src/Services/TimeBasedCommandSchedulingService.cpp +++ b/src/Services/TimeBasedCommandSchedulingService.cpp @@ -65,5 +65,45 @@ void TimeBasedCommandSchedulingService::insertActivities(Message &request) { } +void TimeBasedCommandSchedulingService::timeShiftAllActivities(Message &request) { + + // Check if the correct packet is being processed + assert(request.serviceType == 11); + assert(request.messageType == 5); + + 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 + */ + } +} + +void TimeBasedCommandSchedulingService::timeShiftActivitiesByID(Message &request) { + + // Check if the correct packet is being processed + assert(request.serviceType == 11); + assert(request.messageType == 5); + + uint32_t relativeOffset = request.readUint32(); // Get the offset first + /* + * Search for the earliest activity in the schedule. If the release time of the earliest + * activity + relativeOffset is earlier than current_time + time_margin, reject the request + * and generate a failed start of execution. + */ + uint16_t iterationCount = request.readUint16(); // Get the iteration count, (N) + for (std::size_t i = 0; i < iterationCount; i++) { + // 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 + */ + } +} -- GitLab