Merge branch 'develop' into mueller/data-wrapper-update
This commit is contained in:
commit
3ebebbd493
@ -35,7 +35,7 @@ void Factory::produceFsfwObjects(void) {
|
||||
}
|
||||
|
||||
void Factory::setStaticFrameworkObjectIds() {
|
||||
PusServiceBase::packetSource = objects::NO_OBJECT;
|
||||
PusServiceBase::PUS_DISTRIBUTOR = objects::NO_OBJECT;
|
||||
PusServiceBase::PACKET_DESTINATION = objects::NO_OBJECT;
|
||||
|
||||
CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT;
|
||||
|
@ -243,9 +243,11 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
|
||||
LocalDataPoolManager* getPoolManagerHandle() override;
|
||||
ReturnValue_t subscribeForRegularPeriodicPacket(subdp::RegularHkPeriodicParams params) override;
|
||||
ReturnValue_t subscribeForDiagPeriodicPacket(subdp::DiagnosticsHkPeriodicParams params) override;
|
||||
ReturnValue_t subscribeForPeriodicPacket(subdp::ParamsBase& params);
|
||||
|
||||
ReturnValue_t subscribeForRegularUpdatePacket(subdp::RegularHkUpdateParams params) override;
|
||||
ReturnValue_t subscribeForDiagUpdatePacket(subdp::DiagnosticsHkUpdateParams params) override;
|
||||
ReturnValue_t subscribeForUpdatePacket(subdp::ParamsBase& params);
|
||||
|
||||
protected:
|
||||
ReturnValue_t subscribeForPeriodicPacket(subdp::ParamsBase& params);
|
||||
|
@ -28,17 +28,11 @@ struct ParamsBase {
|
||||
};
|
||||
|
||||
struct RegularHkPeriodicParams : public ParamsBase {
|
||||
RegularHkPeriodicParams(sid_t sid, float collectionInterval)
|
||||
: ParamsBase(sid, false, collectionInterval, false) {}
|
||||
|
||||
RegularHkPeriodicParams(sid_t sid, bool enableReporting, float collectionInterval)
|
||||
: ParamsBase(sid, enableReporting, collectionInterval, false) {}
|
||||
};
|
||||
|
||||
struct DiagnosticsHkPeriodicParams : public ParamsBase {
|
||||
DiagnosticsHkPeriodicParams(sid_t sid, float collectionInterval)
|
||||
: ParamsBase(sid, false, collectionInterval, true) {}
|
||||
|
||||
DiagnosticsHkPeriodicParams(sid_t sid, bool enableReporting, float collectionInterval)
|
||||
: ParamsBase(sid, enableReporting, collectionInterval, true) {}
|
||||
};
|
||||
|
@ -12,7 +12,7 @@ MessageQueueMessage::MessageQueueMessage() : messageSize(getMinimumMessageSize()
|
||||
MessageQueueMessage::MessageQueueMessage(uint8_t* data, size_t size)
|
||||
: messageSize(MessageQueueMessage::HEADER_SIZE + size) {
|
||||
if (size <= MessageQueueMessage::MAX_DATA_SIZE) {
|
||||
std::memcpy(internalBuffer + MessageQueueMessage::HEADER_SIZE, data, size);
|
||||
std::memcpy(MessageQueueMessage::getData(), data, size);
|
||||
this->messageSize = MessageQueueMessage::HEADER_SIZE + size;
|
||||
} else {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
|
@ -39,13 +39,13 @@ class CCSDSTime {
|
||||
* Struct for CDS day-segmented format.
|
||||
*/
|
||||
struct CDS_short {
|
||||
uint8_t pField;
|
||||
uint8_t dayMSB;
|
||||
uint8_t dayLSB;
|
||||
uint8_t msDay_hh;
|
||||
uint8_t msDay_h;
|
||||
uint8_t msDay_l;
|
||||
uint8_t msDay_ll;
|
||||
uint8_t pField = P_FIELD_CDS_SHORT;
|
||||
uint8_t dayMSB = 0;
|
||||
uint8_t dayLSB = 0;
|
||||
uint8_t msDay_hh = 0;
|
||||
uint8_t msDay_h = 0;
|
||||
uint8_t msDay_l = 0;
|
||||
uint8_t msDay_ll = 0;
|
||||
};
|
||||
/**
|
||||
* Struct for the CCS fromat in day of month variation with max resolution
|
||||
|
@ -13,44 +13,6 @@ using PusChecksumT = uint16_t;
|
||||
//! Version numbers according to ECSS-E-ST-70-41C p.439
|
||||
enum PusVersion : uint8_t { PUS_A = 1, PUS_C = 2 };
|
||||
|
||||
struct RawData {
|
||||
const uint8_t* data;
|
||||
size_t len;
|
||||
};
|
||||
|
||||
enum DataTypes { RAW, SERIALIZABLE };
|
||||
|
||||
union DataUnion {
|
||||
RawData raw;
|
||||
SerializeIF* serializable;
|
||||
};
|
||||
|
||||
struct DataWrapper {
|
||||
DataTypes type;
|
||||
DataUnion dataUnion;
|
||||
using BufPairT = std::pair<const uint8_t*, size_t>;
|
||||
|
||||
[[nodiscard]] size_t getLength() const {
|
||||
if (type == DataTypes::RAW) {
|
||||
return dataUnion.raw.len;
|
||||
} else if (type == DataTypes::SERIALIZABLE and dataUnion.serializable != nullptr) {
|
||||
return dataUnion.serializable->getSerializedSize();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void setRawData(BufPairT bufPair) {
|
||||
type = DataTypes::RAW;
|
||||
dataUnion.raw.data = bufPair.first;
|
||||
dataUnion.raw.len = bufPair.second;
|
||||
}
|
||||
|
||||
void setSerializable(SerializeIF& serializable) {
|
||||
type = DataTypes::SERIALIZABLE;
|
||||
dataUnion.serializable = &serializable;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This struct defines the data structure of a Space Packet when accessed
|
||||
* via a pointer.
|
||||
|
@ -37,14 +37,14 @@ ReturnValue_t PusTcCreator::serialize(uint8_t **buffer, size_t *size, size_t max
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
if (pusParams.dataWrapper.type == ecss::DataTypes::RAW) {
|
||||
if (pusParams.dataWrapper.type == util::DataTypes::RAW) {
|
||||
const uint8_t *data = pusParams.dataWrapper.dataUnion.raw.data;
|
||||
if (data != nullptr and userDataLen > 0) {
|
||||
std::memcpy(*buffer, data, userDataLen);
|
||||
*buffer += userDataLen;
|
||||
*size += userDataLen;
|
||||
}
|
||||
} else if (pusParams.dataWrapper.type == ecss::DataTypes::SERIALIZABLE and
|
||||
} else if (pusParams.dataWrapper.type == util::DataTypes::SERIALIZABLE and
|
||||
pusParams.dataWrapper.dataUnion.serializable != nullptr) {
|
||||
result = pusParams.dataWrapper.dataUnion.serializable->serialize(buffer, size, maxSize,
|
||||
streamEndianness);
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "fsfw/tmtcpacket/pus/CustomUserDataIF.h"
|
||||
#include "fsfw/tmtcpacket/pus/defs.h"
|
||||
#include "fsfw/tmtcpacket/pus/tc/PusTcIF.h"
|
||||
#include "fsfw/util/dataWrapper.h"
|
||||
|
||||
struct PusTcParams {
|
||||
PusTcParams(uint8_t service_, uint8_t subservice_) : service(service_), subservice(subservice_) {}
|
||||
@ -15,7 +16,7 @@ struct PusTcParams {
|
||||
uint8_t subservice;
|
||||
uint8_t ackFlags = ecss::ACK_ALL;
|
||||
uint16_t sourceId = 0;
|
||||
ecss::DataWrapper dataWrapper{};
|
||||
util::DataWrapper dataWrapper{};
|
||||
uint8_t pusVersion = ecss::PusVersion::PUS_C;
|
||||
};
|
||||
|
||||
|
@ -77,12 +77,12 @@ ReturnValue_t PusTmCreator::serialize(uint8_t** buffer, size_t* size, size_t max
|
||||
}
|
||||
}
|
||||
|
||||
if (pusParams.dataWrapper.type == ecss::DataTypes::RAW and
|
||||
if (pusParams.dataWrapper.type == util::DataTypes::RAW and
|
||||
pusParams.dataWrapper.dataUnion.raw.data != nullptr) {
|
||||
std::memcpy(*buffer, pusParams.dataWrapper.dataUnion.raw.data, userDataLen);
|
||||
*buffer += userDataLen;
|
||||
*size += userDataLen;
|
||||
} else if (pusParams.dataWrapper.type == ecss::DataTypes::SERIALIZABLE and
|
||||
} else if (pusParams.dataWrapper.type == util::DataTypes::SERIALIZABLE and
|
||||
pusParams.dataWrapper.dataUnion.serializable != nullptr) {
|
||||
result = pusParams.dataWrapper.dataUnion.serializable->serialize(buffer, size, maxSize,
|
||||
streamEndianness);
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "PusTmIF.h"
|
||||
#include "fsfw/tmtcpacket/ccsds/SpacePacketCreator.h"
|
||||
#include "fsfw/tmtcpacket/pus/CustomUserDataIF.h"
|
||||
#include "fsfw/util/dataWrapper.h"
|
||||
|
||||
struct PusTmSecHeader {
|
||||
PusTmSecHeader() = default;
|
||||
@ -22,19 +23,19 @@ struct PusTmSecHeader {
|
||||
struct PusTmParams {
|
||||
PusTmParams() = default;
|
||||
explicit PusTmParams(PusTmSecHeader secHeader) : secHeader(secHeader){};
|
||||
PusTmParams(PusTmSecHeader secHeader, ecss::DataWrapper dataWrapper)
|
||||
PusTmParams(PusTmSecHeader secHeader, util::DataWrapper dataWrapper)
|
||||
: secHeader(secHeader), dataWrapper(dataWrapper) {}
|
||||
|
||||
PusTmParams(uint8_t service, uint8_t subservice, TimeStamperIF* timeStamper)
|
||||
: secHeader(service, subservice, timeStamper) {}
|
||||
|
||||
PusTmParams(uint8_t service, uint8_t subservice, TimeStamperIF* timeStamper,
|
||||
ecss::DataWrapper dataWrapper_)
|
||||
util::DataWrapper dataWrapper_)
|
||||
: PusTmParams(service, subservice, timeStamper) {
|
||||
dataWrapper = dataWrapper_;
|
||||
}
|
||||
PusTmSecHeader secHeader;
|
||||
ecss::DataWrapper dataWrapper{};
|
||||
util::DataWrapper dataWrapper{};
|
||||
};
|
||||
|
||||
class TimeStamperIF;
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
namespace tcverif {
|
||||
|
||||
enum VerifFlags : uint8_t {
|
||||
enum VerificationFlags : uint8_t {
|
||||
NONE = 0b0000,
|
||||
ACCEPTANCE = 0b0001,
|
||||
START = 0b0010,
|
||||
|
@ -11,13 +11,13 @@ class DataWithObjectIdPrefix : public SerializeIF {
|
||||
public:
|
||||
DataWithObjectIdPrefix(object_id_t objectId, const uint8_t* srcData, size_t srcDataLen)
|
||||
: objectId(objectId) {
|
||||
dataWrapper.type = ecss::DataTypes::RAW;
|
||||
dataWrapper.type = util::DataTypes::RAW;
|
||||
dataWrapper.dataUnion.raw.data = srcData;
|
||||
dataWrapper.dataUnion.raw.len = srcDataLen;
|
||||
}
|
||||
|
||||
DataWithObjectIdPrefix(object_id_t objectId, SerializeIF& serializable) : objectId(objectId) {
|
||||
dataWrapper.type = ecss::DataTypes::SERIALIZABLE;
|
||||
dataWrapper.type = util::DataTypes::SERIALIZABLE;
|
||||
dataWrapper.dataUnion.serializable = &serializable;
|
||||
}
|
||||
|
||||
@ -26,11 +26,11 @@ class DataWithObjectIdPrefix : public SerializeIF {
|
||||
if (*size + getSerializedSize() > maxSize) {
|
||||
return SerializeIF::BUFFER_TOO_SHORT;
|
||||
}
|
||||
if (dataWrapper.type != ecss::DataTypes::RAW) {
|
||||
if (dataWrapper.type != util::DataTypes::RAW) {
|
||||
if ((dataWrapper.dataUnion.raw.data == nullptr) and (dataWrapper.dataUnion.raw.len > 0)) {
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
} else if (dataWrapper.type == ecss::DataTypes::SERIALIZABLE) {
|
||||
} else if (dataWrapper.type == util::DataTypes::SERIALIZABLE) {
|
||||
if (dataWrapper.dataUnion.serializable == nullptr) {
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
@ -40,7 +40,7 @@ class DataWithObjectIdPrefix : public SerializeIF {
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
if (dataWrapper.type != ecss::DataTypes::RAW) {
|
||||
if (dataWrapper.type != util::DataTypes::RAW) {
|
||||
std::memcpy(*buffer, dataWrapper.dataUnion.raw.data, dataWrapper.dataUnion.raw.len);
|
||||
*buffer += dataWrapper.dataUnion.raw.len;
|
||||
*size += dataWrapper.dataUnion.raw.len;
|
||||
@ -63,7 +63,7 @@ class DataWithObjectIdPrefix : public SerializeIF {
|
||||
|
||||
private:
|
||||
object_id_t objectId;
|
||||
ecss::DataWrapper dataWrapper{};
|
||||
util::DataWrapper dataWrapper{};
|
||||
};
|
||||
|
||||
} // namespace telemetry
|
||||
|
@ -43,6 +43,7 @@ struct DataWrapper {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void setRawData(BufPairT bufPair) {
|
||||
type = DataTypes::RAW;
|
||||
dataUnion.raw.data = bufPair.first;
|
||||
|
@ -44,7 +44,7 @@ TEST_CASE("TM Store And Send Helper", "[tm-store-send-helper]") {
|
||||
REQUIRE(creator.getSubService() == 2);
|
||||
REQUIRE(creator.getService() == 17);
|
||||
auto& params = creator.getParams();
|
||||
REQUIRE(params.dataWrapper.type == ecss::DataTypes::RAW);
|
||||
REQUIRE(params.dataWrapper.type == util::DataTypes::RAW);
|
||||
REQUIRE(params.dataWrapper.dataUnion.raw.data == nullptr);
|
||||
REQUIRE(params.dataWrapper.dataUnion.raw.len == 0);
|
||||
REQUIRE(tmHelper.sendCounter == 0);
|
||||
@ -65,7 +65,7 @@ TEST_CASE("TM Store And Send Helper", "[tm-store-send-helper]") {
|
||||
REQUIRE(tmHelper.prepareTmPacket(2, data.data(), data.size()) == returnvalue::OK);
|
||||
auto& creator = storeHelper.getCreatorRef();
|
||||
auto& params = creator.getParams();
|
||||
REQUIRE(params.dataWrapper.type == ecss::DataTypes::RAW);
|
||||
REQUIRE(params.dataWrapper.type == util::DataTypes::RAW);
|
||||
REQUIRE(params.dataWrapper.dataUnion.raw.data == data.data());
|
||||
REQUIRE(params.dataWrapper.dataUnion.raw.len == data.size());
|
||||
}
|
||||
@ -75,7 +75,7 @@ TEST_CASE("TM Store And Send Helper", "[tm-store-send-helper]") {
|
||||
REQUIRE(tmHelper.prepareTmPacket(2, simpleSer) == returnvalue::OK);
|
||||
auto& creator = storeHelper.getCreatorRef();
|
||||
auto& params = creator.getParams();
|
||||
REQUIRE(params.dataWrapper.type == ecss::DataTypes::SERIALIZABLE);
|
||||
REQUIRE(params.dataWrapper.type == util::DataTypes::SERIALIZABLE);
|
||||
REQUIRE(params.dataWrapper.dataUnion.serializable == &simpleSer);
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ TEST_CASE("TM Store And Send Helper", "[tm-store-send-helper]") {
|
||||
REQUIRE(tmHelper.prepareTmPacket(2, dataWithObjId) == returnvalue::OK);
|
||||
auto& creator = storeHelper.getCreatorRef();
|
||||
auto& params = creator.getParams();
|
||||
REQUIRE(params.dataWrapper.type == ecss::DataTypes::SERIALIZABLE);
|
||||
REQUIRE(params.dataWrapper.type == util::DataTypes::SERIALIZABLE);
|
||||
REQUIRE(params.dataWrapper.dataUnion.serializable == &dataWithObjId);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user