continued router component
This commit is contained in:
parent
267466be9d
commit
81a7c21cd1
@ -18,31 +18,35 @@ cfdp::DestHandler::DestHandler(DestHandlerParams params, FsfwParams fsfwParams)
|
||||
}
|
||||
|
||||
ReturnValue_t cfdp::DestHandler::performStateMachine() {
|
||||
switch (step) {
|
||||
case TransactionStep::IDLE: {
|
||||
ReturnValue_t status = returnvalue::OK;
|
||||
ReturnValue_t result;
|
||||
for (const auto& info : dp.packetListRef) {
|
||||
if (info.pduType == PduType::FILE_DIRECTIVE and
|
||||
info.directiveType == FileDirectives::METADATA) {
|
||||
result = handleMetadataPdu(info);
|
||||
if (result != OK) {
|
||||
status = result;
|
||||
}
|
||||
if (step == TransactionStep::IDLE) {
|
||||
ReturnValue_t status = returnvalue::OK;
|
||||
ReturnValue_t result;
|
||||
for (const auto& info : dp.packetListRef) {
|
||||
if (info.pduType == PduType::FILE_DIRECTIVE and
|
||||
info.directiveType == FileDirectives::METADATA) {
|
||||
result = handleMetadataPdu(info);
|
||||
if (result != OK) {
|
||||
status = result;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
case TransactionStep::TRANSACTION_START:
|
||||
break;
|
||||
case TransactionStep::RECEIVING_FILE_DATA_PDUS:
|
||||
break;
|
||||
case TransactionStep::SENDING_ACK_PDU:
|
||||
break;
|
||||
case TransactionStep::TRANSFER_COMPLETION:
|
||||
break;
|
||||
case TransactionStep::SENDING_FINISHED_PDU:
|
||||
break;
|
||||
if (step != TransactionStep::IDLE) {
|
||||
return CALL_FSM_AGAIN;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
if (cfdpState == CfdpStates::BUSY_CLASS_1_NACKED) {
|
||||
for (const auto& info : dp.packetListRef) {
|
||||
if (info.pduType == PduType::FILE_DATA) {
|
||||
}
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
if (cfdpState == CfdpStates::BUSY_CLASS_2_ACKED) {
|
||||
// TODO: Will be implemented at a later stage
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "CFDP state machine for acknowledged mode not implemented yet" << std::endl;
|
||||
#endif
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
@ -178,3 +182,5 @@ ReturnValue_t cfdp::DestHandler::startTransaction(MetadataPduReader& reader, Met
|
||||
dp.user.metadataRecvdIndication(params);
|
||||
return OK;
|
||||
}
|
||||
|
||||
cfdp::CfdpStates cfdp::DestHandler::getCfdpState() const { return cfdpState; }
|
||||
|
@ -58,8 +58,18 @@ struct FsfwParams {
|
||||
|
||||
class DestHandler {
|
||||
public:
|
||||
/**
|
||||
* Will be returned if it is advisable to call the state machine operation call again
|
||||
*/
|
||||
ReturnValue_t CALL_FSM_AGAIN = returnvalue::makeCode(1, 0);
|
||||
explicit DestHandler(DestHandlerParams handlerParams, FsfwParams fsfwParams);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* - @c returnvalue::OK State machine OK for this execution cycle
|
||||
* - @c CALL_FSM_AGAIN State machine should be called again.
|
||||
*/
|
||||
ReturnValue_t performStateMachine();
|
||||
|
||||
ReturnValue_t passPacket(PacketInfo packet);
|
||||
@ -69,6 +79,8 @@ class DestHandler {
|
||||
ReturnValue_t handleMetadataPdu(const PacketInfo& info);
|
||||
ReturnValue_t handleMetadataParseError(const uint8_t* rawData, size_t maxSize);
|
||||
|
||||
[[nodiscard]] CfdpStates getCfdpState() const;
|
||||
|
||||
private:
|
||||
enum class TransactionStep {
|
||||
IDLE = 0,
|
||||
|
@ -27,8 +27,8 @@ struct TransactionFinishedParams {
|
||||
};
|
||||
|
||||
struct MetadataRecvdParams {
|
||||
MetadataRecvdParams(const TransactionId& id, const EntityId& sourceId):
|
||||
id(id), sourceId(sourceId) {}
|
||||
MetadataRecvdParams(const TransactionId& id, const EntityId& sourceId)
|
||||
: id(id), sourceId(sourceId) {}
|
||||
const TransactionId& id;
|
||||
const EntityId& sourceId;
|
||||
uint64_t fileSize = 0;
|
||||
@ -65,7 +65,6 @@ struct FileSegmentRecvdParams {
|
||||
*/
|
||||
class UserBase {
|
||||
public:
|
||||
|
||||
explicit UserBase(HasFileSystemIF& vfs);
|
||||
|
||||
virtual void transactionIndication(const TransactionId& id) = 0;
|
||||
@ -87,7 +86,8 @@ class UserBase {
|
||||
virtual void suspendedIndication(const TransactionId& id, ConditionCode code) = 0;
|
||||
virtual void resumedIndication(const TransactionId& id, size_t progress) = 0;
|
||||
virtual void faultIndication(const TransactionId& id, ConditionCode code, size_t progress) = 0;
|
||||
virtual void abandonedIndication(const TransactionId& id, ConditionCode code, size_t progress) = 0;
|
||||
virtual void abandonedIndication(const TransactionId& id, ConditionCode code,
|
||||
size_t progress) = 0;
|
||||
virtual void eofRecvIndication(const TransactionId& id) = 0;
|
||||
|
||||
private:
|
||||
|
@ -7,7 +7,7 @@ cfdp::UserMock::UserMock(HasFileSystemIF& vfs) : UserBase(vfs) {}
|
||||
void UserMock::transactionIndication(const TransactionId& id) {}
|
||||
void UserMock::eofSentIndication(const TransactionId& id) {}
|
||||
void UserMock::abandonedIndication(const TransactionId& id, cfdp::ConditionCode code,
|
||||
uint64_t progress) {}
|
||||
uint64_t progress) {}
|
||||
void UserMock::eofRecvIndication(const TransactionId& id) {}
|
||||
void UserMock::transactionFinishedIndication(const TransactionFinishedParams& finishedParams) {}
|
||||
void UserMock::metadataRecvdIndication(const MetadataRecvdParams& params) {}
|
||||
@ -15,7 +15,7 @@ void UserMock::fileSegmentRecvdIndication(const FileSegmentRecvdParams& params)
|
||||
void UserMock::reportIndication(const TransactionId& id, StatusReportIF& report) {}
|
||||
void UserMock::suspendedIndication(const TransactionId& id, ConditionCode code) {}
|
||||
void UserMock::resumedIndication(const TransactionId& id, size_t progress) {}
|
||||
void UserMock::faultIndication(const TransactionId& id, cfdp::ConditionCode code,
|
||||
size_t progress) {}
|
||||
|
||||
void UserMock::faultIndication(const TransactionId& id, cfdp::ConditionCode code, size_t progress) {
|
||||
}
|
||||
|
||||
} // namespace cfdp
|
||||
|
Loading…
Reference in New Issue
Block a user