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 #210, Add SB API to get pipe by name #404

Merged
merged 2 commits into from
Feb 12, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
CDKnightNASA marked this conversation as resolved.
Show resolved Hide resolved
**
** \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
69 changes: 68 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,7 @@
** 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 61
#define CFE_SB_MAX_EID 67

/*
** SB task event message ID's.
Expand Down Expand Up @@ -183,6 +183,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
CDKnightNASA marked this conversation as resolved.
Show resolved Hide resolved
\brief Spare bytes to ensure alignment */

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