## Find all needed packages once
PKG_CHECK_MODULES(BUNDLE_DEPS REQUIRED bundle)
PKG_CHECK_MODULES(CAPI_APPFW_APP_COMMON_DEPS REQUIRED capi-appfw-app-common)
+PKG_CHECK_MODULES(CAPI_APPFW_APP_CONTROL_DEPS REQUIRED capi-appfw-app-control)
PKG_CHECK_MODULES(CAPI_APPFW_APP_MANAGER_DEPS REQUIRED capi-appfw-app-manager)
PKG_CHECK_MODULES(CAPI_APPFW_PACKAGE_MANAGER_DEPS REQUIRED capi-appfw-package-manager)
PKG_CHECK_MODULES(CAPI_APPFW_SERVICE_APPLICATION_DEPS REQUIRED capi-appfw-service-application)
BuildRequires: tidl
BuildRequires: pkgconfig(bundle)
BuildRequires: pkgconfig(capi-appfw-app-common)
+BuildRequires: pkgconfig(capi-appfw-app-control)
BuildRequires: pkgconfig(capi-appfw-app-manager)
BuildRequires: pkgconfig(capi-appfw-package-manager)
BuildRequires: pkgconfig(capi-appfw-service-application)
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} ACTION_SRCS)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/executor ACTION_EXECUTOR_SRCS)
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/utils ACTION_UTILS_SRCS)
-ADD_LIBRARY(${TARGET_TIZEN_ACTION} ${ACTION_SRCS} ${ACTION_UTILS_SRCS})
+ADD_LIBRARY(${TARGET_TIZEN_ACTION} ${ACTION_SRCS} ${ACTION_EXECUTOR_SRCS} ${ACTION_UTILS_SRCS})
TARGET_INCLUDE_DIRECTORIES(${TARGET_TIZEN_ACTION} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../)
APPLY_PKG_CONFIG(${TARGET_TIZEN_ACTION} PUBLIC
CAPI_APPFW_APP_COMMON_DEPS
+ CAPI_APPFW_APP_CONTROL_DEPS
CAPI_APPFW_APP_MANAGER_DEPS
CAPI_APPFW_PACKAGE_MANAGER_DEPS
CAPI_APPFW_SERVICE_APPLICATION_DEPS
--- /dev/null
+/*
+ * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+
+#include "action/app_control_executor.hh"
+
+#include <app_control.h>
+
+#include <memory>
+
+#include "action/app_control_sender.hh"
+#include "common/action_model.h"
+#include "common/utils/logging.hh"
+
+namespace {
+
+app_control_h ConvertToAppControl(const common::ActionModel& action_model) {
+ app_control_h handle = nullptr;
+
+ int ret = app_control_create(&handle);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ LOG(ERROR) << "Failed to create app_control handle: " << ret;
+ return nullptr;
+ }
+
+ // TODO: Convert to app_control handle from action model
+
+ return handle;
+}
+
+} // namespace
+
+namespace action {
+
+int AppControlExecutor::Execute(const common::ActionModel& model) {
+ app_control_h app_control = ConvertToAppControl(model);
+
+ std::unique_ptr<AppControlSender> sender =
+ std::make_unique<AppControlSender>(app_control);
+
+ // TODO: handle result?
+ sender->Send();
+
+ senders_.emplace_back(std::move(sender));
+
+ return 0;
+}
+
+} // namespace action
--- /dev/null
+/*
+ * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+#ifndef ACTION_APP_CONTROL_EXECUTOR_HH_
+#define ACTION_APP_CONTROL_EXECUTOR_HH_
+
+#include <memory>
+
+#include "action/app_control_sender.hh"
+#include "common/action_executor.hh"
+#include "common/action_model.h"
+
+namespace action {
+
+class AppControlExecutor : public common::IActionExecutor {
+ public:
+ AppControlExecutor();
+ ~AppControlExecutor();
+ int Execute(const common::ActionModel& model) override;
+
+ private:
+ std::vector<std::unique_ptr<AppControlSender>> senders_;
+};
+
+} // namespace action
+
+#endif // ACTION_APP_CONTROL_EXECUTOR_HH_
--- /dev/null
+/*
+ * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+#include "action/app_control_sender.hh"
+
+#include <app_control.h>
+
+#include "common/utils/logging.hh"
+
+namespace {
+
+void ResultCb(app_control_h request, app_control_error_e result,
+ void* user_data) {
+ LOG(DEBUG) << "ResultCb: " << result;
+}
+
+void ReplyCb(app_control_h request, app_control_h reply,
+ app_control_result_e result, void* user_data) {
+ // TODO: return reply to caller
+}
+
+} // namespace
+
+namespace action {
+
+AppControlSender::AppControlSender(app_control_h app_control)
+ : app_control_(app_control) {
+}
+
+AppControlSender::~AppControlSender() {
+ int ret = app_control_destroy(app_control_);
+ if (ret != APP_CONTROL_ERROR_NONE)
+ LOG(ERROR) << "Failed to destroy app_control: " << ret;
+}
+
+bool AppControlSender::Send() {
+ int ret = app_control_send_launch_request_async(app_control_, ResultCb,
+ ReplyCb, nullptr);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ LOG(ERROR) << "Failed to send launch request: " << ret;
+ return false;
+ }
+
+ return true;
+}
+
+} // namespace action
--- /dev/null
+/*
+ * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+#ifndef ACTION_EXECUTOR_APP_CONTROL_SENDER_HH_
+#define ACTION_EXECUTOR_APP_CONTROL_SENDER_HH_
+
+#include <app_control.h>
+
+namespace action {
+
+class AppControlSender {
+ public:
+ AppControlSender(app_control_h app_control);
+ ~AppControlSender();
+ bool Send();
+
+ private:
+ app_control_h app_control_;
+};
+
+} // action
+
+#endif // ACTION_EXECUTOR_APP_CONTROL_SENDER_HH_
--- /dev/null
+/*
+ * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+#ifndef COMMON_ACTION_EXECUTOR_HH_
+#define COMMON_ACTION_EXECUTOR_HH_
+
+#include "common/action_model.h"
+
+namespace common {
+
+class IActionExecutor {
+ public:
+ virtual ~IActionExecutor() = default;
+ virtual int Execute(const ActionModel& model) = 0;
+};
+
+} // namespace common
+
+#endif // COMMON_ACTION_EXECUTOR_HH_