Update FSFW from upstream #71

Closed
muellerr wants to merge 1112 commits from development into eive/develop
12 changed files with 44 additions and 18 deletions
Showing only changes of commit 899d021e00 - Show all commits

View File

@ -10,7 +10,7 @@ void CFDPMessage::setCommand(CommandMessage *message, store_address_t cfdpPacket
store_address_t CFDPMessage::getStoreId(const CommandMessage *message) {
store_address_t storeAddressCFDPPacket;
storeAddressCFDPPacket = message->getParameter();
storeAddressCFDPPacket = static_cast<store_address_t>(message->getParameter());
return storeAddressCFDPPacket;
}

View File

@ -80,7 +80,7 @@ class HasLocalDataPoolIF {
* clearing the store automatically
*/
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) {
if (clearMessage != nullptr) {
*clearMessage = true;
@ -100,7 +100,7 @@ class HasLocalDataPoolIF {
* after the callback.
*/
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) {
if (clearMessage != nullptr) {
*clearMessage = true;

View File

@ -44,7 +44,7 @@ store_address_t ParameterMessage::getParameterLoadCommand(const CommandMessage*
*pfc = packedParamSettings >> 16 & 0xff;
*rows = packedParamSettings >> 8 & 0xff;
*columns = packedParamSettings & 0xff;
return message->getParameter2();
return static_cast<store_address_t>(message->getParameter2());
}
void ParameterMessage::clear(CommandMessage* message) {

View File

@ -3,26 +3,26 @@
#include <cstdint>
namespace storeId {
static constexpr uint32_t INVALID_STORE_ADDRESS = 0xffffffff;
}
/**
* 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
* a structured part to use it in pool-like stores.
*/
union store_address_t {
public:
static constexpr uint32_t INVALID_RAW = 0xffffffff;
/**
* 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
*
* @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
@ -52,6 +52,12 @@ union store_address_t {
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; }
store_address_t& operator=(const uint32_t rawAddr) {
raw = rawAddr;
return *this;
}
};
#endif /* FSFW_STORAGEMANAGER_STOREADDRESS_H_ */

View File

@ -58,3 +58,5 @@ void TmStoreHelper::setTimeStamper(TimeStamperIF& timeStamper_) {
}
void TmStoreHelper::setApid(uint16_t apid) { creator.setApid(apid); }
PusTmCreator& TmStoreHelper::getCreatorRef() { return creator; }

View File

@ -15,6 +15,7 @@ class TmStoreHelper {
ReturnValue_t preparePacket(uint8_t service, uint8_t subservice, uint16_t counter);
PusTmCreator& getCreatorRef();
void setTimeStamper(TimeStamperIF& timeStamper);
[[nodiscard]] const store_address_t& getCurrentAddr() const;
void setSourceDataRaw(const uint8_t* data, size_t len);

View File

@ -166,7 +166,7 @@ ReturnValue_t TmTcBridge::handleTmQueue() {
}
ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage* message) {
store_address_t storeId = 0;
store_address_t storeId;
if (tmFifo == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED;
}

View File

@ -80,7 +80,7 @@ TEST_CASE("Action Helper", "[ActionHelper]") {
}
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};
REQUIRE(ipcStore->addData(&toLongParamAddress, toLongData.data(), 5) == retval::CATCH_OK);
ActionMessage::setCommand(&actionMessage, testActionId, toLongParamAddress);
@ -98,7 +98,7 @@ TEST_CASE("Action Helper", "[ActionHelper]") {
}
SECTION("Missing IPC Data") {
ActionMessage::setCommand(&actionMessage, testActionId, StorageManagerIF::INVALID_ADDRESS);
ActionMessage::setCommand(&actionMessage, testActionId, store_address_t::invalid());
CHECK(not testDhMock.executeActionCalled);
REQUIRE(actionHelper.handleActionMessage(&actionMessage) == retval::CATCH_OK);
CommandMessage testMessage;

View File

@ -392,13 +392,13 @@ TEST_CASE("LocalPoolManagerTest", "[LocManTest]") {
CHECK(gpidToCheck == lpool::uint8VarGpid);
HousekeepingMessage::setUpdateSnapshotSetCommand(&hkCmd, lpool::testSid,
storeId::INVALID_STORE_ADDRESS);
store_address_t::invalid());
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
CHECK(poolOwner->changedDataSetCallbackWasCalled(sidToCheck, storeId) == true);
CHECK(sidToCheck == lpool::testSid);
HousekeepingMessage::setUpdateSnapshotVariableCommand(&hkCmd, lpool::uint8VarGpid,
storeId::INVALID_STORE_ADDRESS);
store_address_t::invalid());
CHECK(poolOwner->poolManager.handleHousekeepingMessage(&hkCmd) == retval::CATCH_OK);
CHECK(poolOwner->changedVariableCallbackWasCalled(gpidToCheck, storeId) == true);
CHECK(gpidToCheck == lpool::uint8VarGpid);

View File

@ -90,7 +90,7 @@ bool LocalPoolOwnerBase::changedDataSetCallbackWasCalled(sid_t &sid, store_addre
sid = changedDatasetSid;
storeId = storeIdForChangedSet;
this->changedDatasetSid.raw = sid_t::INVALID_SID;
this->storeIdForChangedSet = storeId::INVALID_STORE_ADDRESS;
this->storeIdForChangedSet = store_address_t::invalid();
return condition;
}
@ -108,7 +108,7 @@ bool LocalPoolOwnerBase::changedVariableCallbackWasCalled(gp_id_t &gpid, store_a
gpid = changedPoolVariableGpid;
storeId = storeIdForChangedVariable;
this->changedPoolVariableGpid.raw = gp_id_t::INVALID_GPID;
this->storeIdForChangedVariable = storeId::INVALID_STORE_ADDRESS;
this->storeIdForChangedVariable = store_address_t::invalid();
return condition;
}

View File

@ -162,7 +162,7 @@ TEST_CASE("New Accessor", "[NewAccessor]") {
REQUIRE(result == retval::CATCH_OK);
{
StorageAccessor accessor(testStoreId);
StorageAccessor accessor2(0);
StorageAccessor accessor2(store_address_t::invalid());
accessor2 = std::move(accessor);
REQUIRE(accessor.data() == nullptr);
std::array<uint8_t, 6> data;

View File

@ -9,4 +9,21 @@ TEST_CASE("TM Store Helper", "[tm-store-helper]") {
LocalPool::LocalPoolConfig cfg = {{10, 32}, {5, 64}};
LocalPool pool(objects::NO_OBJECT, cfg);
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());
}
}