Skip to content
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
16 changes: 2 additions & 14 deletions modules/tbl/fsw/src/cfe_tbl_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,6 @@ bool CFE_TBL_SendDumpEventHelper(const CFE_TBL_TxnEvent_t *Event, CFE_TBL_TxnEve
const CFE_TBL_DumpContext_t *DumpCtxt;
uint16 EventType;
char EventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
char CallerString[CFE_MISSION_MAX_API_LEN + 8];

DumpCtxt = Ctxt->OperationDataPtr;

Expand Down Expand Up @@ -487,24 +486,13 @@ bool CFE_TBL_SendDumpEventHelper(const CFE_TBL_TxnEvent_t *Event, CFE_TBL_TxnEve
return false;
}

if (Ctxt->CallerName[0] == 0)
{
/* Empty name indicates it was initiated via ground command */
snprintf(CallerString, sizeof(CallerString), "command");
}
else
{
/* non-Empty name means it was initiated by another app via API */
snprintf(CallerString, sizeof(CallerString), "app=%s", Ctxt->CallerName);
}

/* Finally send the actual event by appending all the info we have */
CFE_EVS_SendEventWithAppID(Event->EventId,
EventType,
CFE_TBL_Global.TableTaskAppId,
"%s by %s,table=%s,file=%s:%s",
"%s%s,table=%s,file=%s:%s",
Ctxt->Operation,
CallerString,
Ctxt->CallerIdent,
DumpCtxt->RequestedTableName,
DumpCtxt->FileName,
EventString);
Expand Down
8 changes: 4 additions & 4 deletions modules/tbl/fsw/src/cfe_tbl_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,9 @@ bool CFE_TBL_SendLoadBasicEventHelper(const CFE_TBL_TxnEvent_t *Event, CFE_TBL_T
CFE_EVS_SendEventWithAppID(Event->EventId,
EventType,
CFE_TBL_Global.TableTaskAppId,
"%s,app=%s,tbl=%s:%s",
"%s%s,tbl=%s:%s",
Ctxt->Operation,
Ctxt->CallerName,
Ctxt->CallerIdent,
Ctxt->TableName,
EventString);

Expand Down Expand Up @@ -602,9 +602,9 @@ bool CFE_TBL_SendLoadFileEventHelper(const CFE_TBL_TxnEvent_t *Event, CFE_TBL_Tx
CFE_EVS_SendEventWithAppID(Event->EventId,
EventType,
CFE_TBL_Global.TableTaskAppId,
"%s,app=%s,file=%s,tbl=%s:%s",
"%s%s,file=%s,tbl=%s:%s",
Ctxt->Operation,
Ctxt->CallerName,
Ctxt->CallerIdent,
LoadFileCtxt->LoadFilename,
Ctxt->TableName,
EventString);
Expand Down
4 changes: 2 additions & 2 deletions modules/tbl/fsw/src/cfe_tbl_loadbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,9 +593,9 @@ bool CFE_TBL_SendActivationEventHelper(const CFE_TBL_TxnEvent_t *Event, CFE_TBL_
CFE_EVS_SendEventWithAppID(Event->EventId,
EventType,
CFE_TBL_Global.TableTaskAppId,
"%s,app=%s,tbl=%s:%s",
"%s%s,tbl=%s:%s",
Ctxt->Operation,
Ctxt->CallerName,
Ctxt->CallerIdent,
Ctxt->TableName,
EventString);

Expand Down
23 changes: 21 additions & 2 deletions modules/tbl/fsw/src/cfe_tbl_transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,13 +406,32 @@ void CFE_TBL_SendTransactionEvents(CFE_TBL_TxnState_t *Txn,
const void *OperationData)
{
CFE_TBL_TxnEventContext_t Ctxt;
const char *CallerName;

memset(&Ctxt, 0, sizeof(Ctxt));

Ctxt.Operation = Operation;
Ctxt.OperationDataPtr = OperationData;
Ctxt.CallerName = CFE_TBL_TxnAppNameCaller(Txn);
Ctxt.RegRecPtr = CFE_TBL_TxnRegRec(Txn);

/* If called by table services itself, leave the CallerIdent blank.
* Otherwise make it a string snippet to append to the event */
if (CFE_RESOURCEID_TEST_DEFINED(Txn->AppId)
&& !CFE_RESOURCEID_TEST_EQUAL(Txn->AppId, CFE_TBL_Global.TableTaskAppId))
{
CallerName = CFE_TBL_TxnAppNameCaller(Txn);
if (CallerName[0] == 0)
{
/* Empty name indicates it was initiated via ground command */
snprintf(Ctxt.CallerIdent, sizeof(Ctxt.CallerIdent), ",appid=%lx", CFE_RESOURCEID_TO_ULONG(Txn->AppId));
}
else
{
/* non-Empty name means it was initiated by another app via API */
snprintf(Ctxt.CallerIdent, sizeof(Ctxt.CallerIdent), ",app=%s", CallerName);
}
}

Ctxt.RegRecPtr = CFE_TBL_TxnRegRec(Txn);

if (Ctxt.RegRecPtr != NULL)
{
Expand Down
5 changes: 4 additions & 1 deletion modules/tbl/fsw/src/cfe_tbl_transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ typedef struct CFE_TBL_TxnEventContext_t
const void *OperationDataPtr;

const char *TableName;
const char *CallerName;

/* a string which indicates the calling context of the operation. For
* operations done via API call this looks like "app=<app-name>" */
char CallerIdent[CFE_MISSION_MAX_API_LEN + 8];

const CFE_TBL_RegistryRec_t *RegRecPtr;

Expand Down
4 changes: 2 additions & 2 deletions modules/tbl/fsw/src/cfe_tbl_valresult.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ bool CFE_TBL_SendValidationEventHelper(const CFE_TBL_TxnEvent_t *Event, CFE_TBL_
CFE_EVS_SendEventWithAppID(Event->EventId,
EventType,
CFE_TBL_Global.TableTaskAppId,
"%s,app=%s,tbl=%s:%s",
"%s%s,tbl=%s:%s",
Ctxt->Operation,
Ctxt->CallerName,
Ctxt->CallerIdent,
Ctxt->TableName,
EventString);

Expand Down
12 changes: 12 additions & 0 deletions modules/tbl/ut-coverage/tbl_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -2235,6 +2235,18 @@ void Test_CFE_TBL_TableDumpCommon(void)
CFE_TBL_TxnAddEvent(&Txn, -1, -1, -1);
CFE_TBL_SendTableDumpEvents(&Txn, NULL, NULL);
UtAssert_STUB_COUNT(CFE_EVS_SendEventWithAppID, 0); /* nothing should have been sent */

memset(&Txn, 0, sizeof(Txn));
CFE_TBL_TxnAddEvent(&Txn, -1, -1, -1);
Txn.AppId = CFE_TBL_Global.TableTaskAppId;
CFE_TBL_SendTableDumpEvents(&Txn, NULL, NULL);
UtAssert_STUB_COUNT(CFE_EVS_SendEventWithAppID, 0); /* nothing should have been sent */

memset(&Txn, 0, sizeof(Txn));
CFE_TBL_TxnAddEvent(&Txn, -1, -1, -1);
Txn.AppId = CFE_ES_APPID_C(CFE_ResourceId_FromInteger(1));
CFE_TBL_SendTableDumpEvents(&Txn, NULL, NULL);
UtAssert_STUB_COUNT(CFE_EVS_SendEventWithAppID, 0); /* nothing should have been sent */
}

/*
Expand Down
Loading