add remote config table provider class
This commit is contained in:
parent
8c059f8f32
commit
d45108e3c2
@ -1,4 +1,5 @@
|
||||
target_sources(${LIB_FSFW_NAME} PRIVATE CfdpMessage.cpp CfdpDistributor.cpp)
|
||||
target_sources(${LIB_FSFW_NAME} PRIVATE CfdpMessage.cpp CfdpDistributor.cpp
|
||||
VarLenFields.cpp)
|
||||
|
||||
add_subdirectory(pdu)
|
||||
add_subdirectory(tlv)
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "VarLenField.h"
|
||||
#include "VarLenFields.h"
|
||||
|
||||
#include "fsfw/serialize/SerializeAdapter.h"
|
||||
#include "fsfw/serviceinterface.h"
|
||||
@ -119,9 +119,15 @@ ReturnValue_t cfdp::VarLenField::deSerialize(const uint8_t **buffer, size_t *siz
|
||||
}
|
||||
|
||||
bool cfdp::VarLenField::operator<(const cfdp::VarLenField &other) const {
|
||||
return getValue() < other.getValue();
|
||||
if (getWidth() < other.getWidth()) {
|
||||
return true;
|
||||
} else if (getWidth() == other.getWidth()) {
|
||||
return getValue() < other.getValue();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool cfdp::VarLenField::operator==(const cfdp::VarLenField &other) const {
|
||||
return getValue() == other.getValue();
|
||||
return getWidth() == other.getWidth() and getValue() == other.getValue();
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
#include "fsfw/cfdp/definitions.h"
|
||||
#include "fsfw/serialize/SerializeIF.h"
|
||||
@ -56,6 +57,34 @@ cfdp::VarLenField::VarLenField(UnsignedByteField<T> byteField)
|
||||
setValue(width, byteField.getValue());
|
||||
}
|
||||
|
||||
struct EntityId : public VarLenField {
|
||||
public:
|
||||
EntityId() : VarLenField() {}
|
||||
template <typename T>
|
||||
explicit EntityId(UnsignedByteField<T> byteField) : VarLenField(byteField) {}
|
||||
EntityId(cfdp::WidthInBytes width, size_t entityId) : VarLenField(width, entityId) {}
|
||||
};
|
||||
|
||||
struct TransactionSeqNum : public VarLenField {
|
||||
public:
|
||||
TransactionSeqNum() : VarLenField() {}
|
||||
template <typename T>
|
||||
explicit TransactionSeqNum(UnsignedByteField<T> byteField) : VarLenField(byteField) {}
|
||||
TransactionSeqNum(cfdp::WidthInBytes width, size_t seqNum) : VarLenField(width, seqNum) {}
|
||||
};
|
||||
|
||||
struct TransactionId {
|
||||
TransactionId(EntityId entityId, TransactionSeqNum seqNum)
|
||||
: entityId(std::move(entityId)), seqNum(std::move(seqNum)) {}
|
||||
|
||||
bool operator==(const TransactionId &other) {
|
||||
return entityId == other.entityId and seqNum == other.seqNum;
|
||||
}
|
||||
|
||||
EntityId entityId;
|
||||
TransactionSeqNum seqNum;
|
||||
};
|
||||
|
||||
} // namespace cfdp
|
||||
|
||||
#endif /* FSFW_CFDP_PDU_VARLENFIELD_H_ */
|
@ -11,7 +11,11 @@
|
||||
|
||||
namespace cfdp {
|
||||
|
||||
static constexpr uint8_t VERSION_BITS = 0b00100000;
|
||||
static constexpr char CFDP_VERSION_2_NAME[] = "CCSDS 727.0-B-5";
|
||||
|
||||
// Second version of the protocol, only this one is supported here
|
||||
static constexpr uint8_t CFDP_VERSION_2 = 0b001;
|
||||
static constexpr uint8_t VERSION_BITS = CFDP_VERSION_2 << 5;
|
||||
|
||||
static constexpr uint8_t CFDP_CLASS_ID = CLASS_ID::CFDP;
|
||||
|
||||
|
@ -2,5 +2,6 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
cfdp::DestHandler::DestHandler(LocalEntityCfg cfg, UserBase& user)
|
||||
: cfg(std::move(cfg)), user(user) {}
|
||||
cfdp::DestHandler::DestHandler(LocalEntityCfg cfg, UserBase& user,
|
||||
RemoteConfigTableIF& remoteCfgTable)
|
||||
: cfg(std::move(cfg)), user(user), remoteCfgTable(remoteCfgTable) {}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef FSFW_CFDP_CFDPDESTHANDLER_H
|
||||
#define FSFW_CFDP_CFDPDESTHANDLER_H
|
||||
|
||||
#include "RemoteConfigTableIF.h"
|
||||
#include "UserBase.h"
|
||||
#include "fsfw/cfdp/handler/mib.h"
|
||||
#include "fsfw/cfdp/pdu/PduConfig.h"
|
||||
@ -9,11 +10,12 @@ namespace cfdp {
|
||||
|
||||
class DestHandler {
|
||||
public:
|
||||
DestHandler(LocalEntityCfg cfg, UserBase& user /*, RemoteConfigTableIF& remoteConfigTable*/);
|
||||
DestHandler(LocalEntityCfg cfg, UserBase& user, RemoteConfigTableIF& remoteCfgTable);
|
||||
|
||||
private:
|
||||
LocalEntityCfg cfg;
|
||||
UserBase& user;
|
||||
RemoteConfigTableIF& remoteCfgTable;
|
||||
};
|
||||
|
||||
} // namespace cfdp
|
||||
|
15
src/fsfw/cfdp/handler/RemoteConfigTableIF.h
Normal file
15
src/fsfw/cfdp/handler/RemoteConfigTableIF.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef FSFW_CFDP_HANDLER_REMOTECONFIGTABLEIF_H
|
||||
#define FSFW_CFDP_HANDLER_REMOTECONFIGTABLEIF_H
|
||||
|
||||
#include "fsfw/cfdp/handler/mib.h"
|
||||
|
||||
namespace cfdp {
|
||||
|
||||
class RemoteConfigTableIF {
|
||||
virtual ~RemoteConfigTableIF() = default;
|
||||
virtual bool getRemoteCfg(EntityId remoteId, RemoteEntityCfg* cfg) = 0;
|
||||
};
|
||||
|
||||
} // namespace cfdp
|
||||
|
||||
#endif // FSFW_CFDP_HANDLER_REMOTECONFIGTABLEIF_H
|
@ -1,6 +1,7 @@
|
||||
#ifndef FSFW_CFDP_USERBASE_H
|
||||
#define FSFW_CFDP_USERBASE_H
|
||||
|
||||
#include "fsfw/cfdp/VarLenFields.h"
|
||||
#include "fsfw/filesystem/HasFileSystemIF.h"
|
||||
|
||||
namespace cfdp {
|
||||
@ -22,6 +23,20 @@ class UserBase {
|
||||
*/
|
||||
explicit UserBase(HasFileSystemIF& vfs);
|
||||
|
||||
virtual void transactionIndication(TransactionId id) = 0;
|
||||
virtual void eofSentIndication(TransactionId id) = 0;
|
||||
|
||||
virtual void abandonedIndication(TransactionId id, ConditionCode code, uint64_t progress) = 0;
|
||||
virtual void eofRecvIndication(TransactionId id) = 0;
|
||||
|
||||
// TODO: Parameters
|
||||
virtual void transactionFinishedIndication() = 0;
|
||||
virtual void metadataRecvdIndication() = 0;
|
||||
virtual void fileSegmentRecvdIndication() = 0;
|
||||
virtual void reportIndication() = 0;
|
||||
virtual void suspendedIndication() = 0;
|
||||
virtual void resumedIndication() = 0;
|
||||
|
||||
private:
|
||||
HasFileSystemIF& vfs;
|
||||
};
|
||||
|
@ -26,6 +26,16 @@ struct LocalEntityCfg {
|
||||
FaultHandlerBase& fhBase;
|
||||
};
|
||||
|
||||
struct RemoteEntityCfg {
|
||||
EntityId remoteId;
|
||||
size_t maxFileSegmentLen;
|
||||
bool closureRequested;
|
||||
bool crcOnTransmission;
|
||||
TransmissionModes defaultTransmissionMode;
|
||||
ChecksumType defaultChecksum;
|
||||
const uint8_t version = CFDP_VERSION_2;
|
||||
};
|
||||
|
||||
} // namespace cfdp
|
||||
|
||||
#endif // FSFW_CFDP_MIB_H
|
||||
|
@ -1,7 +1,6 @@
|
||||
target_sources(
|
||||
${LIB_FSFW_NAME}
|
||||
PRIVATE PduConfig.cpp
|
||||
VarLenField.cpp
|
||||
HeaderCreator.cpp
|
||||
HeaderReader.cpp
|
||||
FileDirectiveReader.cpp
|
||||
|
@ -1,29 +1,9 @@
|
||||
#ifndef FSFW_SRC_FSFW_CFDP_PDU_PDUCONFIG_H_
|
||||
#define FSFW_SRC_FSFW_CFDP_PDU_PDUCONFIG_H_
|
||||
|
||||
#include "VarLenField.h"
|
||||
#include "fsfw/cfdp/VarLenFields.h"
|
||||
#include "fsfw/cfdp/definitions.h"
|
||||
|
||||
namespace cfdp {
|
||||
|
||||
struct EntityId : public VarLenField {
|
||||
public:
|
||||
EntityId() : VarLenField() {}
|
||||
template <typename T>
|
||||
explicit EntityId(UnsignedByteField<T> byteField) : VarLenField(byteField) {}
|
||||
EntityId(cfdp::WidthInBytes width, size_t entityId) : VarLenField(width, entityId) {}
|
||||
};
|
||||
|
||||
struct TransactionSeqNum : public VarLenField {
|
||||
public:
|
||||
TransactionSeqNum() : VarLenField() {}
|
||||
template <typename T>
|
||||
explicit TransactionSeqNum(UnsignedByteField<T> byteField) : VarLenField(byteField) {}
|
||||
TransactionSeqNum(cfdp::WidthInBytes width, size_t seqNum) : VarLenField(width, seqNum) {}
|
||||
};
|
||||
|
||||
} // namespace cfdp
|
||||
|
||||
class PduConfig {
|
||||
public:
|
||||
PduConfig(cfdp::EntityId sourceId, cfdp::EntityId destId, cfdp::TransmissionModes mode,
|
||||
|
Loading…
Reference in New Issue
Block a user