From 0ea358ab8157d743dc07f12bde5fb34d03a02522 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 13 Sep 2023 10:09:04 +1000 Subject: Make the onboarding flow basically work. Much still to do! --- src/system_fsm/include/service_locator.hpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/system_fsm/include') diff --git a/src/system_fsm/include/service_locator.hpp b/src/system_fsm/include/service_locator.hpp index 00285ed5..1dcf0f5e 100644 --- a/src/system_fsm/include/service_locator.hpp +++ b/src/system_fsm/include/service_locator.hpp @@ -14,6 +14,7 @@ #include "gpios.hpp" #include "nvs.hpp" #include "samd.hpp" +#include "storage.hpp" #include "tag_parser.hpp" #include "touchwheel.hpp" #include "track_queue.hpp" @@ -22,7 +23,7 @@ namespace system_fsm { class ServiceLocator { public: - static auto instance() -> ServiceLocator&; + ServiceLocator(); auto gpios() -> drivers::Gpios& { assert(gpios_ != nullptr); @@ -45,6 +46,10 @@ class ServiceLocator { auto nvs(std::unique_ptr i) { nvs_ = std::move(i); } + auto sd() -> drivers::SdState& { return sd_; } + + auto sd(drivers::SdState s) { sd_ = s; } + auto bluetooth() -> drivers::Bluetooth& { assert(bluetooth_ != nullptr); return *bluetooth_; @@ -96,6 +101,10 @@ class ServiceLocator { queue_ = std::move(i); } + // Not copyable or movable. + ServiceLocator(const ServiceLocator&) = delete; + ServiceLocator& operator=(const ServiceLocator&) = delete; + private: std::unique_ptr gpios_; std::unique_ptr samd_; @@ -108,6 +117,8 @@ class ServiceLocator { std::shared_ptr database_; std::unique_ptr tag_parser_; + + drivers::SdState sd_; }; } // namespace system_fsm -- cgit v1.2.3