diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-09-13 10:09:04 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-09-13 10:09:04 +1000 |
| commit | 0ea358ab8157d743dc07f12bde5fb34d03a02522 (patch) | |
| tree | fade7a837b75f94df95ac2a00a0775353179155d /src/system_fsm/include | |
| parent | b0aa9ab391143a8139373e42ea95ccb6ed14ce60 (diff) | |
| download | tangara-fw-0ea358ab8157d743dc07f12bde5fb34d03a02522.tar.gz | |
Make the onboarding flow basically work. Much still to do!
Diffstat (limited to 'src/system_fsm/include')
| -rw-r--r-- | src/system_fsm/include/service_locator.hpp | 13 |
1 files changed, 12 insertions, 1 deletions
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<drivers::NvsStorage> 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<drivers::Gpios> gpios_; std::unique_ptr<drivers::Samd> samd_; @@ -108,6 +117,8 @@ class ServiceLocator { std::shared_ptr<database::Database> database_; std::unique_ptr<database::ITagParser> tag_parser_; + + drivers::SdState sd_; }; } // namespace system_fsm |
