diff options
author | Sehong Na <sehong.na@samsung.com> | 2014-05-31 12:52:36 +0900 |
---|---|---|
committer | Sehong Na <sehong.na@samsung.com> | 2014-05-31 12:52:36 +0900 |
commit | 06e76f4e3d3b109dae626ce06c6ad4ffbfda6e82 (patch) | |
tree | b296b93daba8e5d5ca060f92609278c9a4dbfb8f /src_mobile/Daemon/BoxDaemonUtil.cpp | |
download | web-provider-tizen_2.3.tar.gz web-provider-tizen_2.3.tar.bz2 web-provider-tizen_2.3.zip |
Initialize Tizen 2.3submit/tizen_2.3/20140531.1002062.3a_releasetizen_2.3
Diffstat (limited to 'src_mobile/Daemon/BoxDaemonUtil.cpp')
-rw-r--r-- | src_mobile/Daemon/BoxDaemonUtil.cpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src_mobile/Daemon/BoxDaemonUtil.cpp b/src_mobile/Daemon/BoxDaemonUtil.cpp new file mode 100644 index 0000000..00668a3 --- /dev/null +++ b/src_mobile/Daemon/BoxDaemonUtil.cpp @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file BoxDaemonUtil.cpp + * @author Yunchan Cho (yunchan.cho@samsung.com) + */ +#include <string> +#include <memory> +#include <app_service.h> +#include <Core/Util/Log.h> +#include <API/web_provider_livebox_info.h> +#include "BoxDaemonUtil.h" + +const std::string BoxDaemonUtil::boxIdKey("box-id"); +const std::string BoxDaemonUtil::instanceIdKey("instance-id"); + +bool BoxDaemonUtil::launchApplication(std::string& boxId, std::string& instanceId) +{ + LogD("enter"); + + std::shared_ptr<const char> appId(web_provider_livebox_get_app_id(boxId.c_str())); + if (!appId) { + LogD("no appid of %s", boxId.c_str()); + return false; + } + + service_h handle = NULL; + int ret = SERVICE_ERROR_NONE; + + ret = service_create(&handle); + if (ret != SERVICE_ERROR_NONE && !handle) { + LogD("failed to create service"); + return false; + } + + ret = service_set_package(handle, appId.get()); + if (ret != SERVICE_ERROR_NONE) { + LogD("failed to set package"); + service_destroy(handle); + return false; + } + + service_add_extra_data(handle, boxIdKey.c_str(), boxId.c_str()); + service_add_extra_data(handle, instanceIdKey.c_str(), instanceId.c_str()); + + ret = service_send_launch_request(handle, NULL, NULL); + if (ret != SERVICE_ERROR_NONE) { + LogD("failed to launch package"); + service_destroy(handle); + return false; + } + + service_destroy(handle); + LogD("success to launch app of %s", boxId.c_str()); + + return true; +} |