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; size_t maxFilenameLen = 255;
}; };
enum class CallStatus { DONE, CALL_AFTER_DELAY, CALL_AGAIN };
class DestHandler { class DestHandler {
public: public:
enum class TransactionStep : uint8_t { enum class TransactionStep : uint8_t {

View File

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

View File

@ -24,6 +24,16 @@ struct SourceHandlerParams {
class SourceHandler { class SourceHandler {
public: 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); SourceHandler(SourceHandlerParams params, FsfwParams fsfwParams);
/** /**
@ -32,7 +42,7 @@ class SourceHandler {
* @return * @return
*/ */
ReturnValue_t putRequest(PutRequestFull& putRequest, RemoteEntityCfg& cfg); ReturnValue_t putRequest(PutRequestFull& putRequest, RemoteEntityCfg& cfg);
void stateMachine(); FsmResult& stateMachine();
private: private:
enum class TransactionStep : uint8_t { enum class TransactionStep : uint8_t {
@ -64,12 +74,13 @@ class SourceHandler {
SourceHandlerParams sourceParams; SourceHandlerParams sourceParams;
cfdp::FsfwParams fsfwParams; cfdp::FsfwParams fsfwParams;
RemoteEntityCfg currentRemoteCfg; RemoteEntityCfg currentRemoteCfg;
FsmResult fsmResult;
void fsmNacked(); FsmResult& fsmNacked();
ReturnValue_t checksumGeneration(); ReturnValue_t checksumGeneration();
ReturnValue_t prepareAndSendMetadataPdu(); ReturnValue_t prepareAndSendMetadataPdu();
ReturnValue_t prepareNextFileDataPdu(); ReturnValue_t prepareAndSendNextFileDataPdu();
ReturnValue_t prepareEofPdu(); ReturnValue_t prepareAndSendEofPdu();
}; };
} // namespace cfdp } // namespace cfdp

View File

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