diff --git a/libs/RobotKit/include/StateMachine.h b/libs/RobotKit/include/StateMachine.h index e0be6f6ac..bed5bf071 100644 --- a/libs/RobotKit/include/StateMachine.h +++ b/libs/RobotKit/include/StateMachine.h @@ -244,6 +244,9 @@ struct StateMachine { , sm::state::deep_sleeping + event = X , sm::state::deep_sleeping + event = X + , sm::state::deep_sleeping + event = X + , sm::state::deep_sleeping + event = X + , sm::state::charging + boost::sml::on_entry<_> / (sm::action::start_deep_sleep_timeout {}, sm::action::start_charging_behavior {} ) , sm::state::charging + boost::sml::on_exit<_> / (sm::action::stop_deep_sleep_timeout {}, sm::action::stop_charging_behavior {} ) diff --git a/libs/RobotKit/tests/StateMachine_test.cpp b/libs/RobotKit/tests/StateMachine_test.cpp index c1a30f7b8..3de5137be 100644 --- a/libs/RobotKit/tests/StateMachine_test.cpp +++ b/libs/RobotKit/tests/StateMachine_test.cpp @@ -267,6 +267,28 @@ TEST_F(StateMachineTest, stateDeepSleepingEventChargeDidStop) EXPECT_TRUE(sm.is(X)); } +TEST_F(StateMachineTest, stateDeepSleepingEventBleConnection) +{ + sm.set_current_states(lksm::state::deep_sleeping); + + EXPECT_CALL(mock_rc, wakeUp); + + sm.process_event(lksm::event::ble_connection {}); + + EXPECT_TRUE(sm.is(X)); +} + +TEST_F(StateMachineTest, stateDeepSleepingEventBleDisconnection) +{ + sm.set_current_states(lksm::state::deep_sleeping); + + EXPECT_CALL(mock_rc, wakeUp); + + sm.process_event(lksm::event::ble_disconnection {}); + + EXPECT_TRUE(sm.is(X)); +} + TEST_F(StateMachineTest, stateIdleEventChargeDidStart) { sm.set_current_states(lksm::state::idle);