continue update
This commit is contained in:
parent
3c1072d7c9
commit
8ef93705eb
@ -9,7 +9,7 @@ class LocalPoolObjectBase;
|
||||
|
||||
class HasLocalDpIFManagerAttorney {
|
||||
static LocalPoolObjectBase* getPoolObjectHandle(PeriodicHkGenerationIF* clientIF,
|
||||
dp::lp_id_t localPoolId);
|
||||
dp::id_t localPoolId);
|
||||
|
||||
static object_id_t getObjectId(PeriodicHkGenerationIF* clientIF);
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "fsfw/objectmanager/ObjectManager.h"
|
||||
|
||||
using namespace dp;
|
||||
PoolObjectBase::PoolObjectBase(SharedPool& sharedPool, dp::lp_id_t poolId, DataSetIF* dataSet,
|
||||
PoolObjectBase::PoolObjectBase(SharedPool& sharedPool, dp::id_t poolId, DataSetIF* dataSet,
|
||||
pool_rwm_t setReadWriteMode)
|
||||
: localPoolId(poolId), readWriteMode(setReadWriteMode), sharedPool(&sharedPool) {
|
||||
if (poolId == PoolVariableIF::NO_PARAMETER) {
|
||||
@ -19,7 +19,7 @@ PoolObjectBase::PoolObjectBase(SharedPool& sharedPool, dp::lp_id_t poolId, DataS
|
||||
}
|
||||
}
|
||||
|
||||
PoolObjectBase::PoolObjectBase(object_id_t poolOwner, lp_id_t poolId, DataSetIF* dataSet,
|
||||
PoolObjectBase::PoolObjectBase(object_id_t poolOwner, id_t poolId, DataSetIF* dataSet,
|
||||
pool_rwm_t setReadWriteMode)
|
||||
: localPoolId(poolId), readWriteMode(setReadWriteMode) {
|
||||
if (poolId == PoolVariableIF::NO_PARAMETER) {
|
||||
@ -56,16 +56,16 @@ PoolObjectBase::PoolObjectBase(object_id_t poolOwner, lp_id_t poolId, DataSetIF*
|
||||
|
||||
pool_rwm_t PoolObjectBase ::getReadWriteMode() const { return readWriteMode; }
|
||||
|
||||
lp_id_t PoolObjectBase ::getDataPoolId() const { return localPoolId; }
|
||||
id_t PoolObjectBase ::getDataPoolId() const { return localPoolId; }
|
||||
|
||||
void PoolObjectBase::setDataPoolId(lp_id_t poolId) { this->localPoolId = poolId; }
|
||||
void PoolObjectBase::setDataPoolId(id_t poolId) { this->localPoolId = poolId; }
|
||||
|
||||
void PoolObjectBase::setReadWriteMode(pool_rwm_t newReadWriteMode) {
|
||||
this->readWriteMode = newReadWriteMode;
|
||||
}
|
||||
|
||||
void PoolObjectBase::reportReadCommitError(const char* variableType, ReturnValue_t error, bool read,
|
||||
object_id_t objectId, lp_id_t lpId) {
|
||||
object_id_t objectId, id_t lpId) {
|
||||
#if FSFW_DISABLE_PRINTOUT == 0
|
||||
const char* variablePrintout = variableType;
|
||||
if (variablePrintout == nullptr) {
|
||||
|
@ -15,17 +15,17 @@ namespace datapool {
|
||||
*/
|
||||
class PoolObjectBase : public PoolVariableIF {
|
||||
public:
|
||||
PoolObjectBase(dp::SharedPool& sharedPool, dp::lp_id_t poolId, DataSetIF* dataSet,
|
||||
PoolObjectBase(dp::SharedPool& sharedPool, dp::id_t poolId, DataSetIF* dataSet,
|
||||
pool_rwm_t setReadWriteMode);
|
||||
|
||||
PoolObjectBase(object_id_t poolOwner, dp::lp_id_t poolId, DataSetIF* dataSet = nullptr,
|
||||
PoolObjectBase(object_id_t poolOwner, dp::id_t poolId, DataSetIF* dataSet = nullptr,
|
||||
pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE);
|
||||
|
||||
void setReadWriteMode(pool_rwm_t newReadWriteMode) override;
|
||||
[[nodiscard]] pool_rwm_t getReadWriteMode() const override;
|
||||
|
||||
[[nodiscard]] lp_id_t getDataPoolId() const override;
|
||||
void setDataPoolId(dp::lp_id_t poolId);
|
||||
[[nodiscard]] dp::id_t getDataPoolId() const override;
|
||||
void setDataPoolId(dp::id_t poolId);
|
||||
|
||||
protected:
|
||||
/**
|
||||
@ -44,7 +44,7 @@ class PoolObjectBase : public PoolVariableIF {
|
||||
dp::SharedPool* sharedPool = nullptr;
|
||||
|
||||
void reportReadCommitError(const char* variableType, ReturnValue_t error, bool read,
|
||||
object_id_t objectId, dp::lp_id_t lpId);
|
||||
object_id_t objectId, dp::id_t lpId);
|
||||
};
|
||||
|
||||
} // namespace datapool
|
@ -48,7 +48,7 @@ class PoolVector : public PoolObjectBase {
|
||||
* @param dataSet The data set in which the variable shall register itself.
|
||||
* If nullptr, the variable is not registered.
|
||||
*/
|
||||
PoolVector(SharedPool& sharedPool, lp_id_t poolId, DataSetIF* dataSet = nullptr,
|
||||
PoolVector(SharedPool& sharedPool, id_t poolId, DataSetIF* dataSet = nullptr,
|
||||
pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE)
|
||||
: PoolObjectBase(sharedPool, poolId, dataSet, setReadWriteMode) {}
|
||||
|
||||
@ -59,15 +59,15 @@ class PoolVector : public PoolObjectBase {
|
||||
* It does not fetch the current value from the data pool. This is performed
|
||||
* by the read() operation (which is not thread-safe).
|
||||
* Datasets can be used to access local pool entires in a thread-safe way.
|
||||
* @param poolOwner Owner of the shared pool.
|
||||
* @param poolId ID of the local pool entry.
|
||||
* @param hkOwner Pointer of the owner. This will generally be the calling
|
||||
* class itself which passes "this".
|
||||
* @param setReadWriteMode Specify the read-write mode of the pool variable.
|
||||
* @param dataSet The data set in which the variable shall register itself.
|
||||
* If nullptr, the variable is not registered.
|
||||
*/
|
||||
PoolVector(object_id_t poolOwner, lp_id_t poolId, DataSetIF* dataSet = nullptr,
|
||||
pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE);
|
||||
PoolVector(object_id_t poolOwner, id_t poolId, DataSetIF* dataSet = nullptr,
|
||||
pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE)
|
||||
: PoolObjectBase(poolOwner, poolId, dataSet, setReadWriteMode) {}
|
||||
/**
|
||||
* Variation which takes the unique global identifier of a local pool
|
||||
* vector.
|
||||
|
@ -43,7 +43,7 @@ class PoolVariable : public PoolObjectBase {
|
||||
* If nullptr, the variable is not registered.
|
||||
* @param setReadWriteMode Specify the read-write mode of the pool variable.
|
||||
*/
|
||||
PoolVariable(SharedPool& sharedPool, lp_id_t poolId, DataSetIF* dataSet = nullptr,
|
||||
PoolVariable(SharedPool& sharedPool, dp::id_t poolId, DataSetIF* dataSet = nullptr,
|
||||
pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE);
|
||||
|
||||
/**
|
||||
@ -63,7 +63,7 @@ class PoolVariable : public PoolObjectBase {
|
||||
* @param setReadWriteMode Specify the read-write mode of the pool variable.
|
||||
*
|
||||
*/
|
||||
PoolVariable(object_id_t poolOwner, lp_id_t poolId, DataSetIF* dataSet = nullptr,
|
||||
PoolVariable(object_id_t poolOwner, dp::id_t poolId, DataSetIF* dataSet = nullptr,
|
||||
pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE);
|
||||
/**
|
||||
* Variation which takes the global unique identifier of a pool variable.
|
||||
@ -164,12 +164,12 @@ class PoolVariable : public PoolObjectBase {
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
PoolVariable<T>::PoolVariable(SharedPool& sharedPool, lp_id_t poolId, DataSetIF* dataSet,
|
||||
PoolVariable<T>::PoolVariable(SharedPool& sharedPool, dp::id_t poolId, DataSetIF* dataSet,
|
||||
pool_rwm_t setReadWriteMode)
|
||||
: PoolObjectBase(sharedPool, poolId, dataSet, setReadWriteMode) {}
|
||||
|
||||
template <typename T>
|
||||
PoolVariable<T>::PoolVariable(object_id_t poolOwner, lp_id_t poolId, DataSetIF* dataSet,
|
||||
PoolVariable<T>::PoolVariable(object_id_t poolOwner, dp::id_t poolId, DataSetIF* dataSet,
|
||||
pool_rwm_t setReadWriteMode)
|
||||
: PoolObjectBase(poolOwner, poolId, dataSet, setReadWriteMode) {}
|
||||
|
||||
|
@ -20,13 +20,13 @@ SharedPool::~SharedPool() { MutexFactory::instance()->deleteMutex(mutex); }
|
||||
|
||||
object_id_t SharedPool::getOwnerId() const { return ownerId; }
|
||||
|
||||
void SharedPool::addPoolEntry(lp_id_t poolId, PoolEntryIF* entry) {
|
||||
void SharedPool::addPoolEntry(id_t poolId, PoolEntryIF* entry) {
|
||||
localPoolMap.emplace(poolId, entry);
|
||||
}
|
||||
|
||||
MutexIF* SharedPool::getPoolMutex() { return mutex; }
|
||||
|
||||
ReturnValue_t SharedPool::printPoolEntry(lp_id_t localPoolId) {
|
||||
ReturnValue_t SharedPool::printPoolEntry(id_t localPoolId) {
|
||||
auto poolIter = localPoolMap.find(localPoolId);
|
||||
if (poolIter == localPoolMap.end()) {
|
||||
return POOL_ENTRY_NOT_FOUND;
|
||||
|
@ -25,9 +25,9 @@ class SharedPool {
|
||||
* @return
|
||||
*/
|
||||
template <class T>
|
||||
ReturnValue_t fetchPoolEntry(lp_id_t localPoolId, PoolEntry<T>** poolEntry);
|
||||
ReturnValue_t printPoolEntry(lp_id_t localPoolId);
|
||||
void addPoolEntry(lp_id_t poolId, PoolEntryIF* entry);
|
||||
ReturnValue_t fetchPoolEntry(id_t localPoolId, PoolEntry<T>** poolEntry);
|
||||
ReturnValue_t printPoolEntry(id_t localPoolId);
|
||||
void addPoolEntry(id_t poolId, PoolEntryIF* entry);
|
||||
MutexIF* getPoolMutex();
|
||||
|
||||
private:
|
||||
@ -41,7 +41,7 @@ class SharedPool {
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline ReturnValue_t datapool::SharedPool::fetchPoolEntry(lp_id_t localPoolId,
|
||||
inline ReturnValue_t datapool::SharedPool::fetchPoolEntry(id_t localPoolId,
|
||||
PoolEntry<T>** poolEntry) {
|
||||
if (poolEntry == nullptr) {
|
||||
return returnvalue::FAILED;
|
||||
|
@ -76,7 +76,7 @@ ReturnValue_t SharedSetBase::serializeLocalPoolIds(uint8_t **buffer, size_t *siz
|
||||
SerializeAdapter::serialize(&fillCount, buffer, size, maxSize, streamEndianness);
|
||||
}
|
||||
for (uint16_t count = 0; count < fillCount; count++) {
|
||||
lp_id_t currentPoolId = base.registeredVariables[count]->getDataPoolId();
|
||||
id_t currentPoolId = base.registeredVariables[count]->getDataPoolId();
|
||||
auto result =
|
||||
SerializeAdapter::serialize(¤tPoolId, buffer, size, maxSize, streamEndianness);
|
||||
if (result != returnvalue::OK) {
|
||||
@ -96,9 +96,9 @@ ReturnValue_t SharedSetBase::serializeLocalPoolIds(uint8_t **buffer, size_t *siz
|
||||
|
||||
size_t SharedSetBase::getLocalPoolIdsSerializedSize(bool serializeFillCount) const {
|
||||
if (serializeFillCount) {
|
||||
return base.getFillCount() * sizeof(lp_id_t) + sizeof(u8_t);
|
||||
return base.getFillCount() * sizeof(id_t) + sizeof(u8_t);
|
||||
} else {
|
||||
return base.getFillCount() * sizeof(lp_id_t);
|
||||
return base.getFillCount() * sizeof(id_t);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ namespace datapool {
|
||||
/**
|
||||
* @brief Type definition for local pool entries.
|
||||
*/
|
||||
using lp_id_t = uint32_t;
|
||||
using id_t = uint32_t;
|
||||
|
||||
static constexpr uint32_t INVALID_LPID = -1;
|
||||
|
||||
@ -23,7 +23,7 @@ static constexpr ReturnValue_t POOL_ENTRY_TYPE_CONFLICT = MAKE_RETURN_CODE(0x01)
|
||||
|
||||
/** This is the core data structure of the local data pools. Users should insert all desired
|
||||
pool variables, using the std::map interface. */
|
||||
using DataPool = std::map<lp_id_t, PoolEntryIF*>;
|
||||
using DataPool = std::map<id_t, PoolEntryIF*>;
|
||||
|
||||
/**
|
||||
* Used as a unique identifier for data sets. Consists of 4 byte object ID and 4 byte set ID.
|
||||
@ -70,12 +70,11 @@ union g_id_t {
|
||||
|
||||
g_id_t() : raw(INVALID_GPID) {}
|
||||
|
||||
g_id_t(object_id_t objectId, lp_id_t localPoolId)
|
||||
: objectId(objectId), localPoolId(localPoolId) {}
|
||||
g_id_t(object_id_t objectId, id_t localPoolId) : objectId(objectId), localPoolId(localPoolId) {}
|
||||
|
||||
struct {
|
||||
object_id_t objectId;
|
||||
lp_id_t localPoolId;
|
||||
id_t localPoolId;
|
||||
};
|
||||
|
||||
uint64_t raw;
|
||||
|
@ -16,7 +16,7 @@ namespace datapool {
|
||||
class SharedPoolAttorney {
|
||||
private:
|
||||
template <typename T>
|
||||
static ReturnValue_t fetchPoolEntry(SharedPool& manager, lp_id_t localPoolId,
|
||||
static ReturnValue_t fetchPoolEntry(SharedPool& manager, dp::id_t localPoolId,
|
||||
PoolEntry<T>** poolEntry) {
|
||||
return manager.fetchPoolEntry(localPoolId, poolEntry);
|
||||
}
|
||||
|
@ -122,8 +122,8 @@ class DeviceHandlerIF {
|
||||
|
||||
static constexpr uint32_t DEFAULT_THERMAL_SET_ID = dp::sid_t::INVALID_SET_ID - 1;
|
||||
|
||||
static constexpr dp::lp_id_t DEFAULT_THERMAL_STATE_POOL_ID = dp::INVALID_LPID - 2;
|
||||
static constexpr dp::lp_id_t DEFAULT_THERMAL_HEATING_REQUEST_POOL_ID = dp::INVALID_LPID - 1;
|
||||
static constexpr dp::id_t DEFAULT_THERMAL_STATE_POOL_ID = dp::INVALID_LPID - 2;
|
||||
static constexpr dp::id_t DEFAULT_THERMAL_HEATING_REQUEST_POOL_ID = dp::INVALID_LPID - 1;
|
||||
|
||||
/**
|
||||
* Default Destructor
|
||||
@ -138,8 +138,8 @@ class DeviceHandlerIF {
|
||||
};
|
||||
|
||||
struct ThermalStateCfg {
|
||||
dp::lp_id_t thermalStatePoolId = DeviceHandlerIF::DEFAULT_THERMAL_STATE_POOL_ID;
|
||||
dp::lp_id_t thermalRequestPoolId = DeviceHandlerIF::DEFAULT_THERMAL_HEATING_REQUEST_POOL_ID;
|
||||
dp::id_t thermalStatePoolId = DeviceHandlerIF::DEFAULT_THERMAL_STATE_POOL_ID;
|
||||
dp::id_t thermalRequestPoolId = DeviceHandlerIF::DEFAULT_THERMAL_HEATING_REQUEST_POOL_ID;
|
||||
uint32_t thermalSetId = DeviceHandlerIF::DEFAULT_THERMAL_SET_ID;
|
||||
};
|
||||
|
||||
|
@ -17,8 +17,8 @@ class DeviceHandlerThermalSet : public dp::StaticSharedSet<2> {
|
||||
thermalStatePoolId(cfg.thermalStatePoolId),
|
||||
heaterRequestPoolId(cfg.thermalRequestPoolId) {}
|
||||
|
||||
const dp::lp_id_t thermalStatePoolId;
|
||||
const dp::lp_id_t heaterRequestPoolId;
|
||||
const dp::id_t thermalStatePoolId;
|
||||
const dp::id_t heaterRequestPoolId;
|
||||
|
||||
dp::var_t<DeviceHandlerIF::dh_thermal_state_t> thermalState =
|
||||
dp::var_t<DeviceHandlerIF::dh_thermal_state_t>(sid.objectId, thermalStatePoolId, this);
|
||||
|
@ -34,6 +34,8 @@ namespace hk {
|
||||
* }
|
||||
*/
|
||||
class GeneratesPeriodicHkIF {
|
||||
friend class PeriodicHelper;
|
||||
|
||||
public:
|
||||
[[nodiscard]] virtual object_id_t getObjectId() const = 0;
|
||||
|
||||
|
@ -130,7 +130,7 @@ ReturnValue_t PeriodicHelper::handleHousekeepingMessage(CommandMessage* message)
|
||||
return result;
|
||||
}
|
||||
|
||||
PeriodicHkGenerationIF* PeriodicHelper::getOwner() const { return owner; }
|
||||
GeneratesPeriodicHkIF* PeriodicHelper::getOwner() const { return owner; }
|
||||
|
||||
ReturnValue_t PeriodicHelper::generateHousekeepingPacket(const dp::sid_t sid,
|
||||
MessageQueueId_t destination) {
|
||||
@ -189,7 +189,7 @@ void PeriodicHelper::performPeriodicHkGeneration(SetSpecification& setSpec, time
|
||||
// timeval now{};
|
||||
Clock::getClockMonotonic(&now);
|
||||
|
||||
sid_t sid = setSpec.dataId.sid;
|
||||
dp::sid_t sid = setSpec.dataId.sid;
|
||||
|
||||
timeval diff = now - setSpec.lastGenerated;
|
||||
dur_millis_t diffMillis = diff.tv_sec * 1000 + diff.tv_usec / 1000;
|
||||
@ -222,7 +222,7 @@ ReturnValue_t PeriodicHelper::togglePeriodicGeneration(dp::sid_t sid, bool enabl
|
||||
}
|
||||
|
||||
std::optional<std::reference_wrapper<SetSpecification>> PeriodicHelper::getSetSpecification(
|
||||
sid_t structureId) {
|
||||
dp::sid_t structureId) {
|
||||
for (auto& receiver : setList) {
|
||||
if (receiver.dataId.sid == structureId) {
|
||||
return receiver;
|
||||
@ -231,7 +231,7 @@ std::optional<std::reference_wrapper<SetSpecification>> PeriodicHelper::getSetSp
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
ReturnValue_t PeriodicHelper::setCollectionInterval(sid_t sid,
|
||||
ReturnValue_t PeriodicHelper::setCollectionInterval(dp::sid_t sid,
|
||||
dur_millis_t newCollectionIntervalMs) {
|
||||
bool wasUpdated = false;
|
||||
for (auto& receiver : setList) {
|
||||
@ -247,7 +247,7 @@ ReturnValue_t PeriodicHelper::setCollectionInterval(sid_t sid,
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PeriodicHelper::generateSetStructurePacket(sid_t sid) {
|
||||
ReturnValue_t PeriodicHelper::generateSetStructurePacket(dp::structure_id_t sid) {
|
||||
// Get and check dataset first.
|
||||
auto optSetSpec = getSetSpecification(sid);
|
||||
if (!optSetSpec.has_value()) {
|
||||
@ -297,7 +297,7 @@ ReturnValue_t PeriodicHelper::generateSetStructurePacket(sid_t sid) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t PeriodicHelper::enablePeriodicPacket(const sid_t structureId,
|
||||
ReturnValue_t PeriodicHelper::enablePeriodicPacket(const dp::structure_id_t structureId,
|
||||
const std::optional<dur_millis_t> frequencyMs) {
|
||||
// Get and check dataset first.
|
||||
const auto optSetSpec = getSetSpecification(structureId);
|
||||
@ -314,7 +314,7 @@ ReturnValue_t PeriodicHelper::enablePeriodicPacket(const sid_t structureId,
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PeriodicHelper::disablePeriodicPacket(const sid_t structureId) {
|
||||
ReturnValue_t PeriodicHelper::disablePeriodicPacket(const dp::structure_id_t structureId) {
|
||||
// Get and check dataset first.
|
||||
const auto optSetSpec = getSetSpecification(structureId);
|
||||
if (!optSetSpec.has_value()) {
|
||||
|
@ -113,10 +113,10 @@ class PeriodicHelper : public PeriodicHelperIF {
|
||||
ReturnValue_t generateHousekeepingPacket(dp::sid_t sid,
|
||||
MessageQueueId_t destination = MessageQueueIF::NO_QUEUE);
|
||||
|
||||
[[nodiscard]] PeriodicHkGenerationIF* getOwner() const;
|
||||
[[nodiscard]] GeneratesPeriodicHkIF* getOwner() const;
|
||||
|
||||
void addSetSpecification(const SetSpecification& setSpec);
|
||||
ReturnValue_t printPoolEntry(dp::lp_id_t localPoolId);
|
||||
ReturnValue_t printPoolEntry(dp::id_t localPoolId);
|
||||
|
||||
/* Copying forbidden */
|
||||
PeriodicHelper(const PeriodicHkGenerationHelper&) = delete;
|
||||
@ -139,7 +139,6 @@ class PeriodicHelper : public PeriodicHelperIF {
|
||||
*/
|
||||
MutexIF* getMutexHandle();
|
||||
|
||||
// PeriodicHkGenerationHelper* getPoolManagerHandle() override;
|
||||
/**
|
||||
* Set the periodic generation frequency without enabling the periodic generation of packets.
|
||||
*/
|
||||
|
@ -36,7 +36,7 @@ union DataId {
|
||||
return d;
|
||||
}
|
||||
dp::sid_t sid;
|
||||
dp::lp_id_t localPoolId;
|
||||
dp::id_t localPoolId;
|
||||
};
|
||||
|
||||
/** Different data types are possible in the HK receiver map. For example, updates can be
|
||||
@ -44,8 +44,9 @@ requested for full datasets or for single pool variables. Periodic reporting is
|
||||
for data sets. */
|
||||
enum class DataType : uint8_t { LOCAL_POOL_VARIABLE, DATA_SET };
|
||||
|
||||
/** The data pool manager will keep an internal map of HK receivers. */
|
||||
struct SetSpecification {
|
||||
friend class PeriodicHelper;
|
||||
|
||||
public:
|
||||
SetSpecification(dp::sid_t structureId, size_t size, dur_millis_t collectionFrequency,
|
||||
MessageQueueId_t destinationQueue = MessageQueueIF::NO_QUEUE)
|
||||
|
@ -28,7 +28,7 @@ class MonitoringReportContent : public SerialLinkedListAdapter<SerializeIF> {
|
||||
public:
|
||||
SerializeElement<uint8_t> monitorId;
|
||||
SerializeElement<uint32_t> parameterObjectId;
|
||||
SerializeElement<dp::lp_id_t> localPoolId;
|
||||
SerializeElement<dp::id_t> localPoolId;
|
||||
SerializeElement<T> parameterValue;
|
||||
SerializeElement<T> limitValue;
|
||||
SerializeElement<ReturnValue_t> oldState;
|
||||
|
@ -4,8 +4,7 @@ target_sources(${FSFW_TEST_TGT} PRIVATE CatchDefinitions.cpp CatchFactory.cpp
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE CatchRunner.cpp CatchSetup.cpp)
|
||||
|
||||
add_subdirectory(testcfg)
|
||||
add_subdirectory(mocks)
|
||||
|
||||
add_subdirectory(mock)
|
||||
add_subdirectory(tcdistributor)
|
||||
add_subdirectory(action)
|
||||
add_subdirectory(power)
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
||||
#include <fsfw/tmtcservices/PusServiceBase.h>
|
||||
|
||||
#include "mocks/HkReceiverMock.h"
|
||||
#include "mock/HkReceiverMock.h"
|
||||
#include "tests/TestsConfig.h"
|
||||
|
||||
#if FSFW_ADD_DEFAULT_FACTORY_FUNCTIONS == 1
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <array>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
|
||||
TEST_CASE("Action Helper", "[action]") {
|
||||
ActionHelperOwnerMockBase testDhMock;
|
||||
|
@ -10,14 +10,14 @@
|
||||
#include "fsfw/cfdp/pdu/EofPduCreator.h"
|
||||
#include "fsfw/cfdp/pdu/FileDataCreator.h"
|
||||
#include "fsfw/cfdp/pdu/MetadataPduCreator.h"
|
||||
#include "mocks/AcceptsTmMock.h"
|
||||
#include "mocks/EventReportingProxyMock.h"
|
||||
#include "mocks/FilesystemMock.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "mocks/StorageManagerMock.h"
|
||||
#include "mocks/cfdp/FaultHandlerMock.h"
|
||||
#include "mocks/cfdp/RemoteConfigTableMock.h"
|
||||
#include "mocks/cfdp/UserMock.h"
|
||||
#include "mock/AcceptsTmMock.h"
|
||||
#include "mock/EventReportingProxyMock.h"
|
||||
#include "mock/FilesystemMock.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
#include "mock/StorageManagerMock.h"
|
||||
#include "mock/cfdp/FaultHandlerMock.h"
|
||||
#include "mock/cfdp/RemoteConfigTableMock.h"
|
||||
#include "mock/cfdp/UserMock.h"
|
||||
|
||||
TEST_CASE("CFDP Dest Handler", "[cfdp]") {
|
||||
using namespace cfdp;
|
||||
|
@ -5,9 +5,9 @@
|
||||
#include "fsfw/cfdp/tlv/StringLv.h"
|
||||
#include "fsfw/storagemanager/LocalPool.h"
|
||||
#include "fsfw/tcdistribution/definitions.h"
|
||||
#include "mocks/AcceptsTcMock.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "mocks/StorageManagerMock.h"
|
||||
#include "mock/AcceptsTcMock.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
#include "mock/StorageManagerMock.h"
|
||||
|
||||
TEST_CASE("CFDP Distributor", "[cfdp][distributor]") {
|
||||
LocalPool::LocalPoolConfig cfg = {{5, 32}, {2, 64}};
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "mocks/cfdp/FaultHandlerMock.h"
|
||||
#include "mock/cfdp/FaultHandlerMock.h"
|
||||
|
||||
TEST_CASE("CFDP Fault Handler", "[cfdp]") {
|
||||
using namespace cfdp;
|
||||
|
@ -10,8 +10,8 @@
|
||||
#include "fsfw/cfdp/tlv/StringLv.h"
|
||||
#include "fsfw/globalfunctions/arrayprinter.h"
|
||||
#include "fsfw/serialize.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "mocks/StorageManagerMock.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
#include "mock/StorageManagerMock.h"
|
||||
|
||||
TEST_CASE("Reserved Message Parser", "[cfdp]") {
|
||||
using namespace cfdp;
|
||||
|
@ -15,14 +15,14 @@
|
||||
#include "fsfw/cfdp/pdu/MetadataPduReader.h"
|
||||
#include "fsfw/tmtcservices/TmTcMessage.h"
|
||||
#include "fsfw/util/SeqCountProvider.h"
|
||||
#include "mocks/AcceptsTmMock.h"
|
||||
#include "mocks/EventReportingProxyMock.h"
|
||||
#include "mocks/FilesystemMock.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "mocks/StorageManagerMock.h"
|
||||
#include "mocks/cfdp/FaultHandlerMock.h"
|
||||
#include "mocks/cfdp/RemoteConfigTableMock.h"
|
||||
#include "mocks/cfdp/UserMock.h"
|
||||
#include "mock/AcceptsTmMock.h"
|
||||
#include "mock/EventReportingProxyMock.h"
|
||||
#include "mock/FilesystemMock.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
#include "mock/StorageManagerMock.h"
|
||||
#include "mock/cfdp/FaultHandlerMock.h"
|
||||
#include "mock/cfdp/RemoteConfigTableMock.h"
|
||||
#include "mock/cfdp/UserMock.h"
|
||||
|
||||
TEST_CASE("CFDP Source Handler", "[cfdp]") {
|
||||
using namespace cfdp;
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
#include <fsfw/datapoollocal/SharedLocalDataset.h>
|
||||
#include <fsfw/datapool/SharedSet.h>
|
||||
#include <fsfw/globalfunctions/bitutility.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
|
||||
@ -7,29 +7,30 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "CatchDefinitions.h"
|
||||
#include "mocks/LocalPoolOwnerBase.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
#include "mock/TestPoolOwner.h"
|
||||
#include "tests/TestsConfig.h"
|
||||
|
||||
using namespace returnvalue;
|
||||
using namespace lpool;
|
||||
|
||||
TEST_CASE("DataSetTest", "[DataSetTest]") {
|
||||
auto queue = MessageQueueMock(1);
|
||||
LocalPoolOwnerBase poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
TestPoolOwner poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
poolOwner.initialize();
|
||||
LocalPoolStaticTestDataSet localSet;
|
||||
StaticTestDataSet localSet;
|
||||
|
||||
SECTION("BasicTest") {
|
||||
/* Test some basic functions */
|
||||
CHECK(localSet.getReportingEnabled() == false);
|
||||
CHECK(localSet.getLocalPoolIdsSerializedSize(false) == 3 * sizeof(lp_id_t));
|
||||
CHECK(localSet.getLocalPoolIdsSerializedSize(true) == 3 * sizeof(lp_id_t) + sizeof(uint8_t));
|
||||
CHECK(localSet.getLocalPoolIdsSerializedSize(false) == 3 * sizeof(dp::id_t));
|
||||
CHECK(localSet.getLocalPoolIdsSerializedSize(true) == 3 * sizeof(dp::id_t) + sizeof(uint8_t));
|
||||
CHECK(localSet.getSid() == lpool::testSid0);
|
||||
CHECK(localSet.getCreatorObjectId() == objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
size_t maxSize = localSet.getLocalPoolIdsSerializedSize(true);
|
||||
uint8_t localPoolIdBuff[maxSize];
|
||||
// Skip size field
|
||||
auto* lpIds = reinterpret_cast<lp_id_t*>(localPoolIdBuff + 1);
|
||||
auto* lpIds = reinterpret_cast<id_t*>(localPoolIdBuff + 1);
|
||||
size_t serSize = 0;
|
||||
auto* localPoolIdBuffPtr = reinterpret_cast<uint8_t*>(localPoolIdBuff);
|
||||
|
||||
@ -42,7 +43,7 @@ TEST_CASE("DataSetTest", "[DataSetTest]") {
|
||||
CHECK(lpIds[1] == localSet.localPoolVarFloat.getDataPoolId());
|
||||
CHECK(lpIds[2] == localSet.localPoolUint16Vec.getDataPoolId());
|
||||
// Now serialize without fill count
|
||||
lpIds = reinterpret_cast<lp_id_t*>(localPoolIdBuff);
|
||||
lpIds = reinterpret_cast<dp::id_t*>(localPoolIdBuff);
|
||||
localPoolIdBuffPtr = localPoolIdBuff;
|
||||
serSize = 0;
|
||||
CHECK(localSet.serializeLocalPoolIds(&localPoolIdBuffPtr, &serSize, maxSize,
|
||||
@ -125,26 +126,15 @@ TEST_CASE("DataSetTest", "[DataSetTest]") {
|
||||
CHECK(localSet.localPoolUint16Vec.value[1] == 0);
|
||||
CHECK(localSet.localPoolUint16Vec.value[2] == 0);
|
||||
}
|
||||
|
||||
/* Common fault test cases */
|
||||
LocalPoolObjectBase* variableHandle = poolOwner.getPoolObjectHandle(lpool::uint32VarId);
|
||||
CHECK(variableHandle != nullptr);
|
||||
CHECK(localSet.registerVariable(variableHandle) == static_cast<int>(DataSetIF::DATA_SET_FULL));
|
||||
variableHandle = nullptr;
|
||||
REQUIRE(localSet.registerVariable(variableHandle) ==
|
||||
static_cast<int>(DataSetIF::POOL_VAR_NULL));
|
||||
}
|
||||
|
||||
SECTION("SharedDataSet") {
|
||||
object_id_t sharedSetId = objects::SHARED_SET_ID;
|
||||
SharedLocalDataset sharedSet(sharedSetId, poolOwner.sharedPool, lpool::testSetId0, 5);
|
||||
SharedSet sharedSet(poolOwner.sharedPool, sharedSetId, 5);
|
||||
localSet.localPoolVarUint8.setReadWriteMode(pool_rwm_t::VAR_WRITE);
|
||||
localSet.localPoolUint16Vec.setReadWriteMode(pool_rwm_t::VAR_WRITE);
|
||||
CHECK(sharedSet.registerVariable(&localSet.localPoolVarUint8) == returnvalue::OK);
|
||||
CHECK(sharedSet.registerVariable(&localSet.localPoolUint16Vec) == returnvalue::OK);
|
||||
CHECK(sharedSet.initialize() == returnvalue::OK);
|
||||
CHECK(sharedSet.lockDataset() == returnvalue::OK);
|
||||
CHECK(sharedSet.unlockDataset() == returnvalue::OK);
|
||||
|
||||
{
|
||||
PoolReadGuard rg(&sharedSet);
|
||||
|
@ -1,6 +1,4 @@
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
#include <fsfw/datapoollocal/PeriodicHkGenerationHelper.h>
|
||||
#include <fsfw/datapoollocal/StaticSharedDataset.h>
|
||||
#include <fsfw/globalfunctions/timevalOperations.h>
|
||||
#include <fsfw/ipc/CommandMessageCleaner.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
@ -12,8 +10,10 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "CatchDefinitions.h"
|
||||
#include "mocks/HkReceiverMock.h"
|
||||
#include "mocks/LocalPoolOwnerBase.h"
|
||||
#include "mock/HkReceiverMock.h"
|
||||
#include "mock/TestPoolOwner.h"
|
||||
|
||||
using namespace lpool;
|
||||
|
||||
TEST_CASE("Local Pool Manager Tests", "[LocManTest]") {
|
||||
const MessageQueueId_t defaultDestId = 1;
|
||||
@ -21,7 +21,7 @@ TEST_CASE("Local Pool Manager Tests", "[LocManTest]") {
|
||||
const MessageQueueId_t subscriberId = 2;
|
||||
auto hkReceiver = HkReceiverMock(hkDest);
|
||||
auto queue = MessageQueueMock(3);
|
||||
LocalPoolOwnerBase poolOwner(queue, hkDest, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
TestPoolOwner poolOwner(queue, hkDest, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
|
||||
REQUIRE(poolOwner.initialize() == returnvalue::OK);
|
||||
|
||||
@ -32,7 +32,7 @@ TEST_CASE("Local Pool Manager Tests", "[LocManTest]") {
|
||||
SECTION("Basic Test") {
|
||||
{
|
||||
// For code coverage, should not crash
|
||||
PeriodicHkGenerationHelper manager(nullptr, nullptr);
|
||||
hk::PeriodicHelper manager(nullptr, nullptr);
|
||||
}
|
||||
auto owner = poolOwner.hkHelper.getOwner();
|
||||
REQUIRE(owner != nullptr);
|
||||
|
@ -1,23 +1,24 @@
|
||||
#include <fsfw/datapoollocal/PeriodicHkGenerationHelper.h>
|
||||
#include <fsfw/housekeeping/PeriodicHkHelper.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "CatchDefinitions.h"
|
||||
#include "mocks/LocalPoolOwnerBase.h"
|
||||
#include "mock/TestPoolOwner.h"
|
||||
#include "tests/TestsConfig.h"
|
||||
|
||||
using namespace returnvalue;
|
||||
using namespace lpool;
|
||||
using namespace dp;
|
||||
|
||||
TEST_CASE("LocalPoolVariable", "[LocPoolVarTest]") {
|
||||
auto queue = MessageQueueMock(1);
|
||||
LocalPoolOwnerBase poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
lpool::TestPoolOwner poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
REQUIRE(poolOwner.initialize() == OK);
|
||||
|
||||
SECTION("Basic Tests") {
|
||||
/* very basic test. */
|
||||
lp_var_t<uint8_t> testVariable =
|
||||
lp_var_t<uint8_t>(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId);
|
||||
u8_t testVariable{objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId};
|
||||
REQUIRE(testVariable.read() == returnvalue::OK);
|
||||
CHECK(testVariable.value == 0);
|
||||
testVariable.value = 5;
|
||||
@ -34,8 +35,8 @@ TEST_CASE("LocalPoolVariable", "[LocPoolVarTest]") {
|
||||
CHECK(testVariable.getDataPoolId() == 22);
|
||||
testVariable.setDataPoolId(lpool::uint8VarId);
|
||||
|
||||
gp_id_t globPoolId(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId);
|
||||
lp_var_t<uint8_t> testVariable2 = lp_var_t<uint8_t>(globPoolId);
|
||||
g_id_t globPoolId(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId);
|
||||
u8_t testVariable2{globPoolId};
|
||||
REQUIRE(testVariable2.read() == returnvalue::OK);
|
||||
CHECK(testVariable2 == 5);
|
||||
CHECK(testVariable == testVariable2);
|
||||
@ -70,32 +71,30 @@ TEST_CASE("LocalPoolVariable", "[LocPoolVarTest]") {
|
||||
|
||||
SECTION("ErrorHandling") {
|
||||
/* now try to use a local pool variable which does not exist */
|
||||
lp_var_t<uint8_t> invalidVariable =
|
||||
lp_var_t<uint8_t>(objects::TEST_LOCAL_POOL_OWNER_BASE, 0xffffffff);
|
||||
REQUIRE(invalidVariable.read() == static_cast<int>(localpool::POOL_ENTRY_NOT_FOUND));
|
||||
dp::u8_t invalidVariable{objects::TEST_LOCAL_POOL_OWNER_BASE, 0xffffffff};
|
||||
REQUIRE(invalidVariable.read() == static_cast<int>(POOL_ENTRY_NOT_FOUND));
|
||||
|
||||
REQUIRE(invalidVariable.commit() == static_cast<int>(localpool::POOL_ENTRY_NOT_FOUND));
|
||||
REQUIRE(invalidVariable.commit() == static_cast<int>(POOL_ENTRY_NOT_FOUND));
|
||||
/* now try to access with wrong type */
|
||||
lp_var_t<int8_t> invalidVariable2 =
|
||||
lp_var_t<int8_t>(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId);
|
||||
REQUIRE(invalidVariable2.read() == static_cast<int>(localpool::POOL_ENTRY_TYPE_CONFLICT));
|
||||
dp::i8_t invalidVariable2 = dp::i8_t(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId);
|
||||
REQUIRE(invalidVariable2.read() == static_cast<int>(POOL_ENTRY_TYPE_CONFLICT));
|
||||
|
||||
lp_var_t<uint8_t> readOnlyVar = lp_var_t<uint8_t>(
|
||||
dp::var_t<uint8_t> readOnlyVar = dp::var_t<uint8_t>(
|
||||
objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId, nullptr, pool_rwm_t::VAR_READ);
|
||||
REQUIRE(readOnlyVar.commit() == static_cast<int>(PoolVariableIF::INVALID_READ_WRITE_MODE));
|
||||
lp_var_t<uint8_t> writeOnlyVar = lp_var_t<uint8_t>(
|
||||
dp::var_t<uint8_t> writeOnlyVar = dp::var_t<uint8_t>(
|
||||
objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId, nullptr, pool_rwm_t::VAR_WRITE);
|
||||
REQUIRE(writeOnlyVar.read() == static_cast<int>(PoolVariableIF::INVALID_READ_WRITE_MODE));
|
||||
|
||||
lp_var_t<uint32_t> uint32tVar =
|
||||
lp_var_t<uint32_t>(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint32VarId);
|
||||
dp::var_t<uint32_t> uint32tVar =
|
||||
dp::var_t<uint32_t>(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint32VarId);
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "LocalPoolVariable printout: " << uint32tVar << std::endl;
|
||||
#endif
|
||||
|
||||
/* for code coverage. If program does not crash -> OK */
|
||||
lp_var_t<uint8_t> invalidObjectVar = lp_var_t<uint8_t>(0xffffffff, lpool::uint8VarId);
|
||||
gp_id_t globPoolId(0xffffffff, lpool::uint8VarId);
|
||||
lp_var_t<uint8_t> invalidObjectVar2 = lp_var_t<uint8_t>(globPoolId);
|
||||
dp::var_t<uint8_t> invalidObjectVar = dp::var_t<uint8_t>(0xffffffff, lpool::uint8VarId);
|
||||
dp::g_id_t globPoolId(0xffffffff, lpool::uint8VarId);
|
||||
dp::var_t<uint8_t> invalidObjectVar2 = dp::var_t<uint8_t>(globPoolId);
|
||||
}
|
||||
}
|
||||
|
@ -1,30 +1,30 @@
|
||||
#include <fsfw/datapoollocal/PeriodicHkGenerationHelper.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "CatchDefinitions.h"
|
||||
#include "mocks/LocalPoolOwnerBase.h"
|
||||
#include "mock/TestPoolOwner.h"
|
||||
#include "tests/TestsConfig.h"
|
||||
|
||||
using namespace returnvalue;
|
||||
using namespace dp;
|
||||
using namespace lpool;
|
||||
|
||||
TEST_CASE("LocalPoolVector", "[LocPoolVecTest]") {
|
||||
auto queue = MessageQueueMock(1);
|
||||
LocalPoolOwnerBase poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
lpool::TestPoolOwner poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
REQUIRE(poolOwner.initialize() == OK);
|
||||
|
||||
SECTION("BasicTest") {
|
||||
// very basic test.
|
||||
lp_vec_t<uint16_t, 3> testVector =
|
||||
lp_vec_t<uint16_t, 3>(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint16Vec3Id);
|
||||
vec_t<uint16_t, 3> testVector =
|
||||
vec_t<uint16_t, 3>(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint16Vec3Id);
|
||||
REQUIRE(testVector.read() == returnvalue::OK);
|
||||
testVector.value[0] = 5;
|
||||
testVector.value[1] = 232;
|
||||
testVector.value[2] = 32023;
|
||||
|
||||
REQUIRE(testVector.commit(true) == returnvalue::OK);
|
||||
// CHECK(testVector.isValid());
|
||||
REQUIRE(testVector.commit() == returnvalue::OK);
|
||||
|
||||
testVector.value[0] = 0;
|
||||
testVector.value[1] = 0;
|
||||
@ -44,7 +44,7 @@ TEST_CASE("LocalPoolVector", "[LocPoolVecTest]") {
|
||||
CHECK(testVector.commit() == returnvalue::OK);
|
||||
|
||||
/* Use read-only reference. */
|
||||
const lp_vec_t<uint16_t, 3>& roTestVec = testVector;
|
||||
const dp::vec_t<uint16_t, 3>& roTestVec = testVector;
|
||||
uint16_t valueOne = roTestVec[0];
|
||||
CHECK(valueOne == 5);
|
||||
|
||||
@ -55,7 +55,7 @@ TEST_CASE("LocalPoolVector", "[LocPoolVecTest]") {
|
||||
CHECK(maxSize == 6);
|
||||
|
||||
uint16_t serializedVector[3];
|
||||
uint8_t* vecPtr = reinterpret_cast<uint8_t*>(serializedVector);
|
||||
auto* vecPtr = reinterpret_cast<uint8_t*>(serializedVector);
|
||||
size_t serSize = 0;
|
||||
REQUIRE(testVector.serialize(&vecPtr, &serSize, maxSize, SerializeIF::Endianness::MACHINE) ==
|
||||
returnvalue::OK);
|
||||
@ -73,7 +73,7 @@ TEST_CASE("LocalPoolVector", "[LocPoolVecTest]") {
|
||||
serializedVector[1] = 7832;
|
||||
serializedVector[2] = 39232;
|
||||
|
||||
const uint8_t* constVecPtr = reinterpret_cast<const uint8_t*>(serializedVector);
|
||||
const auto* constVecPtr = reinterpret_cast<const uint8_t*>(serializedVector);
|
||||
REQUIRE(testVector.deSerialize(&constVecPtr, &serSize, SerializeIF::Endianness::MACHINE) ==
|
||||
returnvalue::OK);
|
||||
CHECK(testVector[0] == 16);
|
||||
@ -87,23 +87,21 @@ TEST_CASE("LocalPoolVector", "[LocPoolVecTest]") {
|
||||
|
||||
SECTION("ErrorHandling") {
|
||||
/* Now try to use a local pool variable which does not exist */
|
||||
lp_vec_t<uint16_t, 3> invalidVector =
|
||||
lp_vec_t<uint16_t, 3>(objects::TEST_LOCAL_POOL_OWNER_BASE, 0xffffffff);
|
||||
REQUIRE(invalidVector.read() == static_cast<int>(localpool::POOL_ENTRY_NOT_FOUND));
|
||||
REQUIRE(invalidVector.commit() == static_cast<int>(localpool::POOL_ENTRY_NOT_FOUND));
|
||||
dp::vec_t<uint16_t, 3> invalidVector{objects::TEST_LOCAL_POOL_OWNER_BASE, 0xffffffff};
|
||||
REQUIRE(invalidVector.read() == static_cast<int>(POOL_ENTRY_NOT_FOUND));
|
||||
REQUIRE(invalidVector.commit() == static_cast<int>(POOL_ENTRY_NOT_FOUND));
|
||||
|
||||
/* Now try to access with wrong type */
|
||||
lp_vec_t<uint32_t, 3> invalidVector2 =
|
||||
lp_vec_t<uint32_t, 3>(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint16Vec3Id);
|
||||
REQUIRE(invalidVector2.read() == static_cast<int>(localpool::POOL_ENTRY_TYPE_CONFLICT));
|
||||
REQUIRE(invalidVector2.commit() == static_cast<int>(localpool::POOL_ENTRY_TYPE_CONFLICT));
|
||||
dp::vec_t<uint32_t, 3> invalidVector2{objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint16Vec3Id};
|
||||
REQUIRE(invalidVector2.read() == static_cast<int>(POOL_ENTRY_TYPE_CONFLICT));
|
||||
REQUIRE(invalidVector2.commit() == static_cast<int>(POOL_ENTRY_TYPE_CONFLICT));
|
||||
|
||||
lp_vec_t<uint16_t, 3> writeOnlyVec = lp_vec_t<uint16_t, 3>(
|
||||
objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint16Vec3Id, nullptr, pool_rwm_t::VAR_WRITE);
|
||||
dp::vec_t<uint16_t, 3> writeOnlyVec{objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint16Vec3Id,
|
||||
nullptr, pool_rwm_t::VAR_WRITE};
|
||||
REQUIRE(writeOnlyVec.read() == static_cast<int>(PoolVariableIF::INVALID_READ_WRITE_MODE));
|
||||
|
||||
lp_vec_t<uint16_t, 3> readOnlyVec = lp_vec_t<uint16_t, 3>(
|
||||
objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint16Vec3Id, nullptr, pool_rwm_t::VAR_READ);
|
||||
dp::vec_t<uint16_t, 3> readOnlyVec = {objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint16Vec3Id,
|
||||
nullptr, pool_rwm_t::VAR_READ};
|
||||
REQUIRE(readOnlyVec.commit() == static_cast<int>(PoolVariableIF::INVALID_READ_WRITE_MODE));
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
#include <mocks/HkReceiverMock.h>
|
||||
#include <mocks/MessageQueueMock.h>
|
||||
#include <mock/HkReceiverMock.h>
|
||||
#include <mock/MessageQueueMock.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "DeviceHandlerCommander.h"
|
||||
#include "mocks/ComIFMock.h"
|
||||
#include "mocks/CookieIFMock.h"
|
||||
#include "mocks/DeviceFdirMock.h"
|
||||
#include "mocks/DeviceHandlerMock.h"
|
||||
#include "mock/ComIFMock.h"
|
||||
#include "mock/CookieIFMock.h"
|
||||
#include "mock/DeviceFdirMock.h"
|
||||
#include "mock/DeviceHandlerMock.h"
|
||||
#include "objects/systemObjectList.h"
|
||||
|
||||
TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") {
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "fsfw/serialize/SerializeIF.h"
|
||||
#include "mocks/FilesystemMock.h"
|
||||
#include "mock/FilesystemMock.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "fsfw/ipc/CommandMessage.h"
|
||||
#include "fsfw/ipc/MessageQueueMessage.h"
|
||||
#include "fsfw/objectmanager/frameworkObjects.h"
|
||||
#include "mocks/PeriodicTaskIFMock.h"
|
||||
#include "mock/PeriodicTaskIFMock.h"
|
||||
|
||||
TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
|
||||
PeriodicTaskMock task(10, nullptr);
|
||||
|
@ -7,7 +7,6 @@ target_sources(
|
||||
ComIFMock.cpp
|
||||
MessageQueueMock.cpp
|
||||
InternalErrorReporterMock.cpp
|
||||
LocalPoolOwnerBase.cpp
|
||||
PusVerificationReporterMock.cpp
|
||||
PusServiceBaseMock.cpp
|
||||
AcceptsTmMock.cpp
|
||||
@ -16,6 +15,7 @@ target_sources(
|
||||
AcceptsTcMock.cpp
|
||||
StorageManagerMock.cpp
|
||||
FilesystemMock.cpp
|
||||
TestPoolOwner.cpp
|
||||
EventReportingProxyMock.cpp)
|
||||
|
||||
add_subdirectory(cfdp)
|
@ -109,14 +109,13 @@ ReturnValue_t DeviceHandlerMock::initialize() {
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t DeviceHandlerMock::serializeHkDataset(structure_id_t structureId, uint8_t *buf,
|
||||
ReturnValue_t DeviceHandlerMock::serializeHkDataset(dp::structure_id_t structureId, uint8_t *buf,
|
||||
size_t maxSize) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t DeviceHandlerMock::specifyHkDatasets(
|
||||
std::vector<periodicHk::SetSpecification> &setList) {
|
||||
ReturnValue_t DeviceHandlerMock::specifyHkDatasets(std::vector<hk::SetSpecification> &setList) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
localpool::SharedPool *DeviceHandlerMock::getOptionalSharedPool() { return nullptr; }
|
||||
dp::SharedPool *DeviceHandlerMock::getOptionalSharedPool() { return nullptr; }
|
@ -23,11 +23,12 @@ class DeviceHandlerMock : public DeviceHandlerBase {
|
||||
|
||||
ReturnValue_t initialize() override;
|
||||
|
||||
ReturnValue_t serializeHkDataset(sid_t structureId, uint8_t *buf, size_t maxSize) override;
|
||||
ReturnValue_t serializeHkDataset(dp::structure_id_t structureId, uint8_t *buf,
|
||||
size_t maxSize) override;
|
||||
|
||||
ReturnValue_t specifyHkDatasets(std::vector<periodicHk::SetSpecification> &setList) override;
|
||||
ReturnValue_t specifyHkDatasets(std::vector<hk::SetSpecification> &setList) override;
|
||||
|
||||
localpool::SharedPool *getOptionalSharedPool() override;
|
||||
dp::SharedPool *getOptionalSharedPool() override;
|
||||
|
||||
protected:
|
||||
void doStartUp() override;
|
75
unittests/mock/TestPoolOwner.cpp
Normal file
75
unittests/mock/TestPoolOwner.cpp
Normal file
@ -0,0 +1,75 @@
|
||||
#include "TestPoolOwner.h"
|
||||
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
|
||||
using namespace lpool;
|
||||
|
||||
TestPoolOwner::TestPoolOwner(MessageQueueIF &queue, MessageQueueId_t hkDestId, object_id_t objectId)
|
||||
: SystemObject(objectId),
|
||||
hkHelper(this, &queue, hkDestId),
|
||||
sharedPool(TestPoolOwner::getObjectId()),
|
||||
set1(sharedPool, lpool::testSetId1),
|
||||
set2(sharedPool, lpool::testSetId2),
|
||||
queue(queue) {}
|
||||
|
||||
TestPoolOwner::~TestPoolOwner() = default;
|
||||
|
||||
ReturnValue_t TestPoolOwner::initialize() {
|
||||
sharedPool.addPoolEntry(lpool::uint8VarId, &u8PoolEntry);
|
||||
sharedPool.addPoolEntry(lpool::floatVarId, &floatPoolEntry);
|
||||
sharedPool.addPoolEntry(lpool::uint32VarId, &u32PoolEntry);
|
||||
sharedPool.addPoolEntry(lpool::uint16Vec3Id, &u16VecPoolEntry);
|
||||
sharedPool.addPoolEntry(lpool::int64Vec2Id, &i64VecPoolEntry);
|
||||
ReturnValue_t result = hkHelper.initialize(&queue);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
return SystemObject::initialize();
|
||||
}
|
||||
|
||||
SharedPool *TestPoolOwner::getOptionalSharedPool() { return &sharedPool; }
|
||||
|
||||
ReturnValue_t TestPoolOwner::serializeHkDataset(structure_id_t structureId, uint8_t *buf,
|
||||
size_t maxSize) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t TestPoolOwner::specifyHkDatasets(std::vector<hk::SetSpecification> &setList) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t TestPoolOwner::reset() {
|
||||
ReturnValue_t status = returnvalue::OK;
|
||||
{
|
||||
PoolReadGuard readHelper(&set1);
|
||||
if (readHelper.getReadResult() != returnvalue::OK) {
|
||||
status = readHelper.getReadResult();
|
||||
}
|
||||
set1.localPoolVarUint8.value = 0;
|
||||
set1.localPoolVarFloat.value = 0.0;
|
||||
set1.localPoolUint16Vec.value[0] = 0;
|
||||
set1.localPoolUint16Vec.value[1] = 0;
|
||||
set1.localPoolUint16Vec.value[2] = 0;
|
||||
// dataset.setValidity(false, true);
|
||||
}
|
||||
|
||||
{
|
||||
PoolReadGuard readHelper(&testUint32);
|
||||
if (readHelper.getReadResult() != returnvalue::OK) {
|
||||
status = readHelper.getReadResult();
|
||||
}
|
||||
testUint32.value = 0;
|
||||
}
|
||||
|
||||
{
|
||||
PoolReadGuard readHelper(&testInt64Vec);
|
||||
if (readHelper.getReadResult() != returnvalue::OK) {
|
||||
status = readHelper.getReadResult();
|
||||
}
|
||||
testInt64Vec.value[0] = 0;
|
||||
testInt64Vec.value[1] = 0;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
void TestPoolOwner::setHkDestId(MessageQueueId_t id) { hkHelper.setHkDestinationId(id); }
|
64
unittests/mock/TestPoolOwner.h
Normal file
64
unittests/mock/TestPoolOwner.h
Normal file
@ -0,0 +1,64 @@
|
||||
#pragma once
|
||||
#include <fsfw/housekeeping/GeneratesPeriodicHkIF.h>
|
||||
#include <fsfw/objectmanager/SystemObject.h>
|
||||
|
||||
#include "poolDefinitions.h"
|
||||
|
||||
namespace lpool {
|
||||
|
||||
class TestPoolOwner : public SystemObject, public hk::GeneratesPeriodicHkIF {
|
||||
public:
|
||||
explicit TestPoolOwner(MessageQueueIF& queue, MessageQueueId_t hkDestId,
|
||||
object_id_t objectId = objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
|
||||
~TestPoolOwner() override;
|
||||
|
||||
[[nodiscard]] object_id_t getObjectId() const override { return SystemObject::getObjectId(); }
|
||||
|
||||
ReturnValue_t serializeHkDataset(structure_id_t structureId, uint8_t* buf,
|
||||
size_t maxSize) override;
|
||||
|
||||
ReturnValue_t specifyHkDatasets(std::vector<hk::SetSpecification>& setList) override;
|
||||
|
||||
SharedPool* getOptionalSharedPool() override;
|
||||
ReturnValue_t initialize() override;
|
||||
|
||||
void setHkDestId(MessageQueueId_t id);
|
||||
|
||||
/** Command queue for housekeeping messages. */
|
||||
[[nodiscard]] MessageQueueId_t getCommandQueue() const override { return queue.getId(); }
|
||||
|
||||
[[nodiscard]] MessageQueueMock& getMockQueueHandle() const {
|
||||
return dynamic_cast<MessageQueueMock&>(queue);
|
||||
}
|
||||
|
||||
ReturnValue_t subscribePeriodicHk(bool enableReporting) {
|
||||
return hkHelper.enablePeriodicPacket(lpool::testSid0, 50);
|
||||
}
|
||||
|
||||
ReturnValue_t reset();
|
||||
|
||||
hk::PeriodicHelper hkHelper;
|
||||
SharedPool sharedPool;
|
||||
LocalPoolTestDataSet set1;
|
||||
StaticTestDataSet set2;
|
||||
|
||||
private:
|
||||
PoolEntry<uint8_t> u8PoolEntry = PoolEntry<uint8_t>({0});
|
||||
PoolEntry<float> floatPoolEntry = PoolEntry<float>({0});
|
||||
PoolEntry<uint32_t> u32PoolEntry = PoolEntry<uint32_t>({0});
|
||||
PoolEntry<uint16_t> u16VecPoolEntry = PoolEntry<uint16_t>({0, 0, 0});
|
||||
PoolEntry<int64_t> i64VecPoolEntry = PoolEntry<int64_t>({0, 0});
|
||||
|
||||
dp::u8_t testUint8{sharedPool, lpool::uint8VarId};
|
||||
dp::f32_t testFloat{sharedPool, lpool::floatVarId};
|
||||
dp::u32_t testUint32{sharedPool, lpool::uint32VarId};
|
||||
vec_t<uint16_t, 3> testUint16Vec{sharedPool, lpool::uint16Vec3Id};
|
||||
vec_t<int64_t, 2> testInt64Vec{sharedPool, lpool::int64Vec2Id};
|
||||
|
||||
MessageQueueIF& queue;
|
||||
|
||||
bool initialized = false;
|
||||
bool initializedAfterTaskCreation = false;
|
||||
};
|
||||
} // namespace lpool
|
63
unittests/mock/poolDefinitions.h
Normal file
63
unittests/mock/poolDefinitions.h
Normal file
@ -0,0 +1,63 @@
|
||||
#pragma once
|
||||
|
||||
#include <fsfw/datapool.h>
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
#include <fsfw/objectmanager/SystemObject.h>
|
||||
|
||||
#include "fsfw/datapool/PoolEntry.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
#include "tests/TestsConfig.h"
|
||||
|
||||
namespace lpool {
|
||||
|
||||
using namespace dp;
|
||||
|
||||
static constexpr id_t uint8VarId = 0;
|
||||
static constexpr id_t floatVarId = 1;
|
||||
static constexpr id_t uint32VarId = 2;
|
||||
static constexpr id_t uint16Vec3Id = 3;
|
||||
static constexpr id_t int64Vec2Id = 4;
|
||||
|
||||
static constexpr uint32_t testSetId0 = 0;
|
||||
static constexpr uint32_t testSetId1 = 1;
|
||||
static constexpr uint32_t testSetId2 = 2;
|
||||
static constexpr uint8_t dataSetMaxVariables = 10;
|
||||
|
||||
static const auto testSid0 = structure_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, testSetId0);
|
||||
static const auto testSid1 = structure_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, testSetId1);
|
||||
static const auto testSid2 = structure_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, testSetId2);
|
||||
|
||||
static const g_id_t uint8VarGpid = g_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, uint8VarId);
|
||||
static const g_id_t floatVarGpid = g_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, floatVarId);
|
||||
static const g_id_t uint32Gpid = g_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, uint32VarId);
|
||||
static const g_id_t uint16Vec3Gpid = g_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, uint16Vec3Id);
|
||||
static const g_id_t uint64Vec2Id = g_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, int64Vec2Id);
|
||||
|
||||
class StaticTestDataSet : public StaticSharedSet<3> {
|
||||
public:
|
||||
StaticTestDataSet() : StaticSharedSet(lpool::testSid1) {}
|
||||
|
||||
StaticTestDataSet(SharedPool& sharedPool, uint32_t setId) : StaticSharedSet(sharedPool, setId) {}
|
||||
|
||||
u8_t localPoolVarUint8{lpool::uint8VarGpid, this};
|
||||
f32_t localPoolVarFloat{lpool::floatVarGpid, this};
|
||||
vec_t<uint16_t, 3> localPoolUint16Vec{lpool::uint16Vec3Gpid, this};
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
class LocalPoolTestDataSet : public SharedSet {
|
||||
public:
|
||||
LocalPoolTestDataSet() : SharedSet(lpool::testSid2, lpool::dataSetMaxVariables) {}
|
||||
|
||||
LocalPoolTestDataSet(SharedPool& sharedPool, uint32_t setId)
|
||||
: SharedSet(sharedPool, setId, lpool::dataSetMaxVariables) {}
|
||||
|
||||
u8_t localPoolVarUint8{lpool::uint8VarGpid, this};
|
||||
f32_t localPoolVarFloat{lpool::floatVarGpid, this};
|
||||
vec_t<uint16_t, 3> localPoolUint16Vec{lpool::uint16Vec3Gpid, this};
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
} // namespace lpool
|
@ -1,108 +0,0 @@
|
||||
#include "LocalPoolOwnerBase.h"
|
||||
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
|
||||
LocalPoolOwnerBase::LocalPoolOwnerBase(MessageQueueIF &queue, MessageQueueId_t hkDestId,
|
||||
object_id_t objectId)
|
||||
: SystemObject(objectId),
|
||||
hkHelper(this, &queue, hkDestId),
|
||||
sharedPool(LocalPoolOwnerBase::getObjectId()),
|
||||
set1(sharedPool, lpool::testSetId1),
|
||||
set2(sharedPool, lpool::testSetId2),
|
||||
queue(queue) {}
|
||||
|
||||
LocalPoolOwnerBase::~LocalPoolOwnerBase() = default;
|
||||
|
||||
ReturnValue_t LocalPoolOwnerBase::initialize() {
|
||||
sharedPool.addPoolEntry(lpool::uint8VarId, &u8PoolEntry);
|
||||
sharedPool.addPoolEntry(lpool::floatVarId, &floatPoolEntry);
|
||||
sharedPool.addPoolEntry(lpool::uint32VarId, &u32PoolEntry);
|
||||
sharedPool.addPoolEntry(lpool::uint16Vec3Id, &u16VecPoolEntry);
|
||||
sharedPool.addPoolEntry(lpool::int64Vec2Id, &i64VecPoolEntry);
|
||||
ReturnValue_t result = hkHelper.initialize(&queue);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
return SystemObject::initialize();
|
||||
}
|
||||
|
||||
localpool::SharedPool *LocalPoolOwnerBase::getOptionalSharedPool() { return &sharedPool; }
|
||||
|
||||
ReturnValue_t LocalPoolOwnerBase::serializeHkDataset(structure_id_t structureId, uint8_t *buf,
|
||||
size_t maxSize) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t LocalPoolOwnerBase::specifyHkDatasets(
|
||||
std::vector<periodicHk::SetSpecification> &setList) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
/*
|
||||
ReturnValue_t LocalPoolOwnerBase::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||
PeriodicHkGenerationHelper &poolManager) {
|
||||
// Default initialization empty for now.
|
||||
localDataPoolMap.emplace(lpool::uint8VarId, &u8PoolEntry);
|
||||
localDataPoolMap.emplace(lpool::floatVarId, &floatPoolEntry);
|
||||
localDataPoolMap.emplace(lpool::uint32VarId, &u32PoolEntry);
|
||||
|
||||
localDataPoolMap.emplace(lpool::uint16Vec3Id, &u16VecPoolEntry);
|
||||
localDataPoolMap.emplace(lpool::int64Vec2Id, &i64VecPoolEntry);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
*/
|
||||
|
||||
LocalPoolObjectBase *LocalPoolOwnerBase::getPoolObjectHandle(lp_id_t localPoolId) {
|
||||
if (localPoolId == lpool::uint8VarId) {
|
||||
return &testUint8;
|
||||
} else if (localPoolId == lpool::uint16Vec3Id) {
|
||||
return &testUint16Vec;
|
||||
} else if (localPoolId == lpool::floatVarId) {
|
||||
return &testFloat;
|
||||
} else if (localPoolId == lpool::int64Vec2Id) {
|
||||
return &testInt64Vec;
|
||||
} else if (localPoolId == lpool::uint32VarId) {
|
||||
return &testUint32;
|
||||
} else {
|
||||
return &testUint8;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t LocalPoolOwnerBase::reset() {
|
||||
// resetSubscriptionList();
|
||||
ReturnValue_t status = returnvalue::OK;
|
||||
{
|
||||
PoolReadGuard readHelper(&set1);
|
||||
if (readHelper.getReadResult() != returnvalue::OK) {
|
||||
status = readHelper.getReadResult();
|
||||
}
|
||||
set1.localPoolVarUint8.value = 0;
|
||||
set1.localPoolVarFloat.value = 0.0;
|
||||
set1.localPoolUint16Vec.value[0] = 0;
|
||||
set1.localPoolUint16Vec.value[1] = 0;
|
||||
set1.localPoolUint16Vec.value[2] = 0;
|
||||
// dataset.setValidity(false, true);
|
||||
}
|
||||
|
||||
{
|
||||
PoolReadGuard readHelper(&testUint32);
|
||||
if (readHelper.getReadResult() != returnvalue::OK) {
|
||||
status = readHelper.getReadResult();
|
||||
}
|
||||
testUint32.value = 0;
|
||||
// testUint32.setValid(false);
|
||||
}
|
||||
|
||||
{
|
||||
PoolReadGuard readHelper(&testInt64Vec);
|
||||
if (readHelper.getReadResult() != returnvalue::OK) {
|
||||
status = readHelper.getReadResult();
|
||||
}
|
||||
testInt64Vec.value[0] = 0;
|
||||
testInt64Vec.value[1] = 0;
|
||||
// testInt64Vec.setValid(false);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
void LocalPoolOwnerBase::setHkDestId(MessageQueueId_t id) { hkHelper.setHkDestinationId(id); }
|
@ -1,125 +0,0 @@
|
||||
#ifndef FSFW_UNITTEST_TESTS_DATAPOOLLOCAL_LOCALPOOLOWNERBASE_H_
|
||||
#define FSFW_UNITTEST_TESTS_DATAPOOLLOCAL_LOCALPOOLOWNERBASE_H_
|
||||
|
||||
#include <fsfw/datapoollocal/LocalPoolVector.h>
|
||||
#include <fsfw/datapoollocal/PeriodicHkGenerationHelper.h>
|
||||
#include <fsfw/datapoollocal/PoolVariable.h>
|
||||
#include <fsfw/datapoollocal/SharedDataset.h>
|
||||
#include <fsfw/datapoollocal/StaticSharedDataset.h>
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
#include <fsfw/objectmanager/SystemObject.h>
|
||||
|
||||
#include "fsfw/datapool/PoolEntry.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "tests/TestsConfig.h"
|
||||
|
||||
namespace lpool {
|
||||
static constexpr lp_id_t uint8VarId = 0;
|
||||
static constexpr lp_id_t floatVarId = 1;
|
||||
static constexpr lp_id_t uint32VarId = 2;
|
||||
static constexpr lp_id_t uint16Vec3Id = 3;
|
||||
static constexpr lp_id_t int64Vec2Id = 4;
|
||||
|
||||
static constexpr uint32_t testSetId0 = 0;
|
||||
static constexpr uint32_t testSetId1 = 1;
|
||||
static constexpr uint32_t testSetId2 = 2;
|
||||
static constexpr uint8_t dataSetMaxVariables = 10;
|
||||
|
||||
static const auto testSid0 = structure_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, testSetId0);
|
||||
static const auto testSid1 = structure_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, testSetId1);
|
||||
static const auto testSid2 = structure_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, testSetId2);
|
||||
|
||||
static const gp_id_t uint8VarGpid = gp_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, uint8VarId);
|
||||
static const gp_id_t floatVarGpid = gp_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, floatVarId);
|
||||
static const gp_id_t uint32Gpid = gp_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, uint32VarId);
|
||||
static const gp_id_t uint16Vec3Gpid = gp_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, uint16Vec3Id);
|
||||
static const gp_id_t uint64Vec2Id = gp_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, int64Vec2Id);
|
||||
} // namespace lpool
|
||||
|
||||
class LocalPoolStaticTestDataSet : public StaticSharedDataset<3> {
|
||||
public:
|
||||
LocalPoolStaticTestDataSet() : StaticSharedDataset(lpool::testSid1) {}
|
||||
|
||||
LocalPoolStaticTestDataSet(localpool::SharedPool& sharedPool, uint32_t setId)
|
||||
: StaticSharedDataset(sharedPool, setId) {}
|
||||
|
||||
lp_var_t<uint8_t> localPoolVarUint8 = lp_var_t<uint8_t>(lpool::uint8VarGpid, this);
|
||||
lp_var_t<float> localPoolVarFloat = lp_var_t<float>(lpool::floatVarGpid, this);
|
||||
lp_vec_t<uint16_t, 3> localPoolUint16Vec = lp_vec_t<uint16_t, 3>(lpool::uint16Vec3Gpid, this);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
class LocalPoolTestDataSet : public SharedDataSet {
|
||||
public:
|
||||
LocalPoolTestDataSet() : SharedDataSet(lpool::testSid2, lpool::dataSetMaxVariables) {}
|
||||
|
||||
LocalPoolTestDataSet(localpool::SharedPool& sharedPool, uint32_t setId)
|
||||
: SharedDataSet(sharedPool, setId, lpool::dataSetMaxVariables) {}
|
||||
|
||||
lp_var_t<uint8_t> localPoolVarUint8 = lp_var_t<uint8_t>(lpool::uint8VarGpid, this);
|
||||
lp_var_t<float> localPoolVarFloat = lp_var_t<float>(lpool::floatVarGpid, this);
|
||||
lp_vec_t<uint16_t, 3> localPoolUint16Vec = lp_vec_t<uint16_t, 3>(lpool::uint16Vec3Gpid, this);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
class LocalPoolOwnerBase : public SystemObject, public PeriodicHkGenerationIF {
|
||||
public:
|
||||
explicit LocalPoolOwnerBase(MessageQueueIF& queue, MessageQueueId_t hkDestId,
|
||||
object_id_t objectId = objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
|
||||
~LocalPoolOwnerBase() override;
|
||||
|
||||
[[nodiscard]] object_id_t getObjectId() const override { return SystemObject::getObjectId(); }
|
||||
|
||||
ReturnValue_t serializeHkDataset(structure_id_t structureId, uint8_t* buf,
|
||||
size_t maxSize) override;
|
||||
|
||||
ReturnValue_t specifyHkDatasets(std::vector<periodicHk::SetSpecification>& setList) override;
|
||||
|
||||
localpool::SharedPool* getOptionalSharedPool() override;
|
||||
ReturnValue_t initialize() override;
|
||||
|
||||
void setHkDestId(MessageQueueId_t id);
|
||||
|
||||
/** Command queue for housekeeping messages. */
|
||||
[[nodiscard]] MessageQueueId_t getCommandQueue() const override { return queue.getId(); }
|
||||
|
||||
LocalPoolObjectBase* getPoolObjectHandle(lp_id_t localPoolId) override;
|
||||
|
||||
[[nodiscard]] MessageQueueMock& getMockQueueHandle() const {
|
||||
return dynamic_cast<MessageQueueMock&>(queue);
|
||||
}
|
||||
|
||||
ReturnValue_t subscribePeriodicHk(bool enableReporting) {
|
||||
return hkHelper.enablePeriodicPacket(lpool::testSid0, 50);
|
||||
}
|
||||
|
||||
ReturnValue_t reset();
|
||||
|
||||
PeriodicHkGenerationHelper hkHelper;
|
||||
localpool::SharedPool sharedPool;
|
||||
LocalPoolTestDataSet set1;
|
||||
LocalPoolStaticTestDataSet set2;
|
||||
|
||||
private:
|
||||
PoolEntry<uint8_t> u8PoolEntry = PoolEntry<uint8_t>({0});
|
||||
PoolEntry<float> floatPoolEntry = PoolEntry<float>({0});
|
||||
PoolEntry<uint32_t> u32PoolEntry = PoolEntry<uint32_t>({0});
|
||||
PoolEntry<uint16_t> u16VecPoolEntry = PoolEntry<uint16_t>({0, 0, 0});
|
||||
PoolEntry<int64_t> i64VecPoolEntry = PoolEntry<int64_t>({0, 0});
|
||||
|
||||
lp_var_t<uint8_t> testUint8 = lp_var_t<uint8_t>(sharedPool, lpool::uint8VarId);
|
||||
lp_var_t<float> testFloat = lp_var_t<float>(sharedPool, lpool::floatVarId);
|
||||
lp_var_t<uint32_t> testUint32 = lp_var_t<uint32_t>(sharedPool, lpool::uint32VarId);
|
||||
lp_vec_t<uint16_t, 3> testUint16Vec = lp_vec_t<uint16_t, 3>(sharedPool, lpool::uint16Vec3Id);
|
||||
lp_vec_t<int64_t, 2> testInt64Vec = lp_vec_t<int64_t, 2>(sharedPool, lpool::int64Vec2Id);
|
||||
|
||||
MessageQueueIF& queue;
|
||||
|
||||
bool initialized = false;
|
||||
bool initializedAfterTaskCreation = false;
|
||||
};
|
||||
|
||||
#endif /* FSFW_UNITTEST_TESTS_DATAPOOLLOCAL_LOCALPOOLOWNERBASE_H_ */
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "mocks/PowerSwitcherMock.h"
|
||||
#include "mock/PowerSwitcherMock.h"
|
||||
#include "objects/systemObjectList.h"
|
||||
|
||||
TEST_CASE("Power Switcher", "[power-switcher]") {
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <array>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "mocks/SimpleSerializable.h"
|
||||
#include "mock/SimpleSerializable.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -4,9 +4,9 @@
|
||||
#include "fsfw/storagemanager/LocalPool.h"
|
||||
#include "fsfw/tcdistribution/CcsdsDistributor.h"
|
||||
#include "fsfw/tmtcpacket/ccsds/SpacePacketCreator.h"
|
||||
#include "mocks/AcceptsTcMock.h"
|
||||
#include "mocks/CcsdsCheckerMock.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "mock/AcceptsTcMock.h"
|
||||
#include "mock/CcsdsCheckerMock.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
|
||||
TEST_CASE("CCSDS Distributor", "[ccsds][tmtcdistrib]") {
|
||||
LocalPool::LocalPoolConfig cfg = {{5, 32}, {2, 64}};
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "fsfw/globalfunctions/CRC.h"
|
||||
#include "fsfw/tmtcpacket/pus/tc.h"
|
||||
#include "mocks/SimpleSerializable.h"
|
||||
#include "mock/SimpleSerializable.h"
|
||||
|
||||
TEST_CASE("PUS TC Creator", "[pus-tc-creator]") {
|
||||
auto packetId = PacketId(ccsds::PacketType::TC, true, 0x02);
|
||||
|
@ -3,8 +3,8 @@
|
||||
#include "fsfw/globalfunctions/CRC.h"
|
||||
#include "fsfw/globalfunctions/arrayprinter.h"
|
||||
#include "fsfw/tmtcpacket/pus/tm.h"
|
||||
#include "mocks/CdsShortTimestamperMock.h"
|
||||
#include "mocks/SimpleSerializable.h"
|
||||
#include "mock/CdsShortTimestamperMock.h"
|
||||
#include "mock/SimpleSerializable.h"
|
||||
|
||||
TEST_CASE("PUS TM Creator", "[pus-tm-creator]") {
|
||||
auto packetId = PacketId(ccsds::PacketType::TC, true, 0xef);
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "fsfw/tmtcpacket/pus/tm/PusTmCreator.h"
|
||||
#include "fsfw/tmtcpacket/pus/tm/PusTmReader.h"
|
||||
#include "mocks/CdsShortTimestamperMock.h"
|
||||
#include "mock/CdsShortTimestamperMock.h"
|
||||
|
||||
TEST_CASE("PUS TM Reader", "[pus-tm-reader]") {
|
||||
auto packetId = PacketId(ccsds::PacketType::TC, true, 0xef);
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "fsfw/globalfunctions/CRC.h"
|
||||
#include "fsfw/tmtcpacket/pus/tm.h"
|
||||
#include "fsfw/tmtcpacket/pus/tm/PusTmZcWriter.h"
|
||||
#include "mocks/CdsShortTimestamperMock.h"
|
||||
#include "mock/CdsShortTimestamperMock.h"
|
||||
|
||||
TEST_CASE("TM ZC Helper", "[tm-zc-helper]") {
|
||||
auto packetId = PacketId(ccsds::PacketType::TC, true, 0xef);
|
||||
|
@ -3,13 +3,13 @@
|
||||
#include "fsfw/ipc/QueueFactory.h"
|
||||
#include "fsfw/storagemanager/LocalPool.h"
|
||||
#include "fsfw/storagemanager/PoolManager.h"
|
||||
#include "mocks/AcceptsTmMock.h"
|
||||
#include "mocks/CdsShortTimestamperMock.h"
|
||||
#include "mocks/InternalErrorReporterMock.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "mocks/PusDistributorMock.h"
|
||||
#include "mocks/PusServiceBaseMock.h"
|
||||
#include "mocks/PusVerificationReporterMock.h"
|
||||
#include "mock/AcceptsTmMock.h"
|
||||
#include "mock/CdsShortTimestamperMock.h"
|
||||
#include "mock/InternalErrorReporterMock.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
#include "mock/PusDistributorMock.h"
|
||||
#include "mock/PusServiceBaseMock.h"
|
||||
#include "mock/PusVerificationReporterMock.h"
|
||||
|
||||
TEST_CASE("Pus Service Base", "[pus-service-base]") {
|
||||
uint16_t apid = 2;
|
||||
|
@ -3,9 +3,9 @@
|
||||
#include "fsfw/storagemanager/LocalPool.h"
|
||||
#include "fsfw/tmtcservices/TmSendHelper.h"
|
||||
#include "fsfw/tmtcservices/TmStoreHelper.h"
|
||||
#include "mocks/CdsShortTimestamperMock.h"
|
||||
#include "mocks/InternalErrorReporterMock.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "mock/CdsShortTimestamperMock.h"
|
||||
#include "mock/InternalErrorReporterMock.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
|
||||
TEST_CASE("TM Send Helper", "[tm-send-helper]") {
|
||||
MessageQueueId_t destId = 2;
|
||||
|
@ -4,10 +4,10 @@
|
||||
#include "fsfw/tmtcservices/TmSendHelper.h"
|
||||
#include "fsfw/tmtcservices/TmStoreAndSendHelper.h"
|
||||
#include "fsfw/tmtcservices/TmStoreHelper.h"
|
||||
#include "mocks/CdsShortTimestamperMock.h"
|
||||
#include "mocks/InternalErrorReporterMock.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "mocks/SimpleSerializable.h"
|
||||
#include "mock/CdsShortTimestamperMock.h"
|
||||
#include "mock/InternalErrorReporterMock.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
#include "mock/SimpleSerializable.h"
|
||||
|
||||
TEST_CASE("TM Store And Send Helper", "[tm-store-send-helper]") {
|
||||
auto timeStamper = CdsShortTimestamperMock();
|
||||
|
@ -3,8 +3,8 @@
|
||||
#include "fsfw/storagemanager/LocalPool.h"
|
||||
#include "fsfw/tmtcservices/TmStoreHelper.h"
|
||||
#include "fsfw/tmtcservices/tmHelpers.h"
|
||||
#include "mocks/CdsShortTimestamperMock.h"
|
||||
#include "mocks/SimpleSerializable.h"
|
||||
#include "mock/CdsShortTimestamperMock.h"
|
||||
#include "mock/SimpleSerializable.h"
|
||||
|
||||
TEST_CASE("TM Store Helper", "[tm-store-helper]") {
|
||||
auto timeStamper = CdsShortTimestamperMock();
|
||||
|
Loading…
x
Reference in New Issue
Block a user