Bump FSFW #31

Merged
muellerr merged 139 commits from bump-fsfw into develop 2023-12-18 13:16:28 +01:00
4 changed files with 32 additions and 14 deletions
Showing only changes of commit b53c48863f - Show all commits

View File

@ -47,8 +47,6 @@ struct DestHandlerParams {
size_t maxFilenameLen = 255;
};
enum class CallStatus { DONE, CALL_AFTER_DELAY, CALL_AGAIN };
class DestHandler {
public:
enum class TransactionStep : uint8_t {

View File

@ -13,13 +13,12 @@ cfdp::SourceHandler::SourceHandler(SourceHandlerParams params, FsfwParams fsfwPa
sourceParams(std::move(params)),
fsfwParams(fsfwParams) {}
void cfdp::SourceHandler::fsmNacked() {
cfdp::SourceHandler::FsmResult& cfdp::SourceHandler::fsmNacked() {
ReturnValue_t result;
if (step == TransactionStep::IDLE) {
step = TransactionStep::TRANSACTION_START;
}
if (step == TransactionStep::TRANSACTION_START) {
// TODO: Use put request information to start the transaction
step = TransactionStep::CRC_PROCEDURE;
}
if (step == TransactionStep::CRC_PROCEDURE) {
@ -34,18 +33,21 @@ void cfdp::SourceHandler::fsmNacked() {
if (result != OK) {
// TODO: Error handling
}
return fsmResult;
}
if (step == TransactionStep::SENDING_FILE_DATA) {
result = prepareNextFileDataPdu();
result = prepareAndSendNextFileDataPdu();
if (result != OK) {
// TODO: Error handling
}
return fsmResult;
}
if (step == TransactionStep::SENDING_EOF) {
result = prepareEofPdu();
result = prepareAndSendEofPdu();
if (result != OK) {
// TODO: Error handling
}
return fsmResult;
}
if (step == TransactionStep::WAIT_FOR_FINISH) {
// TODO: In case this is a request with closure, wait for finish.
@ -59,14 +61,17 @@ void cfdp::SourceHandler::fsmNacked() {
step = TransactionStep::IDLE;
state = CfdpState::IDLE;
}
return fsmResult;
}
void cfdp::SourceHandler::stateMachine() {
cfdp::SourceHandler::FsmResult& cfdp::SourceHandler::stateMachine() {
if (state == cfdp::CfdpState::IDLE) {
return;
return fsmResult;
}
if (state == cfdp::CfdpState::BUSY_CLASS_1_NACKED) {
return fsmNacked();
}
return fsmResult;
}
ReturnValue_t cfdp::SourceHandler::checksumGeneration() {
@ -133,13 +138,15 @@ ReturnValue_t cfdp::SourceHandler::prepareAndSendMetadataPdu() {
step = TransactionStep::SENDING_FILE_DATA;
return OK;
}
ReturnValue_t cfdp::SourceHandler::prepareNextFileDataPdu() {
ReturnValue_t cfdp::SourceHandler::prepareAndSendNextFileDataPdu() {
// TODO: Implement
// Advance FSM after all file data PDUs were sent
step = TransactionStep::SENDING_EOF;
return OK;
}
ReturnValue_t cfdp::SourceHandler::prepareEofPdu() {
ReturnValue_t cfdp::SourceHandler::prepareAndSendEofPdu() {
// TODO: Implement
step = TransactionStep::WAIT_FOR_FINISH;
return OK;

View File

@ -24,6 +24,16 @@ struct SourceHandlerParams {
class SourceHandler {
public:
struct FsmResult {
public:
ReturnValue_t result = returnvalue::OK;
CallStatus callStatus = CallStatus::CALL_AFTER_DELAY;
CfdpState state = CfdpState::IDLE;
uint32_t packetsSent = 0;
uint8_t errors = 0;
std::array<ReturnValue_t, 3> errorCodes = {};
};
SourceHandler(SourceHandlerParams params, FsfwParams fsfwParams);
/**
@ -32,7 +42,7 @@ class SourceHandler {
* @return
*/
ReturnValue_t putRequest(PutRequestFull& putRequest, RemoteEntityCfg& cfg);
void stateMachine();
FsmResult& stateMachine();
private:
enum class TransactionStep : uint8_t {
@ -64,12 +74,13 @@ class SourceHandler {
SourceHandlerParams sourceParams;
cfdp::FsfwParams fsfwParams;
RemoteEntityCfg currentRemoteCfg;
FsmResult fsmResult;
void fsmNacked();
FsmResult& fsmNacked();
ReturnValue_t checksumGeneration();
ReturnValue_t prepareAndSendMetadataPdu();
ReturnValue_t prepareNextFileDataPdu();
ReturnValue_t prepareEofPdu();
ReturnValue_t prepareAndSendNextFileDataPdu();
ReturnValue_t prepareAndSendEofPdu();
};
} // namespace cfdp

View File

@ -59,6 +59,8 @@ struct PutRequestFull {
bool closureRequested = true;
};
enum class CallStatus { DONE, CALL_AFTER_DELAY, CALL_AGAIN };
namespace events {
static constexpr Event STORE_ERROR = event::makeEvent(SSID, 0, severity::LOW);