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 #157, Move function prototypes to header file #158

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
41 changes: 4 additions & 37 deletions fsw/src/to_lab_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,46 +30,12 @@
#include "to_lab_sub_table.h"

/*
** Global Data Section
** TO Global Data Section
*/
typedef struct
{
CFE_SB_PipeId_t Tlm_pipe;
CFE_SB_PipeId_t Cmd_pipe;
osal_id_t TLMsockid;
bool downlink_on;
char tlm_dest_IP[17];
bool suppress_sendto;

TO_LAB_HkTlm_t HkTlm;
TO_LAB_DataTypesTlm_t DataTypesTlm;
} TO_LAB_GlobalData_t;

TO_LAB_GlobalData_t TO_LAB_Global;

TO_LAB_Subs_t * TO_LAB_Subs;
CFE_TBL_Handle_t TO_SubTblHandle;

/*
** Prototypes Section
*/
void TO_LAB_openTLM(void);
int32 TO_LAB_init(void);
void TO_LAB_exec_local_command(CFE_SB_Buffer_t *SBBufPtr);
void TO_LAB_process_commands(void);
void TO_LAB_forward_telemetry(void);

/*
* Individual Command Handler prototypes
*/
int32 TO_LAB_AddPacket(const TO_LAB_AddPacketCmd_t *data);
int32 TO_LAB_Noop(const TO_LAB_NoopCmd_t *data);
int32 TO_LAB_EnableOutput(const TO_LAB_EnableOutputCmd_t *data);
int32 TO_LAB_RemoveAll(const TO_LAB_RemoveAllCmd_t *data);
int32 TO_LAB_RemovePacket(const TO_LAB_RemovePacketCmd_t *data);
int32 TO_LAB_ResetCounters(const TO_LAB_ResetCountersCmd_t *data);
int32 TO_LAB_SendDataTypes(const TO_LAB_SendDataTypesCmd_t *data);
int32 TO_LAB_SendHousekeeping(const CFE_MSG_CommandHeader_t *data);
TO_LAB_Subs_t * TO_LAB_Subs;

Check notice

Code scanning / CodeQL

Global could be static

The global variable TO_LAB_Subs is not accessed outside of to_lab_app.c and could be made static.
CFE_TBL_Handle_t TO_SubTblHandle;

Check notice

Code scanning / CodeQL

Variable scope too large

The variable TO_SubTblHandle is only accessed in [TO_LAB_init](1) and should be scoped accordingly.

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -344,6 +310,7 @@ void TO_LAB_exec_local_command(CFE_SB_Buffer_t *SBBufPtr)
"L%d TO: Invalid Function Code Rcvd In Ground Command 0x%x", __LINE__,
(unsigned int)CommandCode);
++TO_LAB_Global.HkTlm.Payload.CommandErrorCounter;
break;
}
}

Expand Down
52 changes: 45 additions & 7 deletions fsw/src/to_lab_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@
#include "common_types.h"
#include "osapi.h"

/*****************************************************************************/
#include "to_lab_msg.h"

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

#define TO_LAB_TASK_MSEC 500 /* run at 2 Hz */
#define TO_LAB_UNUSED CFE_SB_MSGID_RESERVED
Expand All @@ -52,13 +56,47 @@
#define cfgTLM_PORT 1235
#define TO_LAB_VERSION_NUM "5.1.0"

/******************************************************************************/
/************************************************************************
** Type Definitions
*************************************************************************/

/*
** Prototypes Section
*/
void TO_LAB_AppMain(void);
/**
* CI global data structure
*/
typedef struct
{
CFE_SB_PipeId_t Tlm_pipe;
CFE_SB_PipeId_t Cmd_pipe;
osal_id_t TLMsockid;
bool downlink_on;
char tlm_dest_IP[17];
bool suppress_sendto;

/******************************************************************************/
TO_LAB_HkTlm_t HkTlm;
TO_LAB_DataTypesTlm_t DataTypesTlm;
} TO_LAB_GlobalData_t;

/************************************************************************
* Function Prototypes
************************************************************************/

void TO_LAB_AppMain(void);
void TO_LAB_openTLM(void);
int32 TO_LAB_init(void);
void TO_LAB_exec_local_command(CFE_SB_Buffer_t *SBBufPtr);
void TO_LAB_process_commands(void);
void TO_LAB_forward_telemetry(void);

/*
* Individual Command Handler prototypes
*/
int32 TO_LAB_AddPacket(const TO_LAB_AddPacketCmd_t *data);
int32 TO_LAB_Noop(const TO_LAB_NoopCmd_t *data);
int32 TO_LAB_EnableOutput(const TO_LAB_EnableOutputCmd_t *data);
int32 TO_LAB_RemoveAll(const TO_LAB_RemoveAllCmd_t *data);
int32 TO_LAB_RemovePacket(const TO_LAB_RemovePacketCmd_t *data);
int32 TO_LAB_ResetCounters(const TO_LAB_ResetCountersCmd_t *data);
int32 TO_LAB_SendDataTypes(const TO_LAB_SendDataTypesCmd_t *data);
int32 TO_LAB_SendHousekeeping(const CFE_MSG_CommandHeader_t *data);

#endif