renamed new class, small tweak
This commit is contained in:
parent
d74bcbb1f8
commit
15d69e64f3
@ -1,4 +1,4 @@
|
|||||||
target_sources(
|
target_sources(
|
||||||
${LIB_FSFW_NAME}
|
${LIB_FSFW_NAME}
|
||||||
PRIVATE TcPacketPusBase.cpp TcPacketPus.cpp TcPacketStoredBase.cpp
|
PRIVATE TcPacketPusBase.cpp TcPacketPus.cpp TcPacketStoredBase.cpp
|
||||||
TcPacketStoredPus.cpp TcPacketPusIntoBuf.cpp)
|
TcPacketStoredPus.cpp TcPacketSerializer.cpp)
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#include "TcPacketPusIntoBuf.h"
|
#include "TcPacketSerializer.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
TcPacketPusIntoBuf::TcPacketPusIntoBuf(uint8_t* store, size_t maxSize, PusConfig& cfg)
|
TcPacketSerializer::TcPacketSerializer(uint8_t* store, size_t maxSize, PusConfig& cfg)
|
||||||
: TcPacketPus(nullptr), store(store), maxSize(maxSize), cfg(cfg) {}
|
: TcPacketPus(nullptr), store(store), maxSize(maxSize), cfg(cfg) {}
|
||||||
|
|
||||||
ReturnValue_t TcPacketPusIntoBuf::serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
ReturnValue_t TcPacketSerializer::serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
||||||
Endianness streamEndianness) const {
|
Endianness streamEndianness) const {
|
||||||
if (*size + getSerializedSize() > maxSize) {
|
if (*size + getSerializedSize() > maxSize) {
|
||||||
return BUFFER_TOO_SHORT;
|
return BUFFER_TOO_SHORT;
|
||||||
@ -16,9 +16,9 @@ ReturnValue_t TcPacketPusIntoBuf::serialize(uint8_t** buffer, size_t* size, size
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t TcPacketPusIntoBuf::getSerializedSize() const { return TC_PACKET_MIN_SIZE + cfg.appDataLen; }
|
size_t TcPacketSerializer::getSerializedSize() const { return TC_PACKET_MIN_SIZE + cfg.appDataLen; }
|
||||||
|
|
||||||
ReturnValue_t TcPacketPusIntoBuf::initialize() {
|
ReturnValue_t TcPacketSerializer::initialize() {
|
||||||
if (getSerializedSize() > maxSize) {
|
if (getSerializedSize() > maxSize) {
|
||||||
return SerializeIF::BUFFER_TOO_SHORT;
|
return SerializeIF::BUFFER_TOO_SHORT;
|
||||||
}
|
}
|
||||||
@ -26,13 +26,8 @@ ReturnValue_t TcPacketPusIntoBuf::initialize() {
|
|||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#if FSFW_USE_PUS_C_TELECOMMANDS == 1
|
initializeTcPacket(cfg.apid, cfg.sequenceCount, cfg.ack, cfg.service, cfg.subservice,
|
||||||
pus::PusVersion pusVersion = pus::PusVersion::PUS_C_VERSION;
|
cfg.pusVersion, cfg.sourceId);
|
||||||
#else
|
|
||||||
pus::PusVersion pusVersion = pus::PusVersion::PUS_A_VERSION;
|
|
||||||
#endif
|
|
||||||
initializeTcPacket(cfg.apid, cfg.sequenceCount, cfg.ack, cfg.service, cfg.subservice, pusVersion,
|
|
||||||
cfg.sourceId);
|
|
||||||
if (cfg.appData != nullptr and cfg.appDataLen > 0) {
|
if (cfg.appData != nullptr and cfg.appDataLen > 0) {
|
||||||
std::memcpy(&tcData->appData, cfg.appData, cfg.appDataLen);
|
std::memcpy(&tcData->appData, cfg.appData, cfg.appDataLen);
|
||||||
}
|
}
|
||||||
@ -41,7 +36,7 @@ ReturnValue_t TcPacketPusIntoBuf::initialize() {
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t TcPacketPusIntoBuf::deSerialize(const uint8_t** buffer, size_t* size,
|
ReturnValue_t TcPacketSerializer::deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
Endianness streamEndianness) {
|
Endianness streamEndianness) {
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
@ -14,12 +14,13 @@ struct PusConfig {
|
|||||||
uint16_t sourceId = 0;
|
uint16_t sourceId = 0;
|
||||||
uint8_t* appData = nullptr;
|
uint8_t* appData = nullptr;
|
||||||
size_t appDataLen = 0;
|
size_t appDataLen = 0;
|
||||||
|
pus::PusVersion pusVersion = pus::PusVersion::PUS_C_VERSION;
|
||||||
uint8_t ack = TcPacketPus::ACK_ALL;
|
uint8_t ack = TcPacketPus::ACK_ALL;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TcPacketPusIntoBuf : public TcPacketPus, public SerializeIF, public HasReturnvaluesIF {
|
class TcPacketSerializer : public TcPacketPus, public SerializeIF, public HasReturnvaluesIF {
|
||||||
public:
|
public:
|
||||||
TcPacketPusIntoBuf(uint8_t* data, size_t size, PusConfig& cfg);
|
TcPacketSerializer(uint8_t* data, size_t size, PusConfig& cfg);
|
||||||
|
|
||||||
ReturnValue_t initialize();
|
ReturnValue_t initialize();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user