Skip to content

Commit 36df88f

Browse files
author
Jacob Hageman
committed
CCB 20191218: Merge #24 #27 #29 #31
Fix #23, #25, #28, #30 Reviewed and approved at 2019-12-18 CCB
2 parents 9c093b5 + 67fac46 commit 36df88f

File tree

2 files changed

+32
-13
lines changed

2 files changed

+32
-13
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ project(CFE_SAMPLE_APP C)
44
include_directories(fsw/mission_inc)
55
include_directories(fsw/platform_inc)
66

7+
# Include the public API from sample_lib to demonstrate how
8+
# to call library-provided functions
9+
include_directories(${sample_lib_MISSION_DIR}/fsw/public_inc)
10+
711
aux_source_directory(fsw/src APP_SRC_FILES)
812

913
# Create the app module

fsw/src/sample_app.c

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
#include "sample_app.h"
3434
#include "sample_table.h"
3535

36+
/* The sample_lib module provides the SAMPLE_Function() prototype */
37+
#include <sample_lib.h>
38+
3639
#include <string.h>
3740

3841
/*
@@ -163,8 +166,8 @@ int32 SAMPLE_AppInit( void )
163166
CFE_EVS_BINARY_FILTER);
164167
if (status != CFE_SUCCESS)
165168
{
166-
CFE_ES_WriteToSysLog("Sample App: Error Registering Events, RC = 0x%08X\n",
167-
status);
169+
CFE_ES_WriteToSysLog("Sample App: Error Registering Events, RC = 0x%08lX\n",
170+
(unsigned long)status);
168171
return ( status );
169172
}
170173

@@ -184,8 +187,8 @@ int32 SAMPLE_AppInit( void )
184187
Sample_AppData.PipeName);
185188
if (status != CFE_SUCCESS)
186189
{
187-
CFE_ES_WriteToSysLog("Sample App: Error creating pipe, RC = 0x%08X\n",
188-
status);
190+
CFE_ES_WriteToSysLog("Sample App: Error creating pipe, RC = 0x%08lX\n",
191+
(unsigned long)status);
189192
return ( status );
190193
}
191194

@@ -196,8 +199,8 @@ int32 SAMPLE_AppInit( void )
196199
Sample_AppData.SAMPLE_CommandPipe);
197200
if (status != CFE_SUCCESS)
198201
{
199-
CFE_ES_WriteToSysLog("Sample App: Error Subscribing to HK request, RC = 0x%08X\n",
200-
status);
202+
CFE_ES_WriteToSysLog("Sample App: Error Subscribing to HK request, RC = 0x%08lX\n",
203+
(unsigned long)status);
201204
return ( status );
202205
}
203206

@@ -208,8 +211,8 @@ int32 SAMPLE_AppInit( void )
208211
Sample_AppData.SAMPLE_CommandPipe);
209212
if (status != CFE_SUCCESS )
210213
{
211-
CFE_ES_WriteToSysLog("Sample App: Error Subscribing to Command, RC = 0x%08X\n",
212-
status);
214+
CFE_ES_WriteToSysLog("Sample App: Error Subscribing to Command, RC = 0x%08lX\n",
215+
(unsigned long)status);
213216

214217
return ( status );
215218
}
@@ -225,7 +228,7 @@ int32 SAMPLE_AppInit( void )
225228
if ( status != CFE_SUCCESS )
226229
{
227230
CFE_ES_WriteToSysLog("Sample App: Error Registering \
228-
Table, RC = 0x%08X\n", status);
231+
Table, RC = 0x%08lX\n", (unsigned long)status);
229232

230233
return ( status );
231234
}
@@ -353,8 +356,8 @@ void SAMPLE_ReportHousekeeping( const CCSDS_CommandPacket_t *Msg )
353356
/*
354357
** Get command execution counters...
355358
*/
356-
Sample_AppData.SAMPLE_HkTelemetryPkt.sample_command_error_count = Sample_AppData.CmdCounter;
357-
Sample_AppData.SAMPLE_HkTelemetryPkt.sample_command_count = Sample_AppData.ErrCounter;
359+
Sample_AppData.SAMPLE_HkTelemetryPkt.sample_command_error_count = Sample_AppData.ErrCounter;
360+
Sample_AppData.SAMPLE_HkTelemetryPkt.sample_command_count = Sample_AppData.CmdCounter;
358361

359362
/*
360363
** Send housekeeping telemetry packet...
@@ -427,19 +430,31 @@ void SAMPLE_ResetCounters( const SAMPLE_ResetCounters_t *Msg )
427430
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
428431
void SAMPLE_ProcessCC( const SAMPLE_Process_t *Msg )
429432
{
433+
int32 status;
430434
SampleTable_t *TblPtr;
431435
const char *TableName = "SAMPLE_APP.SampleTable";
432436

433437
/* Sample Use of Table */
434-
CFE_TBL_GetAddress((void *)&TblPtr,
438+
439+
status = CFE_TBL_GetAddress((void *)&TblPtr,
435440
Sample_AppData.TblHandles[0]);
436441

442+
if (status != CFE_SUCCESS)
443+
{
444+
CFE_ES_WriteToSysLog("Sample App: Fail to get table address: 0x%08lx",
445+
(unsigned long)status);
446+
return;
447+
}
448+
437449
CFE_ES_WriteToSysLog("Sample App: Table Value 1: %d Value 2: %d",
438450
TblPtr->Int1,
439451
TblPtr->Int2);
440452

441453
SAMPLE_GetCrc(TableName);
442454

455+
/* Invoke a function provided by SAMPLE_LIB */
456+
SAMPLE_Function();
457+
443458
return;
444459

445460
} /* End of SAMPLE_ProcessCC */
@@ -524,7 +539,7 @@ void SAMPLE_GetCrc( const char *TableName )
524539
else
525540
{
526541
Crc = TblInfoPtr.Crc;
527-
CFE_ES_WriteToSysLog("Sample App: CRC: 0x%08X\n\n", Crc);
542+
CFE_ES_WriteToSysLog("Sample App: CRC: 0x%08lX\n\n", (unsigned long)Crc);
528543
}
529544

530545
return;

0 commit comments

Comments
 (0)