Add FW_PACKET_FILE descriptor to FileDownlink and FileUplink logic#3488
Add FW_PACKET_FILE descriptor to FileDownlink and FileUplink logic#3488thomas-bc merged 8 commits intonasa:develfrom
Conversation
| sendFilePacket(const Fw::FilePacket& filePacket) | ||
| { | ||
| const U32 bufferSize = filePacket.bufferSize(); | ||
| const U32 bufferSize = filePacket.bufferSize() + sizeof(FwPacketDescriptorType); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
|
|
||
| void FileUplink ::pingIn_handler(const FwIndexType portNum, U32 key) { | ||
| // return key | ||
| this->pingOut_out(0, key); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| else { | ||
| this->m_warnings.invalidReceiveMode(Fw::FilePacket::T_END); | ||
| this->m_filesReceived.fileReceived(); | ||
| this->checkSequenceIndex(endPacket.asHeader().getSequenceIndex()); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| FpFrameHeader::TokenType total = real_data_size + FpFrameHeader::SIZE + HASH_DIGEST_LENGTH; | ||
| Fw::Buffer buffer = m_interface->allocate(total); | ||
|
|
||
| FpFrameHeader::TokenType totalSize = size + FpFrameHeader::SIZE + HASH_DIGEST_LENGTH; |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
LeStarch
left a comment
There was a problem hiding this comment.
Just the one minor fix!
| const char *const name | ||
| ) : | ||
| FileDownlinkComponentBase(name), | ||
| FileDownlink ::FileDownlink(const char* const name) |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
| { | ||
| } | ||
|
|
||
| void FileDownlink ::sendFile(const char* sourceFilename, const char* destFilename, U32 startOffset, U32 length) { |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
| { | ||
| } | ||
|
|
||
| void FileDownlink ::sendFile(const char* sourceFilename, const char* destFilename, U32 startOffset, U32 length) { |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
| static_cast<FwSizeType>(sizeof(struct FileEntry)) | ||
| ); | ||
| Os::Queue::Status stat = | ||
| m_fileQueue.create(Os::QueueString("fileDownlinkQueue"), static_cast<FwSizeType>(fileQueueDepth), |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| } | ||
|
|
||
| void FileDownlink ::pingIn_handler(const FwIndexType portNum, U32 key) { | ||
| this->pingOut_out(0, key); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| default: | ||
| // Trigger assertion if given unknown status | ||
| FW_ASSERT(false); | ||
| this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| default: | ||
| // Trigger assertion if given unknown status | ||
| FW_ASSERT(false); | ||
| this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| // ---------------------------------------------------------------------- | ||
|
|
||
| Fw::CmdResponse FileDownlink ::statusToCmdResp(SendFileStatus status) { | ||
| switch (status.e) { |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| this->cmdResponse_out(this->m_curEntry.opCode, this->m_curEntry.cmdSeq, statusToCmdResp(resp)); | ||
| void FileDownlink ::sendResponse(SendFileStatus resp) { | ||
| if (this->m_curEntry.source == FileDownlink::COMMAND) { | ||
| this->cmdResponse_out(this->m_curEntry.opCode, this->m_curEntry.cmdSeq, statusToCmdResp(resp)); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| this->FileComplete_out(i, Svc::SendFileResponse(resp, this->m_curEntry.context)); | ||
| for (FwIndexType i = 0; i < this->getNum_FileComplete_OutputPorts(); i++) { | ||
| if (this->isConnected_FileComplete_OutputPort(i)) { | ||
| this->FileComplete_out(i, Svc::SendFileResponse(resp, this->m_curEntry.context)); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| sourceFilename, | ||
| destFilename | ||
| ); | ||
| Os::File::Status status = this->m_file.open(sourceFilename, destFilename); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| sourceFilename, | ||
| destFilename | ||
| ); | ||
| Os::File::Status status = this->m_file.open(sourceFilename, destFilename); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| // Check type is correct | ||
| FW_ASSERT(type < COUNT_PACKET_TYPE && type >= 0, static_cast<FwAssertArgType>(type)); | ||
| // Wrap the buffer around our indexed memory. | ||
| buffer.setData(this->m_memoryStore[type]); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
|
Adding breaking change in that if a user were to do unexpected things with buffers coming out of FileDownlink/FileUplink, things would break. The common use cases do not break. |
Change Description
Fix #3467
Packet descriptor is now handled at reception/emission time within FileUplink/FileDownlink.
Rationale
No custom code in routing / framing needed anymore, etc. File packets are stamped when created.