-
Notifications
You must be signed in to change notification settings - Fork 21
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 #82, use separate dispatcher for messages #88
Conversation
/* Process a command pipe message */ | ||
/* */ | ||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | ||
int32 LC_AppPipe(const CFE_SB_Buffer_t *BufPtr) |
Check notice
Code scanning / CodeQL
Function too long
} | ||
|
||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | ||
/* */ | ||
/* Housekeeping request */ | ||
/* */ | ||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | ||
int32 LC_HousekeepingReq(const CFE_MSG_CommandHeader_t *MsgPtr) | ||
int32 LC_SendHkCmd(const CFE_MSG_CommandHeader_t *MsgPtr) |
Check notice
Code scanning / CodeQL
Long function without assertion
/* Process a command pipe message */ | ||
/* */ | ||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | ||
int32 LC_AppPipe(const CFE_SB_Buffer_t *BufPtr) |
Check notice
Code scanning / CodeQL
Long function without assertion
/* Verify message packet length */ | ||
/* */ | ||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | ||
bool LC_VerifyMsgLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength) |
Check notice
Code scanning / CodeQL
Long function without assertion
} | ||
|
||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | ||
/* */ | ||
/* Housekeeping request */ | ||
/* */ | ||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | ||
int32 LC_HousekeepingReq(const CFE_MSG_CommandHeader_t *MsgPtr) | ||
int32 LC_SendHkCmd(const CFE_MSG_CommandHeader_t *MsgPtr) |
Check notice
Code scanning / CodeQL
Function too long
switch (CFE_SB_MsgIdToValue(MessageID)) | ||
{ | ||
/* | ||
** Sample actionpoints request | ||
*/ | ||
case LC_SAMPLE_AP_MID: | ||
LC_SampleAPVerifyDispatch(BufPtr); | ||
break; | ||
|
||
/* | ||
** Housekeeping telemetry request | ||
** (only routine that can return a critical error indicator) | ||
*/ | ||
case LC_SEND_HK_MID: | ||
LC_SendHkVerifyDispatch(BufPtr); | ||
break; | ||
|
||
/* | ||
** LC application commands... | ||
*/ | ||
case LC_CMD_MID: | ||
|
||
CFE_MSG_GetFcnCode(&BufPtr->Msg, &CommandCode); | ||
switch (CommandCode) | ||
{ | ||
case LC_NOOP_CC: | ||
LC_NoopVerifyDispatch(BufPtr); | ||
break; | ||
|
||
case LC_RESET_CC: | ||
LC_ResetCountersVerifyDispatch(BufPtr); | ||
break; | ||
|
||
case LC_SET_LC_STATE_CC: | ||
LC_SetLCStateVerifyDispatch(BufPtr); | ||
break; | ||
|
||
case LC_SET_AP_STATE_CC: | ||
LC_SetAPStateVerifyDispatch(BufPtr); | ||
break; | ||
|
||
case LC_SET_AP_PERM_OFF_CC: | ||
LC_SetAPPermOffVerifyDispatch(BufPtr); | ||
break; | ||
|
||
case LC_RESET_AP_STATS_CC: | ||
LC_ResetAPStatsVerifyDispatch(BufPtr); | ||
break; | ||
|
||
case LC_RESET_WP_STATS_CC: | ||
LC_ResetWPStatsVerifyDispatch(BufPtr); | ||
break; | ||
|
||
default: | ||
CFE_EVS_SendEvent(LC_CC_ERR_EID, CFE_EVS_EventType_ERROR, | ||
"Invalid command code: ID = 0x%08lX, CC = %d", | ||
(unsigned long)CFE_SB_MsgIdToValue(MessageID), CommandCode); | ||
|
||
LC_AppData.CmdErrCount++; | ||
break; | ||
|
||
} /* end CommandCode switch */ | ||
break; | ||
|
||
/* | ||
** All other message ID's should be monitor | ||
** packets | ||
*/ | ||
default: | ||
LC_CheckMsgForWPs(MessageID, BufPtr); | ||
break; | ||
|
||
} /* end MessageID switch */ |
Check notice
Code scanning / CodeQL
Long switch case
16d72e3
to
171ff1c
Compare
171ff1c
to
b7dcff4
Compare
Isolate the message verification and dispatch from the general message processing. Functions in the "cmds" file now strictly handle the command content, and do not get involved in general validation.
b7dcff4
to
8aa3742
Compare
Format checks fixed, all passing now. |
Checklist (Please check before submitting)
Describe the contribution
Isolate the message verification and dispatch from the general message processing. Functions in the "cmds" file now strictly handle the command content, and do not get involved in general validation.
Fixes #82
Testing performed
Build and run CFE with LC, sanity check operation
Expected behavior changes
No impact, just improves source unit organization
System(s) tested on
Debian
Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.