Skip to content

Commit

Permalink
Fix nasa#140, Move function prototypes to header file
Browse files Browse the repository at this point in the history
  • Loading branch information
thnkslprpt committed May 2, 2023
1 parent 6fef38e commit 0ba8e41
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 37 deletions.
28 changes: 1 addition & 27 deletions fsw/src/ci_lab_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,37 +33,11 @@
#include "ci_lab_version.h"

/*
** CI global data...
** CI Global Data
*/

typedef struct
{
bool SocketConnected;
CFE_SB_PipeId_t CommandPipe;
osal_id_t SocketID;
OS_SockAddr_t SocketAddress;

CI_LAB_HkTlm_t HkTlm;

CFE_SB_Buffer_t *NextIngestBufPtr;

} CI_LAB_GlobalData_t;

CI_LAB_GlobalData_t CI_LAB_Global;

/*
* Individual message handler function prototypes
*
* Per the recommended code pattern, these should accept a const pointer
* to a structure type which matches the message, and return an int32
* where CFE_SUCCESS (0) indicates successful handling of the message.
*/
int32 CI_LAB_Noop(const CI_LAB_NoopCmd_t *data);
int32 CI_LAB_ResetCounters(const CI_LAB_ResetCountersCmd_t *data);

/* Housekeeping message handler */
int32 CI_LAB_ReportHousekeeping(const CFE_MSG_CommandHeader_t *data);

/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* Application entry point and main process loop */
Expand Down
48 changes: 40 additions & 8 deletions fsw/src/ci_lab_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@

#include "osapi.h"

#include "ci_lab_msg.h"

#include <string.h>
#include <errno.h>
#include <unistd.h>

/****************************************************************************/
/************************************************************************
* Macro Definitions
************************************************************************/

#define CI_LAB_BASE_UDP_PORT 1234
#define CI_LAB_MAX_INGEST 768
Expand All @@ -45,13 +49,28 @@
** Type Definitions
*************************************************************************/

/****************************************************************************/
/*
** Local function prototypes...
**
** Note: Except for the entry point (CI_LAB_AppMain), these
** functions are not called from any other source module.
*/
/**
* CI global data structure
*/
typedef struct
{
bool SocketConnected;
CFE_SB_PipeId_t CommandPipe;
osal_id_t SocketID;
OS_SockAddr_t SocketAddress;

CI_LAB_HkTlm_t HkTlm;

CFE_SB_Buffer_t *NextIngestBufPtr;
} CI_LAB_GlobalData_t;

/************************************************************************
* Function Prototypes
*
* Note: Except for the entry point (CI_Lab_AppMain), these
* functions are not called from any other source module.
************************************************************************/

void CI_Lab_AppMain(void);
void CI_LAB_TaskInit(void);
void CI_LAB_ProcessCommandPacket(CFE_SB_Buffer_t *SBBufPtr);
Expand All @@ -61,4 +80,17 @@ void CI_LAB_ReadUpLink(void);

bool CI_LAB_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength);

/*
* Individual message handler function prototypes
*
* Per the recommended code pattern, these should accept a const pointer
* to a structure type which matches the message, and return an int32
* where CFE_SUCCESS (0) indicates successful handling of the message.
*/
int32 CI_LAB_Noop(const CI_LAB_NoopCmd_t *data);
int32 CI_LAB_ResetCounters(const CI_LAB_ResetCountersCmd_t *data);

/* Housekeeping message handler */
int32 CI_LAB_ReportHousekeeping(const CFE_MSG_CommandHeader_t *data);

#endif
2 changes: 0 additions & 2 deletions fsw/src/ci_lab_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
typedef struct
{
CFE_MSG_CommandHeader_t CmdHeader;

} CI_LAB_NoArgsCmd_t;

/*
Expand All @@ -63,7 +62,6 @@ typedef struct
uint32 IngestPackets;
uint32 IngestErrors;
uint32 Spare2;

} CI_LAB_HkTlm_Payload_t;

typedef struct
Expand Down

0 comments on commit 0ba8e41

Please sign in to comment.