Skip to content

Conversation

@timcanham
Copy link
Collaborator

Related Issue(s) #4443
Has Unit Tests (y/n) y
Documentation Included (y/n) y
Generative AI was used in this contribution (y/n) y

Change Description

Adds a new Svc/FileDispatcher component for dispatching newly uplinked files

Rationale

Provides automation for automatically handling files like sequences.

Testing/Review Recommendations

Unit tests are provided which test some entries

Future Work

#4444 - this issue will add a port to Svc/CmdSequencer to automatically run sequences.

AI Usage (see policy)

Git Copilot provided suggestions while writing the code.

Copy link
Collaborator

@LeStarch LeStarch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really think you need 2 data structures here:

  1. Mapping for EXT to port
  2. List of ports to disable/enable

Right now the code looks like you are trying to separate the concepts, but cannot because of the singular data structure.

Either remove "port" from the data structure, make enable/disable a loop through all table entrys matching on port type, or split them up.

@thomas-bc thomas-bc changed the title File dispatcher - second try Add Svc.FileDispatcher component Dec 17, 2025
Copy link
Collaborator

@LeStarch LeStarch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to think a bit on the copy, and I need to evaluate the CodeQL warnings.

Copy link
Collaborator

@kevin-f-ortega kevin-f-ortega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, nice work! A few comments


FileDispatcher ::~FileDispatcher() {}

void FileDispatcher ::configure(const FileDispatcherTable& table) {

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
// Handler implementations for commands
// ----------------------------------------------------------------------

void FileDispatcher ::ENABLE_DISPATCH_cmdHandler(FwOpcodeType opCode,

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
FW_ASSERT(table.entries[entry].fileExt.length() > 0,
static_cast<FwAssertArgType>(table.entries[entry].fileExt.length())); // non-zero length
// Copy over table entry
this->m_dispatchTable.entries[entry].port = table.entries[entry].port;

Check warning

Code scanning / CodeQL

Unchecked return value Warning

The return value of non-void function
operator=
is not checked.
static_cast<FwAssertArgType>(table.entries[entry].fileExt.length())); // non-zero length
// Copy over table entry
this->m_dispatchTable.entries[entry].port = table.entries[entry].port;
this->m_dispatchTable.entries[entry].fileExt = table.entries[entry].fileExt;

Check warning

Code scanning / CodeQL

Unchecked return value Warning

The return value of non-void function
operator=
is not checked.
this->m_dispatchTable.entries[i].enabled = enable;
}
}
this->log_ACTIVITY_HI_FileDispatchState(file_type, enable);

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter file_type has not been checked.
this->m_dispatchTable.entries[i].enabled = enable;
}
}
this->log_ACTIVITY_HI_FileDispatchState(file_type, enable);

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter enable has not been checked.
LeStarch
LeStarch previously approved these changes Jan 7, 2026

for (FwSizeType i = 0; i < this->m_dispatchTable.numEntries; i++) {
if (this->m_dispatchTable.entries[i].port == file_type) {
this->m_dispatchTable.entries[i].enabled = enable;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be this->m_dispatchTable.entries[i].enabled = (enable == Fw::Enabled::ENABLED);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, yes it should

Copy link
Collaborator

@kevin-f-ortega kevin-f-ortega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one minor comment

@LeStarch LeStarch merged commit 5067881 into nasa:devel Jan 7, 2026
53 checks passed
@timcanham timcanham deleted the file-dispatcher-2 branch January 9, 2026 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants