mirror of
https://github.com/nasa/fprime.git
synced 2026-04-20 22:53:58 -05:00
* Add a state machine unit test under FppTest * Updated the base class and unit tests work * Remove the sendEvent function as it did not allow for data to be passed * Add state machine in SmTest.fpp * Add dependency in SmTest.fpp * state machine unit test passes with new fpp phase 1 * Makefile for state machines don't use special switch * Rebase DeviceSm.hpp * Update on SMEvents inclusion * Use latest phase1 fpp and STARS which uses _Interface * Change SMEvents to SMSignals * Use SMSignals instead of SMEvents * Update test for state machine instance priority and full queue behavior * Update requirements to use new fpp version * Removed unneeded files * update FppTest for new autocoder changes * Get unit tests updated and working for fpp state machines phase 1 delivery * Rename Fw/SMTest to Fw/Sm * Update STARS to use FW_ASSERT * Rename SMSignalBuffer to SmSignalBuffer * Fix spelling issues with CI * Update requirements to the FPP alpha release v2.2.0a3 * Fix requirements.txt * Fix requirements.txt * Initialize data in the constructor of SmSignalBuffer * Add constructor list to all the constructors in SmSignalBuffer * Fixes for reserved word state and address review comments * Fix other review issues pertaining to unit tests and argument checks in the SmSignalBuffer constructors * Add a cast to NATIVE_UINT_TYPE in SmSignalBuffer * Fixing type * Fixing size type in cpp --------- Co-authored-by: watney <garth.j.watney@jpl.nasa.gov> Co-authored-by: Rob Bocchino <bocchino@jpl.nasa.gov> Co-authored-by: M Starch <LeStarch@googlemail.com>
106 lines
3.3 KiB
C++
106 lines
3.3 KiB
C++
// ======================================================================
|
|
// \title SmTest.cpp
|
|
// \author watney
|
|
// \brief hpp file for SmTest component implementation class
|
|
// ======================================================================
|
|
|
|
#include <cstdio>
|
|
|
|
#include "FppTest/state_machine/SmTest.hpp"
|
|
#include "Fw/Types/Assert.hpp"
|
|
|
|
namespace FppTest {
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Construction, initialization, and destruction
|
|
// ----------------------------------------------------------------------
|
|
|
|
SmTest::SmTest(const char* const compName):
|
|
SmTestComponentBase(compName) {}
|
|
|
|
void SmTest ::init(const NATIVE_INT_TYPE queueDepth, const NATIVE_INT_TYPE instance) {
|
|
SmTestComponentBase::init(queueDepth, instance);
|
|
}
|
|
|
|
SmTest ::~SmTest() {}
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Handler implementations for user-defined typed input ports
|
|
// ----------------------------------------------------------------------
|
|
|
|
void SmTest::schedIn_handler(const NATIVE_INT_TYPE portNum, U32 context) {
|
|
Fw::SmSignalBuffer data;
|
|
|
|
device1_stateMachineInvoke(DeviceSm_Interface::DeviceSm_Signals::RTI_SIG, data);
|
|
device2_stateMachineInvoke(DeviceSm_Interface::DeviceSm_Signals::RTI_SIG, data);
|
|
device3_stateMachineInvoke(HackSm_Interface::HackSm_Signals::RTI_SIG, data);
|
|
device4_stateMachineInvoke(HackSm_Interface::HackSm_Signals::RTI_SIG, data);
|
|
device5_stateMachineInvoke(HackSm_Interface::HackSm_Signals::RTI_SIG, data);
|
|
|
|
}
|
|
|
|
//! Overflow hook for state machine device4
|
|
void SmTest::device4_stateMachineOverflowHook(
|
|
const HackSm_Interface::HackSm_Signals signal, //!< The state machine signal
|
|
const Fw::SmSignalBuffer& data //!< The state machine data
|
|
) {
|
|
|
|
}
|
|
|
|
void SmTest::DeviceSm_turnOn(const FwEnumStoreType stateMachineId) {
|
|
printf("DeviceSm turnOn for state machine %d\n", stateMachineId);
|
|
}
|
|
|
|
void SmTest::DeviceSm_turnOff(const FwEnumStoreType stateMachineId) {
|
|
printf("DeviceSm turnOff for state machine %d\n", stateMachineId);
|
|
}
|
|
|
|
void SmTest::DeviceSm_a1(
|
|
const FwEnumStoreType stateMachineId,
|
|
const DeviceSm_Signals signal,
|
|
const Fw::SmSignalBuffer& data
|
|
) {
|
|
printf("Action 1, stateMachineId = %d, signal = %d\n", stateMachineId, signal);
|
|
}
|
|
|
|
|
|
bool SmTest::DeviceSm_g1(const FwEnumStoreType stateMachineId) {
|
|
return true;
|
|
}
|
|
|
|
bool SmTest::DeviceSm_g2(
|
|
const FwEnumStoreType stateMachineId,
|
|
const DeviceSm_Signals signal,
|
|
const Fw::SmSignalBuffer& data
|
|
) {
|
|
return true;
|
|
}
|
|
|
|
void SmTest::DeviceSm_a2(const FwEnumStoreType stateMachineId) {
|
|
printf("Action 2\n");
|
|
}
|
|
|
|
void SmTest::HackSm_turnOn(const FwEnumStoreType stateMachineId) {
|
|
printf("HackSm turn on\n");
|
|
}
|
|
|
|
void SmTest::HackSm_turnOff(const FwEnumStoreType stateMachineId) {
|
|
printf("HackSm turn off\n");
|
|
}
|
|
|
|
void SmTest::HackSm_doDiag(const FwEnumStoreType stateMachineId) {
|
|
printf("HackSm do diag\n");
|
|
}
|
|
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Data product handler implementations
|
|
// ----------------------------------------------------------------------
|
|
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Private helper functions
|
|
// ----------------------------------------------------------------------
|
|
|
|
} // end namespace FppTest
|