Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #142, Standardize command responses #143

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

thnkslprpt
Copy link
Contributor

@thnkslprpt thnkslprpt commented Jun 9, 2024

Checklist

Describe the contribution

  • Fixes Standardization of Command Responses #142
    • Changes SC_RESET_DEB_EID, SC_DISABLE_RTS_DEB_EID, SC_ENABLE_RTS_DEB_EID & SC_CONT_CMD_DEB_EID to INFORMATION type
      - Adds new event (SC_TABLE_MANAGE_INF_EID) and required logic to the SC_ManageTableCmd and SC_ManageTable functions in order to return a success event when no errors were encountered during processing (either from the SC functions or passed through from cFE functions)
      - Updates nominal manage table tests to include a check for SC_TABLE_MANAGE_INF_EID
      Note: the issue requested the addition of an event for the SC_MANAGE_TABLE_CC command, but given the risk of flooding, and the fact that issuing an event for table processing is out-of-family with the open-source cFS apps, it has not been included in this pull request.

Testing performed
GitHub CI actions all passing successfully (incl. Build + Run, Unit/Functional Tests etc.).

Expected behavior changes
Success event will be issued if no errors are encountered during processing of the SC_MANAGE_TABLE_CC command.

System(s) tested on
Debian GNU/Linux 12 (bookworm)
Current main branch of cFS bundle.

Contributor Info
Avi Weiss   @thnkslprpt

@@ -702,12 +718,12 @@
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

void SC_ManageTable(SC_TableType type, int32 ArrayIndex)
CFE_Status_t SC_ManageTable(SC_TableType type, int32 ArrayIndex)

Check notice

Code scanning / CodeQL-coding-standard

Long function without assertion

All functions of more than 10 lines should have at least one assertion.
@@ -683,17 +694,22 @@
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

void SC_ManageAtsTable(int32 ArrayIndex)
CFE_Status_t SC_ManageAtsTable(int32 ArrayIndex)

Check notice

Code scanning / CodeQL-coding-standard

Long function without assertion

All functions of more than 10 lines should have at least one assertion.
@@ -664,17 +670,22 @@
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

void SC_ManageRtsTable(int32 ArrayIndex)
CFE_Status_t SC_ManageRtsTable(int32 ArrayIndex)

Check notice

Code scanning / CodeQL-coding-standard

Long function without assertion

All functions of more than 10 lines should have at least one assertion.
@@ -702,12 +718,12 @@
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

void SC_ManageTable(SC_TableType type, int32 ArrayIndex)
CFE_Status_t SC_ManageTable(SC_TableType type, int32 ArrayIndex)

Check notice

Code scanning / CodeQL-coding-standard

Function too long

SC_ManageTable has too many lines (73, while 60 are allowed).
@dzbaker
Copy link
Contributor

dzbaker commented Sep 26, 2024

Hi @thnkslprpt, apologies about the delay with this PR. I'd like to get it into the next round of PR reviews. Would you be able to resolve the merge conflict?

@thnkslprpt thnkslprpt force-pushed the fix-142-standardize-command-responses branch 6 times, most recently from 0bea4eb to 6db7f5d Compare September 27, 2024 19:46
@thnkslprpt
Copy link
Contributor Author

Hi @thnkslprpt, apologies about the delay with this PR. I'd like to get it into the next round of PR reviews. Would you be able to resolve the merge conflict?

Good to go now @dzbaker

* This event message is issued when a #SC_MANAGE_TABLE_CC command was received
* and executed without error
*/
#define SC_MANAGE_TABLE_INF_EID 111
Copy link
Contributor

Choose a reason for hiding this comment

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

@thnkslprpt What was the reason for adding this EID?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was added in order to address the comment in the issue from Dan:
"SC_MANAGE_TABLE_CC command does not issue success events in all success cases.", but if Jose's comment below regarding flooding is an issue, I can remove the event add a comment to that effect.

@@ -773,4 +775,9 @@ void SC_ManageTable(SC_TableType type, int32 ArrayIndex)
}
}

if (Result == CFE_SUCCESS)
{
CFE_EVS_SendEvent(SC_MANAGE_TABLE_INF_EID, CFE_EVS_EventType_INFORMATION, "Table manage command.");
Copy link

@pepepr08 pepepr08 Oct 3, 2024

Choose a reason for hiding this comment

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

@jphickey Is it possible we never sent a success event here because it floods the system whenever running an RTS (CFE TABLE sends this command whenever a table needs to be managed)? We also don't increment the command success counter?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand, could you elaborate? Specifically what's the flow that would cause flooding and what's the relation to CFE TIME?

Copy link

Choose a reason for hiding this comment

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

@skliper Oops, not CFE TIME, CFE TABLE Services. I'm not sure if it will flood the system or not, I haven't tested it. But I assumed that was the reason why we never added an event for this command. Will this get called only when a table is updated externally from SC? In that case, it might not be a problem.

Copy link
Contributor

Choose a reason for hiding this comment

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

@pepepr08 Oh, yeah I see now where SC calls CFE_TBL_NotifyByMessage to register the SC_MANAGE_TABLE_CC with CFE Table services. I wish it was using a different MID so it's obvious it's not a ground command. Either way, should only get called when a table is updated using table services (worth testing to confirm though). Interestingly SC is the only common/shared app I could find that uses the NotifyByMessage API. Either way since it's really just internal TBL/SC coordination I don't think it falls under the "common ground command handling" need to send an event when it happens. I'm not aware of any other app that reports table management in an event.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes correct - no other apps have an event for table handling, and it was only noted in the issue here because SC is the only app that handles tables as part of the processing of a direct command (SC_ManageTableCmd()).

So for now I'll remove the event, and add a comment noting that it is an exception.

@thnkslprpt thnkslprpt force-pushed the fix-142-standardize-command-responses branch from 6db7f5d to 88c6703 Compare October 7, 2024 19:49
@dzbaker dzbaker merged commit 5f4d21a into nasa:main Oct 10, 2024
16 checks passed
@thnkslprpt thnkslprpt deleted the fix-142-standardize-command-responses branch October 10, 2024 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Standardization of Command Responses
5 participants