fsfw/src/fsfw/cfdp/handler/defs.h

77 lines
3.2 KiB
C
Raw Normal View History

2022-08-23 20:30:41 +02:00
#ifndef FSFW_CFDP_HANDLER_DEFS_H
#define FSFW_CFDP_HANDLER_DEFS_H
2023-07-17 09:53:23 +02:00
#include <etl/list.h>
2023-07-17 10:25:09 +02:00
#include "fsfw/storagemanager/StorageManagerIF.h"
2023-06-30 11:59:22 +02:00
#include "fsfw/storagemanager/storeAddress.h"
2023-07-17 10:25:09 +02:00
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
2023-06-30 11:59:22 +02:00
2022-08-23 20:30:41 +02:00
namespace cfdp {
2023-07-14 15:56:38 +02:00
enum class CfdpState { IDLE, BUSY_CLASS_1_NACKED, BUSY_CLASS_2_ACKED, SUSPENDED };
2022-08-23 20:30:41 +02:00
2022-10-17 12:19:31 +02:00
static constexpr uint8_t SSID = SUBSYSTEM_ID::CFDP;
2023-08-31 14:59:09 +02:00
static constexpr uint8_t CID = CLASS_ID::CFDP_HANDLER;
2022-10-17 12:19:31 +02:00
2023-06-30 11:59:22 +02:00
struct PacketInfo {
PacketInfo(PduType type, store_address_t storeId,
std::optional<FileDirective> directive = std::nullopt)
: pduType(type), directiveType(directive), storeId(storeId) {}
PduType pduType = PduType::FILE_DATA;
std::optional<FileDirective> directiveType = FileDirective::INVALID_DIRECTIVE;
store_address_t storeId = store_address_t::invalid();
PacketInfo() = default;
};
2023-07-17 10:25:09 +02:00
struct FsfwParams {
FsfwParams(AcceptsTelemetryIF& packetDest, MessageQueueIF* msgQueue,
EventReportingProxyIF* eventReporter, StorageManagerIF& tcStore,
StorageManagerIF& tmStore)
: FsfwParams(packetDest, msgQueue, eventReporter) {
this->tcStore = &tcStore;
this->tmStore = &tmStore;
}
FsfwParams(AcceptsTelemetryIF& packetDest, MessageQueueIF* msgQueue,
EventReportingProxyIF* eventReporter)
: packetDest(packetDest), msgQueue(msgQueue), eventReporter(eventReporter) {}
AcceptsTelemetryIF& packetDest;
MessageQueueIF* msgQueue;
EventReportingProxyIF* eventReporter = nullptr;
StorageManagerIF* tcStore = nullptr;
StorageManagerIF* tmStore = nullptr;
};
2023-06-30 11:59:22 +02:00
template <size_t SIZE>
using PacketInfoList = etl::list<PacketInfo, SIZE>;
using PacketInfoListBase = etl::ilist<PacketInfo>;
2023-07-17 15:21:22 +02:00
enum class CallStatus { DONE, CALL_AFTER_DELAY, CALL_AGAIN };
2022-10-17 12:19:31 +02:00
namespace events {
static constexpr Event STORE_ERROR = event::makeEvent(SSID, 0, severity::LOW);
static constexpr Event MSG_QUEUE_ERROR = event::makeEvent(SSID, 1, severity::LOW);
static constexpr Event SERIALIZATION_ERROR = event::makeEvent(SSID, 2, severity::LOW);
2023-02-24 15:49:05 +01:00
static constexpr Event FILESTORE_ERROR = event::makeEvent(SSID, 3, severity::LOW);
//! [EXPORT] : [COMMENT] P1: Transaction step ID, P2: 0 for source file name, 1 for dest file name
static constexpr Event FILENAME_TOO_LARGE_ERROR = event::makeEvent(SSID, 4, severity::LOW);
2023-08-31 14:59:09 +02:00
//! [EXPORT] : [COMMENT] CFDP request handling failed. P2: Returncode.
static constexpr Event HANDLING_CFDP_REQUEST_FAILED = event::makeEvent(SSID, 5, severity::LOW);
2022-10-17 12:19:31 +02:00
} // namespace events
2023-07-17 15:03:08 +02:00
static constexpr ReturnValue_t SOURCE_TRANSACTION_PENDING = returnvalue::makeCode(CID, 0);
2023-07-17 16:40:44 +02:00
static constexpr ReturnValue_t FILE_DOES_NOT_EXIST = returnvalue::makeCode(CID, 1);
2023-07-27 17:15:01 +02:00
static constexpr ReturnValue_t FILE_SEGMENT_LEN_INVALID = returnvalue::makeCode(CID, 2);
static constexpr ReturnValue_t SOURCE_NAME_EMPTY = returnvalue::makeCode(CID, 3);
static constexpr ReturnValue_t DEST_NAME_EMPTY = returnvalue::makeCode(CID, 4);
static constexpr ReturnValue_t WRONG_REMOTE_CFG_ENTITY_ID = returnvalue::makeCode(CID, 5);
static constexpr ReturnValue_t TARGET_MSG_QUEUE_FULL = returnvalue::makeCode(CID, 6);
2023-09-06 10:11:09 +02:00
static constexpr ReturnValue_t TM_STORE_FULL = returnvalue::makeCode(CID, 7);
2023-07-17 15:03:08 +02:00
2022-10-17 12:19:31 +02:00
} // namespace cfdp
2022-08-23 20:30:41 +02:00
#endif // FSFW_CFDP_HANDLER_DEFS_H