Skip to content

Commit 7e7442e

Browse files
authored
Merge branch 'devel' into Lex-ari-FpySequencer-Cancel-Port
2 parents 68345eb + 5843907 commit 7e7442e

25 files changed

Lines changed: 659 additions & 90 deletions

Svc/CmdSequencer/CmdSequencerImpl.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ void CmdSequencerComponentImpl::CS_RUN_cmdHandler(FwOpcodeType opCode,
100100
if (AUTO == this->m_stepMode) {
101101
this->m_runMode = RUNNING;
102102
if (this->isConnected_seqStartOut_OutputPort(0)) {
103-
this->seqStartOut_out(0, this->m_sequence->getStringFileName());
103+
// Create empty SeqArgs as placeholder
104+
// Use parameterized constructor to ensure m_size is initialized to 0
105+
Svc::SeqArgs emptyArgs{0, 0};
106+
this->seqStartOut_out(0, this->m_sequence->getStringFileName(), emptyArgs);
104107
}
105108
this->performCmd_Step();
106109
}
@@ -162,15 +165,21 @@ void CmdSequencerComponentImpl::doSequenceRun(const Fw::StringBase& filename) {
162165
if (AUTO == this->m_stepMode) {
163166
this->m_runMode = RUNNING;
164167
if (this->isConnected_seqStartOut_OutputPort(0)) {
165-
this->seqStartOut_out(0, this->m_sequence->getStringFileName());
168+
// Create empty SeqArgs as placeholder
169+
// Use parameterized constructor to ensure m_size is initialized to 0
170+
Svc::SeqArgs emptyArgs{0, 0};
171+
this->seqStartOut_out(0, this->m_sequence->getStringFileName(), emptyArgs);
166172
}
167173
this->performCmd_Step();
168174
}
169175

170176
this->log_ACTIVITY_HI_CS_PortSequenceStarted(this->m_sequence->getLogFileName());
171177
}
172178

173-
void CmdSequencerComponentImpl::seqRunIn_handler(FwIndexType portNum, const Fw::StringBase& filename) {
179+
void CmdSequencerComponentImpl::seqRunIn_handler(FwIndexType portNum,
180+
const Fw::StringBase& filename,
181+
const Svc::SeqArgs& args) {
182+
(void)args; // Suppress unused parameter warning
174183
this->doSequenceRun(filename);
175184
}
176185

@@ -322,7 +331,9 @@ void CmdSequencerComponentImpl ::CS_START_cmdHandler(FwOpcodeType opcode, U32 cm
322331
this->performCmd_Step();
323332
this->log_ACTIVITY_HI_CS_CmdStarted(this->m_sequence->getLogFileName());
324333
if (this->isConnected_seqStartOut_OutputPort(0)) {
325-
this->seqStartOut_out(0, this->m_sequence->getStringFileName());
334+
// Create empty SeqArgs as placeholder
335+
Svc::SeqArgs emptyArgs{0, 0};
336+
this->seqStartOut_out(0, this->m_sequence->getStringFileName(), emptyArgs);
326337
}
327338
this->cmdResponse_out(opcode, cmdSeq, Fw::CmdResponse::OK);
328339
}

Svc/CmdSequencer/CmdSequencerImpl.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,9 @@ class CmdSequencerComponentImpl final : public CmdSequencerComponentBase {
519519
) override;
520520

521521
//! Handler for input port seqRunIn
522-
void seqRunIn_handler(FwIndexType portNum, //!< The port number
523-
const Fw::StringBase& filename //!< The sequence file
522+
void seqRunIn_handler(FwIndexType portNum, //!< The port number
523+
const Fw::StringBase& filename, //!< The sequence file
524+
const Svc::SeqArgs& args //!< Sequence arguments (not currently used)
524525
) override;
525526

526527
//! Handler implementation for seqDispatchIn

Svc/CmdSequencer/Commands.fppi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
@ Run a command sequence file
44
async command CS_RUN(
5-
fileName: string size 240 @< The name of the sequence file
5+
fileName: string size FileNameStringSize @< The name of the sequence file
66
$block: BlockState @< Return command status when complete or not
77
) \
88
opcode 0
99

1010
@ Validate a command sequence file
1111
async command CS_VALIDATE(
12-
fileName: string size 240 @< The name of the sequence file
12+
fileName: string size FileNameStringSize @< The name of the sequence file
1313
) \
1414
opcode 1
1515

Svc/CmdSequencer/test/ut/CmdSequencerTester.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ void CmdSequencerTester ::parameterizedDataReadErrors(SequenceFiles::File& file)
271271
void CmdSequencerTester ::parameterizedNeverLoaded() {
272272
// Try to run a sequence
273273
Fw::String fArg("");
274-
this->invoke_to_seqRunIn(0, fArg);
274+
Svc::SeqArgs emptyArgs{0, 0};
275+
this->invoke_to_seqRunIn(0, fArg, emptyArgs);
275276
this->clearAndDispatch();
276277
// Assert seqDone response
277278
ASSERT_from_seqDone_SIZE(1);
@@ -474,7 +475,8 @@ void CmdSequencerTester ::runSequence(const U32 cmdSeq, const char* const fileNa
474475
void CmdSequencerTester ::runSequenceByPortCall(const char* const fileName) {
475476
// Invoke the seqRun port
476477
Fw::String fArg(fileName);
477-
this->invoke_to_seqRunIn(0, fArg);
478+
Svc::SeqArgs emptyArgs{0, 0};
479+
this->invoke_to_seqRunIn(0, fArg, emptyArgs);
478480
this->clearAndDispatch();
479481
// Assert no command response
480482
ASSERT_CMD_RESPONSE_SIZE(0);
@@ -500,7 +502,8 @@ void CmdSequencerTester ::runSequenceByFileDispatcherPortCall(const char* const
500502
void CmdSequencerTester ::runLoadedSequence() {
501503
// Invoke the port
502504
Fw::String fArg("");
503-
this->invoke_to_seqRunIn(0, fArg);
505+
Svc::SeqArgs emptyArgs{0, 0};
506+
this->invoke_to_seqRunIn(0, fArg, emptyArgs);
504507
this->clearAndDispatch();
505508
// Assert no command response
506509
ASSERT_CMD_RESPONSE_SIZE(0);
@@ -530,7 +533,8 @@ void CmdSequencerTester ::startNewSequence(const char* const fileName) {
530533
ASSERT_EVENTS_CS_InvalidMode_SIZE(1);
531534
// Invoke sequence port
532535
Fw::String fArg(fileName);
533-
this->invoke_to_seqRunIn(0, fArg);
536+
Svc::SeqArgs emptyArgs{0, 0};
537+
this->invoke_to_seqRunIn(0, fArg, emptyArgs);
534538
this->clearAndDispatch();
535539
// Assert response on seqDone
536540
ASSERT_from_seqDone_SIZE(1);

Svc/CmdSequencer/test/ut/ImmediateBase.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ void CmdSequencerTester ::parameterizedLoadRunRun(SequenceFiles::File& file, con
166166
this->parameterizedAutoByPort(file, numCommands, bound);
167167
// Try to run a loaded sequence
168168
Fw::String fArg("");
169-
this->invoke_to_seqRunIn(0, fArg);
169+
Svc::SeqArgs emptyArgs{0, 0};
170+
this->invoke_to_seqRunIn(0, fArg, emptyArgs);
170171
this->clearAndDispatch();
171172
// Assert seqDone response
172173
ASSERT_from_seqDone_SIZE(1);

Svc/CmdSequencer/test/ut/InvalidFiles.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ void CmdSequencerTester ::MissingCRC() {
218218
ASSERT_TLM_CS_Errors(0, 2);
219219
// Run the sequence by port call
220220
Fw::String fArg(file.getName());
221-
this->invoke_to_seqRunIn(0, fArg);
221+
Svc::SeqArgs emptyArgs{0, 0};
222+
this->invoke_to_seqRunIn(0, fArg, emptyArgs);
222223
this->clearAndDispatch();
223224
// Assert seqDone response
224225
ASSERT_from_seqDone_SIZE(1);

Svc/FileWorker/CMakeLists.txt

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
#
1111
####
1212

13-
if (BUILD_TESTING AND NOT __FPRIME_NO_UT_GEN__)
14-
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/test/FileTester")
15-
endif()
1613

1714
register_fprime_module(
1815
AUTOCODER_INPUTS
@@ -39,18 +36,31 @@ register_fprime_ut(
3936
"${CMAKE_CURRENT_LIST_DIR}"
4037
)
4138

42-
register_fprime_ut(
43-
FileWorkerTestError
44-
AUTOCODER_INPUTS
45-
"${CMAKE_CURRENT_LIST_DIR}/FileWorker.fpp"
46-
SOURCES
47-
"${CMAKE_CURRENT_LIST_DIR}/test/ut/FileWorkerErrTestMain.cpp"
48-
"${CMAKE_CURRENT_LIST_DIR}/test/ut/FileWorkerErrTester.cpp"
49-
CHOOSES_IMPLEMENTATIONS
50-
Svc_FileWorker_test_FileTester
51-
DEPENDS
52-
STest
53-
UT_AUTO_HELPERS
54-
WORKING_DIRECTORY
55-
"${CMAKE_CURRENT_LIST_DIR}"
56-
)
39+
# FileTester is a test dependency and only supported on Posix platforms, therefore:
40+
# - only attempt to add the FileTester module in BUILD_TESTING
41+
# - only add the FileWorkerTestError test if the FileTester module was successfully added
42+
if (BUILD_TESTING AND NOT __FPRIME_NO_UT_GEN__)
43+
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/test/FileTester")
44+
45+
# Target will not exist on non-Posix platforms, so guard against its existence
46+
if (TARGET Svc_FileWorker_test_FileTester)
47+
register_fprime_ut(
48+
FileWorkerTestError
49+
AUTOCODER_INPUTS
50+
"${CMAKE_CURRENT_LIST_DIR}/FileWorker.fpp"
51+
SOURCES
52+
"${CMAKE_CURRENT_LIST_DIR}/test/ut/FileWorkerErrTestMain.cpp"
53+
"${CMAKE_CURRENT_LIST_DIR}/test/ut/FileWorkerErrTester.cpp"
54+
CHOOSES_IMPLEMENTATIONS
55+
Svc_FileWorker_test_FileTester
56+
DEPENDS
57+
STest
58+
UT_AUTO_HELPERS
59+
WORKING_DIRECTORY
60+
"${CMAKE_CURRENT_LIST_DIR}"
61+
)
62+
else()
63+
# Only print message if we're in BUILD_TESTING *and* FileTester isn't available
64+
message(STATUS "Svc/FileWorker: FileTester test dependency is only supported on Posix, skipping FileWorkerTestError")
65+
endif()
66+
endif()

Svc/FileWorker/test/FileTester/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
restrict_platforms(Posix)
2+
13
register_fprime_implementation(
24
Svc_FileWorker_test_FileTester
35
IMPLEMENTS

Svc/FpySequencer/FpySequencer.cpp

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ void FpySequencer::RUN_cmdHandler(FwOpcodeType opCode, //!< The op
3939
U32 cmdSeq, //!< The command sequence number
4040
const Fw::CmdStringArg& fileName, //!< The name of the sequence file
4141
FpySequencer_BlockState block //!< Return command status when complete or not
42+
) {
43+
// Empty args and delegate to RUN_ARGS handler
44+
this->RUN_ARGS_cmdHandler(opCode, cmdSeq, fileName, block, Svc::SeqArgs{0, 0});
45+
}
46+
47+
void FpySequencer ::RUN_ARGS_cmdHandler(
48+
FwOpcodeType opCode, //!< The opcode
49+
U32 cmdSeq, //!< The command sequence number
50+
const Fw::CmdStringArg& fileName, //!< The name of the sequence file
51+
Svc::FpySequencer_BlockState block, //!< Return command status when complete or not
52+
Svc::SeqArgs args //!< Arguments to pass to the sequencer
4253
) {
4354
// can only run a seq while in idle
4455
if (sequencer_getState() != State::IDLE) {
@@ -53,7 +64,8 @@ void FpySequencer::RUN_cmdHandler(FwOpcodeType opCode, //!< The op
5364
this->m_savedCmdSeq = cmdSeq;
5465
}
5566

56-
this->sequencer_sendSignal_cmd_RUN(FpySequencer_SequenceExecutionArgs(fileName, block));
67+
// Store args for pushArgsToStack action
68+
this->sequencer_sendSignal_cmd_RUN(FpySequencer_SequenceExecutionArgs(fileName, block, args));
5769

5870
// only respond if the user doesn't want us to block further execution
5971
if (block == FpySequencer_BlockState::NO_BLOCK) {
@@ -68,6 +80,16 @@ void FpySequencer::VALIDATE_cmdHandler(FwOpcodeType opCode, //!< Th
6880
U32 cmdSeq, //!< The command sequence number
6981
const Fw::CmdStringArg& fileName //!< The name of the sequence file
7082
) {
83+
this->VALIDATE_ARGS_cmdHandler(opCode, cmdSeq, fileName, Svc::SeqArgs{0, 0});
84+
}
85+
86+
//! Handler implementation for command VALIDATE_ARGS
87+
//!
88+
//! Loads and validates a sequence with arguments
89+
void FpySequencer ::VALIDATE_ARGS_cmdHandler(FwOpcodeType opCode,
90+
U32 cmdSeq,
91+
const Fw::CmdStringArg& fileName,
92+
Svc::SeqArgs buffer) {
7193
// can only validate a seq while in idle
7294
if (sequencer_getState() != State::IDLE) {
7395
this->log_WARNING_HI_InvalidCommand(static_cast<I32>(sequencer_getState()));
@@ -80,13 +102,12 @@ void FpySequencer::VALIDATE_cmdHandler(FwOpcodeType opCode, //!< Th
80102
this->m_savedOpCode = opCode;
81103
this->m_savedCmdSeq = cmdSeq;
82104

105+
// VALIDATE_ARGS receives args via command interface
106+
// Store args for pushArgsToStack action when RUN_VALIDATED is called
83107
this->sequencer_sendSignal_cmd_VALIDATE(
84-
FpySequencer_SequenceExecutionArgs(fileName, FpySequencer_BlockState::BLOCK));
108+
FpySequencer_SequenceExecutionArgs(fileName, FpySequencer_BlockState::BLOCK, buffer));
85109
}
86110

87-
//! Handler for command RUN_VALIDATED
88-
//!
89-
//! Runs a previously validated sequence
90111
void FpySequencer::RUN_VALIDATED_cmdHandler(
91112
FwOpcodeType opCode, //!< The opcode
92113
U32 cmdSeq, //!< The command sequence number
@@ -105,7 +126,8 @@ void FpySequencer::RUN_VALIDATED_cmdHandler(
105126
this->m_savedCmdSeq = cmdSeq;
106127
}
107128

108-
this->sequencer_sendSignal_cmd_RUN_VALIDATED(FpySequencer_SequenceExecutionArgs(this->m_sequenceFilePath, block));
129+
this->sequencer_sendSignal_cmd_RUN_VALIDATED(
130+
FpySequencer_SequenceExecutionArgs(this->m_sequenceFilePath, block, this->m_sequenceArgs));
109131

110132
// only respond if the user doesn't want us to block further execution
111133
if (block == FpySequencer_BlockState::NO_BLOCK) {
@@ -367,15 +389,17 @@ void FpySequencer ::seqCancelIn_handler(FwIndexType portNum) {
367389
}
368390

369391
//! Handler for input port seqRunIn
370-
void FpySequencer::seqRunIn_handler(FwIndexType portNum, const Fw::StringBase& filename) {
392+
void FpySequencer::seqRunIn_handler(FwIndexType portNum, const Fw::StringBase& filename, const Svc::SeqArgs& args) {
371393
// can only run a seq while in idle
372394
if (sequencer_getState() != State::IDLE) {
373395
this->log_WARNING_HI_InvalidSeqRunCall(static_cast<I32>(sequencer_getState()));
374396
return;
375397
}
376398

377-
// seqRunIn is never blocking
378-
this->sequencer_sendSignal_cmd_RUN(FpySequencer_SequenceExecutionArgs(filename, FpySequencer_BlockState::NO_BLOCK));
399+
// seqRunIn is never blocking - store args for pushArgsToStack action
400+
// Args must be serialized in F' big-endian format by the caller before being sent
401+
this->sequencer_sendSignal_cmd_RUN(
402+
FpySequencer_SequenceExecutionArgs(filename, FpySequencer_BlockState::NO_BLOCK, args));
379403
}
380404

381405
//! Handler for input port tlmWrite

0 commit comments

Comments
 (0)