12 #ifndef Svc_FileDownlink_HPP 13 #define Svc_FileDownlink_HPP 21 #include <config/FileDownlinkCfg.hpp> 39 typedef enum {
IDLE, DOWNLINK, CANCEL, WAIT, COOLDOWN } Type;
43 Mode() : m_value(
IDLE) {}
47 void set(
const Type value) {
49 this->m_value = value;
50 this->m_mutex.unLock();
56 const Type value = this->m_value;
57 this->m_mutex.unLock();
96 const char*
const destFileName
103 void getChecksum(
CFDP::Checksum& checksum) { checksum = this->m_checksum; }
112 Os::File& getOsFile(
void) {
return this->m_osFile; }
115 U32 getSize(
void) {
return this->m_size; }
124 FilesSent(
FileDownlink*
const fileDownlink) : m_sent_file_count(0), m_fileDownlink(fileDownlink) {}
129 ++this->m_sent_file_count;
130 this->m_fileDownlink->tlmWrite_FilesSent(m_sent_file_count);
135 U32 m_sent_file_count;
147 PacketsSent(
FileDownlink*
const fileDownlink) : m_sent_packet_count(0), m_fileDownlink(fileDownlink) {}
152 ++this->m_sent_packet_count;
153 this->m_fileDownlink->tlmWrite_PacketsSent(m_sent_packet_count);
158 U32 m_sent_packet_count;
170 Warnings(
FileDownlink*
const fileDownlink) : m_warning_count(0), m_fileDownlink(fileDownlink) {}
174 void fileOpenError();
182 ++this->m_warning_count;
183 this->m_fileDownlink->tlmWrite_Warnings(m_warning_count);
195 enum CallerSource { COMMAND, PORT };
211 enum PacketType { FILE_PACKET, CANCEL_PACKET, COUNT_PACKET_TYPE };
265 void bufferReturn_handler(
const FwIndexType portNum,
295 void SendPartial_cmdHandler(
310 const char* sourceFilename,
311 const char* destFilename,
318 void sendCancelPacket();
319 void sendEndPacket();
320 void sendStartPacket();
324 void exitFileTransfer();
325 void enterCooldown();
328 void getBuffer(
Fw::Buffer& buffer, PacketType type);
330 void downlinkPacket();
332 void finishHelper(
bool is_cancel);
336 void sendResponse(SendFileStatus resp);
359 FilesSent m_filesSent;
362 PacketsSent m_packetsSent;
401 struct FileEntry m_curEntry;
friend class FileDownlinkTester
FwIdType FwOpcodeType
The type of a command opcode.
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.