Merge pull request 'Service 11 regression' (#670) from eive/fsfw:mueller/service-11-issues into development

Reviewed-on: fsfw/fsfw#670
This commit is contained in:
Ulrich Mohr 2022-09-01 11:59:18 +02:00
commit 7dec45ccf2
5 changed files with 27 additions and 14 deletions

View File

@ -38,8 +38,9 @@ class Service11TelecommandScheduling final : public PusServiceBase {
static constexpr uint8_t CLASS_ID = CLASS_ID::PUS_SERVICE_11;
static constexpr ReturnValue_t INVALID_TYPE_TIME_WINDOW = returnvalue::makeCode(CLASS_ID, 1);
static constexpr ReturnValue_t TIMESHIFTING_NOT_POSSIBLE = returnvalue::makeCode(CLASS_ID, 2);
static constexpr ReturnValue_t INVALID_RELATIVE_TIME = returnvalue::makeCode(CLASS_ID, 3);
static constexpr ReturnValue_t INVALID_TIME_WINDOW = returnvalue::makeCode(CLASS_ID, 2);
static constexpr ReturnValue_t TIMESHIFTING_NOT_POSSIBLE = returnvalue::makeCode(CLASS_ID, 3);
static constexpr ReturnValue_t INVALID_RELATIVE_TIME = returnvalue::makeCode(CLASS_ID, 4);
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PUS_SERVICE_11;

View File

@ -571,12 +571,17 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::getMapFilterFr
if (result != returnvalue::OK) {
return result;
}
if(fromTimestamp > toTimestamp) {
return INVALID_TIME_WINDOW;
}
itBegin = telecommandMap.begin();
itEnd = telecommandMap.begin();
while (itBegin->first < fromTimestamp && itBegin != telecommandMap.end()) {
itBegin++;
}
//start looking for end beginning at begin
itEnd = itBegin;
while (itEnd->first <= toTimestamp && itEnd != telecommandMap.end()) {
itEnd++;
}
@ -586,17 +591,6 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::getMapFilterFr
default:
return returnvalue::FAILED;
}
// additional security check, this should never be true
if (itBegin > itEnd) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "11::getMapFilterFromData: itBegin > itEnd\n" << std::endl;
#else
sif::printError("11::getMapFilterFromData: itBegin > itEnd\n");
#endif
return returnvalue::FAILED;
}
// the map range should now be set according to the sent filter.
return returnvalue::OK;
}

View File

@ -18,6 +18,7 @@ add_subdirectory(power)
add_subdirectory(util)
add_subdirectory(container)
add_subdirectory(osal)
add_subdirectory(pus)
add_subdirectory(serialize)
add_subdirectory(datapoollocal)
add_subdirectory(storagemanager)

View File

@ -0,0 +1,3 @@
target_sources(${FSFW_TEST_TGT} PRIVATE
testService11.cpp
)

View File

@ -0,0 +1,14 @@
#include <fsfw/pus/Service11TelecommandScheduling.h>
#include <catch2/catch_test_macros.hpp>
#include "objects/systemObjectList.h"
#include "tmtc/apid.h"
#include "tmtc/pusIds.h"
TEST_CASE("PUS Service 11", "[pus-srvc11]") {
Service11TelecommandScheduling<13> pusService11(objects::PUS_SERVICE_11_TC_SCHEDULER,
apid::DEFAULT_APID, pus::PUS_SERVICE_11, nullptr);
// TODO test something...
}