//
-// 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;
}
result
-_ConditionManagerProxy::RegisterAppLaunch(const AppId& appId, const Tizen::Base::String& executableName, const String& condition,
+_ConditionManagerProxy::RegisterAppLaunch(const AppId& appId, const String& condition,
const IList* pArguments, AppManager::LaunchOption option)
{
SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null.");
dummy.Construct();
std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) ConditionManager_RegisterAppLaunch(
- appId, executableName, condition, (pArrayList != null) ? *pArrayList : dummy,
- (int) AppManager::LAUNCH_OPTION_DEFAULT, &response));
+ appId, condition, (pArrayList != null) ? *pArrayList : dummy,
+ 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, "");
result response = E_SUCCESS;
std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) ConditionManager_UnregisterAppLaunch(
- appId, executableName, (pCondition != null) ? *pCondition : L"", &response));
+ appId, (pCondition != null) ? *pCondition : L"", &response));
result r = __pIpcClient->SendRequest(*pMsg.get());
SysTryReturn(NID_APP, !IsFailed(r), r, r, "__pIpcClient->SendRequest is failed. (%s)", GetErrorMessage(r));
}
bool
-_ConditionManagerProxy::IsAppLaunchRegistered(const AppId& appId, const Tizen::Base::String& executableName, const String* pCondition) const
+_ConditionManagerProxy::IsAppLaunchRegistered(const AppId& appId, const String* pCondition) const
{
SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null.");
SysLog(NID_APP, "");
bool isAppLaunchRegistered = false;
result exception = E_SYSTEM;
std::auto_ptr<IPC::Message> pMsg(new (std::nothrow) ConditionManager_IsAppLaunchRegistered(
- appId, executableName, (pCondition != null) ? *pCondition : L"", &isAppLaunchRegistered, &exception));
+ appId, (pCondition != null) ? *pCondition : L"", &isAppLaunchRegistered, &exception));
result r = __pIpcClient->SendRequest(*pMsg.get());
SysTryReturn(NID_APP, !IsFailed(r), false, r, "__pIpcClient->SendRequest is failed. (%s)", GetErrorMessage(r));