AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} ACTION_FW_TOOL_SRCS)
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/tools TOOLS_SRCS)
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../.. ACTION_FW_SERVICE_PROXY_SRCS)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/api/ ACTION_FW_SERVICE_PROXY_SRCS)
ADD_EXECUTABLE(${TARGET_ACTION_FW_TOOL}
${ACTION_FW_TOOL_SRCS}
TARGET_INCLUDE_DIRECTORIES(${TARGET_ACTION_FW_TOOL} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/
- ${CMAKE_CURRENT_SOURCE_DIR}/../../
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/api/
)
INSTALL(TARGETS ${TARGET_ACTION_FW_TOOL} DESTINATION bin)
--- /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_fw_tool.hh"
+#include "log_private.hh"
+
+#include <utility>
+
+#include "tizen_action_service_proxy.h"
+
+namespace action_fw_tool {
+
+constexpr const char kStubAppId[] = "org.tizen.action-framework.service";
+
+class Execute : public ActionFwTool,
+ rpc_port::tizen_action_service_proxy::proxy::ActionService::
+ IEventListener {
+ public:
+ Execute()
+ : ActionFwTool("execute", "Execute", "execute <launch_request(string)>"),
+ proxy_(this, kStubAppId) {}
+
+ virtual ~Execute() {}
+
+ void SetUp() override {
+ try {
+ proxy_.Connect(true);
+ connected = true;
+ } catch (
+ const rpc_port::tizen_action_service_proxy::proxy::InvalidIDException&
+ e) {
+ _E("InvalidIDException");
+ } catch (
+ const rpc_port::tizen_action_service_proxy::proxy::InvalidIOException&
+ e) {
+ _E("InvalidIOException");
+ } catch (const rpc_port::tizen_action_service_proxy::proxy::
+ PermissionDeniedException& e) {
+ _E("PermissionDeniedException");
+ } catch (...) {
+ _E("Unknown exception");
+ }
+ }
+
+ void TearDown() override {
+ if (connected)
+ proxy_.Disconnect();
+ }
+
+ int Run(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ std::string launch_req = std::string(argv[2]);
+ try {
+ int ret = proxy_.Execute(std::move(launch_req));
+ return ret;
+ } catch (...) {
+ _E("Execute Failed");
+ return -1;
+ }
+ }
+
+ void OnConnected() override {
+ connected = true;
+ _W("connected");
+ }
+
+ void OnDisconnected() override {
+ connected = false;
+ _W("disconnected");
+ }
+
+ void OnRejected() override {
+ connected = false;
+ _W("Rejected");
+ }
+
+ private:
+ rpc_port::tizen_action_service_proxy::proxy::ActionService proxy_;
+ bool connected = false;
+};
+
+ACTION_FW_TOOL_REGISTER(Execute, execute);
+
+} // namespace action_fw_tool