apply afmt

This commit is contained in:
Robin Müller 2022-05-20 08:34:14 +02:00
parent 576414438c
commit d0fc360697
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
3 changed files with 44 additions and 53 deletions

View File

@ -14,6 +14,7 @@ enum framework_objects : object_id_t {
PUS_SERVICE_5_EVENT_REPORTING = 0x53000005, PUS_SERVICE_5_EVENT_REPORTING = 0x53000005,
PUS_SERVICE_8_FUNCTION_MGMT = 0x53000008, PUS_SERVICE_8_FUNCTION_MGMT = 0x53000008,
PUS_SERVICE_9_TIME_MGMT = 0x53000009, PUS_SERVICE_9_TIME_MGMT = 0x53000009,
PUS_SERVICE_11_TC_SCHEDULER = 0x53000011,
PUS_SERVICE_17_TEST = 0x53000017, PUS_SERVICE_17_TEST = 0x53000017,
PUS_SERVICE_20_PARAMETERS = 0x53000020, PUS_SERVICE_20_PARAMETERS = 0x53000020,
PUS_SERVICE_200_MODE_MGMT = 0x53000200, PUS_SERVICE_200_MODE_MGMT = 0x53000200,

View File

@ -45,8 +45,7 @@ class Service11TelecommandScheduling final : public PusServiceBase {
HasReturnvaluesIF::makeReturnCode(CLASS_ID, 3); HasReturnvaluesIF::makeReturnCode(CLASS_ID, 3);
// The types of PUS-11 subservices // The types of PUS-11 subservices
enum Subservice : uint8_t { enum [[maybe_unused]] Subservice : uint8_t{ENABLE_SCHEDULING = 1,
ENABLE_SCHEDULING = 1,
DISABLE_SCHEDULING = 2, DISABLE_SCHEDULING = 2,
RESET_SCHEDULING = 3, RESET_SCHEDULING = 3,
INSERT_ACTIVITY = 4, INSERT_ACTIVITY = 4,
@ -56,8 +55,7 @@ class Service11TelecommandScheduling final : public PusServiceBase {
FILTER_TIMESHIFT_ACTIVITY = 8, FILTER_TIMESHIFT_ACTIVITY = 8,
DETAIL_REPORT = 9, DETAIL_REPORT = 9,
TIMEBASE_SCHEDULE_DETAIL_REPORT = 10, TIMEBASE_SCHEDULE_DETAIL_REPORT = 10,
TIMESHIFT_ALL_SCHEDULE_ACTIVITIES = 15 TIMESHIFT_ALL_SCHEDULE_ACTIVITIES = 15};
};
// The types of time windows for TC[11,6] and TC[11,8], as defined in ECSS-E-ST-70-41C, // The types of time windows for TC[11,6] and TC[11,8], as defined in ECSS-E-ST-70-41C,
// requirement 8.11.3c (p. 507) // requirement 8.11.3c (p. 507)
@ -73,7 +71,7 @@ class Service11TelecommandScheduling final : public PusServiceBase {
uint16_t releaseTimeMarginSeconds = DEFAULT_RELEASE_TIME_MARGIN, uint16_t releaseTimeMarginSeconds = DEFAULT_RELEASE_TIME_MARGIN,
bool debugMode = false); bool debugMode = false);
~Service11TelecommandScheduling(); ~Service11TelecommandScheduling() override;
/** PusServiceBase overrides */ /** PusServiceBase overrides */
ReturnValue_t handleRequest(uint8_t subservice) override; ReturnValue_t handleRequest(uint8_t subservice) override;
@ -82,8 +80,8 @@ class Service11TelecommandScheduling final : public PusServiceBase {
private: private:
struct TelecommandStruct { struct TelecommandStruct {
uint64_t requestId; uint64_t requestId{};
uint32_t seconds; uint32_t seconds{};
store_address_t storeAddr; // uint16 store_address_t storeAddr; // uint16
}; };
@ -92,9 +90,6 @@ class Service11TelecommandScheduling final : public PusServiceBase {
// minimum release time offset to insert into schedule // minimum release time offset to insert into schedule
const uint16_t RELEASE_TIME_MARGIN_SECONDS = 5; const uint16_t RELEASE_TIME_MARGIN_SECONDS = 5;
// the maximum amount of stored TCs is defined here
static constexpr uint16_t MAX_STORED_TELECOMMANDS = 500;
bool debugMode = false; bool debugMode = false;
StorageManagerIF* tcStore = nullptr; StorageManagerIF* tcStore = nullptr;
AcceptsTelecommandsIF* tcRecipient = nullptr; AcceptsTelecommandsIF* tcRecipient = nullptr;
@ -139,17 +134,6 @@ class Service11TelecommandScheduling final : public PusServiceBase {
*/ */
ReturnValue_t doFilterTimeshiftActivity(const uint8_t* data, size_t size); ReturnValue_t doFilterTimeshiftActivity(const uint8_t* data, size_t size);
/**
* @brief Deserializes a generic type from a payload buffer by using the FSFW
* SerializeAdapter Interface.
* @param output Output to be deserialized
* @param buf Payload buffer (application data)
* @param bufsize Remaining size of payload buffer (application data size)
* @return RETURN_OK if successful
*/
template <typename T>
ReturnValue_t deserializeViaFsfwInterface(T& output, const uint8_t* buf, size_t bufsize);
/** /**
* @brief Extracts the Request ID from the Application Data of a TC by utilizing a ctor of the * @brief Extracts the Request ID from the Application Data of a TC by utilizing a ctor of the
* class TcPacketPus. * class TcPacketPus.
@ -177,7 +161,7 @@ class Service11TelecommandScheduling final : public PusServiceBase {
* @param ssc Source Sequence Count * @param ssc Source Sequence Count
* @return Request ID * @return Request ID
*/ */
uint64_t buildRequestId(uint32_t sourceId, uint16_t apid, uint16_t ssc) const; [[nodiscard]] uint64_t buildRequestId(uint32_t sourceId, uint16_t apid, uint16_t ssc) const;
/** /**
* @brief Gets the filter range for filter TCs from a data packet * @brief Gets the filter range for filter TCs from a data packet
@ -194,7 +178,7 @@ class Service11TelecommandScheduling final : public PusServiceBase {
/** /**
* @brief Prints content of multimap. Use for simple debugging only. * @brief Prints content of multimap. Use for simple debugging only.
*/ */
void debugPrintMultimapContent(void) const; void debugPrintMultimapContent() const;
}; };
#include "Service11TelecommandScheduling.tpp" #include "Service11TelecommandScheduling.tpp"

View File

@ -1,11 +1,12 @@
#pragma once #pragma once
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/serialize/SerializeAdapter.h>
#include <fsfw/tmtcservices/AcceptsTelecommandsIF.h>
#include <cstddef> #include <cstddef>
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serialize/SerializeAdapter.h"
#include "fsfw/serviceinterface.h"
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
static constexpr auto DEF_END = SerializeIF::Endianness::BIG; static constexpr auto DEF_END = SerializeIF::Endianness::BIG;
template <size_t MAX_NUM_TCS> template <size_t MAX_NUM_TCS>
@ -18,7 +19,7 @@ inline Service11TelecommandScheduling<MAX_NUM_TCS>::Service11TelecommandScheduli
tcRecipient(tcRecipient) {} tcRecipient(tcRecipient) {}
template <size_t MAX_NUM_TCS> template <size_t MAX_NUM_TCS>
inline Service11TelecommandScheduling<MAX_NUM_TCS>::~Service11TelecommandScheduling() {} inline Service11TelecommandScheduling<MAX_NUM_TCS>::~Service11TelecommandScheduling() = default;
template <size_t MAX_NUM_TCS> template <size_t MAX_NUM_TCS>
inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::handleRequest( inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::handleRequest(
@ -404,7 +405,6 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doFilterTimesh
// and then insert it again as new entry // and then insert it again as new entry
telecommandMap.insert(std::make_pair(tempKey, tempTc)); telecommandMap.insert(std::make_pair(tempKey, tempTc));
shiftedItemsCount++; shiftedItemsCount++;
continue;
} }
if (debugMode) { if (debugMode) {
@ -463,9 +463,9 @@ template <size_t MAX_NUM_TCS>
inline uint64_t Service11TelecommandScheduling<MAX_NUM_TCS>::buildRequestId(uint32_t sourceId, inline uint64_t Service11TelecommandScheduling<MAX_NUM_TCS>::buildRequestId(uint32_t sourceId,
uint16_t apid, uint16_t apid,
uint16_t ssc) const { uint16_t ssc) const {
uint64_t sourceId64 = static_cast<uint64_t>(sourceId); auto sourceId64 = static_cast<uint64_t>(sourceId);
uint64_t apid64 = static_cast<uint64_t>(apid); auto apid64 = static_cast<uint64_t>(apid);
uint64_t ssc64 = static_cast<uint64_t>(ssc); auto ssc64 = static_cast<uint64_t>(ssc);
return (sourceId64 << 32) | (apid64 << 16) | ssc64; return (sourceId64 << 32) | (apid64 << 16) | ssc64;
} }
@ -483,7 +483,7 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::getMapFilterFr
if (typeRaw > 3) { if (typeRaw > 3) {
return INVALID_TYPE_TIME_WINDOW; return INVALID_TYPE_TIME_WINDOW;
} }
TypeOfTimeWindow type = static_cast<TypeOfTimeWindow>(typeRaw); auto type = static_cast<TypeOfTimeWindow>(typeRaw);
// we now have the type of delete activity - so now we set the range to delete, // we now have the type of delete activity - so now we set the range to delete,
// according to the type of time window. // according to the type of time window.
@ -558,7 +558,10 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::getMapFilterFr
// additional security check, this should never be true // additional security check, this should never be true
if (itBegin->first > itEnd->first) { if (itBegin->first > itEnd->first) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
#else
sif::printError("11::GetMapFilterFromData: itBegin > itEnd\n"); sif::printError("11::GetMapFilterFromData: itBegin > itEnd\n");
#endif
return RETURN_FAILED; return RETURN_FAILED;
} }
@ -580,19 +583,22 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::handleInvalidD
} }
template <size_t MAX_NUM_TCS> template <size_t MAX_NUM_TCS>
inline void Service11TelecommandScheduling<MAX_NUM_TCS>::debugPrintMultimapContent(void) const { inline void Service11TelecommandScheduling<MAX_NUM_TCS>::debugPrintMultimapContent() const {
for (const auto &dit : telecommandMap) {
#if FSFW_DISABLE_PRINTOUT == 0 #if FSFW_DISABLE_PRINTOUT == 0
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "Service11TelecommandScheduling::debugPrintMultimapContent: Multimap Content" sif::debug << "Service11TelecommandScheduling::debugPrintMultimapContent: Multimap Content"
<< std::endl; << std::endl;
sif::debug << "[" << dit->first << "]: Request ID: " << dit->second.requestId << " | " sif::debug << "[" << dit.first << "]: Request ID: " << dit.second.requestId << " | "
<< "Store Address: " << dit->second.storeAddr << std::endl; << "Store Address: " << dit.second.storeAddr.raw << std::endl;
#else #else
sif::printDebug("Service11TelecommandScheduling::debugPrintMultimapContent: Multimap Content\n"); sif::printDebug(
"Service11TelecommandScheduling::debugPrintMultimapContent: Multimap Content\n");
for (auto dit = telecommandMap.begin(); dit != telecommandMap.end(); ++dit) { for (auto dit = telecommandMap.begin(); dit != telecommandMap.end(); ++dit) {
sif::printDebug("[%d]: Request ID: %d | Store Address: %d\n", dit->first, sif::printDebug("[%d]: Request ID: %d | Store Address: %d\n", dit->first,
dit->second.requestId, dit->second.storeAddr); dit->second.requestId, dit->second.storeAddr);
} }
#endif #endif
#endif #endif
}
} }