2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FApp_PackageManagerProxy.cpp
20 * @brief This is the implementation for the _PackageManagerProxy.cpp class.
26 #include <FBaseErrors.h>
27 #include <FBaseSysLog.h>
28 #include <FAppPkgIPackageInstallationResponseListener.h>
29 #include <FAppPkgIPackageUninstallationResponseListener.h>
30 #include <FIo_IpcClient.h>
32 #include "FApp_PackageManagerIpcMessages.h"
33 #include "FApp_PackageManagerProxy.h"
35 using namespace Tizen::Base;
36 using namespace Tizen::App::Package;
38 namespace Tizen { namespace App
41 _PackageManagerProxy::_PackageManagerProxy(void)
46 _PackageManagerProxy::~_PackageManagerProxy(void)
52 _PackageManagerProxy::Construct()
54 __pIpcClient = new (std::nothrow) Tizen::Io::_IpcClient();
55 SysTryReturnResult(NID_APP, __pIpcClient != null, E_OUT_OF_MEMORY, "_IpcClient creation failed.");
57 result r = __pIpcClient->Construct("osp.app.ipcserver.packagemanager");
58 SysTryReturn(NID_APP, !IsFailed(r), r, r, "_IpcClient constructing failed [%s].", GetErrorMessage(r));
64 _PackageManagerProxy::InstallPackage(const PackageId& packageId, const String& packagePath, IPackageInstallationResponseListener* pListener)
66 SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null.");
67 SysLog(NID_APP, "_PackageManagerProxy::InstallPackage");
69 result response = E_SUCCESS;
70 std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) PackageManager_InstallPackage(packageId, packagePath, (int) pListener, &response));
71 result r = __pIpcClient->SendRequest(*pMsg.get());
73 SysTryReturn(NID_APP, !IsFailed(r), r, r, "__pIpcClient->SendRequest is failed. (%s)", GetErrorMessage(r));
79 _PackageManagerProxy::UninstallPackage(const PackageId& packageId, IPackageUninstallationResponseListener* pListener)
81 SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null.");
82 SysLog(NID_APP, "_PackageManagerProxy::UninstallPackage");
84 result response = E_SUCCESS;
85 std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) PackageManager_UninstallPackage(packageId, (int)pListener, &response));
86 result r = __pIpcClient->SendRequest(*pMsg.get());
88 SysTryReturn(NID_APP, !IsFailed(r), r, r, "__pIpcClient->SendRequest is failed. (%s)", GetErrorMessage(r));