From c86d5fe25739c46551154a98898aa0d973860127 Mon Sep 17 00:00:00 2001 From: Duyoung Jang Date: Thu, 9 May 2013 16:56:48 +0900 Subject: [PATCH] PackageManagerProxy is updated. Change-Id: If18460a018079dd4ffbc6c22251e17673445d71f Signed-off-by: Duyoung Jang --- src/app/FApp_PackageManagerProxy.cpp | 66 ++++++++++++++++++++++++++++ src/app/inc/FApp_PackageManagerIpcMessages.h | 4 ++ src/app/inc/FApp_PackageManagerProxy.h | 4 ++ 3 files changed, 74 insertions(+) diff --git a/src/app/FApp_PackageManagerProxy.cpp b/src/app/FApp_PackageManagerProxy.cpp index 6e492ac..37334e1 100644 --- a/src/app/FApp_PackageManagerProxy.cpp +++ b/src/app/FApp_PackageManagerProxy.cpp @@ -89,4 +89,70 @@ _PackageManagerProxy::UninstallPackage(const PackageId& packageId, IPackageUnins return response; } +result +_PackageManagerProxy::GetPackageInfoFromFileN(const String& filePath, PackageInfo* pPackageInfo) +{ + SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null."); + SysTryReturnResult(NID_APP, pPackageInfo != null, E_INVALID_STATE, "pPackageInfo instance must not be null."); + + SysLog(NID_APP, "file = [%ls]", filePath.GetPointer()); + + result response = E_SUCCESS; + String info; + std::auto_ptr pMsg (new (std::nothrow) PackageManager_GetPackageInfoFromFileN(filePath, &info, &response)); + + result r = __pIpcClient->SendRequest(*pMsg.get()); + SysTryReturn(NID_APP, !IsFailed(r), r, r, "__pIpcClient->SendRequest is failed. (%s)", GetErrorMessage(r)); + + return response; +} + +long long +_PackageManagerProxy::GetSize(const PackageId& packageId) +{ + SysTryReturn(NID_APP, __pIpcClient != null, 0, E_INVALID_STATE, "__pIpcClient instance must not be null."); + + SysLog(NID_APP, "packageId = [%ls]", packageId.GetPointer()); + + long long size = 0; + std::auto_ptr pMsg (new (std::nothrow) PackageManager_GetSize(packageId, &size)); + + result r = __pIpcClient->SendRequest(*pMsg.get()); + SysTryReturn(NID_APP, !IsFailed(r), 0, r, "__pIpcClient->SendRequest is failed. (%s)", GetErrorMessage(r)); + + return size; +} + +long long +_PackageManagerProxy::GetDataSize(const PackageId& packageId) +{ + SysTryReturn(NID_APP, __pIpcClient != null, 0, E_INVALID_STATE, "__pIpcClient instance must not be null."); + + SysLog(NID_APP, "packageId = [%ls]", packageId.GetPointer()); + + long long dataSize = 0; + std::auto_ptr pMsg (new (std::nothrow) PackageManager_GetDataSize(packageId, &dataSize)); + + result r = __pIpcClient->SendRequest(*pMsg.get()); + SysTryReturn(NID_APP, !IsFailed(r), 0, r, "__pIpcClient->SendRequest is failed. (%s)", GetErrorMessage(r)); + + return dataSize; +} + +PackageType +_PackageManagerProxy::GetType(const PackageId& packageId) +{ + SysTryReturn(NID_APP, __pIpcClient != null, PACKAGE_TYPE_TPK, E_INVALID_STATE, "__pIpcClient instance must not be null."); + + SysLog(NID_APP, "packageId = [%ls]", packageId.GetPointer()); + + int type = 0; + std::auto_ptr pMsg (new (std::nothrow) PackageManager_GetType(packageId, &type)); + + result r = __pIpcClient->SendRequest(*pMsg.get()); + SysTryReturn(NID_APP, !IsFailed(r), PACKAGE_TYPE_TPK, r, "__pIpcClient->SendRequest is failed. (%s)", GetErrorMessage(r)); + + return (PackageType)type; +} + } } // Tizen::App diff --git a/src/app/inc/FApp_PackageManagerIpcMessages.h b/src/app/inc/FApp_PackageManagerIpcMessages.h index 890f80e..7b7191c 100644 --- a/src/app/inc/FApp_PackageManagerIpcMessages.h +++ b/src/app/inc/FApp_PackageManagerIpcMessages.h @@ -28,3 +28,7 @@ IPC_SYNC_MESSAGE_CONTROL3_1(PackageManager_InstallPackage, Tizen::App::PackageId, Tizen::Base::String, int, result) IPC_SYNC_MESSAGE_CONTROL2_1(PackageManager_UninstallPackage, Tizen::App::PackageId, int, result) +IPC_SYNC_MESSAGE_CONTROL1_2(PackageManager_GetPackageInfoFromFileN, Tizen::Base::String, Tizen::Base::String, result) +IPC_SYNC_MESSAGE_CONTROL1_1(PackageManager_GetSize, Tizen::App::PackageId, long long) +IPC_SYNC_MESSAGE_CONTROL1_1(PackageManager_GetDataSize, Tizen::App::PackageId, long long) +IPC_SYNC_MESSAGE_CONTROL1_1(PackageManager_GetType, Tizen::App::PackageId, int) diff --git a/src/app/inc/FApp_PackageManagerProxy.h b/src/app/inc/FApp_PackageManagerProxy.h index 0a8a1a3..b1bafb2 100644 --- a/src/app/inc/FApp_PackageManagerProxy.h +++ b/src/app/inc/FApp_PackageManagerProxy.h @@ -55,6 +55,10 @@ public: result InstallPackage(const PackageId& packageId, const Tizen::Base::String& packagePath, Tizen::App::Package::IPackageInstallationResponseListener* pListener); result UninstallPackage(const PackageId& packageId, Tizen::App::Package::IPackageUninstallationResponseListener* pListener); + result GetPackageInfoFromFileN(const Tizen::Base::String& filePath, Tizen::App::Package::PackageInfo* pPackageInfo); + long long GetSize(const PackageId& packageId); + long long GetDataSize(const PackageId& packageId); + Tizen::App::Package::PackageType GetType(const PackageId& packageId); private: _PackageManagerProxy(const _PackageManagerProxy& rhs); -- 2.7.4