Update FSFW from upstream #71
@ -10,7 +10,7 @@ void CFDPMessage::setCommand(CommandMessage *message, store_address_t cfdpPacket
|
|||||||
|
|
||||||
store_address_t CFDPMessage::getStoreId(const CommandMessage *message) {
|
store_address_t CFDPMessage::getStoreId(const CommandMessage *message) {
|
||||||
store_address_t storeAddressCFDPPacket;
|
store_address_t storeAddressCFDPPacket;
|
||||||
storeAddressCFDPPacket = message->getParameter();
|
storeAddressCFDPPacket = static_cast<store_address_t>(message->getParameter());
|
||||||
return storeAddressCFDPPacket;
|
return storeAddressCFDPPacket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ class HasLocalDataPoolIF {
|
|||||||
* clearing the store automatically
|
* clearing the store automatically
|
||||||
*/
|
*/
|
||||||
virtual void handleChangedDataset(sid_t sid,
|
virtual void handleChangedDataset(sid_t sid,
|
||||||
store_address_t storeId = storeId::INVALID_STORE_ADDRESS,
|
store_address_t storeId = store_address_t::invalid(),
|
||||||
bool* clearMessage = nullptr) {
|
bool* clearMessage = nullptr) {
|
||||||
if (clearMessage != nullptr) {
|
if (clearMessage != nullptr) {
|
||||||
*clearMessage = true;
|
*clearMessage = true;
|
||||||
@ -100,7 +100,7 @@ class HasLocalDataPoolIF {
|
|||||||
* after the callback.
|
* after the callback.
|
||||||
*/
|
*/
|
||||||
virtual void handleChangedPoolVariable(gp_id_t gpid,
|
virtual void handleChangedPoolVariable(gp_id_t gpid,
|
||||||
store_address_t storeId = storeId::INVALID_STORE_ADDRESS,
|
store_address_t storeId = store_address_t::invalid(),
|
||||||
bool* clearMessage = nullptr) {
|
bool* clearMessage = nullptr) {
|
||||||
if (clearMessage != nullptr) {
|
if (clearMessage != nullptr) {
|
||||||
*clearMessage = true;
|
*clearMessage = true;
|
||||||
|
@ -44,7 +44,7 @@ store_address_t ParameterMessage::getParameterLoadCommand(const CommandMessage*
|
|||||||
*pfc = packedParamSettings >> 16 & 0xff;
|
*pfc = packedParamSettings >> 16 & 0xff;
|
||||||
*rows = packedParamSettings >> 8 & 0xff;
|
*rows = packedParamSettings >> 8 & 0xff;
|
||||||
*columns = packedParamSettings & 0xff;
|
*columns = packedParamSettings & 0xff;
|
||||||
return message->getParameter2();
|
return static_cast<store_address_t>(message->getParameter2());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParameterMessage::clear(CommandMessage* message) {
|
void ParameterMessage::clear(CommandMessage* message) {
|
||||||
|
@ -3,26 +3,26 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace storeId {
|
|
||||||
static constexpr uint32_t INVALID_STORE_ADDRESS = 0xffffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This union defines the type that identifies where a data packet is
|
* This union defines the type that identifies where a data packet is
|
||||||
* stored in the store. It comprises of a raw part to read it as raw value and
|
* stored in the store. It comprises of a raw part to read it as raw value and
|
||||||
* a structured part to use it in pool-like stores.
|
* a structured part to use it in pool-like stores.
|
||||||
*/
|
*/
|
||||||
union store_address_t {
|
union store_address_t {
|
||||||
|
public:
|
||||||
|
static constexpr uint32_t INVALID_RAW = 0xffffffff;
|
||||||
/**
|
/**
|
||||||
* Default Constructor, initializing to INVALID_ADDRESS
|
* Default Constructor, initializing to INVALID_ADDRESS
|
||||||
*/
|
*/
|
||||||
store_address_t() : raw(storeId::INVALID_STORE_ADDRESS) {}
|
store_address_t() : raw(INVALID_RAW) {}
|
||||||
/**
|
/**
|
||||||
* Constructor to create an address object using the raw address
|
* Constructor to create an address object using the raw address
|
||||||
*
|
*
|
||||||
* @param rawAddress
|
* @param rawAddress
|
||||||
*/
|
*/
|
||||||
store_address_t(uint32_t rawAddress) : raw(rawAddress) {}
|
explicit store_address_t(uint32_t rawAddress) : raw(rawAddress) {}
|
||||||
|
|
||||||
|
static store_address_t invalid() { return {}; };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor to create an address object using pool
|
* Constructor to create an address object using pool
|
||||||
@ -52,6 +52,12 @@ union store_address_t {
|
|||||||
uint32_t raw;
|
uint32_t raw;
|
||||||
|
|
||||||
bool operator==(const store_address_t& other) const { return raw == other.raw; }
|
bool operator==(const store_address_t& other) const { return raw == other.raw; }
|
||||||
|
bool operator!=(const store_address_t& other) const { return raw != other.raw; }
|
||||||
|
|
||||||
|
store_address_t& operator=(const uint32_t rawAddr) {
|
||||||
|
raw = rawAddr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_STORAGEMANAGER_STOREADDRESS_H_ */
|
#endif /* FSFW_STORAGEMANAGER_STOREADDRESS_H_ */
|
||||||
|
@ -58,3 +58,5 @@ void TmStoreHelper::setTimeStamper(TimeStamperIF& timeStamper_) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TmStoreHelper::setApid(uint16_t apid) { creator.setApid(apid); }
|
void TmStoreHelper::setApid(uint16_t apid) { creator.setApid(apid); }
|
||||||
|
|
||||||
|
PusTmCreator& TmStoreHelper::getCreatorRef() { return creator; }
|
||||||
|
@ -15,6 +15,7 @@ class TmStoreHelper {
|
|||||||
|
|
||||||
ReturnValue_t preparePacket(uint8_t service, uint8_t subservice, uint16_t counter);
|
ReturnValue_t preparePacket(uint8_t service, uint8_t subservice, uint16_t counter);
|
||||||
|
|
||||||
|
PusTmCreator& getCreatorRef();
|
||||||
void setTimeStamper(TimeStamperIF& timeStamper);
|
void setTimeStamper(TimeStamperIF& timeStamper);
|
||||||
[[nodiscard]] const store_address_t& getCurrentAddr() const;
|
[[nodiscard]] const store_address_t& getCurrentAddr() const;
|
||||||
void setSourceDataRaw(const uint8_t* data, size_t len);
|
void setSourceDataRaw(const uint8_t* data, size_t len);
|
||||||
|
@ -166,7 +166,7 @@ ReturnValue_t TmTcBridge::handleTmQueue() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage* message) {
|
ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage* message) {
|
||||||
store_address_t storeId = 0;
|
store_address_t storeId;
|
||||||
if (tmFifo == nullptr) {
|
if (tmFifo == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ TEST_CASE("Action Helper", "[ActionHelper]") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SECTION("Handle failed") {
|
SECTION("Handle failed") {
|
||||||
store_address_t toLongParamAddress = StorageManagerIF::INVALID_ADDRESS;
|
store_address_t toLongParamAddress = store_address_t::invalid();
|
||||||
std::array<uint8_t, 5> toLongData = {5, 4, 3, 2, 1};
|
std::array<uint8_t, 5> toLongData = {5, 4, 3, 2, 1};
|
||||||
REQUIRE(ipcStore->addData(&toLongParamAddress, toLongData.data(), 5) == retval::CATCH_OK);
|
REQUIRE(ipcStore->addData(&toLongParamAddress, toLongData.data(), 5) == retval::CATCH_OK);
|
||||||
ActionMessage::setCommand(&actionMessage, testActionId, toLongParamAddress);
|
ActionMessage::setCommand(&actionMessage, testActionId, toLongParamAddress);
|
||||||
@ -98,7 +98,7 @@ TEST_CASE("Action Helper", "[ActionHelper]") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SECTION("Missing IPC Data") {
|
SECTION("Missing IPC Data") {
|
||||||
ActionMessage::setCommand(&actionMessage, testActionId, StorageManagerIF::INVALID_ADDRESS);
|
ActionMessage::setCommand(&actionMessage, testActionId, store_address_t::invalid());
|
||||||
CHECK(not testDhMock.executeActionCalled);
|
CHECK(not testDhMock.executeActionCalled);
|
||||||
REQUIRE(actionHelper.handleActionMessage(&actionMessage) == retval::CATCH_OK);
|
REQUIRE(actionHelper.handleActionMessage(&actionMessage) == retval::CATCH_OK);
|
||||||
CommandMessage testMessage;
|
CommandMessage testMessage;
|
||||||
|
@ -392,13 +392,13 @@ TEST_CASE("LocalPoolManagerTest", "[LocManTest]") {
|
|||||||
CHECK(gpidToCheck == lpool::uint8VarGpid);
|
CHECK(gpidToCheck == lpool::uint8VarGpid);
|
||||||
|
|
||||||
HousekeepingMessage::setUpdateSnapshotSetCommand(&hkCmd, lpool::testSid,
|
HousekeepingMessage::setUpdateSnapshotSetCommand(&hkCmd, lpool::testSid,
|
||||||
storeId::INVALID_STORE_ADDRESS);
|
store_address_t::invalid());
|
||||||
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
||||||
CHECK(poolOwner->changedDataSetCallbackWasCalled(sidToCheck, storeId) == true);
|
CHECK(poolOwner->changedDataSetCallbackWasCalled(sidToCheck, storeId) == true);
|
||||||
CHECK(sidToCheck == lpool::testSid);
|
CHECK(sidToCheck == lpool::testSid);
|
||||||
|
|
||||||
HousekeepingMessage::setUpdateSnapshotVariableCommand(&hkCmd, lpool::uint8VarGpid,
|
HousekeepingMessage::setUpdateSnapshotVariableCommand(&hkCmd, lpool::uint8VarGpid,
|
||||||
storeId::INVALID_STORE_ADDRESS);
|
store_address_t::invalid());
|
||||||
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
|
||||||
CHECK(poolOwner->changedVariableCallbackWasCalled(gpidToCheck, storeId) == true);
|
CHECK(poolOwner->changedVariableCallbackWasCalled(gpidToCheck, storeId) == true);
|
||||||
CHECK(gpidToCheck == lpool::uint8VarGpid);
|
CHECK(gpidToCheck == lpool::uint8VarGpid);
|
||||||
|
@ -90,7 +90,7 @@ bool LocalPoolOwnerBase::changedDataSetCallbackWasCalled(sid_t &sid, store_addre
|
|||||||
sid = changedDatasetSid;
|
sid = changedDatasetSid;
|
||||||
storeId = storeIdForChangedSet;
|
storeId = storeIdForChangedSet;
|
||||||
this->changedDatasetSid.raw = sid_t::INVALID_SID;
|
this->changedDatasetSid.raw = sid_t::INVALID_SID;
|
||||||
this->storeIdForChangedSet = storeId::INVALID_STORE_ADDRESS;
|
this->storeIdForChangedSet = store_address_t::invalid();
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ bool LocalPoolOwnerBase::changedVariableCallbackWasCalled(gp_id_t &gpid, store_a
|
|||||||
gpid = changedPoolVariableGpid;
|
gpid = changedPoolVariableGpid;
|
||||||
storeId = storeIdForChangedVariable;
|
storeId = storeIdForChangedVariable;
|
||||||
this->changedPoolVariableGpid.raw = gp_id_t::INVALID_GPID;
|
this->changedPoolVariableGpid.raw = gp_id_t::INVALID_GPID;
|
||||||
this->storeIdForChangedVariable = storeId::INVALID_STORE_ADDRESS;
|
this->storeIdForChangedVariable = store_address_t::invalid();
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ TEST_CASE("New Accessor", "[NewAccessor]") {
|
|||||||
REQUIRE(result == retval::CATCH_OK);
|
REQUIRE(result == retval::CATCH_OK);
|
||||||
{
|
{
|
||||||
StorageAccessor accessor(testStoreId);
|
StorageAccessor accessor(testStoreId);
|
||||||
StorageAccessor accessor2(0);
|
StorageAccessor accessor2(store_address_t::invalid());
|
||||||
accessor2 = std::move(accessor);
|
accessor2 = std::move(accessor);
|
||||||
REQUIRE(accessor.data() == nullptr);
|
REQUIRE(accessor.data() == nullptr);
|
||||||
std::array<uint8_t, 6> data;
|
std::array<uint8_t, 6> data;
|
||||||
|
@ -9,4 +9,21 @@ TEST_CASE("TM Store Helper", "[tm-store-helper]") {
|
|||||||
LocalPool::LocalPoolConfig cfg = {{10, 32}, {5, 64}};
|
LocalPool::LocalPoolConfig cfg = {{10, 32}, {5, 64}};
|
||||||
LocalPool pool(objects::NO_OBJECT, cfg);
|
LocalPool pool(objects::NO_OBJECT, cfg);
|
||||||
auto storeHelper = TmStoreHelper(2, pool, timeStamper);
|
auto storeHelper = TmStoreHelper(2, pool, timeStamper);
|
||||||
|
|
||||||
|
SECTION("State") {
|
||||||
|
REQUIRE(storeHelper.getCurrentAddr() == store_address_t::invalid());
|
||||||
|
REQUIRE(storeHelper.preparePacket(17, 1, 1) == HasReturnvaluesIF::RETURN_OK);
|
||||||
|
auto& creator = storeHelper.getCreatorRef();
|
||||||
|
REQUIRE(creator.getApid() == 2);
|
||||||
|
REQUIRE(creator.getService() == 17);
|
||||||
|
REQUIRE(creator.getSubService() == 1);
|
||||||
|
REQUIRE(creator.getSequenceCount() == 0);
|
||||||
|
REQUIRE(creator.getMessageTypeCounter() == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("Basic") {
|
||||||
|
REQUIRE(storeHelper.preparePacket(17, 1, 1) == HasReturnvaluesIF::RETURN_OK);
|
||||||
|
REQUIRE(storeHelper.addPacketToStore() == HasReturnvaluesIF::RETURN_OK);
|
||||||
|
REQUIRE(storeHelper.getCurrentAddr() != store_address_t::invalid());
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user