This commit is contained in:
2025-11-01 11:57:49 +03:00
parent 8a202bd38c
commit a7fbae47f0
5 changed files with 56 additions and 19 deletions

View File

@@ -469,6 +469,16 @@ protected:
// only initialization is allowed here
using transition_t = fsm::fsm_transition_table_t<
std::pair<MccGenericFsmMountInitEvent, MccGenericFsmMountInitState<ERROR_STATE_T>>>;
void exit(fsm::traits::fsm_event_c auto& event)
{
this->exitLog(event);
}
void enter(fsm::traits::fsm_event_c auto& event)
{
this->enterLog(event);
}
};
// template <fsm::traits::fsm_state_c ERROR_STATE_T>
@@ -510,22 +520,23 @@ protected:
std::pair<MccGenericFsmMountInitEvent, MccGenericFsmMountInitState>>;
void exit(MccGenericFsmMountInitEvent& event)
{
if constexpr (mcc_generic_log_mount_c<MOUNT_T>) {
event.mount()->logWarn("It seems a re-entering to the initializing state was asked! Ignore the event!");
}
}
// void exit(MccGenericFsmMountInitEvent& event)
// {
// if constexpr (mcc_generic_log_mount_c<MOUNT_T>) {
// event.mount()->logWarn("It seems a re-entering to the initializing state was asked! Ignore the
// event!");
// }
// }
void enter(MccGenericFsmMountInitEvent& event)
{
if constexpr (mcc_generic_log_mount_c<MOUNT_T>) {
event.mount()->logWarn(
"It seems a re-entering to the initializing state was asked! Ignore the event and wait for the "
"mount "
"to initialize!");
}
}
// void enter(MccGenericFsmMountInitEvent& event)
// {
// if constexpr (mcc_generic_log_mount_c<MOUNT_T>) {
// event.mount()->logWarn(
// "It seems a re-entering to the initializing state was asked! Ignore the event and wait for the "
// "mount "
// "to initialize!");
// }
// }
void exit(fsm::traits::fsm_event_c auto& event)
{
@@ -534,14 +545,25 @@ protected:
void enter(fsm::traits::fsm_event_c auto& event)
{
enterLog(event);
this->enterLog(event);
event.mount()->logDebug(
std::format("Current ID: '{}', previous ID: '{}'", ID, event.mount()->previousStateID()));
if (event.mount()->previousStateID() == ID) {
event.mount()->logWarn(
"It seems a re-entering to the initializing state was asked! Ignore the event and wait for the "
"mount "
"to initialize!");
return;
}
auto* mount_ptr = event.mount();
// call base-class initMount method!
auto err = static_cast<MOUNT_T*>(mount_ptr)->initMount();
if (err) {
mount_ptr->dispatchEvent(MccGenericFsmMountErrorEvent{mount_ptr});
mount_ptr->dispatchEvent(MccGenericFsmMountErrorEvent{mount_ptr, err});
return;
}