Skip to content

Commit

Permalink
Fix #1528, Move NO_SUCH_TABLE_ERR_EID into FindTableInRegistry and make
Browse files Browse the repository at this point in the history
optional
  • Loading branch information
thnkslprpt committed May 5, 2023
1 parent e3b6767 commit da5663a
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 63 deletions.
21 changes: 21 additions & 0 deletions modules/tbl/config/default_cfe_tbl_internal_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,25 @@
#define CFE_PLATFORM_TBL_VALID_PRID_3 0
#define CFE_PLATFORM_TBL_VALID_PRID_4 0

/**
** \cfeevscfg Define whether or not to send an event if table not found in registry
**
** \par Description:
** This configuration parameter sets whether or not to send an event if a table is
** not found in the registry when calling CFE_TBL_FindTableInRegistry.
**
** Note: If the table is not found, CFE_TBL_FindTableInRegistry returns
** CFE_TBL_NOT_FOUND, whether or not this configuration parameter is set to true.
** If the event reports are not needed, this parameter can therefore be set to
** false, and the implications of the table not being found can be handled via the
** return code.
**
** If set to true, an event will be sent with Event ID CFE_TBL_NO_SUCH_TABLE_ERR_EID.
** If set to false, no event will be sent.
**
** \par Limits
** The valid settings are true or false.
*/
#define CFE_PLATFORM_TBL_SEND_EVENT_IF_TABLE_NOT_FOUND true

#endif
8 changes: 8 additions & 0 deletions modules/tbl/fsw/src/cfe_tbl_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,14 @@ int16 CFE_TBL_FindTableInRegistry(const char *TblName)
}
} while ((RegIndx == CFE_TBL_NOT_FOUND) && (i < (CFE_PLATFORM_TBL_MAX_NUM_TABLES - 1)));

#if (CFE_PLATFORM_TBL_SEND_EVENT_IF_TABLE_NOT_FOUND == true)
if (RegIndx == CFE_TBL_NOT_FOUND)
{
CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, CFE_EVS_EventType_ERROR,
"Unable to locate '%s' in Table Registry", TblName);
}
#endif

return RegIndx;
}

Expand Down
32 changes: 1 addition & 31 deletions modules/tbl/fsw/src/cfe_tbl_task_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,7 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data)
/* Locate specified table in registry */
RegIndex = CFE_TBL_FindTableInRegistry(TblFileHeader.TableName);

if (RegIndex == CFE_TBL_NOT_FOUND)
{
CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, CFE_EVS_EventType_ERROR,
"Unable to locate '%s' in Table Registry", TblFileHeader.TableName);
}
else
if (RegIndex != CFE_TBL_NOT_FOUND)
{
/* Translate the registry index into a record pointer */
RegRecPtr = &CFE_TBL_Global.Registry[RegIndex];
Expand Down Expand Up @@ -655,11 +650,6 @@ int32 CFE_TBL_DumpCmd(const CFE_TBL_DumpCmd_t *data)
}
}
}
else /* Table could not be found in Registry */
{
CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, CFE_EVS_EventType_ERROR,
"Unable to locate '%s' in Table Registry", TableName);
}

return ReturnCode;
}
Expand Down Expand Up @@ -920,11 +910,6 @@ int32 CFE_TBL_ValidateCmd(const CFE_TBL_ValidateCmd_t *data)
}
}
}
else /* Table could not be found in Registry */
{
CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, CFE_EVS_EventType_ERROR,
"Unable to locate '%s' in Table Registry", TableName);
}

return ReturnCode;
}
Expand Down Expand Up @@ -998,11 +983,6 @@ int32 CFE_TBL_ActivateCmd(const CFE_TBL_ActivateCmd_t *data)
"Cannot activate table '%s'. No Inactive image available", TableName);
}
}
else /* Table could not be found in Registry */
{
CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, CFE_EVS_EventType_ERROR,
"Unable to locate '%s' in Table Registry", TableName);
}

return ReturnCode;
}
Expand Down Expand Up @@ -1278,11 +1258,6 @@ int32 CFE_TBL_SendRegistryCmd(const CFE_TBL_SendRegistryCmd_t *data)
/* Increment Successful Command Counter */
ReturnCode = CFE_TBL_INC_CMD_CTR;
}
else /* Table could not be found in Registry */
{
CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, CFE_EVS_EventType_ERROR,
"Unable to locate '%s' in Table Registry", TableName);
}

return ReturnCode;
}
Expand Down Expand Up @@ -1416,11 +1391,6 @@ int32 CFE_TBL_AbortLoadCmd(const CFE_TBL_AbortLoadCmd_t *data)
"Cannot abort load of '%s'. No load started.", TableName);
}
}
else /* Table could not be found in Registry */
{
CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, CFE_EVS_EventType_ERROR,
"Unable to locate '%s' in Table Registry", TableName);
}

return ReturnCode;
}
Expand Down
Loading

0 comments on commit da5663a

Please sign in to comment.