Skip to content

Commit 10b3d2e

Browse files
committed
Merge pull request #238 from avan989:Fix-237-Update-To-Reflect-582-Standard
Fix #237, update sample app to reflect 582 standard
2 parents 97ef16c + 0c20490 commit 10b3d2e

4 files changed

Lines changed: 25 additions & 36 deletions

File tree

config/default_sample_app_internal_cfg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
/***********************************************************************/
3636
#define SAMPLE_APP_PIPE_DEPTH 32 /* Depth of the Command Pipe for Application */
37+
#define SAMPLE_APP_PIPE_NAME "SAMPLE_APP_CMD_PIPE"
3738

3839
#define SAMPLE_APP_NUMBER_OF_TABLES 1 /* Number of Example Table(s) */
3940

fsw/src/sample_app.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,6 @@ CFE_Status_t SAMPLE_APP_Init(void)
117117

118118
SAMPLE_APP_Data.RunStatus = CFE_ES_RunStatus_APP_RUN;
119119

120-
/*
121-
** Initialize app configuration data
122-
*/
123-
SAMPLE_APP_Data.PipeDepth = SAMPLE_APP_PIPE_DEPTH;
124-
125-
strncpy(SAMPLE_APP_Data.PipeName, "SAMPLE_APP_CMD_PIPE", sizeof(SAMPLE_APP_Data.PipeName));
126-
SAMPLE_APP_Data.PipeName[sizeof(SAMPLE_APP_Data.PipeName) - 1] = 0;
127-
128120
/*
129121
** Register the events
130122
*/
@@ -144,7 +136,7 @@ CFE_Status_t SAMPLE_APP_Init(void)
144136
/*
145137
** Create Software Bus message pipe.
146138
*/
147-
status = CFE_SB_CreatePipe(&SAMPLE_APP_Data.CommandPipe, SAMPLE_APP_Data.PipeDepth, SAMPLE_APP_Data.PipeName);
139+
status = CFE_SB_CreatePipe(&SAMPLE_APP_Data.CommandPipe, SAMPLE_APP_PIPE_DEPTH, SAMPLE_APP_PIPE_NAME);
148140
if (status != CFE_SUCCESS)
149141
{
150142
CFE_EVS_SendEvent(SAMPLE_APP_CR_PIPE_ERR_EID, CFE_EVS_EventType_ERROR,

fsw/src/sample_app.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,6 @@ typedef struct
6868
*/
6969
CFE_SB_PipeId_t CommandPipe;
7070

71-
/*
72-
** Initialization data (not reported in housekeeping)...
73-
*/
74-
char PipeName[CFE_MISSION_MAX_API_LEN];
75-
uint16 PipeDepth;
76-
7771
CFE_TBL_Handle_t TblHandles[SAMPLE_APP_NUMBER_OF_TABLES];
7872
} SAMPLE_APP_Data_t;
7973

fsw/src/sample_app_cmds.c

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -111,37 +111,38 @@ CFE_Status_t SAMPLE_APP_ResetCountersCmd(const SAMPLE_APP_ResetCountersCmd_t *Ms
111111
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
112112
CFE_Status_t SAMPLE_APP_ProcessCmd(const SAMPLE_APP_ProcessCmd_t *Msg)
113113
{
114-
CFE_Status_t status;
114+
CFE_Status_t Status;
115115
void * TblAddr;
116116
SAMPLE_APP_ExampleTable_t *TblPtr;
117117
const char * TableName = "SAMPLE_APP.ExampleTable";
118118

119119
/* Sample Use of Example Table */
120-
121-
status = CFE_TBL_GetAddress(&TblAddr, SAMPLE_APP_Data.TblHandles[0]);
122-
123-
if (status < CFE_SUCCESS)
120+
SAMPLE_APP_Data.CmdCounter++;
121+
Status = CFE_TBL_GetAddress(&TblAddr, SAMPLE_APP_Data.TblHandles[0]);
122+
if (Status < CFE_SUCCESS)
124123
{
125-
CFE_ES_WriteToSysLog("Sample App: Fail to get table address: 0x%08lx", (unsigned long)status);
126-
return status;
124+
CFE_ES_WriteToSysLog("Sample App: Fail to get table address: 0x%08lx", (unsigned long)Status);
127125
}
128-
129-
TblPtr = TblAddr;
130-
CFE_ES_WriteToSysLog("Sample App: Example Table Value 1: %d Value 2: %d", TblPtr->Int1, TblPtr->Int2);
131-
132-
SAMPLE_APP_GetCrc(TableName);
133-
134-
status = CFE_TBL_ReleaseAddress(SAMPLE_APP_Data.TblHandles[0]);
135-
if (status != CFE_SUCCESS)
126+
else
136127
{
137-
CFE_ES_WriteToSysLog("Sample App: Fail to release table address: 0x%08lx", (unsigned long)status);
138-
return status;
128+
TblPtr = TblAddr;
129+
CFE_ES_WriteToSysLog("Sample App: Example Table Value 1: %d Value 2: %d", TblPtr->Int1, TblPtr->Int2);
130+
131+
SAMPLE_APP_GetCrc(TableName);
132+
133+
Status = CFE_TBL_ReleaseAddress(SAMPLE_APP_Data.TblHandles[0]);
134+
if (Status != CFE_SUCCESS)
135+
{
136+
CFE_ES_WriteToSysLog("Sample App: Fail to release table address: 0x%08lx", (unsigned long)Status);
137+
}
138+
else
139+
{
140+
/* Invoke a function provided by SAMPLE_APP_LIB */
141+
SAMPLE_LIB_Function();
142+
}
139143
}
140144

141-
/* Invoke a function provided by SAMPLE_APP_LIB */
142-
SAMPLE_LIB_Function();
143-
144-
return CFE_SUCCESS;
145+
return Status;
145146
}
146147

147148
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
@@ -151,6 +152,7 @@ CFE_Status_t SAMPLE_APP_ProcessCmd(const SAMPLE_APP_ProcessCmd_t *Msg)
151152
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
152153
CFE_Status_t SAMPLE_APP_DisplayParamCmd(const SAMPLE_APP_DisplayParamCmd_t *Msg)
153154
{
155+
SAMPLE_APP_Data.CmdCounter++;
154156
CFE_EVS_SendEvent(SAMPLE_APP_VALUE_INF_EID, CFE_EVS_EventType_INFORMATION,
155157
"SAMPLE_APP: ValU32=%lu, ValI16=%d, ValStr=%s", (unsigned long)Msg->Payload.ValU32,
156158
(int)Msg->Payload.ValI16, Msg->Payload.ValStr);

0 commit comments

Comments
 (0)