Skip to content

Commit

Permalink
Merge pull request #404 from CDKnightNASA/fix-210-getpipidbyname
Browse files Browse the repository at this point in the history
Fix #210, Add SB API to get pipe by name
  • Loading branch information
astrogeco committed Feb 12, 2020
1 parent f26f323 commit 570ed6f
Show file tree
Hide file tree
Showing 11 changed files with 1,045 additions and 192 deletions.
52 changes: 48 additions & 4 deletions fsw/cfe-core/src/inc/cfe_sb.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ typedef struct {
** \retcode #CFE_SB_PIPE_CR_ERR \retdesc \copydoc CFE_SB_PIPE_CR_ERR \endcode
** \endreturns
**
** \sa #CFE_SB_DeletePipe #CFE_SB_GetPipeOpts #CFE_SB_SetPipeOpts
** \sa #CFE_SB_DeletePipe #CFE_SB_GetPipeOpts #CFE_SB_SetPipeOpts #CFE_SB_GetPipeIdByName
**/
int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr,
uint16 Depth,
Expand Down Expand Up @@ -225,7 +225,7 @@ int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr,
** \retcode #CFE_SB_BAD_ARGUMENT \retdesc \copydoc CFE_SB_BAD_ARGUMENT \endcode
** \endreturns
**
** \sa #CFE_SB_CreatePipe #CFE_SB_GetPipeOpts #CFE_SB_SetPipeOpts
** \sa #CFE_SB_CreatePipe #CFE_SB_GetPipeOpts #CFE_SB_SetPipeOpts #CFE_SB_GetPipeIdByName
**/
int32 CFE_SB_DeletePipe(CFE_SB_PipeId_t PipeId);

Expand All @@ -246,7 +246,7 @@ int32 CFE_SB_DeletePipe(CFE_SB_PipeId_t PipeId);
** \retcode #CFE_SB_BAD_ARGUMENT \retdesc \copydoc CFE_SB_BAD_ARGUMENT \endcode
** \endreturns
**
** \sa #CFE_SB_CreatePipe #CFE_SB_DeletePipe #CFE_SB_GetPipeOpts #CFE_SB_PIPEOPTS_IGNOREMINE
** \sa #CFE_SB_CreatePipe #CFE_SB_DeletePipe #CFE_SB_GetPipeOpts #CFE_SB_GetPipeIdByName #CFE_SB_PIPEOPTS_IGNOREMINE
**/
int32 CFE_SB_SetPipeOpts(CFE_SB_PipeId_t PipeId,
uint8 Opts);
Expand All @@ -267,11 +267,55 @@ int32 CFE_SB_SetPipeOpts(CFE_SB_PipeId_t PipeId,
** \retcode #CFE_SB_BAD_ARGUMENT \retdesc \copydoc CFE_SB_BAD_ARGUMENT \endcode
** \endreturns
**
** \sa #CFE_SB_CreatePipe #CFE_SB_DeletePipe #CFE_SB_SetPipeOpts #CFE_SB_PIPEOPTS_IGNOREMINE
** \sa #CFE_SB_CreatePipe #CFE_SB_DeletePipe #CFE_SB_SetPipeOpts #CFE_SB_GetPipeIdByName #CFE_SB_PIPEOPTS_IGNOREMINE
**/
int32 CFE_SB_GetPipeOpts(CFE_SB_PipeId_t PipeId,
uint8 *OptPtr);

/*****************************************************************************/
/**
** \brief Get the pipe name for a given id.
**
** \par Description
** This routine finds the pipe name for a pipe id.
**
** \param[out] PipeNameBuf The buffer to receive the pipe name.
**
** \param[in] PipeNameSize The size (in chars) of the PipeName buffer.
**
** \param[in] PipeId The PipeId for that name.
**
** \returns
** \retcode #CFE_SUCCESS \retdesc \copydoc CFE_SUCCESS \endcode
** \retcode #CFE_SB_BAD_ARGUMENT \retdesc \copydoc CFE_SB_BAD_ARGUMENT \endcode
** \retcode #CFE_SB_INVALID_PIPE \retdesc \copydoc CFE_SB_INVALID_PIPE \endcode
** \endreturns
**
** \sa #CFE_SB_CreatePipe #CFE_SB_DeletePipe #CFE_SB_SetPipeOpts #CFE_SB_GetPipeIdByName
**/
int32 CFE_SB_GetPipeName(char *PipeNameBuf, size_t PipeNameSize, CFE_SB_PipeId_t PipeId);

/*****************************************************************************/
/**
** \brief Get pipe id by pipe name.
**
** \par Description
** This routine finds the pipe id for a pipe name.
**
** \param[in] PipeName The name of the pipe.
**
** \param[out] PipeIdPtr The PipeId for that name.
**
** \returns
** \retcode #CFE_SUCCESS \retdesc \copydoc CFE_SUCCESS \endcode
** \retcode #CFE_SB_BAD_ARGUMENT \retdesc \copydoc CFE_SB_BAD_ARGUMENT \endcode
** \retcode #CFE_SB_INVALID_PIPE \retdesc \copydoc CFE_SB_INVALID_PIPE \endcode
** \endreturns
**
** \sa #CFE_SB_CreatePipe #CFE_SB_DeletePipe #CFE_SB_SetPipeOpts #CFE_SB_PIPEOPTS_IGNOREMINE
**/
int32 CFE_SB_GetPipeIdByName(CFE_SB_PipeId_t *PipeIdPtr, const char *PipeName);

/*****************************************************************************/
/**
** \brief Subscribe to a message on the software bus
Expand Down
70 changes: 69 additions & 1 deletion fsw/cfe-core/src/inc/cfe_sb_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
** and when you're done adding, set this to the highest EID you used. It may
** be worthwhile to, on occasion, re-number the EID's to put them back in order.
*/
#define CFE_SB_MAX_EID 63

#define CFE_SB_MAX_EID 67

/*
** SB task event message ID's.
Expand Down Expand Up @@ -183,6 +184,73 @@
**/
#define CFE_SB_GETPIPEOPTS_EID 60

/** \brief <tt> 'GetPipeName: Name retrieved. NameOut \%s,Id \%d, app \%s' </tt>
** \event <tt> 'GetPipeName: Name retrieved. NameOut \%s,Id \%d, app \%s' </tt>
**
** \par Type: DEBUG
**
** \par Cause:
**
** This debug event is generated when name is retrieved by id.
**/
#define CFE_SB_GETPIPENAME_EID 62

/** \brief <tt> 'GetPipeName: Null ptr error. Id \%d, app \%s' </tt>
** \event <tt> 'GetPipeName: Null ptr error. Id \%d, app \%s' </tt>
**
** \par Type: ERROR
**
** \par Cause:
**
** This debug event is generated when the name buffer ptr is null.
**/
#define CFE_SB_GETPIPENAME_NULL_PTR_EID 63

/** \brief <tt> 'GetPipeName: Id error. NameOut \%s,Id \%d, app \%s' </tt>
** \event <tt> 'GetPipeName: Id error. NameOut \%s,Id \%d, app \%s' </tt>
**
** \par Type: ERROR
**
** \par Cause:
**
** This debug event is generated when name is retrieved by id.
**/
#define CFE_SB_GETPIPENAME_ID_ERR_EID 64

/** \brief <tt> 'GetPipeIdByName: ID retrieved. Name \%s,IdOut 0x\%x, app \%s' </tt>
** \event <tt> 'GetPipeIdByName: ID retrieved. Name \%s,IdOut 0x\%x, app \%s' </tt>
**
** \par Type: DEBUG
**
** \par Cause:
**
** This debug event is generated when id is retrieved by name.
**/
#define CFE_SB_GETPIPEIDBYNAME_EID 65

/** \brief <tt> 'GetPipeIdByName Err:Bad input argument,Name 0x\%x,IdOut 0x%x,App \%s' </tt>
** \event <tt> 'GetPipeIdByName Err:Bad input argument,Name 0x\%x,IdOut 0x%x,App \%s' </tt>
**
** \par Type: ERROR
**
** \par Cause:
**
** This error event message is issued when the #CFE_SB_GetMsgIdByName API receives an
** invalid (possibly NULL) ptr as an argument.
**/
#define CFE_SB_GETPIPEIDBYNAME_NULL_ERR_EID 66

/** \brief <tt> 'GetPipeIdByName Err:Name not found,Name \%s,IdOut 0x%x,App \%s' </tt>
** \event <tt> 'GetPipeIdByName Err:Name not found,Name \%s,IdOut 0x%x,App \%s' </tt>
**
** \par Type: ERROR
**
** \par Cause:
**
** This error event message is issued when the #CFE_SB_GetMsgIdByName API receives an
** invalid name.
**/
#define CFE_SB_GETPIPEIDBYNAME_NAME_ERR_EID 67

/** \brief <tt> 'Subscribe Err:Bad Arg,MsgId 0x\%x,PipeId \%d,app \%s,scope \%d' </tt>
** \event <tt> 'Subscribe Err:Bad Arg,MsgId 0x\%x,PipeId \%d,app \%s,scope \%d' </tt>
Expand Down
4 changes: 3 additions & 1 deletion fsw/cfe-core/src/inc/cfe_sb_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,9 @@ typedef struct {
\brief Count of errors in set/get pipe options API */
uint8 DuplicateSubscriptionsCounter;/**< \cfetlmmnemonic \SB_DUPSUBCNT
\brief Count of duplicate subscriptions */
uint8 Spare2Align[2];/**< \cfetlmmnemonic \SB_SPARE2ALIGN
uint8 GetPipeIdByNameErrorCounter; /**< \cfetlmmnemonic \SB_GETPIPEIDBYNAMEEC
\brief Count of errors in get pipe id by name API */
uint8 Spare2Align[1];/**< \cfetlmmnemonic \SB_SPARE2ALIGN
\brief Spare bytes to ensure alignment */

uint16 PipeOverflowErrorCounter;/**< \cfetlmmnemonic \SB_PIPEOVREC
Expand Down
Loading

0 comments on commit 570ed6f

Please sign in to comment.