12 #ifndef Svc_FileDownlink_HPP 13 #define Svc_FileDownlink_HPP 20 #include <config/FileDownlinkCfg.hpp> 38 typedef enum {
IDLE, DOWNLINK, CANCEL, WAIT, COOLDOWN } Type;
42 Mode() : m_value(
IDLE) {}
46 void set(
const Type value) {
48 this->m_value = value;
49 this->m_mutex.unLock();
55 const Type value = this->m_value;
56 this->m_mutex.unLock();
95 const char*
const destFileName
102 void getChecksum(
CFDP::Checksum& checksum) { checksum = this->m_checksum; }
111 Os::File& getOsFile(
void) {
return this->m_osFile; }
114 U32 getSize(
void) {
return this->m_size; }
123 FilesSent(
FileDownlink*
const fileDownlink) : m_sent_file_count(0), m_fileDownlink(fileDownlink) {}
128 ++this->m_sent_file_count;
129 this->m_fileDownlink->tlmWrite_FilesSent(m_sent_file_count);
134 U32 m_sent_file_count;
146 PacketsSent(
FileDownlink*
const fileDownlink) : m_sent_packet_count(0), m_fileDownlink(fileDownlink) {}
151 ++this->m_sent_packet_count;
152 this->m_fileDownlink->tlmWrite_PacketsSent(m_sent_packet_count);
157 U32 m_sent_packet_count;
169 Warnings(
FileDownlink*
const fileDownlink) : m_warning_count(0), m_fileDownlink(fileDownlink) {}
173 void fileOpenError();
181 ++this->m_warning_count;
182 this->m_fileDownlink->tlmWrite_Warnings(m_warning_count);
194 enum CallerSource { COMMAND, PORT };
196 #define FILE_ENTRY_FILENAME_LEN 101 212 enum PacketType { FILE_PACKET, CANCEL_PACKET, COUNT_PACKET_TYPE };
264 void bufferReturn_handler(
const FwIndexType portNum,
294 void SendPartial_cmdHandler(
309 const char* sourceFilename,
310 const char* destFilename,
317 void sendCancelPacket();
318 void sendEndPacket();
319 void sendStartPacket();
323 void exitFileTransfer();
324 void enterCooldown();
327 void getBuffer(
Fw::Buffer& buffer, PacketType type);
329 void downlinkPacket();
331 void finishHelper(
bool is_cancel);
335 void sendResponse(SendFileStatus resp);
358 FilesSent m_filesSent;
361 PacketsSent m_packetsSent;
400 struct FileEntry m_curEntry;
#define FILE_ENTRY_FILENAME_LEN
friend class FileDownlinkTester
FwIdType FwOpcodeType
The type of a command opcode.
Enum representing a command response.
FileDownlink(const char *const compName)
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
void configure(U32 timeout, U32 cooldown, U32 cycleTime, U32 fileQueueDepth)
PlatformIndexType FwIndexType
Send file response struct.
RateGroupDivider component implementation.
static const U32 FILEDOWNLINK_INTERNAL_BUFFER_SIZE