Skip to content

Commit 5569c2b

Browse files
committed
Working on DP priority update
1 parent 33eef1b commit 5569c2b

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed

Svc/DpCatalog/DpCatalog.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,42 @@ namespace Svc {
10741074

10751075
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
10761076
}
1077+
1078+
void DpCatalog ::UPDATE_DP_PRIO_cmdHandler(FwOpcodeType opCode,
1079+
U32 cmdSeq,
1080+
U32 dir,
1081+
U32 id,
1082+
U32 tSec,
1083+
U32 tSub,
1084+
U32 prio) {
1085+
1086+
// build file name based on the entry to update
1087+
Fw::FileNameString prioFileName;
1088+
prioFileName.format(DP_FILENAME_FORMAT,
1089+
this->m_directories[dir].toChar(),
1090+
id,
1091+
tSec,
1092+
tSub
1093+
);
1094+
1095+
// check to see if file exists
1096+
bool exists = Os::FileSystem::exists(
1097+
prioFileName.toChar());
1098+
1099+
if (not exists) {
1100+
// If it doesn't exist, don't continue.
1101+
// Don't fail the command so a long list of attempts to
1102+
// do DP maintenance fail.
1103+
this->log_WARNING_LO_DpUpdateNoFileError(prioFileName);
1104+
} else {
1105+
// if the file exists, delete it from the tree and reinsert
1106+
// it with the new priority
1107+
1108+
}
1109+
1110+
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
1111+
}
1112+
10771113

10781114

10791115

Svc/DpCatalog/DpCatalog.fpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ module Svc {
9999
) \
100100
opcode 4
101101

102+
@ update existing DP priority
103+
async command UPDATE_DP_PRIO (
104+
dir: U32 # The directory index of the file
105+
$id: U32 # The ID of the data product
106+
tSec: U32 # Generation time in seconds
107+
tSub: U32 # Generation time in subseconds
108+
prio: U32 # Updated priority
109+
) \
110+
opcode 5
102111

103112
# ----------------------------------------------------------------------
104113
# Events
@@ -400,7 +409,24 @@ module Svc {
400409
format "Couldn't delete file {}, stat {}." \
401410
throttle 25
402411
412+
event DpUpdateNoFileError(
413+
file: string size 80 @< The file
414+
) \
415+
severity warning low \
416+
id 46 \
417+
format "Couldn't update priority for file {}, doesn't exist" \
418+
throttle 25
403419
420+
@ DP priority updated
421+
event DpPrioUpdated (
422+
$id: U32 # The ID of the data product
423+
tSec: U32 # Generation time in seconds
424+
tSub: U32 # Generation time in subseconds
425+
prio: U32 # new priority
426+
) \
427+
severity activity low \
428+
id 47 \
429+
format "Priority updated for product ID {},{},{} to {}"
404430
405431
# ----------------------------------------------------------------------
406432
# Telemetry

Svc/DpCatalog/DpCatalog.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,18 @@ namespace Svc {
128128
U32 tSec,
129129
U32 tSub) override;
130130

131+
//! Handler implementation for command UPDATE_DP_PRIO
132+
//!
133+
//! update existing DP priority
134+
void UPDATE_DP_PRIO_cmdHandler(FwOpcodeType opCode, //!< The opcode
135+
U32 cmdSeq, //!< The command sequence number
136+
U32 dir,
137+
U32 id,
138+
U32 tSec,
139+
U32 tSub,
140+
U32 prio) override;
141+
142+
131143
// ----------------------------------
132144
// Private data structures
133145
// ----------------------------------

0 commit comments

Comments
 (0)