From 370d1853b5d099de28c032def4ce3e53b7d735ad Mon Sep 17 00:00:00 2001 From: jacqueline Date: Tue, 9 Jul 2024 14:41:02 +1000 Subject: Break FatfsStreamFactory's dep on ServiceLocator --- src/tangara/audio/fatfs_stream_factory.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/tangara/audio/fatfs_stream_factory.cpp') diff --git a/src/tangara/audio/fatfs_stream_factory.cpp b/src/tangara/audio/fatfs_stream_factory.cpp index 80677b2d..735ec134 100644 --- a/src/tangara/audio/fatfs_stream_factory.cpp +++ b/src/tangara/audio/fatfs_stream_factory.cpp @@ -10,7 +10,6 @@ #include #include -#include "database/database.hpp" #include "esp_log.h" #include "ff.h" #include "freertos/portmacro.h" @@ -19,10 +18,10 @@ #include "audio/audio_source.hpp" #include "audio/fatfs_source.hpp" #include "codec.hpp" +#include "database/database.hpp" #include "database/tag_parser.hpp" #include "database/track.hpp" #include "drivers/spi.hpp" -#include "system_fsm/service_locator.hpp" #include "tasks.hpp" #include "types.hpp" @@ -30,12 +29,13 @@ namespace audio { -FatfsStreamFactory::FatfsStreamFactory(system_fsm::ServiceLocator& services) - : services_(services) {} +FatfsStreamFactory::FatfsStreamFactory(database::Handle&& handle, + database::ITagParser& parser) + : db_(handle), tag_parser_(parser) {} auto FatfsStreamFactory::create(database::TrackId id, uint32_t offset) -> std::shared_ptr { - auto db = services_.database().lock(); + auto db = db_.lock(); if (!db) { return {}; } @@ -48,7 +48,7 @@ auto FatfsStreamFactory::create(database::TrackId id, uint32_t offset) auto FatfsStreamFactory::create(std::string path, uint32_t offset) -> std::shared_ptr { - auto tags = services_.tag_parser().ReadAndParseTags(path); + auto tags = tag_parser_.ReadAndParseTags(path); if (!tags) { ESP_LOGE(kTag, "failed to read tags"); return {}; -- cgit v1.2.3