continue fixing tests
This commit is contained in:
parent
8ef93705eb
commit
639b210666
@ -123,8 +123,7 @@ option(FSFW_ADD_SGP4_PROPAGATOR "Add SGP4 propagator code" OFF)
|
|||||||
set(FSFW_TEST_TGT fsfw-tests)
|
set(FSFW_TEST_TGT fsfw-tests)
|
||||||
set(FSFW_DUMMY_TGT fsfw-dummy)
|
set(FSFW_DUMMY_TGT fsfw-dummy)
|
||||||
|
|
||||||
add_library(${LIB_FSFW_NAME} src/fsfw/housekeeping/PeriodicHkHelperIF.h
|
add_library(${LIB_FSFW_NAME})
|
||||||
src/fsfw/housekeeping/definitions.h)
|
|
||||||
|
|
||||||
if(IPO_SUPPORTED AND FSFW_ENABLE_IPO)
|
if(IPO_SUPPORTED AND FSFW_ENABLE_IPO)
|
||||||
set_property(TARGET ${LIB_FSFW_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION
|
set_property(TARGET ${LIB_FSFW_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION
|
||||||
|
@ -68,13 +68,9 @@ ReturnValue_t SharedSetBase::unlockDataPool() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SharedSetBase::serializeLocalPoolIds(uint8_t **buffer, size_t *size, size_t maxSize,
|
ReturnValue_t SharedSetBase::serializeLocalPoolIds(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||||
SerializeIF::Endianness streamEndianness,
|
SerializeIF::Endianness streamEndianness) const {
|
||||||
bool serializeFillCount) const {
|
|
||||||
/* Serialize fill count as uint8_t */
|
/* Serialize fill count as uint8_t */
|
||||||
auto fillCount = this->getFillCount();
|
auto fillCount = this->getFillCount();
|
||||||
if (serializeFillCount) {
|
|
||||||
SerializeAdapter::serialize(&fillCount, buffer, size, maxSize, streamEndianness);
|
|
||||||
}
|
|
||||||
for (uint16_t count = 0; count < fillCount; count++) {
|
for (uint16_t count = 0; count < fillCount; count++) {
|
||||||
id_t currentPoolId = base.registeredVariables[count]->getDataPoolId();
|
id_t currentPoolId = base.registeredVariables[count]->getDataPoolId();
|
||||||
auto result =
|
auto result =
|
||||||
@ -94,12 +90,8 @@ ReturnValue_t SharedSetBase::serializeLocalPoolIds(uint8_t **buffer, size_t *siz
|
|||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t SharedSetBase::getLocalPoolIdsSerializedSize(bool serializeFillCount) const {
|
size_t SharedSetBase::getLocalPoolIdsSerializedSize() const {
|
||||||
if (serializeFillCount) {
|
return base.getFillCount() * sizeof(id_t);
|
||||||
return base.getFillCount() * sizeof(id_t) + sizeof(u8_t);
|
|
||||||
} else {
|
|
||||||
return base.getFillCount() * sizeof(id_t);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t SharedSetBase::getSerializedSize() const { return base.getSerializedSize(); }
|
size_t SharedSetBase::getSerializedSize() const { return base.getSerializedSize(); }
|
||||||
@ -126,7 +118,7 @@ void SharedSetBase::setReportingEnabled(bool reportingEnabled) {
|
|||||||
|
|
||||||
bool SharedSetBase::getReportingEnabled() const { return reportingEnabled; }
|
bool SharedSetBase::getReportingEnabled() const { return reportingEnabled; }
|
||||||
|
|
||||||
structure_id_t SharedSetBase::getSid() const { return sid; }
|
structure_id_t SharedSetBase::getStructureId() const { return sid; }
|
||||||
|
|
||||||
object_id_t SharedSetBase::getCreatorObjectId() {
|
object_id_t SharedSetBase::getCreatorObjectId() {
|
||||||
if (sharedPool != nullptr) {
|
if (sharedPool != nullptr) {
|
||||||
|
@ -118,14 +118,13 @@ class SharedSetBase : public SerializeIF, public PoolDataSetIF {
|
|||||||
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
Endianness streamEndianness) override;
|
Endianness streamEndianness) override;
|
||||||
|
|
||||||
[[nodiscard]] dp::sid_t getSid() const;
|
[[nodiscard]] dp::sid_t getStructureId() const;
|
||||||
|
|
||||||
[[nodiscard]] size_t getSerializedSize() const override;
|
[[nodiscard]] size_t getSerializedSize() const override;
|
||||||
|
|
||||||
ReturnValue_t serializeLocalPoolIds(uint8_t** buffer, size_t* size, size_t maxSize,
|
ReturnValue_t serializeLocalPoolIds(uint8_t** buffer, size_t* size, size_t maxSize,
|
||||||
SerializeIF::Endianness streamEndianness,
|
SerializeIF::Endianness streamEndianness) const;
|
||||||
bool serializeFillCount = true) const;
|
[[nodiscard]] size_t getLocalPoolIdsSerializedSize() const;
|
||||||
[[nodiscard]] size_t getLocalPoolIdsSerializedSize(bool serializeFillCount = true) const;
|
|
||||||
|
|
||||||
object_id_t getCreatorObjectId();
|
object_id_t getCreatorObjectId();
|
||||||
|
|
||||||
|
@ -29,13 +29,16 @@ 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.
|
* Used as a unique identifier for data sets. Consists of 4 byte object ID and 4 byte set ID.
|
||||||
*/
|
*/
|
||||||
union structure_id_t {
|
union structure_id_t {
|
||||||
|
static constexpr size_t SIZE = sizeof(object_id_t) + sizeof(uint32_t);
|
||||||
|
|
||||||
static constexpr uint64_t INVALID_SID = -1;
|
static constexpr uint64_t INVALID_SID = -1;
|
||||||
static constexpr uint32_t INVALID_OBJECT_ID = objects::NO_OBJECT;
|
static constexpr uint32_t INVALID_OBJECT_ID = objects::NO_OBJECT;
|
||||||
static constexpr uint32_t INVALID_SET_ID = -1;
|
static constexpr uint32_t INVALID_SET_ID = -1;
|
||||||
|
|
||||||
structure_id_t() : raw(INVALID_SID) {}
|
structure_id_t() : raw(INVALID_SID) {}
|
||||||
|
|
||||||
structure_id_t(object_id_t objectId, uint32_t setId) : objectId(objectId), ownerSetId(setId) {}
|
constexpr structure_id_t(object_id_t objectId, uint32_t setId)
|
||||||
|
: objectId(objectId), ownerSetId(setId) {}
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
object_id_t objectId;
|
object_id_t objectId;
|
||||||
@ -51,7 +54,7 @@ union structure_id_t {
|
|||||||
*/
|
*/
|
||||||
uint64_t raw;
|
uint64_t raw;
|
||||||
|
|
||||||
bool notSet() const { return raw == INVALID_SID; }
|
[[nodiscard]] bool notSet() const { return raw == INVALID_SID; }
|
||||||
|
|
||||||
bool operator==(const structure_id_t& other) const { return raw == other.raw; }
|
bool operator==(const structure_id_t& other) const { return raw == other.raw; }
|
||||||
|
|
||||||
|
@ -67,6 +67,9 @@ ReturnValue_t PeriodicHelper::performHkOperation() {
|
|||||||
// Periodic packets shall only be generated from datasets
|
// Periodic packets shall only be generated from datasets
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (not setSpec.periodicCollectionEnabled) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
performPeriodicHkGeneration(setSpec, now);
|
performPeriodicHkGeneration(setSpec, now);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -141,20 +144,24 @@ ReturnValue_t PeriodicHelper::generateHousekeepingPacket(const dp::sid_t sid,
|
|||||||
}
|
}
|
||||||
auto& setSpec = optSetSpec.value().get();
|
auto& setSpec = optSetSpec.value().get();
|
||||||
uint8_t* dataPtr = nullptr;
|
uint8_t* dataPtr = nullptr;
|
||||||
const size_t maxSize = setSpec.size;
|
const size_t maxSize = setSpec.size + dp::structure_id_t::SIZE;
|
||||||
ReturnValue_t result = ipcStore->getFreeElement(&storeId, maxSize, &dataPtr);
|
ReturnValue_t result = ipcStore->getFreeElement(&storeId, maxSize, &dataPtr);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = owner->serializeHkDataset(sid, dataPtr, maxSize);
|
size_t serSize = 0;
|
||||||
|
result = SerializeAdapter::serialize(&sid.objectId, &dataPtr, &serSize, maxSize,
|
||||||
|
SerializeIF::Endianness::NETWORK);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
HousekeepingPacketDownlink hkPacket(sid, dataPtr, maxSize);
|
result = SerializeAdapter::serialize(&sid.ownerSetId, &dataPtr, &serSize, maxSize,
|
||||||
|
SerializeIF::Endianness::NETWORK);
|
||||||
size_t serializedSize = 0;
|
if (result != returnvalue::OK) {
|
||||||
result = hkPacket.serialize(&dataPtr, &serializedSize, maxSize, SerializeIF::Endianness::NETWORK);
|
return result;
|
||||||
if (result != returnvalue::OK or serializedSize == 0) {
|
}
|
||||||
|
result = owner->serializeHkDataset(sid, dataPtr, maxSize - 8);
|
||||||
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,13 +189,6 @@ ReturnValue_t PeriodicHelper::generateHousekeepingPacket(const dp::sid_t sid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PeriodicHelper::performPeriodicHkGeneration(SetSpecification& setSpec, timeval& now) {
|
void PeriodicHelper::performPeriodicHkGeneration(SetSpecification& setSpec, timeval& now) {
|
||||||
if (not setSpec.periodicCollectionEnabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// timeval now{};
|
|
||||||
Clock::getClockMonotonic(&now);
|
|
||||||
|
|
||||||
dp::sid_t sid = setSpec.dataId.sid;
|
dp::sid_t sid = setSpec.dataId.sid;
|
||||||
|
|
||||||
timeval diff = now - setSpec.lastGenerated;
|
timeval diff = now - setSpec.lastGenerated;
|
||||||
|
@ -154,7 +154,7 @@ void InternalErrorReporter::setMutexTimeout(MutexIF::TimeoutType timeoutType, ui
|
|||||||
|
|
||||||
ReturnValue_t InternalErrorReporter::serializeHkDataset(dp::structure_id_t structureId,
|
ReturnValue_t InternalErrorReporter::serializeHkDataset(dp::structure_id_t structureId,
|
||||||
uint8_t *buf, size_t maxSize) {
|
uint8_t *buf, size_t maxSize) {
|
||||||
if (structureId == internalErrorDataset.getSid()) {
|
if (structureId == internalErrorDataset.getStructureId()) {
|
||||||
size_t serSize = 0;
|
size_t serSize = 0;
|
||||||
return internalErrorDataset.serialize(buf, serSize, maxSize, SerializeIF::Endianness::NETWORK);
|
return internalErrorDataset.serialize(buf, serSize, maxSize, SerializeIF::Endianness::NETWORK);
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ ReturnValue_t InternalErrorReporter::serializeHkDataset(dp::structure_id_t struc
|
|||||||
|
|
||||||
ReturnValue_t InternalErrorReporter::specifyHkDatasets(
|
ReturnValue_t InternalErrorReporter::specifyHkDatasets(
|
||||||
std::vector<hk::SetSpecification> &setSpecification) {
|
std::vector<hk::SetSpecification> &setSpecification) {
|
||||||
setSpecification.emplace_back(internalErrorDataset.getSid(),
|
setSpecification.emplace_back(internalErrorDataset.getStructureId(),
|
||||||
internalErrorDataset.getSerializedSize(), generationFrequency);
|
internalErrorDataset.getSerializedSize(), generationFrequency);
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,12 @@ class List : public SerializeIF {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] ReturnValue_t serialize(uint8_t *buffer, size_t &serSize, size_t maxSize,
|
||||||
|
Endianness streamEndianness) const override {
|
||||||
|
return SerializeIF::serialize(buffer, serSize, maxSize, streamEndianness);
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] size_t getSerializedSize() const override {
|
[[nodiscard]] size_t getSerializedSize() const override {
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
for (auto &serializable : serializables) {
|
for (auto &serializable : serializables) {
|
||||||
|
@ -68,8 +68,8 @@ class SerializeAdapter {
|
|||||||
* - @c returnvalue::OK Successful serialization
|
* - @c returnvalue::OK Successful serialization
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static ReturnValue_t serialize(const T *object, uint8_t *const buffer, size_t *serSize,
|
static ReturnValue_t serialize(const T *object, uint8_t *buffer, size_t *serSize, size_t maxSize,
|
||||||
size_t maxSize, SerializeIF::Endianness streamEndianness) {
|
SerializeIF::Endianness streamEndianness) {
|
||||||
if (object == nullptr or buffer == nullptr) {
|
if (object == nullptr or buffer == nullptr) {
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
@ -18,19 +18,18 @@ TEST_CASE("DataSetTest", "[DataSetTest]") {
|
|||||||
auto queue = MessageQueueMock(1);
|
auto queue = MessageQueueMock(1);
|
||||||
TestPoolOwner poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
TestPoolOwner poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||||
poolOwner.initialize();
|
poolOwner.initialize();
|
||||||
StaticTestDataSet localSet;
|
StaticTestDataset localSet;
|
||||||
|
|
||||||
SECTION("BasicTest") {
|
SECTION("BasicTest") {
|
||||||
/* Test some basic functions */
|
/* Test some basic functions */
|
||||||
CHECK(localSet.getReportingEnabled() == false);
|
CHECK(localSet.getReportingEnabled() == false);
|
||||||
CHECK(localSet.getLocalPoolIdsSerializedSize(false) == 3 * sizeof(dp::id_t));
|
CHECK(localSet.getLocalPoolIdsSerializedSize() == 3 * sizeof(dp::id_t));
|
||||||
CHECK(localSet.getLocalPoolIdsSerializedSize(true) == 3 * sizeof(dp::id_t) + sizeof(uint8_t));
|
CHECK(localSet.getStructureId() == lpool::testSid1);
|
||||||
CHECK(localSet.getSid() == lpool::testSid0);
|
|
||||||
CHECK(localSet.getCreatorObjectId() == objects::TEST_LOCAL_POOL_OWNER_BASE);
|
CHECK(localSet.getCreatorObjectId() == objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||||
size_t maxSize = localSet.getLocalPoolIdsSerializedSize(true);
|
size_t maxSize = localSet.getLocalPoolIdsSerializedSize();
|
||||||
uint8_t localPoolIdBuff[maxSize];
|
uint8_t localPoolIdBuff[maxSize];
|
||||||
// Skip size field
|
// Skip size field
|
||||||
auto* lpIds = reinterpret_cast<id_t*>(localPoolIdBuff + 1);
|
auto* lpIds = reinterpret_cast<id_t*>(localPoolIdBuff);
|
||||||
size_t serSize = 0;
|
size_t serSize = 0;
|
||||||
auto* localPoolIdBuffPtr = reinterpret_cast<uint8_t*>(localPoolIdBuff);
|
auto* localPoolIdBuffPtr = reinterpret_cast<uint8_t*>(localPoolIdBuff);
|
||||||
|
|
||||||
@ -38,7 +37,7 @@ TEST_CASE("DataSetTest", "[DataSetTest]") {
|
|||||||
CHECK(localSet.serializeLocalPoolIds(&localPoolIdBuffPtr, &serSize, maxSize,
|
CHECK(localSet.serializeLocalPoolIds(&localPoolIdBuffPtr, &serSize, maxSize,
|
||||||
SerializeIF::Endianness::MACHINE) == returnvalue::OK);
|
SerializeIF::Endianness::MACHINE) == returnvalue::OK);
|
||||||
CHECK(serSize == maxSize);
|
CHECK(serSize == maxSize);
|
||||||
CHECK(localPoolIdBuff[0] == 3);
|
// CHECK(localPoolIdBuff[0] == 3);
|
||||||
CHECK(lpIds[0] == localSet.localPoolVarUint8.getDataPoolId());
|
CHECK(lpIds[0] == localSet.localPoolVarUint8.getDataPoolId());
|
||||||
CHECK(lpIds[1] == localSet.localPoolVarFloat.getDataPoolId());
|
CHECK(lpIds[1] == localSet.localPoolVarFloat.getDataPoolId());
|
||||||
CHECK(lpIds[2] == localSet.localPoolUint16Vec.getDataPoolId());
|
CHECK(lpIds[2] == localSet.localPoolUint16Vec.getDataPoolId());
|
||||||
@ -47,8 +46,8 @@ TEST_CASE("DataSetTest", "[DataSetTest]") {
|
|||||||
localPoolIdBuffPtr = localPoolIdBuff;
|
localPoolIdBuffPtr = localPoolIdBuff;
|
||||||
serSize = 0;
|
serSize = 0;
|
||||||
CHECK(localSet.serializeLocalPoolIds(&localPoolIdBuffPtr, &serSize, maxSize,
|
CHECK(localSet.serializeLocalPoolIds(&localPoolIdBuffPtr, &serSize, maxSize,
|
||||||
SerializeIF::Endianness::MACHINE, false) == OK);
|
SerializeIF::Endianness::MACHINE) == OK);
|
||||||
CHECK(serSize == maxSize - sizeof(uint8_t));
|
CHECK(serSize == maxSize);
|
||||||
CHECK(lpIds[0] == localSet.localPoolVarUint8.getDataPoolId());
|
CHECK(lpIds[0] == localSet.localPoolVarUint8.getDataPoolId());
|
||||||
CHECK(lpIds[1] == localSet.localPoolVarFloat.getDataPoolId());
|
CHECK(lpIds[1] == localSet.localPoolVarFloat.getDataPoolId());
|
||||||
CHECK(lpIds[2] == localSet.localPoolUint16Vec.getDataPoolId());
|
CHECK(lpIds[2] == localSet.localPoolUint16Vec.getDataPoolId());
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
|
|
||||||
using namespace lpool;
|
using namespace lpool;
|
||||||
|
|
||||||
TEST_CASE("Local Pool Manager Tests", "[LocManTest]") {
|
TEST_CASE("Pool Owner and Periodic HK", "[datapool]") {
|
||||||
const MessageQueueId_t defaultDestId = 1;
|
constexpr MessageQueueId_t defaultDestId = 1;
|
||||||
const MessageQueueId_t hkDest = defaultDestId;
|
constexpr MessageQueueId_t hkDest = defaultDestId;
|
||||||
const MessageQueueId_t subscriberId = 2;
|
const MessageQueueId_t subscriberId = 2;
|
||||||
auto hkReceiver = HkReceiverMock(hkDest);
|
auto hkReceiver = HkReceiverMock(hkDest);
|
||||||
auto queue = MessageQueueMock(3);
|
auto queue = MessageQueueMock(3);
|
||||||
@ -47,7 +47,7 @@ TEST_CASE("Local Pool Manager Tests", "[LocManTest]") {
|
|||||||
// the temporal behaviour correctly the HK manager should generate a HK packet
|
// the temporal behaviour correctly the HK manager should generate a HK packet
|
||||||
// immediately and the periodic helper depends on HK op function calls anyway instead of
|
// immediately and the periodic helper depends on HK op function calls anyway instead of
|
||||||
// using the clock, so we could also just call performHkOperation multiple times
|
// using the clock, so we could also just call performHkOperation multiple times
|
||||||
REQUIRE(poolOwner.subscribePeriodicHk(true) == returnvalue::OK);
|
REQUIRE(poolOwner.enablePeriodicHk(lpool::testSid0, 30) == returnvalue::OK);
|
||||||
REQUIRE(poolOwner.hkHelper.performHkOperation() == returnvalue::OK);
|
REQUIRE(poolOwner.hkHelper.performHkOperation() == returnvalue::OK);
|
||||||
// Now HK packet should be sent as message immediately.
|
// Now HK packet should be sent as message immediately.
|
||||||
REQUIRE(poolOwnerMock.wasMessageSent());
|
REQUIRE(poolOwnerMock.wasMessageSent());
|
||||||
|
@ -17,8 +17,7 @@ TEST_CASE("LocalPoolVector", "[LocPoolVecTest]") {
|
|||||||
|
|
||||||
SECTION("BasicTest") {
|
SECTION("BasicTest") {
|
||||||
// very basic test.
|
// very basic test.
|
||||||
vec_t<uint16_t, 3> testVector =
|
auto testVector = vec_t<uint16_t, 3>(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint16Vec3Id);
|
||||||
vec_t<uint16_t, 3>(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint16Vec3Id);
|
|
||||||
REQUIRE(testVector.read() == returnvalue::OK);
|
REQUIRE(testVector.read() == returnvalue::OK);
|
||||||
testVector.value[0] = 5;
|
testVector.value[0] = 5;
|
||||||
testVector.value[1] = 232;
|
testVector.value[1] = 232;
|
||||||
|
@ -31,10 +31,25 @@ SharedPool *TestPoolOwner::getOptionalSharedPool() { return &sharedPool; }
|
|||||||
|
|
||||||
ReturnValue_t TestPoolOwner::serializeHkDataset(structure_id_t structureId, uint8_t *buf,
|
ReturnValue_t TestPoolOwner::serializeHkDataset(structure_id_t structureId, uint8_t *buf,
|
||||||
size_t maxSize) {
|
size_t maxSize) {
|
||||||
return returnvalue::OK;
|
size_t dummy = 0;
|
||||||
|
if (structureId == testSid0) {
|
||||||
|
return set0.serialize(buf, dummy, maxSize, SerializeIF::Endianness::NETWORK);
|
||||||
|
}
|
||||||
|
if (structureId == testSid1) {
|
||||||
|
return set1.serialize(buf, dummy, maxSize, SerializeIF::Endianness::NETWORK);
|
||||||
|
}
|
||||||
|
if (structureId == testSid2) {
|
||||||
|
return set2.serialize(buf, dummy, maxSize, SerializeIF::Endianness::NETWORK);
|
||||||
|
}
|
||||||
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t TestPoolOwner::specifyHkDatasets(std::vector<hk::SetSpecification> &setList) {
|
ReturnValue_t TestPoolOwner::specifyHkDatasets(std::vector<hk::SetSpecification> &setList) {
|
||||||
|
// For the first set, we explicitely associate a set with an ID ourselves.
|
||||||
|
setList.emplace_back(testSid0, set0.getSerializedSize(), 50);
|
||||||
|
// For the other sets, we can use getter functions of the same structure.
|
||||||
|
setList.emplace_back(set1.getStructureId(), set1.getSerializedSize(), 50);
|
||||||
|
setList.emplace_back(set2.getStructureId(), set2.getSerializedSize(), 50);
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,16 +32,17 @@ class TestPoolOwner : public SystemObject, public hk::GeneratesPeriodicHkIF {
|
|||||||
return dynamic_cast<MessageQueueMock&>(queue);
|
return dynamic_cast<MessageQueueMock&>(queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t subscribePeriodicHk(bool enableReporting) {
|
ReturnValue_t enablePeriodicHk(dp::structure_id_t structureId, dur_millis_t frequencyMs) {
|
||||||
return hkHelper.enablePeriodicPacket(lpool::testSid0, 50);
|
return hkHelper.enablePeriodicPacket(structureId, frequencyMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t reset();
|
ReturnValue_t reset();
|
||||||
|
|
||||||
hk::PeriodicHelper hkHelper;
|
hk::PeriodicHelper hkHelper;
|
||||||
SharedPool sharedPool;
|
SharedPool sharedPool;
|
||||||
LocalPoolTestDataSet set1;
|
Dataset set0;
|
||||||
StaticTestDataSet set2;
|
StaticTestDataset set1;
|
||||||
|
TestDataset set2;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PoolEntry<uint8_t> u8PoolEntry = PoolEntry<uint8_t>({0});
|
PoolEntry<uint8_t> u8PoolEntry = PoolEntry<uint8_t>({0});
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include <fsfw/datapool.h>
|
#include <fsfw/datapool.h>
|
||||||
#include <fsfw/ipc/QueueFactory.h>
|
#include <fsfw/ipc/QueueFactory.h>
|
||||||
#include <fsfw/objectmanager/SystemObject.h>
|
#include <fsfw/objectmanager/SystemObject.h>
|
||||||
|
#include <fsfw/serialize/SerializableList.h>
|
||||||
|
#include <fsfw/serialize/SerializableListElement.h>
|
||||||
|
|
||||||
#include "fsfw/datapool/PoolEntry.h"
|
#include "fsfw/datapool/PoolEntry.h"
|
||||||
#include "mock/MessageQueueMock.h"
|
#include "mock/MessageQueueMock.h"
|
||||||
@ -11,6 +13,7 @@
|
|||||||
namespace lpool {
|
namespace lpool {
|
||||||
|
|
||||||
using namespace dp;
|
using namespace dp;
|
||||||
|
using namespace serialize;
|
||||||
|
|
||||||
static constexpr id_t uint8VarId = 0;
|
static constexpr id_t uint8VarId = 0;
|
||||||
static constexpr id_t floatVarId = 1;
|
static constexpr id_t floatVarId = 1;
|
||||||
@ -23,9 +26,9 @@ static constexpr uint32_t testSetId1 = 1;
|
|||||||
static constexpr uint32_t testSetId2 = 2;
|
static constexpr uint32_t testSetId2 = 2;
|
||||||
static constexpr uint8_t dataSetMaxVariables = 10;
|
static constexpr uint8_t dataSetMaxVariables = 10;
|
||||||
|
|
||||||
static const auto testSid0 = structure_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, testSetId0);
|
static constexpr 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 constexpr 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 constexpr 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 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 floatVarGpid = g_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, floatVarId);
|
||||||
@ -33,11 +36,18 @@ static const g_id_t uint32Gpid = g_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, uin
|
|||||||
static const g_id_t uint16Vec3Gpid = g_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, uint16Vec3Id);
|
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);
|
static const g_id_t uint64Vec2Id = g_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, int64Vec2Id);
|
||||||
|
|
||||||
class StaticTestDataSet : public StaticSharedSet<3> {
|
class Dataset : public List {
|
||||||
public:
|
public:
|
||||||
StaticTestDataSet() : StaticSharedSet(lpool::testSid1) {}
|
LE<uint8_t> u8Element{*this};
|
||||||
|
LE<uint16_t> u16Element{*this};
|
||||||
|
LAE<float, 3> floatVec{*this};
|
||||||
|
};
|
||||||
|
|
||||||
StaticTestDataSet(SharedPool& sharedPool, uint32_t setId) : StaticSharedSet(sharedPool, setId) {}
|
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};
|
u8_t localPoolVarUint8{lpool::uint8VarGpid, this};
|
||||||
f32_t localPoolVarFloat{lpool::floatVarGpid, this};
|
f32_t localPoolVarFloat{lpool::floatVarGpid, this};
|
||||||
@ -46,11 +56,11 @@ class StaticTestDataSet : public StaticSharedSet<3> {
|
|||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
class LocalPoolTestDataSet : public SharedSet {
|
class TestDataset : public SharedSet {
|
||||||
public:
|
public:
|
||||||
LocalPoolTestDataSet() : SharedSet(lpool::testSid2, lpool::dataSetMaxVariables) {}
|
TestDataset() : SharedSet(lpool::testSid2, lpool::dataSetMaxVariables) {}
|
||||||
|
|
||||||
LocalPoolTestDataSet(SharedPool& sharedPool, uint32_t setId)
|
TestDataset(SharedPool& sharedPool, uint32_t setId)
|
||||||
: SharedSet(sharedPool, setId, lpool::dataSetMaxVariables) {}
|
: SharedSet(sharedPool, setId, lpool::dataSetMaxVariables) {}
|
||||||
|
|
||||||
u8_t localPoolVarUint8{lpool::uint8VarGpid, this};
|
u8_t localPoolVarUint8{lpool::uint8VarGpid, this};
|
||||||
|
Loading…
Reference in New Issue
Block a user