diff --git a/Tactility/Include/Tactility/app/AppContext.h b/Tactility/Include/Tactility/app/AppContext.h index c31eab48..d425c744 100644 --- a/Tactility/Include/Tactility/app/AppContext.h +++ b/Tactility/Include/Tactility/app/AppContext.h @@ -7,7 +7,7 @@ namespace tt::app { // Forward declarations class App; -class Paths; +class AppPaths; struct AppManifest; enum class Result; @@ -32,50 +32,10 @@ public: virtual const AppManifest& getManifest() const = 0; virtual std::shared_ptr getParameters() const = 0; - virtual std::unique_ptr getPaths() const = 0; + virtual std::unique_ptr getPaths() const = 0; virtual std::shared_ptr getApp() const = 0; }; -class Paths { - -public: - - Paths() = default; - virtual ~Paths() = default; - - /** - * Returns the directory path for the data location for an app. - * The data directory is intended to survive OS upgrades. - * The path will not end with a "/". - */ - virtual std::string getDataDirectory() const = 0; - - /** - * Returns the full path for an entry inside the data location for an app. - * The data directory is intended to survive OS upgrades. - * Configuration data should be stored here. - * @param[in] childPath the path without a "/" prefix - */ - virtual std::string getDataPath(const std::string& childPath) const = 0; - - /** - * Returns the directory path for the system location for an app. - * The system directory is not intended to survive OS upgrades. - * You should not store configuration data here. - * The path will not end with a "/". - * This is mainly used for core apps (system/boot/settings type). - */ - virtual std::string getSystemDirectory() const = 0; - - /** - * Returns the full path for an entry inside the system location for an app. - * The data directory is not intended to survive OS upgrades. - * You should not store configuration data here. - * This is mainly used for core apps (system/boot/settings type). - * @param[in] childPath the path without a "/" prefix - */ - virtual std::string getSystemPath(const std::string& childPath) const = 0; -}; } diff --git a/Tactility/Include/Tactility/app/AppPaths.h b/Tactility/Include/Tactility/app/AppPaths.h new file mode 100644 index 00000000..694a54cb --- /dev/null +++ b/Tactility/Include/Tactility/app/AppPaths.h @@ -0,0 +1,53 @@ +#pragma once + +#include +#include + +namespace tt::app { + +// Forward declarations +class AppManifest; + +class AppPaths { + + const AppManifest& manifest; + +public: + + explicit AppPaths(const AppManifest& manifest) : manifest(manifest) {} + + /** + * Returns the directory path for the data location for an app. + * The data directory is intended to survive OS upgrades. + * The path will not end with a "/". + */ + std::string getDataDirectory() const; + + /** + * Returns the full path for an entry inside the data location for an app. + * The data directory is intended to survive OS upgrades. + * Configuration data should be stored here. + * @param[in] childPath the path without a "/" prefix + */ + std::string getDataPath(const std::string& childPath) const; + + /** + * Returns the directory path for the system location for an app. + * The system directory is not intended to survive OS upgrades. + * You should not store configuration data here. + * The path will not end with a "/". + * This is mainly used for core apps (system/boot/settings type). + */ + std::string getSystemDirectory() const; + + /** + * Returns the full path for an entry inside the system location for an app. + * The data directory is not intended to survive OS upgrades. + * You should not store configuration data here. + * This is mainly used for core apps (system/boot/settings type). + * @param[in] childPath the path without a "/" prefix + */ + std::string getSystemPath(const std::string& childPath) const; +}; + +} \ No newline at end of file diff --git a/Tactility/Include/Tactility/service/ServiceContext.h b/Tactility/Include/Tactility/service/ServiceContext.h index 235ef44e..7362ebe1 100644 --- a/Tactility/Include/Tactility/service/ServiceContext.h +++ b/Tactility/Include/Tactility/service/ServiceContext.h @@ -1,14 +1,11 @@ #pragma once -#include "ServiceManifest.h" - -#include - #include namespace tt::service { -class Paths; +struct ServiceManifest; +class ServicePaths; /** * The public representation of a service instance. @@ -26,48 +23,8 @@ public: virtual const ServiceManifest& getManifest() const = 0; /** Retrieve the paths that are relevant to this service */ - virtual std::unique_ptr getPaths() const = 0; + virtual std::unique_ptr getPaths() const = 0; }; -class Paths { - -public: - - Paths() = default; - virtual ~Paths() = default; - - /** - * Returns the directory path for the data location for a service. - * The data directory is intended to survive OS upgrades. - * The path will not end with a "/". - */ - virtual std::string getDataDirectory() const = 0; - - /** - * Returns the full path for an entry inside the data location for a service. - * The data directory is intended to survive OS upgrades. - * Configuration data should be stored here. - * @param[in] childPath the path without a "/" prefix - */ - virtual std::string getDataPath(const std::string& childPath) const = 0; - - /** - * Returns the directory path for the system location for a service. - * The system directory is not intended to survive OS upgrades. - * You should not store configuration data here. - * The path will not end with a "/". - * This is mainly used for core services. - */ - virtual std::string getSystemDirectory() const = 0; - - /** - * Returns the full path for an entry inside the system location for an app. - * The data directory is not intended to survive OS upgrades. - * You should not store configuration data here. - * This is mainly used for core apps (system/boot/settings type). - * @param[in] childPath the path without a "/" prefix - */ - virtual std::string getSystemPath(const std::string& childPath) const = 0; -}; } // namespace diff --git a/Tactility/Include/Tactility/service/ServiceManifest.h b/Tactility/Include/Tactility/service/ServiceManifest.h index e55e0895..48485536 100644 --- a/Tactility/Include/Tactility/service/ServiceManifest.h +++ b/Tactility/Include/Tactility/service/ServiceManifest.h @@ -1,6 +1,6 @@ #pragma once -#include "Tactility/service/Service.h" +#include #include diff --git a/Tactility/Include/Tactility/service/ServicePaths.h b/Tactility/Include/Tactility/service/ServicePaths.h new file mode 100644 index 00000000..4f2b68c7 --- /dev/null +++ b/Tactility/Include/Tactility/service/ServicePaths.h @@ -0,0 +1,53 @@ +#pragma once + +#include +#include + +namespace tt::service { + +// Forward declarations +class ServiceManifest; + +class ServicePaths { + + std::shared_ptr manifest; + +public: + + explicit ServicePaths(std::shared_ptr manifest) : manifest(std::move(manifest)) {} + + /** + * Returns the directory path for the data location for a service. + * The data directory is intended to survive OS upgrades. + * The path will not end with a "/". + */ + std::string getDataDirectory() const; + + /** + * Returns the full path for an entry inside the data location for a service. + * The data directory is intended to survive OS upgrades. + * Configuration data should be stored here. + * @param[in] childPath the path without a "/" prefix + */ + std::string getDataPath(const std::string& childPath) const; + + /** + * Returns the directory path for the system location for a service. + * The system directory is not intended to survive OS upgrades. + * You should not store configuration data here. + * The path will not end with a "/". + * This is mainly used for core services. + */ + std::string getSystemDirectory() const; + + /** + * Returns the full path for an entry inside the system location for an app. + * The data directory is not intended to survive OS upgrades. + * You should not store configuration data here. + * This is mainly used for core apps (system/boot/settings type). + * @param[in] childPath the path without a "/" prefix + */ + std::string getSystemPath(const std::string& childPath) const; +}; + +} \ No newline at end of file diff --git a/Tactility/Include/Tactility/service/gps/GpsService.h b/Tactility/Include/Tactility/service/gps/GpsService.h index f0314429..5d7b4bd0 100644 --- a/Tactility/Include/Tactility/service/gps/GpsService.h +++ b/Tactility/Include/Tactility/service/gps/GpsService.h @@ -24,7 +24,7 @@ class GpsService final : public Service { Mutex stateMutex; std::vector deviceRecords; std::shared_ptr> statePubSub = std::make_shared>(); - std::unique_ptr paths; + std::unique_ptr paths; State state = State::Off; bool startGpsDevice(GpsDeviceRecord& deviceRecord); diff --git a/Tactility/Private/Tactility/app/AppInstance.h b/Tactility/Private/Tactility/app/AppInstance.h index 033cd80c..974420ac 100644 --- a/Tactility/Private/Tactility/app/AppInstance.h +++ b/Tactility/Private/Tactility/app/AppInstance.h @@ -88,7 +88,7 @@ public: std::shared_ptr getParameters() const override; - std::unique_ptr getPaths() const override; + std::unique_ptr getPaths() const override; std::shared_ptr getApp() const override { return app; } }; diff --git a/Tactility/Private/Tactility/app/AppInstancePaths.h b/Tactility/Private/Tactility/app/AppInstancePaths.h deleted file mode 100644 index 6583610c..00000000 --- a/Tactility/Private/Tactility/app/AppInstancePaths.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include "Tactility/app/AppInstance.h" - -namespace tt::app { - -class AppInstancePaths final : public Paths { - - const AppManifest& manifest; - -public: - - explicit AppInstancePaths(const AppManifest& manifest) : manifest(manifest) {} - ~AppInstancePaths() override = default; - - std::string getDataDirectory() const override; - std::string getDataPath(const std::string& childPath) const override; - std::string getSystemDirectory() const override; - std::string getSystemPath(const std::string& childPath) const override; -}; - -} \ No newline at end of file diff --git a/Tactility/Private/Tactility/app/wifimanage/View.h b/Tactility/Private/Tactility/app/wifimanage/View.h index 475c4db3..1475a647 100644 --- a/Tactility/Private/Tactility/app/wifimanage/View.h +++ b/Tactility/Private/Tactility/app/wifimanage/View.h @@ -4,6 +4,7 @@ #include "./State.h" #include +#include #include @@ -13,7 +14,7 @@ class View final { Bindings* bindings; State* state; - std::unique_ptr paths; + std::unique_ptr paths; lv_obj_t* root = nullptr; lv_obj_t* enable_switch = nullptr; lv_obj_t* enable_on_boot_switch = nullptr; diff --git a/Tactility/Private/Tactility/service/ServiceInstance.h b/Tactility/Private/Tactility/service/ServiceInstance.h index 5d4da957..29628ffb 100644 --- a/Tactility/Private/Tactility/service/ServiceInstance.h +++ b/Tactility/Private/Tactility/service/ServiceInstance.h @@ -1,7 +1,10 @@ #pragma once -#include "Tactility/service/ServiceContext.h" -#include "Tactility/service/Service.h" +#include +#include +#include + +#include namespace tt::service { @@ -21,7 +24,7 @@ public: const ServiceManifest& getManifest() const override; /** Retrieve the paths that are relevant to this service */ - std::unique_ptr getPaths() const override; + std::unique_ptr getPaths() const override; std::shared_ptr getService() const { return service; } diff --git a/Tactility/Private/Tactility/service/ServiceInstancePaths.h b/Tactility/Private/Tactility/service/ServiceInstancePaths.h deleted file mode 100644 index d491bb85..00000000 --- a/Tactility/Private/Tactility/service/ServiceInstancePaths.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include "Tactility/service/ServiceInstance.h" - -namespace tt::service { - -class ServiceInstancePaths final : public Paths { - - std::shared_ptr manifest; - -public: - - explicit ServiceInstancePaths(std::shared_ptr manifest) : manifest(std::move(manifest)) {} - ~ServiceInstancePaths() override = default; - - std::string getDataDirectory() const override; - std::string getDataPath(const std::string& childPath) const override; - std::string getSystemDirectory() const override; - std::string getSystemPath(const std::string& childPath) const override; -}; - -} \ No newline at end of file diff --git a/Tactility/Source/app/AppInstance.cpp b/Tactility/Source/app/AppInstance.cpp index 8989f32a..d3d00c54 100644 --- a/Tactility/Source/app/AppInstance.cpp +++ b/Tactility/Source/app/AppInstance.cpp @@ -1,5 +1,5 @@ -#include "Tactility/app/AppInstance.h" -#include "Tactility/app/AppInstancePaths.h" +#include +#include namespace tt::app { @@ -49,9 +49,9 @@ std::shared_ptr AppInstance::getParameters() const { return result; } -std::unique_ptr AppInstance::getPaths() const { +std::unique_ptr AppInstance::getPaths() const { assert(manifest != nullptr); - return std::make_unique(*manifest); + return std::make_unique(*manifest); } } // namespace diff --git a/Tactility/Source/app/AppInstancePaths.cpp b/Tactility/Source/app/AppPaths.cpp similarity index 69% rename from Tactility/Source/app/AppInstancePaths.cpp rename to Tactility/Source/app/AppPaths.cpp index d00e94f9..1134c0a0 100644 --- a/Tactility/Source/app/AppInstancePaths.cpp +++ b/Tactility/Source/app/AppPaths.cpp @@ -1,5 +1,6 @@ -#include "Tactility/app/AppInstancePaths.h" +#include +#include #include #define LVGL_PATH_PREFIX std::string("A:/") @@ -11,24 +12,24 @@ namespace tt::app { -std::string AppInstancePaths::getDataDirectory() const { +std::string AppPaths::getDataDirectory() const { if (manifest.appLocation.isInternal()) { } return PARTITION_PREFIX + file::DATA_PARTITION_NAME + "/app/" + manifest.appId; } -std::string AppInstancePaths::getDataPath(const std::string& childPath) const { +std::string AppPaths::getDataPath(const std::string& childPath) const { assert(!childPath.starts_with('/')); return PARTITION_PREFIX + file::DATA_PARTITION_NAME + "/app/" + manifest.appId + '/' + childPath; } -std::string AppInstancePaths::getSystemDirectory() const { +std::string AppPaths::getSystemDirectory() const { return PARTITION_PREFIX + file::SYSTEM_PARTITION_NAME + "/app/" + manifest.appId; } -std::string AppInstancePaths::getSystemPath(const std::string& childPath) const { +std::string AppPaths::getSystemPath(const std::string& childPath) const { assert(!childPath.starts_with('/')); return PARTITION_PREFIX + file::SYSTEM_PARTITION_NAME + "/app/" + manifest.appId + '/' + childPath; } diff --git a/Tactility/Source/app/boot/Boot.cpp b/Tactility/Source/app/boot/Boot.cpp index 82cebd5b..d22dcd7f 100644 --- a/Tactility/Source/app/boot/Boot.cpp +++ b/Tactility/Source/app/boot/Boot.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include diff --git a/Tactility/Source/app/launcher/Launcher.cpp b/Tactility/Source/app/launcher/Launcher.cpp index 447176d4..4946e70e 100644 --- a/Tactility/Source/app/launcher/Launcher.cpp +++ b/Tactility/Source/app/launcher/Launcher.cpp @@ -1,6 +1,7 @@ #include #include +#include #include #include #include diff --git a/Tactility/Source/app/timezone/TimeZone.cpp b/Tactility/Source/app/timezone/TimeZone.cpp index 72564405..c5fec8ae 100644 --- a/Tactility/Source/app/timezone/TimeZone.cpp +++ b/Tactility/Source/app/timezone/TimeZone.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include diff --git a/Tactility/Source/service/ServiceInstance.cpp b/Tactility/Source/service/ServiceInstance.cpp index 8ecb1768..cf76beb5 100644 --- a/Tactility/Source/service/ServiceInstance.cpp +++ b/Tactility/Source/service/ServiceInstance.cpp @@ -1,17 +1,19 @@ -#include "Tactility/service/ServiceInstance.h" -#include "Tactility/service/ServiceInstancePaths.h" +#include + +#include +#include namespace tt::service { -ServiceInstance::ServiceInstance(std::shared_ptr manifest) : +ServiceInstance::ServiceInstance(std::shared_ptr manifest) : manifest(manifest), service(manifest->createService()) {} -const service::ServiceManifest& ServiceInstance::getManifest() const { return *manifest; } +const ServiceManifest& ServiceInstance::getManifest() const { return *manifest; } -std::unique_ptr ServiceInstance::getPaths() const { - return std::make_unique(manifest); +std::unique_ptr ServiceInstance::getPaths() const { + return std::make_unique(manifest); } } \ No newline at end of file diff --git a/Tactility/Source/service/ServiceInstancePaths.cpp b/Tactility/Source/service/ServicePaths.cpp similarity index 63% rename from Tactility/Source/service/ServiceInstancePaths.cpp rename to Tactility/Source/service/ServicePaths.cpp index dc8ce653..cdbf9b7f 100644 --- a/Tactility/Source/service/ServiceInstancePaths.cpp +++ b/Tactility/Source/service/ServicePaths.cpp @@ -1,6 +1,7 @@ -#include "Tactility/service/ServiceInstancePaths.h" +#include -#include "Tactility/MountPoints.h" +#include +#include #define LVGL_PATH_PREFIX std::string("A:/") @@ -12,20 +13,20 @@ namespace tt::service { -std::string ServiceInstancePaths::getDataDirectory() const { +std::string ServicePaths::getDataDirectory() const { return PARTITION_PREFIX + file::DATA_PARTITION_NAME + "/service/" + manifest->id; } -std::string ServiceInstancePaths::getDataPath(const std::string& childPath) const { +std::string ServicePaths::getDataPath(const std::string& childPath) const { assert(!childPath.starts_with('/')); return PARTITION_PREFIX + file::DATA_PARTITION_NAME + "/service/" + manifest->id + '/' + childPath; } -std::string ServiceInstancePaths::getSystemDirectory() const { +std::string ServicePaths::getSystemDirectory() const { return PARTITION_PREFIX + file::SYSTEM_PARTITION_NAME + "/service/" + manifest->id; } -std::string ServiceInstancePaths::getSystemPath(const std::string& childPath) const { +std::string ServicePaths::getSystemPath(const std::string& childPath) const { assert(!childPath.starts_with('/')); return PARTITION_PREFIX + file::SYSTEM_PARTITION_NAME + "/service/" + manifest->id + '/' + childPath; } diff --git a/Tactility/Source/service/gps/GpsConfiguration.cpp b/Tactility/Source/service/gps/GpsConfiguration.cpp index 3caa65b8..63328ab7 100644 --- a/Tactility/Source/service/gps/GpsConfiguration.cpp +++ b/Tactility/Source/service/gps/GpsConfiguration.cpp @@ -1,6 +1,6 @@ -#include "Tactility/service/gps/GpsService.h" - -#include "Tactility/file/ObjectFile.h" +#include +#include +#include #include #include diff --git a/Tactility/Source/service/gps/GpsService.cpp b/Tactility/Source/service/gps/GpsService.cpp index 38b27bf2..eff34464 100644 --- a/Tactility/Source/service/gps/GpsService.cpp +++ b/Tactility/Source/service/gps/GpsService.cpp @@ -1,9 +1,10 @@ -#include "Tactility/service/gps/GpsService.h" -#include "Tactility/service/ServiceManifest.h" -#include "Tactility/service/ServiceRegistration.h" +#include -#include #include +#include +#include +#include +#include using tt::hal::gps::GpsDevice; diff --git a/Tactility/Source/service/statusbar/Statusbar.cpp b/Tactility/Source/service/statusbar/Statusbar.cpp index 30c535b7..2b8b1b32 100644 --- a/Tactility/Source/service/statusbar/Statusbar.cpp +++ b/Tactility/Source/service/statusbar/Statusbar.cpp @@ -1,16 +1,16 @@ #include -#include #include #include #include -#include +#include #include -#include -#include +#include #include +#include #include #include +#include namespace tt::service::statusbar { @@ -148,7 +148,7 @@ class StatusbarService final : public Service { int8_t power_icon_id; const char* power_last_icon = nullptr; - std::unique_ptr paths; + std::unique_ptr paths; void lock() const { mutex.lock(); diff --git a/TactilityC/Source/tt_app.cpp b/TactilityC/Source/tt_app.cpp index 59f009c8..1ee071a9 100644 --- a/TactilityC/Source/tt_app.cpp +++ b/TactilityC/Source/tt_app.cpp @@ -1,5 +1,6 @@ #include "tt_app.h" #include +#include #include extern "C" {