diff options
Diffstat (limited to 'src/ui/include/ui_fsm.hpp')
| -rw-r--r-- | src/ui/include/ui_fsm.hpp | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/ui/include/ui_fsm.hpp b/src/ui/include/ui_fsm.hpp index 32275fab..2fc6db4e 100644 --- a/src/ui/include/ui_fsm.hpp +++ b/src/ui/include/ui_fsm.hpp @@ -9,7 +9,9 @@ #include <memory> #include <stack> +#include "audio_events.hpp" #include "relative_wheel.hpp" +#include "screen_playing.hpp" #include "tinyfsm.hpp" #include "display.hpp" @@ -17,13 +19,14 @@ #include "storage.hpp" #include "system_events.hpp" #include "touchwheel.hpp" +#include "track_queue.hpp" #include "ui_events.hpp" namespace ui { class UiState : public tinyfsm::Fsm<UiState> { public: - static auto Init(drivers::IGpios* gpio_expander) -> bool; + static auto Init(drivers::IGpios*, audio::TrackQueue*) -> bool; virtual ~UiState() {} @@ -37,10 +40,14 @@ class UiState : public tinyfsm::Fsm<UiState> { /* Fallback event handler. Does nothing. */ void react(const tinyfsm::Event& ev) {} - virtual void react(const system_fsm::KeyLockChanged&){}; + virtual void react(const audio::PlaybackStarted&) {} + virtual void react(const audio::PlaybackUpdate&) {} + virtual void react(const audio::QueueUpdate&) {} - virtual void react(const internal::RecordSelected&){}; - virtual void react(const internal::IndexSelected&){}; + virtual void react(const system_fsm::KeyLockChanged&) {} + + virtual void react(const internal::RecordSelected&) {} + virtual void react(const internal::IndexSelected&) {} virtual void react(const system_fsm::DisplayReady&) {} virtual void react(const system_fsm::BootComplete&) {} @@ -48,8 +55,11 @@ class UiState : public tinyfsm::Fsm<UiState> { protected: void PushScreen(std::shared_ptr<Screen>); + void PopScreen(); static drivers::IGpios* sIGpios; + static audio::TrackQueue* sQueue; + static std::shared_ptr<drivers::TouchWheel> sTouchWheel; static std::shared_ptr<drivers::RelativeWheel> sRelativeWheel; static std::shared_ptr<drivers::Display> sDisplay; @@ -68,7 +78,7 @@ class Splash : public UiState { using UiState::react; }; -class Interactive : public UiState { +class Browse : public UiState { void entry() override; void react(const internal::RecordSelected&) override; @@ -76,6 +86,17 @@ class Interactive : public UiState { void react(const system_fsm::KeyLockChanged&) override; void react(const system_fsm::StorageMounted&) override; + using UiState::react; +}; + +class Playing : public UiState { + void entry() override; + void exit() override; + + void react(const audio::PlaybackStarted&) override; + void react(const audio::PlaybackUpdate&) override; + void react(const audio::QueueUpdate&) override; + using UiState::react; }; class FatalError : public UiState {}; |
