some internal state handling

This commit is contained in:
Robin Müller 2023-07-17 15:03:08 +02:00
parent 972dc7e19e
commit 8fcc4eab60
Signed by: muellerr
GPG Key ID: 407F9B00F858F270
2 changed files with 20 additions and 6 deletions

View File

@ -26,6 +26,7 @@ void cfdp::SourceHandler::fsmNacked() {
if (result != OK) {
// TODO: Some error handling
}
step = TransactionStep::SENDING_METADATA;
}
if (step == TransactionStep::SENDING_METADATA) {
// TODO: Prepare and send metadata PDU
@ -83,9 +84,18 @@ ReturnValue_t cfdp::SourceHandler::checksumGeneration() {
}
ReturnValue_t cfdp::SourceHandler::putRequest(PutRequestFull& putRequest, RemoteEntityCfg& cfg) {
if (state != CfdpState::IDLE) {
return SOURCE_TRANSACTION_PENDING;
}
transactionParams.closureRequested = putRequest.closureRequested;
transactionParams.destId = putRequest.destId;
transactionParams.transmissionMode = putRequest.transmissionMode;
if (transactionParams.transmissionMode == TransmissionMode::ACKNOWLEDGED) {
state = cfdp::CfdpState::BUSY_CLASS_2_ACKED;
} else if (transactionParams.transmissionMode == TransmissionMode::UNACKNOWLEDGED) {
state = cfdp::CfdpState::BUSY_CLASS_1_NACKED;
}
step = TransactionStep::IDLE;
if (transactionParams.transmissionMode == TransmissionMode::ACKNOWLEDGED) {
}
if (putRequest.sourceNameSize > transactionParams.sourceName.size()) {

View File

@ -12,6 +12,7 @@ namespace cfdp {
enum class CfdpState { IDLE, BUSY_CLASS_1_NACKED, BUSY_CLASS_2_ACKED, SUSPENDED };
static constexpr uint8_t SSID = SUBSYSTEM_ID::CFDP;
static constexpr uint8_t CID = CLASS_ID::CFDP;
struct PacketInfo {
PacketInfo(PduType type, store_address_t storeId,
@ -48,13 +49,14 @@ using PacketInfoList = etl::list<PacketInfo, SIZE>;
using PacketInfoListBase = etl::ilist<PacketInfo>;
struct PutRequestFull {
public:
EntityId destId;
TransmissionMode transmissionMode;
char destName[524];
size_t destNameSize;
char sourceName[524];
size_t sourceNameSize;
bool closureRequested;
TransmissionMode transmissionMode = TransmissionMode::UNACKNOWLEDGED;
char destName[524]{};
size_t destNameSize = 0;
char sourceName[524]{};
size_t sourceNameSize = 0;
bool closureRequested = true;
};
namespace events {
@ -68,5 +70,7 @@ static constexpr Event FILENAME_TOO_LARGE_ERROR = event::makeEvent(SSID, 4, seve
} // namespace events
static constexpr ReturnValue_t SOURCE_TRANSACTION_PENDING = returnvalue::makeCode(CID, 0);
} // namespace cfdp
#endif // FSFW_CFDP_HANDLER_DEFS_H