Update from upstream #94
@ -27,6 +27,7 @@ enum : uint8_t {
|
||||
PUS_SERVICE_6 = 86,
|
||||
PUS_SERVICE_8 = 88,
|
||||
PUS_SERVICE_9 = 89,
|
||||
PUS_SERVICE_11 = 91,
|
||||
PUS_SERVICE_17 = 97,
|
||||
PUS_SERVICE_23 = 103,
|
||||
MGM_LIS3MDL = 106,
|
||||
|
@ -14,6 +14,7 @@ enum framework_objects : object_id_t {
|
||||
PUS_SERVICE_5_EVENT_REPORTING = 0x53000005,
|
||||
PUS_SERVICE_8_FUNCTION_MGMT = 0x53000008,
|
||||
PUS_SERVICE_9_TIME_MGMT = 0x53000009,
|
||||
PUS_SERVICE_11_TC_SCHEDULER = 0x53000011,
|
||||
PUS_SERVICE_17_TEST = 0x53000017,
|
||||
PUS_SERVICE_20_PARAMETERS = 0x53000020,
|
||||
PUS_SERVICE_200_MODE_MGMT = 0x53000200,
|
||||
|
@ -44,6 +44,12 @@ class Service11TelecommandScheduling final : public PusServiceBase {
|
||||
static constexpr ReturnValue_t INVALID_RELATIVE_TIME =
|
||||
HasReturnvaluesIF::makeReturnCode(CLASS_ID, 3);
|
||||
|
||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PUS_SERVICE_11;
|
||||
|
||||
//! [EXPORT] : [COMMENT] Deletion of a TC from the map failed.
|
||||
//! P1: First 32 bit of request ID, P2. Last 32 bit of Request ID
|
||||
static constexpr Event TC_DELETION_FAILED = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
|
||||
|
||||
// The types of PUS-11 subservices
|
||||
enum Subservice : uint8_t {
|
||||
ENABLE_SCHEDULING = 1,
|
||||
@ -73,7 +79,10 @@ class Service11TelecommandScheduling final : public PusServiceBase {
|
||||
uint16_t releaseTimeMarginSeconds = DEFAULT_RELEASE_TIME_MARGIN,
|
||||
bool debugMode = false);
|
||||
|
||||
~Service11TelecommandScheduling();
|
||||
~Service11TelecommandScheduling() override;
|
||||
|
||||
void enableExpiredTcDeletion();
|
||||
void disableExpiredTcDeletion();
|
||||
|
||||
/** PusServiceBase overrides */
|
||||
ReturnValue_t handleRequest(uint8_t subservice) override;
|
||||
@ -82,8 +91,8 @@ class Service11TelecommandScheduling final : public PusServiceBase {
|
||||
|
||||
private:
|
||||
struct TelecommandStruct {
|
||||
uint64_t requestId;
|
||||
uint32_t seconds;
|
||||
uint64_t requestId{};
|
||||
uint32_t seconds{};
|
||||
store_address_t storeAddr; // uint16
|
||||
};
|
||||
|
||||
@ -92,9 +101,11 @@ class Service11TelecommandScheduling final : public PusServiceBase {
|
||||
// minimum release time offset to insert into schedule
|
||||
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;
|
||||
|
||||
/**
|
||||
* By default, the scheduling will be disabled. This is a standard requirement
|
||||
*/
|
||||
bool schedulingEnabled = false;
|
||||
bool deleteExpiredTcWhenDisabled = true;
|
||||
bool debugMode = false;
|
||||
StorageManagerIF* tcStore = nullptr;
|
||||
AcceptsTelecommandsIF* tcRecipient = nullptr;
|
||||
@ -109,6 +120,7 @@ class Service11TelecommandScheduling final : public PusServiceBase {
|
||||
|
||||
TelecommandMap telecommandMap;
|
||||
|
||||
ReturnValue_t handleResetCommand();
|
||||
/**
|
||||
* @brief Logic to be performed on an incoming TC[11,4].
|
||||
* @return RETURN_OK if successful
|
||||
@ -139,17 +151,6 @@ class Service11TelecommandScheduling final : public PusServiceBase {
|
||||
*/
|
||||
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
|
||||
* class TcPacketPus.
|
||||
@ -177,7 +178,7 @@ class Service11TelecommandScheduling final : public PusServiceBase {
|
||||
* @param ssc Source Sequence Count
|
||||
* @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
|
||||
@ -194,7 +195,7 @@ class Service11TelecommandScheduling final : public PusServiceBase {
|
||||
/**
|
||||
* @brief Prints content of multimap. Use for simple debugging only.
|
||||
*/
|
||||
void debugPrintMultimapContent(void) const;
|
||||
void debugPrintMultimapContent() const;
|
||||
};
|
||||
|
||||
#include "Service11TelecommandScheduling.tpp"
|
||||
|
@ -1,11 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/serialize/SerializeAdapter.h>
|
||||
#include <fsfw/tmtcservices/AcceptsTelecommandsIF.h>
|
||||
|
||||
#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;
|
||||
|
||||
template <size_t MAX_NUM_TCS>
|
||||
@ -18,7 +19,7 @@ inline Service11TelecommandScheduling<MAX_NUM_TCS>::Service11TelecommandScheduli
|
||||
tcRecipient(tcRecipient) {}
|
||||
|
||||
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>
|
||||
inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::handleRequest(
|
||||
@ -37,6 +38,17 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::handleRequest(
|
||||
return handleInvalidData("handleRequest");
|
||||
}
|
||||
switch (subservice) {
|
||||
case Subservice::ENABLE_SCHEDULING: {
|
||||
schedulingEnabled = true;
|
||||
break;
|
||||
}
|
||||
case Subservice::DISABLE_SCHEDULING: {
|
||||
schedulingEnabled = false;
|
||||
break;
|
||||
}
|
||||
case Subservice::RESET_SCHEDULING: {
|
||||
return handleResetCommand();
|
||||
}
|
||||
case Subservice::INSERT_ACTIVITY:
|
||||
return doInsertActivity(data, size);
|
||||
case Subservice::DELETE_ACTIVITY:
|
||||
@ -48,41 +60,43 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::handleRequest(
|
||||
case Subservice::FILTER_TIMESHIFT_ACTIVITY:
|
||||
return doFilterTimeshiftActivity(data, size);
|
||||
default:
|
||||
break;
|
||||
return AcceptsTelecommandsIF::INVALID_SUBSERVICE;
|
||||
}
|
||||
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
template <size_t MAX_NUM_TCS>
|
||||
inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::performService() {
|
||||
// DEBUG
|
||||
// DebugPrintMultimapContent();
|
||||
|
||||
if (not schedulingEnabled) {
|
||||
return RETURN_OK;
|
||||
}
|
||||
// get current time as UNIX timestamp
|
||||
timeval tNow = {};
|
||||
Clock::getClock_timeval(&tNow);
|
||||
|
||||
// TODO: Optionally limit the max number of released TCs per cycle?
|
||||
// NOTE: The iterator is increased in the loop here. Increasing the iterator as for-loop arg
|
||||
// does not work in this case as we are deleting the current element here.
|
||||
for (auto it = telecommandMap.begin(); it != telecommandMap.end();) {
|
||||
if (it->first <= tNow.tv_sec) {
|
||||
// release tc
|
||||
TmTcMessage releaseMsg(it->second.storeAddr);
|
||||
auto sendRet = this->requestQueue->sendMessage(recipientMsgQueueId, &releaseMsg, false);
|
||||
if (schedulingEnabled) {
|
||||
// release tc
|
||||
TmTcMessage releaseMsg(it->second.storeAddr);
|
||||
auto sendRet = this->requestQueue->sendMessage(recipientMsgQueueId, &releaseMsg, false);
|
||||
|
||||
if (sendRet != HasReturnvaluesIF::RETURN_OK) {
|
||||
return sendRet;
|
||||
}
|
||||
|
||||
telecommandMap.erase(it++);
|
||||
|
||||
if (debugMode) {
|
||||
if (sendRet != HasReturnvaluesIF::RETURN_OK) {
|
||||
return sendRet;
|
||||
}
|
||||
if (debugMode) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "Released TC & erased it from TC map" << std::endl;
|
||||
sif::info << "Released TC & erased it from TC map" << std::endl;
|
||||
#else
|
||||
sif::printInfo("Released TC & erased it from TC map\n");
|
||||
sif::printInfo("Released TC & erased it from TC map\n");
|
||||
#endif
|
||||
}
|
||||
telecommandMap.erase(it++);
|
||||
} else if (deleteExpiredTcWhenDisabled) {
|
||||
telecommandMap.erase(it++);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@ -112,12 +126,30 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::initialize() {
|
||||
return res;
|
||||
}
|
||||
|
||||
template <size_t MAX_NUM_TCS>
|
||||
inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::handleResetCommand() {
|
||||
for (auto it = telecommandMap.begin(); it != telecommandMap.end(); it++) {
|
||||
ReturnValue_t result = tcStore->deleteData(it->second.storeAddr);
|
||||
if (result != RETURN_OK) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
// This should not happen
|
||||
sif::warning << "Service11TelecommandScheduling::handleRequestDeleting: Deletion failed"
|
||||
<< std::endl;
|
||||
#else
|
||||
sif::printWarning("Service11TelecommandScheduling::handleRequestDeleting: Deletion failed\n");
|
||||
#endif
|
||||
triggerEvent(TC_DELETION_FAILED, (it->second.requestId >> 32) & 0xffffffff,
|
||||
it->second.requestId & 0xffffffff);
|
||||
}
|
||||
}
|
||||
telecommandMap.clear();
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
template <size_t MAX_NUM_TCS>
|
||||
inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doInsertActivity(
|
||||
const uint8_t *data, size_t size) {
|
||||
uint32_t timestamp = 0;
|
||||
const uint8_t *initData = data;
|
||||
size_t initSz = size;
|
||||
ReturnValue_t result = SerializeAdapter::deSerialize(×tamp, &data, &size, DEF_END);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
@ -142,7 +174,7 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doInsertActivi
|
||||
|
||||
// store currentPacket and receive the store address
|
||||
store_address_t addr{};
|
||||
if (tcStore->addData(&addr, initData, initSz) != RETURN_OK ||
|
||||
if (tcStore->addData(&addr, data, size) != RETURN_OK ||
|
||||
addr.raw == storeId::INVALID_STORE_ADDRESS) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "Service11TelecommandScheduling::doInsertActivity: Adding data to TC Store failed"
|
||||
@ -404,7 +436,6 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doFilterTimesh
|
||||
// and then insert it again as new entry
|
||||
telecommandMap.insert(std::make_pair(tempKey, tempTc));
|
||||
shiftedItemsCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (debugMode) {
|
||||
@ -463,9 +494,9 @@ template <size_t MAX_NUM_TCS>
|
||||
inline uint64_t Service11TelecommandScheduling<MAX_NUM_TCS>::buildRequestId(uint32_t sourceId,
|
||||
uint16_t apid,
|
||||
uint16_t ssc) const {
|
||||
uint64_t sourceId64 = static_cast<uint64_t>(sourceId);
|
||||
uint64_t apid64 = static_cast<uint64_t>(apid);
|
||||
uint64_t ssc64 = static_cast<uint64_t>(ssc);
|
||||
auto sourceId64 = static_cast<uint64_t>(sourceId);
|
||||
auto apid64 = static_cast<uint64_t>(apid);
|
||||
auto ssc64 = static_cast<uint64_t>(ssc);
|
||||
|
||||
return (sourceId64 << 32) | (apid64 << 16) | ssc64;
|
||||
}
|
||||
@ -483,7 +514,7 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::getMapFilterFr
|
||||
if (typeRaw > 3) {
|
||||
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,
|
||||
// according to the type of time window.
|
||||
@ -558,7 +589,10 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::getMapFilterFr
|
||||
|
||||
// additional security check, this should never be true
|
||||
if (itBegin->first > itEnd->first) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
#else
|
||||
sif::printError("11::GetMapFilterFromData: itBegin > itEnd\n");
|
||||
#endif
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
|
||||
@ -580,19 +614,32 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::handleInvalidD
|
||||
}
|
||||
|
||||
template <size_t MAX_NUM_TCS>
|
||||
inline void Service11TelecommandScheduling<MAX_NUM_TCS>::debugPrintMultimapContent(void) const {
|
||||
inline void Service11TelecommandScheduling<MAX_NUM_TCS>::debugPrintMultimapContent() const {
|
||||
for ([[maybe_unused]] const auto &dit : telecommandMap) {
|
||||
#if FSFW_DISABLE_PRINTOUT == 0
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::debug << "Service11TelecommandScheduling::debugPrintMultimapContent: Multimap Content"
|
||||
<< std::endl;
|
||||
sif::debug << "[" << dit->first << "]: Request ID: " << dit->second.requestId << " | "
|
||||
<< "Store Address: " << dit->second.storeAddr << std::endl;
|
||||
sif::debug << "Service11TelecommandScheduling::debugPrintMultimapContent: Multimap Content"
|
||||
<< std::endl;
|
||||
sif::debug << "[" << dit.first << "]: Request ID: " << dit.second.requestId << " | "
|
||||
<< "Store Address: " << dit.second.storeAddr.raw << std::endl;
|
||||
#else
|
||||
sif::printDebug("Service11TelecommandScheduling::debugPrintMultimapContent: Multimap Content\n");
|
||||
for (auto dit = telecommandMap.begin(); dit != telecommandMap.end(); ++dit) {
|
||||
sif::printDebug("[%d]: Request ID: %d | Store Address: %d\n", dit->first,
|
||||
dit->second.requestId, dit->second.storeAddr);
|
||||
sif::printDebug(
|
||||
"Service11TelecommandScheduling::debugPrintMultimapContent: Multimap Content\n");
|
||||
for (auto dit = telecommandMap.begin(); dit != telecommandMap.end(); ++dit) {
|
||||
sif::printDebug("[%d]: Request ID: %d | Store Address: %d\n", dit->first,
|
||||
dit->second.requestId, dit->second.storeAddr);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
template <size_t MAX_NUM_TCS>
|
||||
inline void Service11TelecommandScheduling<MAX_NUM_TCS>::enableExpiredTcDeletion() {
|
||||
deleteExpiredTcWhenDisabled = true;
|
||||
}
|
||||
|
||||
template <size_t MAX_NUM_TCS>
|
||||
inline void Service11TelecommandScheduling<MAX_NUM_TCS>::disableExpiredTcDeletion() {
|
||||
deleteExpiredTcWhenDisabled = false;
|
||||
}
|
||||
|
@ -86,8 +86,8 @@ ReturnValue_t Service5EventReporting::handleRequest(uint8_t subservice) {
|
||||
// In addition to the default PUSServiceBase initialization, this service needs
|
||||
// to be registered to the event manager to listen for events.
|
||||
ReturnValue_t Service5EventReporting::initialize() {
|
||||
EventManagerIF* manager = ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
|
||||
if (manager == NULL) {
|
||||
auto* manager = ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
|
||||
if (manager == nullptr) {
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
// register Service 5 as listener for events
|
||||
|
@ -15,7 +15,7 @@ PUSDistributor::PUSDistributor(uint16_t setApid, object_id_t setObjectId,
|
||||
tcStatus(RETURN_FAILED),
|
||||
packetSource(setPacketSource) {}
|
||||
|
||||
PUSDistributor::~PUSDistributor() {}
|
||||
PUSDistributor::~PUSDistributor() = default;
|
||||
|
||||
PUSDistributor::TcMqMapIter PUSDistributor::selectDestination() {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1 && PUS_DISTRIBUTOR_DEBUGGING == 1
|
||||
@ -23,7 +23,7 @@ PUSDistributor::TcMqMapIter PUSDistributor::selectDestination() {
|
||||
sif::debug << "PUSDistributor::handlePacket received: " << storeId.poolIndex << ", "
|
||||
<< storeId.packetIndex << std::endl;
|
||||
#endif
|
||||
TcMqMapIter queueMapIt = this->queueMap.end();
|
||||
auto queueMapIt = this->queueMap.end();
|
||||
if (this->currentPacket == nullptr) {
|
||||
return queueMapIt;
|
||||
}
|
||||
@ -48,10 +48,8 @@ PUSDistributor::TcMqMapIter PUSDistributor::selectDestination() {
|
||||
sif::warning << "PUSDistributor::handlePacket: Packet format invalid, " << keyword
|
||||
<< " error" << std::endl;
|
||||
#else
|
||||
sif::printWarning(
|
||||
"PUSDistributor::handlePacket: Packet format invalid, "
|
||||
"%s error\n",
|
||||
keyword);
|
||||
sif::printWarning("PUSDistributor::handlePacket: Packet format invalid, %s error\n",
|
||||
keyword);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
@ -133,8 +131,7 @@ ReturnValue_t PUSDistributor::initialize() {
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
CCSDSDistributorIF* ccsdsDistributor =
|
||||
ObjectManager::instance()->get<CCSDSDistributorIF>(packetSource);
|
||||
auto* ccsdsDistributor = ObjectManager::instance()->get<CCSDSDistributorIF>(packetSource);
|
||||
if (ccsdsDistributor == nullptr) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "PUSDistributor::initialize: Packet source invalid" << std::endl;
|
||||
|
@ -6,20 +6,20 @@
|
||||
#include "fsfw/objectmanager/frameworkObjects.h"
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
|
||||
StorageManagerIF* TcPacketStoredBase::store = nullptr;
|
||||
StorageManagerIF* TcPacketStoredBase::STORE = nullptr;
|
||||
|
||||
TcPacketStoredBase::TcPacketStoredBase() {
|
||||
this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
|
||||
this->checkAndSetStore();
|
||||
TcPacketStoredBase::checkAndSetStore();
|
||||
}
|
||||
|
||||
TcPacketStoredBase::~TcPacketStoredBase() {}
|
||||
TcPacketStoredBase::~TcPacketStoredBase() = default;
|
||||
|
||||
ReturnValue_t TcPacketStoredBase::getData(const uint8_t** dataPtr, size_t* dataSize) {
|
||||
auto result = this->store->getData(storeAddress, dataPtr, dataSize);
|
||||
auto result = TcPacketStoredBase::STORE->getData(storeAddress, dataPtr, dataSize);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "TcPacketStoredBase: Could not get data!" << std::endl;
|
||||
sif::warning << "TcPacketStoredBase: Could not get data" << std::endl;
|
||||
#else
|
||||
sif::printWarning("TcPacketStoredBase: Could not get data!\n");
|
||||
#endif
|
||||
@ -28,11 +28,13 @@ ReturnValue_t TcPacketStoredBase::getData(const uint8_t** dataPtr, size_t* dataS
|
||||
}
|
||||
|
||||
bool TcPacketStoredBase::checkAndSetStore() {
|
||||
if (this->store == nullptr) {
|
||||
this->store = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
|
||||
if (this->store == nullptr) {
|
||||
if (TcPacketStoredBase::STORE == nullptr) {
|
||||
TcPacketStoredBase::STORE = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
|
||||
if (TcPacketStoredBase::STORE == nullptr) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "TcPacketStoredBase::TcPacketStoredBase: TC Store not found!" << std::endl;
|
||||
sif::error << "TcPacketStoredBase::TcPacketStoredBase: TC Store not found" << std::endl;
|
||||
#else
|
||||
sif::printError("TcPacketStoredBase::TcPacketStoredBase: TC Store not found\n");
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@ -47,7 +49,7 @@ void TcPacketStoredBase::setStoreAddress(store_address_t setAddress,
|
||||
size_t tempSize;
|
||||
ReturnValue_t status = StorageManagerIF::RETURN_FAILED;
|
||||
if (this->checkAndSetStore()) {
|
||||
status = this->store->getData(this->storeAddress, &tempData, &tempSize);
|
||||
status = TcPacketStoredBase::STORE->getData(this->storeAddress, &tempData, &tempSize);
|
||||
}
|
||||
|
||||
if (status == StorageManagerIF::RETURN_OK) {
|
||||
|
@ -65,7 +65,7 @@ class TcPacketStoredBase : public TcPacketStoredIF {
|
||||
* call tries to set it and throws an error message in case of failures.
|
||||
* The default store is objects::TC_STORE.
|
||||
*/
|
||||
static StorageManagerIF* store;
|
||||
static StorageManagerIF* STORE;
|
||||
/**
|
||||
* The address where the packet data of the object instance is stored.
|
||||
*/
|
||||
@ -77,7 +77,7 @@ class TcPacketStoredBase : public TcPacketStoredIF {
|
||||
* @return @li @c true if the store is linked or could be created.
|
||||
* @li @c false otherwise.
|
||||
*/
|
||||
bool checkAndSetStore();
|
||||
static bool checkAndSetStore();
|
||||
};
|
||||
|
||||
#endif /* TMTCPACKET_PUS_TcPacketStoredBase_H_ */
|
||||
#endif /* TMTCPACKET_PUS_TCPACKETSTORED_H_ */
|
||||
|
@ -9,7 +9,8 @@
|
||||
|
||||
class TcPacketStoredIF {
|
||||
public:
|
||||
virtual ~TcPacketStoredIF(){};
|
||||
virtual ~TcPacketStoredIF() = default;
|
||||
;
|
||||
|
||||
/**
|
||||
* With this call, the stored packet can be set to another packet in a store. This is useful
|
||||
|
@ -14,8 +14,8 @@ TcPacketStoredPus::TcPacketStoredPus(uint16_t apid, uint8_t service, uint8_t sub
|
||||
}
|
||||
uint8_t* pData = nullptr;
|
||||
ReturnValue_t returnValue =
|
||||
this->store->getFreeElement(&this->storeAddress, (TC_PACKET_MIN_SIZE + size), &pData);
|
||||
if (returnValue != this->store->RETURN_OK) {
|
||||
this->STORE->getFreeElement(&this->storeAddress, (TC_PACKET_MIN_SIZE + size), &pData);
|
||||
if (returnValue != this->STORE->RETURN_OK) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "TcPacketStoredBase: Could not get free element from store!" << std::endl;
|
||||
#endif
|
||||
@ -44,19 +44,19 @@ TcPacketStoredPus::TcPacketStoredPus(const uint8_t* data, size_t size) : TcPacke
|
||||
return;
|
||||
}
|
||||
if (this->checkAndSetStore()) {
|
||||
ReturnValue_t status = store->addData(&storeAddress, data, size);
|
||||
ReturnValue_t status = STORE->addData(&storeAddress, data, size);
|
||||
if (status != HasReturnvaluesIF::RETURN_OK) {
|
||||
this->setData(nullptr, size);
|
||||
}
|
||||
const uint8_t* storePtr = nullptr;
|
||||
// Repoint base data pointer to the data in the store.
|
||||
store->getData(storeAddress, &storePtr, &size);
|
||||
STORE->getData(storeAddress, &storePtr, &size);
|
||||
this->setData(const_cast<uint8_t*>(storePtr), size);
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t TcPacketStoredPus::deletePacket() {
|
||||
ReturnValue_t result = this->store->deleteData(this->storeAddress);
|
||||
ReturnValue_t result = this->STORE->deleteData(this->storeAddress);
|
||||
this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
|
||||
// To circumvent size checks
|
||||
this->setData(nullptr, -1);
|
||||
@ -68,7 +68,7 @@ TcPacketPusBase* TcPacketStoredPus::getPacketBase() { return this; }
|
||||
bool TcPacketStoredPus::isSizeCorrect() {
|
||||
const uint8_t* temp_data = nullptr;
|
||||
size_t temp_size;
|
||||
ReturnValue_t status = this->store->getData(this->storeAddress, &temp_data, &temp_size);
|
||||
ReturnValue_t status = this->STORE->getData(this->storeAddress, &temp_data, &temp_size);
|
||||
if (status == StorageManagerIF::RETURN_OK) {
|
||||
if (this->getFullSize() == temp_size) {
|
||||
return true;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef FRAMEWORK_TMTCSERVICES_ACCEPTSTELECOMMANDSIF_H_
|
||||
#define FRAMEWORK_TMTCSERVICES_ACCEPTSTELECOMMANDSIF_H_
|
||||
|
||||
#include "../ipc/MessageQueueSenderIF.h"
|
||||
#include "fsfw/ipc/MessageQueueSenderIF.h"
|
||||
|
||||
/**
|
||||
* @brief This interface is implemented by classes that are sinks for
|
||||
@ -20,7 +20,7 @@ class AcceptsTelecommandsIF {
|
||||
/**
|
||||
* @brief The virtual destructor as it is mandatory for C++ interfaces.
|
||||
*/
|
||||
virtual ~AcceptsTelecommandsIF() {}
|
||||
virtual ~AcceptsTelecommandsIF() = default;
|
||||
/**
|
||||
* @brief Getter for the service id.
|
||||
* @details Any receiving service (at least any PUS service) shall have a
|
||||
|
Loading…
Reference in New Issue
Block a user