Compare commits
17 Commits
master
...
mueller/cf
Author | SHA1 | Date | |
---|---|---|---|
1d4fd70101 | |||
15d69e64f3 | |||
d74bcbb1f8 | |||
c00cb1680d | |||
7109422e2c | |||
efd12544df | |||
f512d98c08 | |||
29c4fc33da | |||
e760f5ab75 | |||
b069ed0fec | |||
72c7bd5e03 | |||
b9fbb4fd4c | |||
9368ae81e5 | |||
618f76ae78 | |||
ee2f8d6956 | |||
aa6ffac182 | |||
f7cb0bbf31 |
|
@ -48,7 +48,11 @@
|
||||||
|
|
||||||
#ifndef FSFW_USE_PUS_C_TELECOMMANDS
|
#ifndef FSFW_USE_PUS_C_TELECOMMANDS
|
||||||
#define FSFW_USE_PUS_C_TELECOMMANDS 1
|
#define FSFW_USE_PUS_C_TELECOMMANDS 1
|
||||||
#endif
|
#endif /* FSFW_USE_PUS_C_TELECOMMANDS */
|
||||||
|
|
||||||
|
#ifndef FSFW_DEBUG_CFDP_DISTRIBUTOR
|
||||||
|
#define FSFW_DEBUG_CFDP_DISTRIBUTOR 0
|
||||||
|
#endif /* FSFW_DEBUG_CFDP_DISTRIBUTOR */
|
||||||
|
|
||||||
#ifndef FSFW_TCP_RECV_WIRETAPPING_ENABLED
|
#ifndef FSFW_TCP_RECV_WIRETAPPING_ENABLED
|
||||||
#define FSFW_TCP_RECV_WIRETAPPING_ENABLED 0
|
#define FSFW_TCP_RECV_WIRETAPPING_ENABLED 0
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
|
#include "fsfw/FSFW.h"
|
||||||
|
#include "fsfw/tcdistribution/CCSDSDistributorIF.h"
|
||||||
#include "fsfw/tcdistribution/CFDPDistributor.h"
|
#include "fsfw/tcdistribution/CFDPDistributor.h"
|
||||||
|
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/tcdistribution/CCSDSDistributorIF.h"
|
#include "fsfw/tcdistribution/CCSDSDistributorIF.h"
|
||||||
#include "fsfw/tmtcpacket/cfdp/CFDPPacketStored.h"
|
#include "fsfw/tmtcpacket/cfdp/CFDPPacketStored.h"
|
||||||
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#ifndef FSFW_CFDP_DISTRIBUTOR_DEBUGGING
|
|
||||||
#define FSFW_CFDP_DISTRIBUTOR_DEBUGGING 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CFDPDistributor::CFDPDistributor(uint16_t setApid, object_id_t setObjectId,
|
CFDPDistributor::CFDPDistributor(uint16_t setApid, object_id_t setObjectId,
|
||||||
object_id_t setPacketSource)
|
object_id_t setPacketSource)
|
||||||
|
@ -19,8 +18,8 @@ CFDPDistributor::CFDPDistributor(uint16_t setApid, object_id_t setObjectId,
|
||||||
CFDPDistributor::~CFDPDistributor() {}
|
CFDPDistributor::~CFDPDistributor() {}
|
||||||
|
|
||||||
CFDPDistributor::TcMqMapIter CFDPDistributor::selectDestination() {
|
CFDPDistributor::TcMqMapIter CFDPDistributor::selectDestination() {
|
||||||
#if FSFW_CFDP_DISTRIBUTOR_DEBUGGING == 1
|
#if FSFW_DEBUG_CFDP_DISTRIBUTOR == 1
|
||||||
store_address_t storeId = this->currentMessage.getStorageId();
|
store_address_t storeId = this->currentMessage.getStorageId();
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::debug << "CFDPDistributor::handlePacket received: " << storeId.poolIndex << ", "
|
sif::debug << "CFDPDistributor::handlePacket received: " << storeId.poolIndex << ", "
|
||||||
<< storeId.packetIndex << std::endl;
|
<< storeId.packetIndex << std::endl;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
target_sources(
|
target_sources(
|
||||||
${LIB_FSFW_NAME} PRIVATE TcPacketPusBase.cpp TcPacketPus.cpp
|
${LIB_FSFW_NAME}
|
||||||
TcPacketStoredBase.cpp TcPacketStoredPus.cpp)
|
PRIVATE TcPacketPusBase.cpp TcPacketPus.cpp TcPacketStoredBase.cpp
|
||||||
|
TcPacketStoredPus.cpp TcPacketSerializer.cpp)
|
||||||
|
|
|
@ -22,7 +22,7 @@ class TcPacketPusBase : public SpacePacketBase, virtual public RedirectableDataP
|
||||||
friend class TcPacketStoredBase;
|
friend class TcPacketStoredBase;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum AckField {
|
enum AckField : uint8_t {
|
||||||
//! No acknowledgements are expected.
|
//! No acknowledgements are expected.
|
||||||
ACK_NONE = 0b0000,
|
ACK_NONE = 0b0000,
|
||||||
//! Acknowledgements on acceptance are expected.
|
//! Acknowledgements on acceptance are expected.
|
||||||
|
|
42
src/fsfw/tmtcpacket/pus/tc/TcPacketSerializer.cpp
Normal file
42
src/fsfw/tmtcpacket/pus/tc/TcPacketSerializer.cpp
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
#include "TcPacketSerializer.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
TcPacketSerializer::TcPacketSerializer(uint8_t* store, size_t maxSize, PusConfig& cfg)
|
||||||
|
: TcPacketPus(nullptr), store(store), maxSize(maxSize), cfg(cfg) {}
|
||||||
|
|
||||||
|
ReturnValue_t TcPacketSerializer::serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
||||||
|
Endianness streamEndianness) const {
|
||||||
|
if (*size + getSerializedSize() > maxSize) {
|
||||||
|
return BUFFER_TOO_SHORT;
|
||||||
|
}
|
||||||
|
std::memcpy(*buffer, store, getSerializedSize());
|
||||||
|
*buffer += getSerializedSize();
|
||||||
|
*size += getSerializedSize();
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t TcPacketSerializer::getSerializedSize() const { return TC_PACKET_MIN_SIZE + cfg.appDataLen; }
|
||||||
|
|
||||||
|
ReturnValue_t TcPacketSerializer::initialize() {
|
||||||
|
if (getSerializedSize() > maxSize) {
|
||||||
|
return SerializeIF::BUFFER_TOO_SHORT;
|
||||||
|
}
|
||||||
|
ReturnValue_t result = setData(store, maxSize);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
initializeTcPacket(cfg.apid, cfg.sequenceCount, cfg.ack, cfg.service, cfg.subservice,
|
||||||
|
cfg.pusVersion, cfg.sourceId);
|
||||||
|
if (cfg.appData != nullptr and cfg.appDataLen > 0) {
|
||||||
|
std::memcpy(&tcData->appData, cfg.appData, cfg.appDataLen);
|
||||||
|
}
|
||||||
|
setPacketDataLength(calculateFullPacketLength(cfg.appDataLen) - sizeof(CCSDSPrimaryHeader) - 1);
|
||||||
|
setErrorControl();
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t TcPacketSerializer::deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
|
Endianness streamEndianness) {
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
39
src/fsfw/tmtcpacket/pus/tc/TcPacketSerializer.h
Normal file
39
src/fsfw/tmtcpacket/pus/tc/TcPacketSerializer.h
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#ifndef FSFW_SRC_FSFW_TMTCPACKET_PUS_TC_TCPACKETPUSINTOBUF_H_
|
||||||
|
#define FSFW_SRC_FSFW_TMTCPACKET_PUS_TC_TCPACKETPUSINTOBUF_H_
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
#include "TcPacketPus.h"
|
||||||
|
#include "fsfw/serialize/SerializeIF.h"
|
||||||
|
|
||||||
|
struct PusConfig {
|
||||||
|
uint16_t apid = 0;
|
||||||
|
uint8_t service = 0;
|
||||||
|
uint8_t subservice = 0;
|
||||||
|
uint16_t sequenceCount = 0;
|
||||||
|
uint16_t sourceId = 0;
|
||||||
|
uint8_t* appData = nullptr;
|
||||||
|
size_t appDataLen = 0;
|
||||||
|
pus::PusVersion pusVersion = pus::PusVersion::PUS_C_VERSION;
|
||||||
|
uint8_t ack = TcPacketPus::ACK_ALL;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TcPacketSerializer : public TcPacketPus, public SerializeIF, public HasReturnvaluesIF {
|
||||||
|
public:
|
||||||
|
TcPacketSerializer(uint8_t* data, size_t size, PusConfig& cfg);
|
||||||
|
|
||||||
|
ReturnValue_t initialize();
|
||||||
|
|
||||||
|
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
||||||
|
Endianness streamEndianness) const override;
|
||||||
|
size_t getSerializedSize() const override;
|
||||||
|
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
|
Endianness streamEndianness) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint8_t* store;
|
||||||
|
size_t maxSize;
|
||||||
|
PusConfig& cfg;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* FSFW_SRC_FSFW_TMTCPACKET_PUS_TC_TCPACKETPUSINTOBUF_H_ */
|
Loading…
Reference in New Issue
Block a user