12 #ifndef Svc_FileDownlink_HPP 13 #define Svc_FileDownlink_HPP 22 #include <config/FileDownlinkCfg.hpp> 40 typedef enum {
IDLE, DOWNLINK, CANCEL, WAIT, COOLDOWN } Type;
44 Mode() : m_value(
IDLE) {}
48 void set(
const Type value) {
50 this->m_value = value;
51 this->m_mutex.unLock();
57 const Type value = this->m_value;
58 this->m_mutex.unLock();
104 void getChecksum(
CFDP::Checksum& checksum) { checksum = this->m_checksum; }
113 void configureSandbox(
const char* directory) { this->m_osFile.
configure(directory); }
119 U32 getSize(
void) {
return this->m_size; }
128 FilesSent(
FileDownlink*
const fileDownlink) : m_sent_file_count(0), m_fileDownlink(fileDownlink) {}
133 ++this->m_sent_file_count;
134 this->m_fileDownlink->tlmWrite_FilesSent(m_sent_file_count);
139 U32 m_sent_file_count;
151 PacketsSent(
FileDownlink*
const fileDownlink) : m_sent_packet_count(0), m_fileDownlink(fileDownlink) {}
156 ++this->m_sent_packet_count;
157 this->m_fileDownlink->tlmWrite_PacketsSent(m_sent_packet_count);
162 U32 m_sent_packet_count;
174 Warnings(
FileDownlink*
const fileDownlink) : m_warning_count(0), m_fileDownlink(fileDownlink) {}
178 void fileOpenError();
187 void sourceOutOfSandbox();
192 ++this->m_warning_count;
193 this->m_fileDownlink->tlmWrite_Warnings(m_warning_count);
205 enum CallerSource { COMMAND, PORT };
221 enum PacketType { FILE_PACKET, CANCEL_PACKET, COUNT_PACKET_TYPE };
279 void bufferReturn_handler(
const FwIndexType portNum,
309 void SendPartial_cmdHandler(
332 void sendCancelPacket();
333 void sendEndPacket();
334 void sendStartPacket();
338 void exitFileTransfer();
339 void enterCooldown();
342 void getBuffer(
Fw::Buffer& buffer, PacketType type);
344 void downlinkPacket();
346 void finishHelper(
bool is_cancel);
350 void sendResponse(SendFileStatus resp);
373 FilesSent m_filesSent;
376 PacketsSent m_packetsSent;
415 struct FileEntry m_curEntry;
void configure(const char *allowedDirectory)
Configure the allowed sandbox directory.
friend class FileDownlinkTester
FwIdType FwOpcodeType
The type of a command opcode.
A wrapper around Os::File that restricts file access to an allowed directory.
Enum representing a command response.
FileDownlink(const char *const compName)
void configure(U32 cooldown, U32 cycleTime, U32 fileQueueDepth)
Class representing a 32-bit checksum as mandated by the CCSDS File Delivery Protocol.
Auto-generated base for FileDownlink component.
uint8_t U8
8-bit unsigned integer
PlatformIndexType FwIndexType
Send file response struct.
RateGroupDivider component implementation.
static const U32 FILEDOWNLINK_INTERNAL_BUFFER_SIZE
void deinit()
Cleans up file queue before dispatching to underlying component.