From 60568d92478388ee55c7ff7df788c84f756787b5 Mon Sep 17 00:00:00 2001 From: Bartosz Date: Wed, 21 Dec 2022 11:27:36 +0100 Subject: [PATCH] [MOS-856] Add MTP path to DeviceInfo endpoint Added MTP path for products to enable MC to use it instead of hardcoded paths --- .../endpoints/include/endpoints/JsonKeyNames.hpp | 1 + module-vfs/paths/filesystem_paths.cpp | 8 ++++++++ module-vfs/paths/include/purefs/filesystem_paths.hpp | 3 +++ products/BellHybrid/BellHybridMain.cpp | 2 +- .../desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp | 3 ++- products/PurePhone/PurePhoneMain.cpp | 2 +- .../desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp | 1 + 7 files changed, 17 insertions(+), 3 deletions(-) diff --git a/module-services/service-desktop/endpoints/include/endpoints/JsonKeyNames.hpp b/module-services/service-desktop/endpoints/include/endpoints/JsonKeyNames.hpp index 3a4924076033739fb74fe8f2493c2b9667e045de..3f8f8c4d2836db8c5800f6d30dc86f37565d648d 100644 --- a/module-services/service-desktop/endpoints/include/endpoints/JsonKeyNames.hpp +++ b/module-services/service-desktop/endpoints/include/endpoints/JsonKeyNames.hpp @@ -55,6 +55,7 @@ namespace sdesktop::endpoints::json inline constexpr auto updateFilePath = "updateFilePath"; inline constexpr auto backupFilePath = "backupFilePath"; inline constexpr auto syncFilePath = "syncFilePath"; + inline constexpr auto mtpPath = "mtpPath"; inline constexpr auto deviceToken = "deviceToken"; namespace updateprocess diff --git a/module-vfs/paths/filesystem_paths.cpp b/module-vfs/paths/filesystem_paths.cpp index 736e88588c201af921c6060e930ab4e393177113..ac769b5dcd2f9a247e27a90e6d71e8f1f6109ab7 100644 --- a/module-vfs/paths/filesystem_paths.cpp +++ b/module-vfs/paths/filesystem_paths.cpp @@ -80,6 +80,14 @@ namespace purefs { return getSystemDiskPath() / PATH_VAR; } + std::filesystem::path getMusicPlayerPath() noexcept + { + return purefs::dir::getUserMediaPath() / "app/music_player"; + } + std::filesystem::path getRelaxationPath() noexcept + { + return purefs::dir::getUserMediaPath() / "app/relaxation"; + } } // namespace dir } // namespace purefs diff --git a/module-vfs/paths/include/purefs/filesystem_paths.hpp b/module-vfs/paths/include/purefs/filesystem_paths.hpp index 7940c96eaa48696a2521624fd4349fda61700eb9..b0ef88a580822b260719195e8d6f7720583e47d7 100644 --- a/module-vfs/paths/include/purefs/filesystem_paths.hpp +++ b/module-vfs/paths/include/purefs/filesystem_paths.hpp @@ -21,6 +21,9 @@ namespace purefs std::filesystem::path getAssetsDirPath() noexcept; std::filesystem::path getSystemDataDirPath() noexcept; std::filesystem::path getSystemVarDirPath() noexcept; + std::filesystem::path getMusicPlayerPath() noexcept; + std::filesystem::path getRelaxationPath() noexcept; + } // namespace dir namespace file diff --git a/products/BellHybrid/BellHybridMain.cpp b/products/BellHybrid/BellHybridMain.cpp index 8d21e348f89203c9eb8d8cd7364ee08bef23fb59..16e6a9f187b9f089e02cd5e1808e03b347e19df3 100644 --- a/products/BellHybrid/BellHybridMain.cpp +++ b/products/BellHybrid/BellHybridMain.cpp @@ -82,7 +82,7 @@ int main() systemServices.emplace_back(sys::CreatorFor(std::move(fileIndexerAudioPaths))); systemServices.emplace_back(sys::CreatorFor()); systemServices.emplace_back(sys::CreatorFor()); - systemServices.emplace_back(sys::CreatorFor(purefs::dir::getUserMediaPath() / "app/relaxation")); + systemServices.emplace_back(sys::CreatorFor(purefs::dir::getRelaxationPath())); systemServices.emplace_back(sys::CreatorFor(std::make_shared())); systemServices.emplace_back(sys::CreatorFor(service::eink::ExitAction::None)); systemServices.emplace_back( diff --git a/products/BellHybrid/services/desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp b/products/BellHybrid/services/desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp index 01eecb1c6e27ffb699dc5d7c22ad77d81f357fc7..da567c1f91a4ab58d1089fdc0a80dbbdb3e1b84c 100644 --- a/products/BellHybrid/services/desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp +++ b/products/BellHybrid/services/desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp @@ -46,7 +46,8 @@ namespace sdesktop::endpoints (purefs::dir::getTemporaryPath() / sdesktop::paths::recoveryStatusFilename).string()}, {json::updateFilePath, (purefs::dir::getTemporaryPath() / sdesktop::paths::updateFilename).string()}, {json::backupFilePath, (purefs::dir::getTemporaryPath() / sdesktop::paths::backupFilename).string()}, - {json::syncFilePath, (purefs::dir::getTemporaryPath() / sdesktop::paths::syncFilename).string()}})); + {json::syncFilePath, (purefs::dir::getTemporaryPath() / sdesktop::paths::syncFilename).string()}, + {json::mtpPath, purefs::dir::getRelaxationPath().string()}})); return http::Code::OK; } diff --git a/products/PurePhone/PurePhoneMain.cpp b/products/PurePhone/PurePhoneMain.cpp index 1a6b6c98a1d3a5eeb3f9e52f69bec92c5f7ec7a1..b1262a2cd2d4b1b6378b54f9cc81291cc91a461c 100644 --- a/products/PurePhone/PurePhoneMain.cpp +++ b/products/PurePhone/PurePhoneMain.cpp @@ -182,7 +182,7 @@ int main() systemServices.emplace_back(sys::CreatorFor()); #endif #ifdef ENABLE_SERVICE_DESKTOP - systemServices.emplace_back(sys::CreatorFor(purefs::dir::getUserMediaPath() / "app/music_player")); + systemServices.emplace_back(sys::CreatorFor(purefs::dir::getMusicPlayerPath())); #endif #ifdef ENABLE_SERVICE_TIME systemServices.emplace_back(sys::CreatorFor(std::make_shared())); diff --git a/products/PurePhone/services/desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp b/products/PurePhone/services/desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp index 8c13b7dd458613f7be5247d6a6a42420134596b2..a69195f53c78615be8e9a3f05afe40b17c9cee6e 100644 --- a/products/PurePhone/services/desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp +++ b/products/PurePhone/services/desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp @@ -62,6 +62,7 @@ namespace sdesktop::endpoints {json::updateFilePath, (purefs::dir::getTemporaryPath() / sdesktop::paths::updateFilename).string()}, {json::backupFilePath, (purefs::dir::getTemporaryPath() / sdesktop::paths::backupFilename).string()}, {json::syncFilePath, (purefs::dir::getTemporaryPath() / sdesktop::paths::syncFilename).string()}, + {json::mtpPath, purefs::dir::getMusicPlayerPath().string()}, {json::deviceToken, getDeviceToken()}})); return http::Code::OK;