//
-// Open Service Platform
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
#include <new>
#include <memory>
-#include <FBaseErrors.h>
+#include <unique_ptr.h>
+#include <FBaseErrors.h>
#include <FBaseSysLog.h>
#include <FIo_IpcClient.h>
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
+using namespace Tizen::Io;
namespace Tizen { namespace App
{
+const char CONDITION_MANAGER_IPC_NAME[] = "osp.app.ipcserver.conditionmanager";
+
_ConditionManagerProxy::_ConditionManagerProxy(void)
: __pIpcClient(null)
{
result
_ConditionManagerProxy::Construct()
{
- __pIpcClient = new (std::nothrow) Tizen::Io::_IpcClient();
- SysTryReturnResult(NID_APP, __pIpcClient != null, E_OUT_OF_MEMORY, "_IpcClient creation failed.");
+ std::unique_ptr<_IpcClient> pIpcClient(new (std::nothrow) _IpcClient());
+ SysTryReturnResult(NID_APP, pIpcClient.get() != null, E_OUT_OF_MEMORY, "_IpcClient creation failed.");
+
+ result r = pIpcClient->Construct(CONDITION_MANAGER_IPC_NAME);
+ SysTryReturn(NID_APP, !IsFailed(r), r, r, "[%%s] _IpcClient constructing faliied.", GetErrorMessage(r));
- result r = __pIpcClient->Construct("osp.app.ipcserver.conditionmanager");
- SysTryReturn(NID_APP, !IsFailed(r), r, r, "_IpcClient constructing faliied [%s].", GetErrorMessage(r));
+ __pIpcClient = pIpcClient.release();
return E_SUCCESS;
}
std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) ConditionManager_RegisterAppLaunch(
appId, condition, (pArrayList != null) ? *pArrayList : dummy,
- (int) AppManager::LAUNCH_OPTION_DEFAULT, &response));
+ static_cast<int>(AppManager::LAUNCH_OPTION_DEFAULT), &response));
result r = __pIpcClient->SendRequest(*pMsg.get());
SysTryReturn(NID_APP, !IsFailed(r), r, r, "__pIpcClient->SendRequest is failed. (%s)", GetErrorMessage(r));
result
-_ConditionManagerProxy::UnregisterAppLaunch(const AppId& appId, /*const Tizen::Base::String& executableName,*/ const String* pCondition)
+_ConditionManagerProxy::UnregisterAppLaunch(const AppId& appId, const String* pCondition)
{
SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null.");
SysLog(NID_APP, "");