diff --git a/docs/usage_with_microcontroller.md b/docs/usage_with_microcontroller.md index 6c318409050f0316fdf13ab07393aa47ae554a49..293072c75069b4ac6ddbac858131addf68b75894 100644 --- a/docs/usage_with_microcontroller.md +++ b/docs/usage_with_microcontroller.md @@ -191,8 +191,23 @@ void ParameterService::initializeParameterMap() { parameters = {{0, parameter1}, {1, parameter2}, {2, parameter3}}; } ``` +2. @ref TimeBasedSchedulingService::notifyNewActivityAddition -2. @ref ParameterStatisticsService::initializeStatisticsMap +The TimeBasedSchedulingService is responsible for storing the activities/TCs to be executed. However, if this list of +stored activities is emptied, the Platform Task responsible to execute these TCs should be paused. With this +function, a notifier can be implemented and called by `TimeBasedScheduling::insertActivities()` to notify the +Task to restart after a new activity is inserted. + +An example implementation for FreeRTOS can be as follows: +```cpp +void TimeBasedSchedulingService::notifyNewActivityAddition() { + if (scheduledActivities.size() >= 1) { + xTaskNotify(TaskList::timeBasedSchedulingTask->taskHandle, 0, eNoAction); + } +} +``` + +3. @ref ParameterStatisticsService::initializeStatisticsMap The function is called by the constructor of the class, making sure that the statistics will be initialized properly after creating an instance of the ST04 Service. This function should be implemented according to the specific diff --git a/inc/Services/TimeBasedSchedulingService.hpp b/inc/Services/TimeBasedSchedulingService.hpp index d8b9c467469c39666762062434995415d4a6044c..10561c1e69fbd4af0ed81062d6ddc10327df87e6 100644 --- a/inc/Services/TimeBasedSchedulingService.hpp +++ b/inc/Services/TimeBasedSchedulingService.hpp @@ -115,11 +115,12 @@ private: */ friend struct ::unit_test::Tester; -public: - /* -* ST[11] TimeBased Scheduling Service and Sub-Service Macros, for readability purpose -*/ + /** + * Notifies the timeBasedSchedulingTask after the insertion of activities to scheduleActivity list. + */ + void notifyNewActivityAddition(); +public: inline static const uint8_t ServiceType = 11; enum MessageType : uint8_t { diff --git a/src/Platform/x86/Services/TimeBasedSchedulingService.cpp b/src/Platform/x86/Services/TimeBasedSchedulingService.cpp new file mode 100644 index 0000000000000000000000000000000000000000..86afc2bd2d8e0467d8cf9048821c285cab7b5284 --- /dev/null +++ b/src/Platform/x86/Services/TimeBasedSchedulingService.cpp @@ -0,0 +1,8 @@ +#include "ECSS_Configuration.hpp" +#ifdef SERVICE_TIMESCHEDULING + +#include "Services/TimeBasedSchedulingService.hpp" + +void TimeBasedSchedulingService::notifyNewActivityAddition() {} + +#endif \ No newline at end of file diff --git a/src/Services/TimeBasedSchedulingService.cpp b/src/Services/TimeBasedSchedulingService.cpp index 50e0c3919ca8b5976a4269bc83c0ec746900d857..0173dcc6267f97c60da0e9fc2c94785e6c692e4a 100644 --- a/src/Services/TimeBasedSchedulingService.cpp +++ b/src/Services/TimeBasedSchedulingService.cpp @@ -71,6 +71,7 @@ void TimeBasedSchedulingService::insertActivities(Message& request) { } } sortActivitiesReleaseTime(scheduledActivities); + notifyNewActivityAddition(); } void TimeBasedSchedulingService::timeShiftAllActivities(Message& request) { diff --git a/test/TestPlatform.cpp b/test/TestPlatform.cpp index 1c7233e4334c06c47468dbd427df03a80bdb2dcb..6a56dd7d7dc1db19268269f29a5457bffeebad33 100644 --- a/test/TestPlatform.cpp +++ b/test/TestPlatform.cpp @@ -109,6 +109,8 @@ void ParameterService::initializeParameterMap() { {static_cast<uint16_t>(11), PlatformParameters::parameter12}}; } +void TimeBasedSchedulingService::notifyNewActivityAddition() {} + void ParameterStatisticsService::initializeStatisticsMap() { statisticsMap = {}; }