continued router component
This commit is contained in:
parent
267466be9d
commit
81a7c21cd1
@ -18,8 +18,7 @@ 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) {
|
||||||
@ -31,18 +30,23 @@ ReturnValue_t cfdp::DestHandler::performStateMachine() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (step != TransactionStep::IDLE) {
|
||||||
|
return CALL_FSM_AGAIN;
|
||||||
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
case TransactionStep::TRANSACTION_START:
|
if (cfdpState == CfdpStates::BUSY_CLASS_1_NACKED) {
|
||||||
break;
|
for (const auto& info : dp.packetListRef) {
|
||||||
case TransactionStep::RECEIVING_FILE_DATA_PDUS:
|
if (info.pduType == PduType::FILE_DATA) {
|
||||||
break;
|
}
|
||||||
case TransactionStep::SENDING_ACK_PDU:
|
}
|
||||||
break;
|
return returnvalue::OK;
|
||||||
case TransactionStep::TRANSFER_COMPLETION:
|
}
|
||||||
break;
|
if (cfdpState == CfdpStates::BUSY_CLASS_2_ACKED) {
|
||||||
case TransactionStep::SENDING_FINISHED_PDU:
|
// TODO: Will be implemented at a later stage
|
||||||
break;
|
#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:
|
||||||
|
@ -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