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() {
|
ReturnValue_t cfdp::DestHandler::performStateMachine() {
|
||||||
switch (step) {
|
if (step == TransactionStep::IDLE) {
|
||||||
case TransactionStep::IDLE: {
|
ReturnValue_t status = returnvalue::OK;
|
||||||
ReturnValue_t status = returnvalue::OK;
|
ReturnValue_t result;
|
||||||
ReturnValue_t result;
|
for (const auto& info : dp.packetListRef) {
|
||||||
for (const auto& info : dp.packetListRef) {
|
if (info.pduType == PduType::FILE_DIRECTIVE and
|
||||||
if (info.pduType == PduType::FILE_DIRECTIVE and
|
info.directiveType == FileDirectives::METADATA) {
|
||||||
info.directiveType == FileDirectives::METADATA) {
|
result = handleMetadataPdu(info);
|
||||||
result = handleMetadataPdu(info);
|
if (result != OK) {
|
||||||
if (result != OK) {
|
status = result;
|
||||||
status = result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
case TransactionStep::TRANSACTION_START:
|
if (step != TransactionStep::IDLE) {
|
||||||
break;
|
return CALL_FSM_AGAIN;
|
||||||
case TransactionStep::RECEIVING_FILE_DATA_PDUS:
|
}
|
||||||
break;
|
return status;
|
||||||
case TransactionStep::SENDING_ACK_PDU:
|
}
|
||||||
break;
|
if (cfdpState == CfdpStates::BUSY_CLASS_1_NACKED) {
|
||||||
case TransactionStep::TRANSFER_COMPLETION:
|
for (const auto& info : dp.packetListRef) {
|
||||||
break;
|
if (info.pduType == PduType::FILE_DATA) {
|
||||||
case TransactionStep::SENDING_FINISHED_PDU:
|
}
|
||||||
break;
|
}
|
||||||
|
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;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
@ -178,3 +182,5 @@ ReturnValue_t cfdp::DestHandler::startTransaction(MetadataPduReader& reader, Met
|
|||||||
dp.user.metadataRecvdIndication(params);
|
dp.user.metadataRecvdIndication(params);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfdp::CfdpStates cfdp::DestHandler::getCfdpState() const { return cfdpState; }
|
||||||
|
@ -58,8 +58,18 @@ struct FsfwParams {
|
|||||||
|
|
||||||
class DestHandler {
|
class DestHandler {
|
||||||
public:
|
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);
|
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 performStateMachine();
|
||||||
|
|
||||||
ReturnValue_t passPacket(PacketInfo packet);
|
ReturnValue_t passPacket(PacketInfo packet);
|
||||||
@ -69,6 +79,8 @@ class DestHandler {
|
|||||||
ReturnValue_t handleMetadataPdu(const PacketInfo& info);
|
ReturnValue_t handleMetadataPdu(const PacketInfo& info);
|
||||||
ReturnValue_t handleMetadataParseError(const uint8_t* rawData, size_t maxSize);
|
ReturnValue_t handleMetadataParseError(const uint8_t* rawData, size_t maxSize);
|
||||||
|
|
||||||
|
[[nodiscard]] CfdpStates getCfdpState() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class TransactionStep {
|
enum class TransactionStep {
|
||||||
IDLE = 0,
|
IDLE = 0,
|
||||||
|
@ -27,8 +27,8 @@ struct TransactionFinishedParams {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct MetadataRecvdParams {
|
struct MetadataRecvdParams {
|
||||||
MetadataRecvdParams(const TransactionId& id, const EntityId& sourceId):
|
MetadataRecvdParams(const TransactionId& id, const EntityId& sourceId)
|
||||||
id(id), sourceId(sourceId) {}
|
: id(id), sourceId(sourceId) {}
|
||||||
const TransactionId& id;
|
const TransactionId& id;
|
||||||
const EntityId& sourceId;
|
const EntityId& sourceId;
|
||||||
uint64_t fileSize = 0;
|
uint64_t fileSize = 0;
|
||||||
@ -65,7 +65,6 @@ struct FileSegmentRecvdParams {
|
|||||||
*/
|
*/
|
||||||
class UserBase {
|
class UserBase {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit UserBase(HasFileSystemIF& vfs);
|
explicit UserBase(HasFileSystemIF& vfs);
|
||||||
|
|
||||||
virtual void transactionIndication(const TransactionId& id) = 0;
|
virtual void transactionIndication(const TransactionId& id) = 0;
|
||||||
@ -87,7 +86,8 @@ class UserBase {
|
|||||||
virtual void suspendedIndication(const TransactionId& id, ConditionCode code) = 0;
|
virtual void suspendedIndication(const TransactionId& id, ConditionCode code) = 0;
|
||||||
virtual void resumedIndication(const TransactionId& id, size_t progress) = 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 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;
|
virtual void eofRecvIndication(const TransactionId& id) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -7,7 +7,7 @@ cfdp::UserMock::UserMock(HasFileSystemIF& vfs) : UserBase(vfs) {}
|
|||||||
void UserMock::transactionIndication(const TransactionId& id) {}
|
void UserMock::transactionIndication(const TransactionId& id) {}
|
||||||
void UserMock::eofSentIndication(const TransactionId& id) {}
|
void UserMock::eofSentIndication(const TransactionId& id) {}
|
||||||
void UserMock::abandonedIndication(const TransactionId& id, cfdp::ConditionCode code,
|
void UserMock::abandonedIndication(const TransactionId& id, cfdp::ConditionCode code,
|
||||||
uint64_t progress) {}
|
uint64_t progress) {}
|
||||||
void UserMock::eofRecvIndication(const TransactionId& id) {}
|
void UserMock::eofRecvIndication(const TransactionId& id) {}
|
||||||
void UserMock::transactionFinishedIndication(const TransactionFinishedParams& finishedParams) {}
|
void UserMock::transactionFinishedIndication(const TransactionFinishedParams& finishedParams) {}
|
||||||
void UserMock::metadataRecvdIndication(const MetadataRecvdParams& params) {}
|
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::reportIndication(const TransactionId& id, StatusReportIF& report) {}
|
||||||
void UserMock::suspendedIndication(const TransactionId& id, ConditionCode code) {}
|
void UserMock::suspendedIndication(const TransactionId& id, ConditionCode code) {}
|
||||||
void UserMock::resumedIndication(const TransactionId& id, size_t progress) {}
|
void UserMock::resumedIndication(const TransactionId& id, size_t progress) {}
|
||||||
void UserMock::faultIndication(const TransactionId& id, cfdp::ConditionCode code,
|
void UserMock::faultIndication(const TransactionId& id, cfdp::ConditionCode code, size_t progress) {
|
||||||
size_t progress) {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace cfdp
|
||||||
|
Loading…
Reference in New Issue
Block a user