Compare commits
17 Commits
master
...
mueller/cf
Author | SHA1 | Date |
---|---|---|
Robin Müller | 1d4fd70101 | |
Robin Müller | 15d69e64f3 | |
Robin Müller | d74bcbb1f8 | |
Robin Müller | c00cb1680d | |
Robin Müller | 7109422e2c | |
Robin Müller | efd12544df | |
Robin Müller | f512d98c08 | |
Robin Müller | 29c4fc33da | |
Robin Müller | e760f5ab75 | |
Robin Müller | b069ed0fec | |
Robin Müller | 72c7bd5e03 | |
Robin Müller | b9fbb4fd4c | |
Robin Müller | 9368ae81e5 | |
Robin Müller | 618f76ae78 | |
Robin Müller | ee2f8d6956 | |
Robin Müller | aa6ffac182 | |
Robin Müller | f7cb0bbf31 |
|
@ -48,7 +48,11 @@
|
|||
|
||||
#ifndef FSFW_USE_PUS_C_TELECOMMANDS
|
||||
#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
|
||||
#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/objectmanager/ObjectManager.h"
|
||||
#include "fsfw/tcdistribution/CCSDSDistributorIF.h"
|
||||
#include "fsfw/tmtcpacket/cfdp/CFDPPacketStored.h"
|
||||
|
||||
#ifndef FSFW_CFDP_DISTRIBUTOR_DEBUGGING
|
||||
#define FSFW_CFDP_DISTRIBUTOR_DEBUGGING 1
|
||||
#endif
|
||||
#include "fsfw/objectmanager/ObjectManager.h"
|
||||
|
||||
CFDPDistributor::CFDPDistributor(uint16_t setApid, object_id_t setObjectId,
|
||||
object_id_t setPacketSource)
|
||||
|
@ -19,8 +18,8 @@ CFDPDistributor::CFDPDistributor(uint16_t setApid, object_id_t setObjectId,
|
|||
CFDPDistributor::~CFDPDistributor() {}
|
||||
|
||||
CFDPDistributor::TcMqMapIter CFDPDistributor::selectDestination() {
|
||||
#if FSFW_CFDP_DISTRIBUTOR_DEBUGGING == 1
|
||||
store_address_t storeId = this->currentMessage.getStorageId();
|
||||
#if FSFW_DEBUG_CFDP_DISTRIBUTOR == 1
|
||||
store_address_t storeId = this->currentMessage.getStorageId();
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::debug << "CFDPDistributor::handlePacket received: " << storeId.poolIndex << ", "
|
||||
<< storeId.packetIndex << std::endl;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
target_sources(
|
||||
${LIB_FSFW_NAME} PRIVATE TcPacketPusBase.cpp TcPacketPus.cpp
|
||||
TcPacketStoredBase.cpp TcPacketStoredPus.cpp)
|
||||
${LIB_FSFW_NAME}
|
||||
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;
|
||||
|
||||
public:
|
||||
enum AckField {
|
||||
enum AckField : uint8_t {
|
||||
//! No acknowledgements are expected.
|
||||
ACK_NONE = 0b0000,
|
||||
//! Acknowledgements on acceptance are expected.
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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