Skip to content

Commit

Permalink
Rename Fw/SMTest to Fw/Sm
Browse files Browse the repository at this point in the history
  • Loading branch information
watney committed Sep 3, 2024
1 parent 08d8135 commit 443da3b
Show file tree
Hide file tree
Showing 17 changed files with 36 additions and 93 deletions.
2 changes: 1 addition & 1 deletion FppTest/state_machine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set(SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/DeviceSm.cpp"
"${CMAKE_CURRENT_LIST_DIR}/HackSm.cpp"
)
set(MOD_DEPS Fw/SMSignal)
set(MOD_DEPS Fw/Sm)

register_fprime_module()

Expand Down
7 changes: 3 additions & 4 deletions FppTest/state_machine/DeviceSm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "stdio.h"
#include "assert.h"
#include "Fw/Types/SMSignalsSerializableAc.hpp"
#include "DeviceSm.hpp"


Expand All @@ -22,7 +21,7 @@ void FppTest::DeviceSm::init(const FwEnumStoreType stateMachineId)

void FppTest::DeviceSm::update(
const FwEnumStoreType stateMachineId,
const DeviceSm_Interface::DeviceSmEvents signal,
const DeviceSm_Interface::DeviceSm_Signals signal,
const Fw::SMSignalBuffer &data
)
{
Expand All @@ -35,7 +34,7 @@ void FppTest::DeviceSm::update(

switch (signal) {

case DeviceSm_Interface::DeviceSmEvents::RTI_SIG:
case DeviceSm_Interface::DeviceSm_Signals::RTI_SIG:
if ( parent->DeviceSm_g1(stateMachineId) ) {
parent->DeviceSm_a1(stateMachineId, signal, data);
parent->DeviceSm_turnOn(stateMachineId);
Expand All @@ -56,7 +55,7 @@ void FppTest::DeviceSm::update(

switch (signal) {

case DeviceSm_Interface::DeviceSmEvents::RTI_SIG:
case DeviceSm_Interface::DeviceSm_Signals::RTI_SIG:
if (parent->DeviceSm_g2(stateMachineId, signal, data) ) {
parent->DeviceSm_a2(stateMachineId);
parent->DeviceSm_turnOff(stateMachineId);
Expand Down
20 changes: 7 additions & 13 deletions FppTest/state_machine/DeviceSm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@
#ifndef DEVICESM_H_
#define DEVICESM_H_

#include <Fw/SMSignal/SMSignalBuffer.hpp>
#include <Fw/Sm/SMSignalBuffer.hpp>
#include <config/FpConfig.hpp>

namespace Fw {
class SMSignals;
}

namespace FppTest {

class DeviceSm_Interface {
public:
enum DeviceSmEvents {
enum DeviceSm_Signals {
RTI_SIG,
};

Expand All @@ -30,7 +26,7 @@ class DeviceSm_Interface {

virtual bool DeviceSm_g2(
const FwEnumStoreType stateMachineId,
const DeviceSm_Interface::DeviceSmEvents signal,
const DeviceSm_Interface::DeviceSm_Signals signal,
const Fw::SMSignalBuffer &data) = 0;


Expand All @@ -39,7 +35,7 @@ class DeviceSm_Interface {

virtual void DeviceSm_a1(
const FwEnumStoreType stateMachineId,
const DeviceSm_Interface::DeviceSmEvents signal,
const DeviceSm_Interface::DeviceSm_Signals signal,
const Fw::SMSignalBuffer &data) = 0;


Expand All @@ -60,19 +56,17 @@ class DeviceSm {

DeviceSm(DeviceSm_Interface* parent) : parent(parent) {}

enum DeviceSmStates {
enum DeviceSm_States {
OFF,
ON,
};

enum DeviceSmStates state;

void * extension;
enum DeviceSm_States state;

void init(const FwEnumStoreType stateMachineId);
void update(
const FwEnumStoreType stateMachineId,
const DeviceSm_Interface::DeviceSmEvents signal,
const DeviceSm_Interface::DeviceSm_Signals signal,
const Fw::SMSignalBuffer &data
);
};
Expand Down
13 changes: 6 additions & 7 deletions FppTest/state_machine/HackSm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "stdio.h"
#include "assert.h"
#include "Fw/Types/SMSignalsSerializableAc.hpp"
#include "HackSm.hpp"


Expand All @@ -22,7 +21,7 @@ void FppTest::HackSm::init(const FwEnumStoreType stateMachineId)

void FppTest::HackSm::update(
const FwEnumStoreType stateMachineId,
const HackSm_Interface::HackSmEvents signal,
const HackSm_Interface::HackSm_Signals signal,
const Fw::SMSignalBuffer &data
)
{
Expand All @@ -35,13 +34,13 @@ void FppTest::HackSm::update(

switch (signal) {

case HackSm_Interface::HackSmEvents::RTI_SIG:
case HackSm_Interface::HackSm_Signals::RTI_SIG:
parent->HackSm_turnOn(stateMachineId);
this->state = ON;

break;

case HackSm_Interface::HackSmEvents::CHECK_SIG:
case HackSm_Interface::HackSm_Signals::CHECK_SIG:
parent->HackSm_doDiag(stateMachineId);
this->state = DIAG;

Expand All @@ -59,13 +58,13 @@ void FppTest::HackSm::update(

switch (signal) {

case HackSm_Interface::HackSmEvents::RTI_SIG:
case HackSm_Interface::HackSm_Signals::RTI_SIG:
parent->HackSm_turnOff(stateMachineId);
this->state = OFF;

break;

case HackSm_Interface::HackSmEvents::CHECK_SIG:
case HackSm_Interface::HackSm_Signals::CHECK_SIG:
parent->HackSm_doDiag(stateMachineId);
this->state = DIAG;

Expand All @@ -83,7 +82,7 @@ void FppTest::HackSm::update(

switch (signal) {

case HackSm_Interface::HackSmEvents::RTI_SIG:
case HackSm_Interface::HackSm_Signals::RTI_SIG:
parent->HackSm_turnOff(stateMachineId);
this->state = OFF;

Expand Down
16 changes: 5 additions & 11 deletions FppTest/state_machine/HackSm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@
#ifndef HACKSM_H_
#define HACKSM_H_

#include <Fw/SMSignal/SMSignalBuffer.hpp>
#include <Fw/Sm/SMSignalBuffer.hpp>
#include <config/FpConfig.hpp>

namespace Fw {
class SMSignals;
}

namespace FppTest {

class HackSm_Interface {
public:
enum HackSmEvents {
enum HackSm_Signals {
RTI_SIG,
CHECK_SIG,
};
Expand All @@ -46,20 +42,18 @@ class HackSm {

HackSm(HackSm_Interface* parent) : parent(parent) {}

enum HackSmStates {
enum HackSm_States {
OFF,
ON,
DIAG,
};

enum HackSmStates state;

void * extension;
enum HackSm_States state;

void init(const FwEnumStoreType stateMachineId);
void update(
const FwEnumStoreType stateMachineId,
const HackSm_Interface::HackSmEvents signal,
const HackSm_Interface::HackSm_Signals signal,
const Fw::SMSignalBuffer &data
);
};
Expand Down
16 changes: 8 additions & 8 deletions FppTest/state_machine/SmTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ SmTest ::~SmTest() {}
void SmTest::schedIn_handler(const NATIVE_INT_TYPE portNum, U32 context) {
Fw::SMSignalBuffer data;

device1_stateMachineInvoke(DeviceSm_Interface::DeviceSmEvents::RTI_SIG, data);
device2_stateMachineInvoke(DeviceSm_Interface::DeviceSmEvents::RTI_SIG, data);
device3_stateMachineInvoke(HackSm_Interface::HackSmEvents::RTI_SIG, data);
device4_stateMachineInvoke(HackSm_Interface::HackSmEvents::RTI_SIG, data);
device5_stateMachineInvoke(HackSm_Interface::HackSmEvents::RTI_SIG, 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::HackSmEvents signal, //!< The state machine signal
const HackSm_Interface::HackSm_Signals signal, //!< The state machine signal
const Fw::SMSignalBuffer& data //!< The state machine data
) {

Expand All @@ -57,7 +57,7 @@ void SmTest::DeviceSm_turnOff(const FwEnumStoreType stateMachineId) {

void SmTest::DeviceSm_a1(
const FwEnumStoreType stateMachineId,
const DeviceSmEvents signal,
const DeviceSm_Signals signal,
const Fw::SMSignalBuffer& data
) {
printf("Action 1, stateMachineId = %d, signal = %d\n", stateMachineId, signal);
Expand All @@ -70,7 +70,7 @@ void SmTest::DeviceSm_a1(

bool SmTest::DeviceSm_g2(
const FwEnumStoreType stateMachineId,
const DeviceSmEvents signal,
const DeviceSm_Signals signal,
const Fw::SMSignalBuffer& data
) {
return true;
Expand Down
6 changes: 3 additions & 3 deletions FppTest/state_machine/SmTest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class SmTest :

//! Overflow hook for state machine device4
void device4_stateMachineOverflowHook(
const HackSm_Interface::HackSmEvents signal, //!< The state machine signal
const HackSm_Interface::HackSm_Signals signal, //!< The state machine signal
const Fw::SMSignalBuffer& data //!< The state machine data
);

Expand All @@ -80,7 +80,7 @@ class SmTest :

void DeviceSm_a1(
const FwEnumStoreType stateMachineId,
const DeviceSmEvents signal,
const DeviceSm_Signals signal,
const Fw::SMSignalBuffer& data
);

Expand All @@ -90,7 +90,7 @@ class SmTest :

bool DeviceSm_g2(
const FwEnumStoreType stateMachineId,
const DeviceSmEvents signal,
const DeviceSm_Signals signal,
const Fw::SMSignalBuffer& data
);

Expand Down
2 changes: 1 addition & 1 deletion FppTest/state_machine/test/ut/Tester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void Tester::schedIn_OK() {
ASSERT_EQ(DeviceSm::OFF, this->component.m_stateMachine_device5.state);

Fw::SMSignalBuffer data;
this->component.device3_stateMachineInvoke(HackSm_Interface::HackSmEvents::CHECK_SIG, data);
this->component.device3_stateMachineInvoke(HackSm_Interface::HackSm_Signals::CHECK_SIG, data);
dispatchAll();
ASSERT_EQ(HackSm::DIAG, this->component.m_stateMachine_device3.state);
invoke_to_schedIn(0,0);
Expand Down
2 changes: 1 addition & 1 deletion Fw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Tlm/")
# Framework subdirectories
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Cfg/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Comp/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/SMSignal/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Sm/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FilePacket/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Obj/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Port/")
Expand Down
1 change: 0 additions & 1 deletion Fw/SMSignal/docs/.gitignore

This file was deleted.

Binary file removed Fw/SMSignal/docs/img/FwComBDD.jpg
Binary file not shown.
36 changes: 0 additions & 36 deletions Fw/SMSignal/docs/sdd.md

This file was deleted.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Fw/SMSignal/SMSignalBuffer.hpp>
#include <Fw/Sm/SMSignalBuffer.hpp>
#include <Fw/Types/Assert.hpp>

namespace Fw {
Expand Down
File renamed without changes.
6 changes: 0 additions & 6 deletions Fw/Types/Types.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ module Fw {
NO_ROOM_LEFT @< No room left in the buffer to serialize data
}

struct SMSignals {
smId : U32
eventSignal: U32
payload: [128] U8
}

@ Deserialization status
enum DeserialStatus {
OK = 0
Expand Down

0 comments on commit 443da3b

Please sign in to comment.