continued router component

This commit is contained in:
Robin Müller 2022-08-24 17:31:26 +02:00
parent 267466be9d
commit 81a7c21cd1
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
4 changed files with 48 additions and 30 deletions

View File

@ -18,8 +18,7 @@ cfdp::DestHandler::DestHandler(DestHandlerParams params, FsfwParams fsfwParams)
}
ReturnValue_t cfdp::DestHandler::performStateMachine() {
switch (step) {
case TransactionStep::IDLE: {
if (step == TransactionStep::IDLE) {
ReturnValue_t status = returnvalue::OK;
ReturnValue_t result;
for (const auto& info : dp.packetListRef) {
@ -31,18 +30,23 @@ ReturnValue_t cfdp::DestHandler::performStateMachine() {
}
}
}
if (step != TransactionStep::IDLE) {
return CALL_FSM_AGAIN;
}
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 (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; }

View File

@ -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,

View File

@ -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:

View File

@ -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