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)
51 _PackageManagerProxy::Construct()
53 __pIpcClient = new (std::nothrow) Tizen::Io::_IpcClient();
54 SysTryReturnResult(NID_APP, __pIpcClient != null, E_OUT_OF_MEMORY, "_IpcClient creation failed.");
56 result r = __pIpcClient->Construct("osp.app.ipcserver.packagemanager");
57 SysTryReturn(NID_APP, !IsFailed(r), r, r, "_IpcClient constructing failed [%s].", GetErrorMessage(r));
63 _PackageManagerProxy::InstallPackage(const PackageId& packageId, const String& packagePath, IPackageInstallationResponseListener* pListener)
65 SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null.");
66 SysLog(NID_APP, "_PackageManagerProxy::InstallPackage");
68 result response = E_SUCCESS;
69 std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) PackageManager_InstallPackage(packageId, packagePath, (int) pListener, &response));
70 result r = __pIpcClient->SendRequest(*pMsg.get());
72 SysTryReturn(NID_APP, !IsFailed(r), r, r, "__pIpcClient->SendRequest is failed. (%s)", GetErrorMessage(r));
78 _PackageManagerProxy::UninstallPackage(const PackageId& packageId, IPackageUninstallationResponseListener* pListener)
80 SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null.");
81 SysLog(NID_APP, "_PackageManagerProxy::UninstallPackage");
83 result response = E_SUCCESS;
84 std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) PackageManager_UninstallPackage(packageId, (int)pListener, &response));
85 result r = __pIpcClient->SendRequest(*pMsg.get());
87 SysTryReturn(NID_APP, !IsFailed(r), r, r, "__pIpcClient->SendRequest is failed. (%s)", GetErrorMessage(r));