Fix directory structure
authorSangyoon Jang <jeremy.jang@samsung.com>
Mon, 10 Feb 2025 02:02:45 +0000 (11:02 +0900)
committer장상윤/Tizen Platform Lab(SR)/삼성전자 <jeremy.jang@samsung.com>
Tue, 11 Feb 2025 05:44:32 +0000 (14:44 +0900)
changed to:

src/
├── action               # action framework
├── common               # common lib for action framework
├── pkgmgr_plugin_parser # pkgmgr parser plugin
└── service              # action service app

Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
41 files changed:
CMakeLists.txt
build.sh [deleted file]
src/CMakeLists.txt
src/action/CMakeLists.txt [new file with mode: 0644]
src/action/action_loader.hh [new file with mode: 0644]
src/action/action_request_handler.cc [new file with mode: 0644]
src/action/action_request_handler.h [new file with mode: 0644]
src/action/irequest_handler.h [new file with mode: 0644]
src/action/service.cc [new file with mode: 0644]
src/action/service.h [new file with mode: 0644]
src/action/sqlite_db.cc [new file with mode: 0644]
src/action/sqlite_db.hh [new file with mode: 0644]
src/action/utils/json_parser.cc [new file with mode: 0644]
src/action/utils/json_parser.h [new file with mode: 0644]
src/action/utils/logging.cc [new file with mode: 0644]
src/action/utils/logging.h [new file with mode: 0644]
src/action/utils/sqlite_db.cc [new file with mode: 0644]
src/action/utils/sqlite_db.h [new file with mode: 0644]
src/common/action_loader.hh [deleted file]
src/common/sqlite_db.cc [deleted file]
src/common/sqlite_db.hh [deleted file]
src/service/.exportMap [deleted file]
src/service/.project [deleted file]
src/service/CMakeLists.txt
src/service/build.sh [deleted file]
src/service/main.cc [new file with mode: 0644]
src/service/project_def.prop [deleted file]
src/service/src/CMakeLists.txt [deleted file]
src/service/src/action_request_handler.cc [deleted file]
src/service/src/action_request_handler.h [deleted file]
src/service/src/irequest_handler.h [deleted file]
src/service/src/main.cc [deleted file]
src/service/src/service.cc [deleted file]
src/service/src/service.h [deleted file]
src/service/src/utils/json_parser.cc [deleted file]
src/service/src/utils/json_parser.h [deleted file]
src/service/src/utils/logging.cc [deleted file]
src/service/src/utils/logging.h [deleted file]
src/service/src/utils/sqlite_db.cc [deleted file]
src/service/src/utils/sqlite_db.h [deleted file]
tidl/prebuild.sh

index 899a4f53ad5af021235b8a68c7c9a72d059d517d..9f48f288c8461c1e0f8a057bfcf310c1adeb78e4 100644 (file)
@@ -16,6 +16,7 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed,--gc-sections -pie")
 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
 
 ## Targets
+SET(TARGET_TIZEN_ACTION "tizen-action")
 SET(TARGET_TIZEN_ACTION_COMMON "tizen-action-common")
 SET(TARGET_TIZEN_ACTION_PLUGIN "tizen-action-plugin")
 SET(TARGET_TIZEN_ACTION_SERVICE "tizen-action-service")
diff --git a/build.sh b/build.sh
deleted file mode 100755 (executable)
index 6cbda95..0000000
--- a/build.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-
-# generate tidl code
-/bin/bash tidl/prebuild.sh
-
-# build service app
-cd src/service
-/bin/bash build.sh
index 43862433ac92e6c28eeaaf3565176b251ccf0aa2..8bf8dd912e1a7e6ee225c41c10b8191fb012c7ab 100644 (file)
@@ -1,3 +1,4 @@
+ADD_SUBDIRECTORY(action)
 ADD_SUBDIRECTORY(common)
 ADD_SUBDIRECTORY(pkgmgr_plugin_parser)
 ADD_SUBDIRECTORY(service)
diff --git a/src/action/CMakeLists.txt b/src/action/CMakeLists.txt
new file mode 100644 (file)
index 0000000..3c4da74
--- /dev/null
@@ -0,0 +1,20 @@
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} ACTION_SRCS)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/utils ACTION_UTILS_SRCS)
+ADD_LIBRARY(${TARGET_TIZEN_ACTION} ${ACTION_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_MANAGER_DEPS
+  CAPI_APPFW_PACKAGE_MANAGER_DEPS
+  CAPI_APPFW_SERVICE_APPLICATION_DEPS
+  DLOG_DEPS
+  GLIB_DEPS
+  TIZEN_DATABASE_DEPS
+  RPC_PORT_DEPS
+)
+
+TARGET_LINK_LIBRARIES(${TARGET_TIZEN_ACTION} PRIVATE ${TARGET_TIZEN_ACTION_COMMON})
+
+INSTALL(TARGETS ${TARGET_TIZEN_ACTION} DESTINATION ${LIB_INSTALL_DIR})
diff --git a/src/action/action_loader.hh b/src/action/action_loader.hh
new file mode 100644 (file)
index 0000000..6dd4d66
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * 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_LOADER_HH_
+#define COMMON_ACTION_LOADER_HH_
+
+namespace common {
+
+class IActionLoader {
+ public:
+  virtual ~IActionLoader() = default;
+  virtual void ListActions() = 0;
+  virtual void GetAction(const std::string& name) = 0;
+};
+
+}  // namespace common
+
+#endif  // COMMON_ACTION_LOADER_HH_
diff --git a/src/action/action_request_handler.cc b/src/action/action_request_handler.cc
new file mode 100644 (file)
index 0000000..8d58d63
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2024 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 <string>
+
+#include "action_request_handler.h"
+#include "service.h"
+
+#include "action/sqlite_db.hh"
+
+namespace service {
+
+ActionRequestHandler::ActionRequestHandler() {
+}
+
+ActionRequestHandler::~ActionRequestHandler() {
+}
+
+void ActionRequestHandler::Init() {
+  service_.Listen(std::make_shared<service::Service::Factory>(*this));
+}
+
+void ActionRequestHandler::OnListActions() {
+  // TODO: db as member variable?
+  auto db = std::make_unique<common::SqliteDb>();
+  db->ListActions();
+}
+
+void ActionRequestHandler::OnGetAction(std::string id) {
+  auto db = std::make_unique<common::SqliteDb>();
+  db->GetAction(id);
+}
+
+void ActionRequestHandler::OnGetActionId(std::string user_description, int top_k,
+    float search_threshold) {
+}
+
+void ActionRequestHandler::OnExecute(std::string launch_req) {
+
+}
+
+}  // namespace service
diff --git a/src/action/action_request_handler.h b/src/action/action_request_handler.h
new file mode 100644 (file)
index 0000000..dfbdd25
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2024 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 SRC_ACTION_MANAGER_H_
+#define SRC_ACTION_MANAGER_H_
+
+#include <vector>
+
+#include "irequest_handler.h"
+#include "tizen_action_service_stub.h"
+
+using Action = rpc_port::tizen_action_service_stub::Action;
+
+namespace service {
+
+class ActionRequestHandler : public IRequestHandler {
+ public:
+  ActionRequestHandler();
+  ~ActionRequestHandler();
+  void Init();
+
+  void OnListActions() override;
+  void OnGetAction(std::string id) override;
+  void OnGetActionId(std::string user_description, int top_k,
+      float search_threshold) override;
+  void OnExecute(std::string request) override;
+
+ private:
+  rpc_port::tizen_action_service_stub::stub::ActionService service_;
+};
+
+}  // namespace service
+
+#endif  // SRC_ACTION_MANAGER_H_
diff --git a/src/action/irequest_handler.h b/src/action/irequest_handler.h
new file mode 100644 (file)
index 0000000..57ca85d
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2024 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 SRC_IREQUEST_HANDLER_H_
+#define SRC_IREQUEST_HANDLER_H_
+
+#include <string>
+
+namespace service {
+
+class IRequestHandler {
+ public:
+  virtual ~IRequestHandler() = default;
+  virtual void OnListActions() = 0;
+  virtual void OnGetAction(std::string id) = 0;
+  virtual void OnGetActionId(std::string user_description, int top_k,
+      float search_threshold) = 0;
+  virtual void OnExecute(std::string launch_req) = 0;
+};
+
+}  // namespace service
+
+#endif  // SRC_IREQUEST_HANDLER_H_
diff --git a/src/action/service.cc b/src/action/service.cc
new file mode 100644 (file)
index 0000000..337fac2
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2024 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 "irequest_handler.h"
+#include "service.h"
+#include "utils/logging.h"
+
+#include "utils/sqlite_db.h"
+#include "utils/json_parser.h"
+
+namespace service {
+
+Service::Service(std::string sender, std::string instance,
+    IRequestHandler& handler)
+    : rs::stub::ActionService::ServiceBase(std::move(sender),
+          std::move(instance)), handler_(handler) {
+}
+
+Service::~Service() {
+}
+
+std::vector<rs::Action> Service::ListActions() {
+  // return list of actions from db
+  // handler_->ListActions();
+  return {};
+}
+
+rs::Action Service::GetAction(std::string action_id) {
+  // return action by id
+  // handler_->GetAction(action_id);
+  LOG(DEBUG) << "GetAction : " << action_id;
+
+  std::string result;
+  utils::SqliteDb sqlite_db;
+
+  sqlite_db.Select(action_id, result);
+
+  LOG(DEBUG) << "GetAction result : " << result;
+
+  auto ps = new utils::JsonParser(result);
+
+  auto params = ps->GetParameters();
+
+  rs::Action action;
+  std::vector<rs::Parameter> actionparams;
+
+  action.Setapp_id(ps->GetAppId());
+  action.Setaction_id(ps->GetName());
+  action.Setlabel(ps->GetName());
+  action.Setdescription(ps->GetDescription());
+
+  for (auto const& iter : params) {
+    auto param_value = iter.second;
+
+    auto param = rs::Parameter(iter.first, param_value["type"], param_value["desc"],
+                              param_value["isMandatory"].compare("true") == 0 ? true : false);
+
+    actionparams.push_back(param);
+  }
+
+  action.Setparameters(actionparams);
+
+  LOG(DEBUG) << "appid : " << action.Getapp_id();
+  LOG(DEBUG) << "actionid : " << action.Getaction_id();
+
+  // return {};
+  return action;
+}
+
+std::vector<rs::VectorDbResult> Service::GetActionId(
+    std::string user_description, int top_k, float search_threshold) {
+  // return result from db
+  // handler_->GetActionId(user_description, top_k, search_threshold);
+  return {};
+}
+
+int Service::Execute(std::string launch_req) {
+  // return action exetution result
+  // handler_->Execute(std::move(launch_req));
+  return 0;
+}
+
+}  // namespace service
diff --git a/src/action/service.h b/src/action/service.h
new file mode 100644 (file)
index 0000000..a6aec8c
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2024 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 SRC_SERVICE_H_
+#define SRC_SERVICE_H_
+
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "irequest_handler.h"
+#include "tizen_action_service_stub.h"
+
+namespace service {
+
+namespace rs = rpc_port::tizen_action_service_stub;
+
+class Service : public rs::stub::ActionService::ServiceBase {
+ public:
+  class Factory : public rs::stub::ActionService::ServiceBase::Factory {
+   public:
+    Factory(IRequestHandler& handler) : handler_(handler) {}
+    virtual ~Factory() = default;
+    std::unique_ptr<rs::stub::ActionService::ServiceBase> CreateService(
+        std::string sender, std::string instance) override {
+      return std::make_unique<Service>(sender, instance, handler_);
+    }
+
+   private:
+    IRequestHandler& handler_;
+  };
+
+  Service(std::string sender, std::string instance, IRequestHandler& handler);
+  ~Service();
+
+  void OnCreate() override {}
+  void OnTerminate() override {}
+  std::vector<rs::Action> ListActions() override;
+  rs::Action GetAction(std::string action_id) override;
+  std::vector<rs::VectorDbResult> GetActionId(std::string user_description,
+      int top_k, float search_threshold) override;
+  int Execute(std::string launch_req) override;
+
+ private:
+  IRequestHandler& handler_;
+};
+
+}  // namespace service
+
+#endif  // SRC_SERVICE_H_
diff --git a/src/action/sqlite_db.cc b/src/action/sqlite_db.cc
new file mode 100644 (file)
index 0000000..5ff3ac1
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * 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/sqlite_db.hh"
+
+#include <database.hpp>
+
+#include "common/utils/logging.hh"
+
+namespace {
+
+constexpr char kDbPath[] = "/opt/dbspace/.tizen_action.db";
+constexpr char kGetActionQuery[] =
+    "SELECT pkgid, action_name, json_str FROM action WHERE name = ?";
+constexpr char kListActionQuery[] =
+    "SELECT json_str FROM action;";
+
+}  // namespace
+
+namespace common {
+
+// TODO: check smack label of db file
+SqliteDb::SqliteDb() : conn_(kDbPath, SQLITE_OPEN_READONLY) {
+}
+
+void SqliteDb::ListActions() {
+  // TODO
+  Select();
+}
+
+void SqliteDb::GetAction(const std::string& name) {
+  // TODO
+  Select(name);
+}
+
+void SqliteDb::Select(const std::string& name) {
+  auto q = std::move(tizen_base::Database::Sql(kGetActionQuery)
+      .Bind(name));
+  auto r = conn_.Exec(q);
+  if (!static_cast<bool>(r)) {
+    LOG(ERROR) << "Failed to execute select query: "
+        << static_cast<const char*>(r);
+    return;
+  }
+
+  auto rec = r.GetFirstRecord();
+  if (!rec) {
+    LOG(ERROR) << "No record found";
+    return;
+  }
+
+  auto [pkgid, action_name, json_str] =
+      (*rec).Get<tizen_base::_, tizen_base::_, tizen_base::_>();
+  LOG(DEBUG) << "pkgid: " << static_cast<std::string>(pkgid)
+      << ", name: " << static_cast<std::string>(action_name)
+      << ", json_str: " << static_cast<std::string>(json_str);
+}
+
+void SqliteDb::Select() {
+  auto q = tizen_base::Database::Sql(kListActionQuery);
+  auto r = conn_.Exec(q);
+  if (!static_cast<bool>(r)) {
+    LOG(ERROR) << "Failed to execute select query: "
+        << static_cast<const char*>(r);
+    return;
+  }
+
+  for (const auto& i : r) {
+    auto [pkgid, action_name, json_str] =
+        i.Get<tizen_base::_, tizen_base::_, tizen_base::_>();
+    LOG(DEBUG) << "pkgid: " << static_cast<std::string>(pkgid)
+        << ", name: " << static_cast<std::string>(action_name)
+        << ", json_str: " << static_cast<std::string>(json_str);
+  }
+}
+
+}  // namespace common
diff --git a/src/action/sqlite_db.hh b/src/action/sqlite_db.hh
new file mode 100644 (file)
index 0000000..49055d1
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * 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_SQLITE_DB_HH_
+#define COMMON_SQLITE_DB_HH_
+
+#include <database.hpp>
+
+#include <string>
+
+#include "action/action_loader.hh"
+
+namespace common {
+
+class SqliteDb : public IActionLoader {
+ public:
+  SqliteDb();
+  ~SqliteDb() = default;
+
+  void ListActions() override;
+  void GetAction(const std::string& name) override;
+
+  void Select();
+  void Select(const std::string& name);
+
+ private:
+  tizen_base::Database conn_;
+};
+
+}  // namespace common
+
+#endif  // COMMON_SQLITE_DB_HH_
\ No newline at end of file
diff --git a/src/action/utils/json_parser.cc b/src/action/utils/json_parser.cc
new file mode 100644 (file)
index 0000000..3cf1393
--- /dev/null
@@ -0,0 +1,150 @@
+/*
+ * 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 <stdexcept>
+
+#include "json_parser.h"
+
+#include "logging.h"
+
+namespace utils {
+
+JsonParser::JsonParser(std::string json_str)
+    : json_str_(json_str) {
+  LOG(DEBUG) << "ParseStr const";
+  
+  std::size_t pos = 0;
+  std::size_t lpos = 0;
+  std::string params;
+
+  // remove {}
+  pos = json_str_.find("{");
+  lpos = json_str_.rfind("}");
+  json_str_ = json_str_.substr(pos + 1, lpos - pos - 1);
+
+  // seperate params
+  pos = json_str_.find("{");
+  lpos = json_str_.rfind("}");
+  params = json_str_.substr(pos + 1, lpos - pos - 1);
+  json_str_.replace(pos + 1, lpos - pos - 1, " ");
+
+  // make nodes
+  while(true) {
+    pos = json_str_.find(",");
+
+    if (pos == std::string::npos)
+      break;
+    
+    std::string sub_ = json_str_.substr(0, pos);
+    std::size_t spos = sub_.find(":");
+    std::string key = sub_.substr(1, spos - 2);
+    sub_ = sub_.substr(spos + 1);
+    std::string value = sub_.substr(1, sub_.length() - 2);
+
+    nodes_[key] = value;
+
+    // LOG(DEBUG) << key << " : " << value;
+
+    json_str_ = json_str_.substr(pos + 1);
+  }
+
+//   LOG(DEBUG) << params;
+
+  std::size_t compos = 0;
+
+  // make params
+  while(true) {
+    pos = params.find("{");
+    lpos = params.find("}");
+
+    std::string key = params.substr(1, pos - 3);
+    std::string value = params.substr(pos + 1, lpos - pos - 1);
+
+    // LOG(DEBUG) << key << " : " << value;
+
+
+    std::size_t subpos = 0;
+    std::size_t nextpos = 0;
+    std::size_t compos_ = 0;
+    std::map<std::string, std::string> mvalue;
+
+    // make param value
+    while(true) {
+    //   LOG(DEBUG) << value;
+
+      subpos = value.find("\"");
+      nextpos = value.find("\"", subpos + 1);
+
+      std::string subkey = value.substr(1, nextpos - 1);
+
+      subpos = value.find("\"", nextpos + 1);
+      nextpos = value.find("\"", subpos + 1);
+
+      std::string subval = value.substr(subpos + 1, nextpos - subpos - 1);
+
+      mvalue[subkey] = subval;
+
+      compos_ = value.find(",", nextpos);
+      if (compos_ == std::string::npos)
+        break;
+
+      value = value.substr(compos_ + 1);
+    }
+    params_[key] = mvalue;
+
+    compos = params.find(",", lpos);
+    if (compos == std::string::npos)
+      break;
+
+    params = params.substr(lpos + 2);
+  }
+
+  LOG(DEBUG) << "ParseStr const end";
+}
+
+std::string JsonParser::GetAppId() {
+  return nodes_["appId"];
+}
+
+std::string JsonParser::GetName() {
+  return nodes_["name"];
+}
+
+std::string JsonParser::GetDescription() {
+  return nodes_["desc"];
+}
+
+std::string JsonParser::GetType() {
+  return nodes_["type"];
+}
+
+std::string JsonParser::GetVersion() {
+  return nodes_["version"];
+}
+
+std::string JsonParser::GetRequiredPrivilege() {
+  return nodes_["required-privileges"];
+}
+
+std::string JsonParser::GetReturns() {
+  return nodes_["required-privileges"];
+}
+
+std::map<std::string, std::map<std::string, std::string>> JsonParser::GetParameters() {
+  return params_;
+}
+
+}  // namespace utils
diff --git a/src/action/utils/json_parser.h b/src/action/utils/json_parser.h
new file mode 100644 (file)
index 0000000..10666fa
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * 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 JSON_PARSER_H_
+#define JSON_PARSER_H_
+
+// #include <json/json.h>
+
+#include <string>
+#include <map>
+
+namespace utils {
+
+/* temporary parser */
+/* need to be changed to use json */
+
+class JsonParser {
+ public:
+  JsonParser(std::string json_str);
+  ~JsonParser() = default;
+
+  std::string GetAppId();
+  std::string GetName();
+  std::string GetDescription();
+  std::string GetType();
+  std::string GetVersion();
+  std::string GetRequiredPrivilege();
+  std::string GetReturns();
+  std::map<std::string, std::map<std::string, std::string>> GetParameters();
+
+ private:
+  std::string json_str_;
+  std::map<std::string, std::string> nodes_;
+  std::map<std::string, std::map<std::string, std::string>> params_;
+};
+
+}  // namespace utils
+
+#endif  // 
diff --git a/src/action/utils/logging.cc b/src/action/utils/logging.cc
new file mode 100644 (file)
index 0000000..34d603d
--- /dev/null
@@ -0,0 +1,24 @@
+// Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#include "action/utils/logging.h"
+
+namespace utils {
+
+log_priority LogLevelToPriority(LogLevel level) {
+  switch (level) {
+    case LogLevel::LOG_ERROR:
+      return log_priority::DLOG_ERROR;
+    case LogLevel::LOG_WARNING:
+      return log_priority::DLOG_WARN;
+    case LogLevel::LOG_INFO:
+      return log_priority::DLOG_INFO;
+    case LogLevel::LOG_DEBUG:
+      return log_priority::DLOG_DEBUG;
+    default:
+      return log_priority::DLOG_UNKNOWN;
+  }
+}
+
+}  // namespace utils
diff --git a/src/action/utils/logging.h b/src/action/utils/logging.h
new file mode 100644 (file)
index 0000000..8dc1d72
--- /dev/null
@@ -0,0 +1,102 @@
+// Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef LOGGING_HH_
+#define LOGGING_HH_
+
+#include <dlog.h>
+
+#ifndef PROJECT_TAG
+#define PROJECT_TAG "TAF"
+#endif
+
+#ifdef LOG
+#undef LOG
+#endif
+
+#include <cassert>
+#include <cstring>
+#include <iomanip>
+#include <iostream>
+#include <sstream>
+#include <string>
+
+#ifndef __FILENAME__
+#define __FILENAME__                                                           \
+    (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
+#endif
+
+namespace utils {
+
+enum class LogLevel {
+  LOG_ERROR,
+  LOG_WARNING,
+  LOG_INFO,
+  LOG_DEBUG,
+};
+
+log_priority LogLevelToPriority(LogLevel level);
+
+template <class charT, class traits = std::char_traits<charT>>
+class StringStream : private std::basic_ostringstream<charT, traits> {
+ public:
+  using std::basic_ostringstream<charT, traits>::str;
+
+  template <class T>
+  StringStream&  operator<<(const T& value) {
+    static_cast<std::basic_ostringstream<charT, traits> &>(*this) << value;
+    return *this;
+  }
+};
+
+class LogCatcher {
+ public:
+  LogCatcher(LogLevel level, const char* tag)
+    : level_(level), tag_(tag) { }
+
+  void operator&(const StringStream<char>& str) const {
+    dlog_print(LogLevelToPriority(level_), tag_.c_str(), "%s",
+        Escape(str.str()).c_str());
+  }
+
+ private:
+  // Since LogCatcher passes input to dlog_print(), the input which contains
+  // format string(such as %d, %n) can cause unexpected result.
+  // This is simple function to escape '%'.
+  // NOTE: Is there any gorgeous way instead of this?
+  std::string Escape(const std::string& str) const {
+    std::string escaped = std::string(str);
+    size_t start_pos = 0;
+    std::string from = "%";
+    std::string to = "%%";
+    while ((start_pos = escaped.find(from, start_pos)) != std::string::npos) {
+      escaped.replace(start_pos, from.length(), to);
+      start_pos += to.length();
+    }
+    return escaped;
+  }
+  LogLevel level_;
+  std::string tag_;
+};
+
+}  // namespace utils
+
+inline static const constexpr char* __tag_for_project() {
+  return PROJECT_TAG;
+}
+
+// Simple logging macro of following usage:
+//   LOG(LEVEL) << object_1 << object_2 << object_n;
+//     where:
+//       LEVEL = ERROR | WARNING | INFO | DEBUG
+#define LOG(LEVEL)                                                             \
+    ::utils::LogCatcher(                                                       \
+      ::utils::LogLevel::LOG_ ## LEVEL, __tag_for_project())                   \
+      & ::utils::StringStream<char>()                                          \
+      << std::setw(50) << std::right                                           \
+      << (std::string(__FILENAME__) + ": " + std::string(__FUNCTION__) + "(" + \
+          std::to_string(__LINE__) + ")").c_str()                              \
+      << std::setw(0) << " : "                                                 \
+
+#endif  // LOGGING_HH_
diff --git a/src/action/utils/sqlite_db.cc b/src/action/utils/sqlite_db.cc
new file mode 100644 (file)
index 0000000..3de6d9a
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * 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 "sqlite_db.h"
+
+#include "logging.h"
+
+namespace {
+
+constexpr char kDbPath[] = "/opt/dbspace/.tizen_action.db";
+constexpr char kSelectQuery[] =
+    "SELECT json_str FROM action WHERE action_name = ?";
+
+}  // namespace
+
+namespace utils {
+
+bool SqliteDb::Select(std::string action_id, std::string& result) {
+  LOG(DEBUG) << "select : " << action_id;
+
+  int ret;
+  char *val;
+  sqlite3 *db;
+  sqlite3_stmt *stmt = nullptr;
+
+       ret = sqlite3_open_v2(kDbPath, &db, SQLITE_OPEN_READONLY, nullptr);
+       if (ret != SQLITE_OK) {
+    LOG(ERROR) << "failed to open db : " << kDbPath << " , : " << ret;
+               return false;
+       }
+
+  ret = sqlite3_prepare_v2(db, kSelectQuery, strlen(kSelectQuery), &stmt, nullptr);
+       if (ret != SQLITE_OK) {
+               LOG(ERROR) << "failed to prepare : " << ret;
+    return false;
+       }
+
+  sqlite3_bind_text(stmt, 1, action_id.c_str(), -1, SQLITE_STATIC);
+
+  ret = sqlite3_step(stmt);
+  if (ret != SQLITE_ROW) {
+    LOG(ERROR) << "failed to step : " << sqlite3_errmsg(db);
+    return false;
+  }
+
+       val = (char *)sqlite3_column_text(stmt, 0);
+  LOG(DEBUG) << "result : " << val;
+
+  result = val;
+
+  sqlite3_finalize(stmt);
+       sqlite3_close_v2(db);
+
+  return true;
+}
+
+}  // namespace utils
diff --git a/src/action/utils/sqlite_db.h b/src/action/utils/sqlite_db.h
new file mode 100644 (file)
index 0000000..cd67502
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * 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 SQLITE_DB_H_
+#define SQLITE_DB_H_
+
+// #include <database.hpp>
+#include <sqlite3.h>
+
+#include <string>
+
+/* need to be changed to use cpp tizen-database */
+/* neec to be changed smack label for .tizen_action.db */
+
+namespace utils {
+
+class SqliteDb {
+ public:
+  SqliteDb() = default;
+  ~SqliteDb() = default;
+
+  bool Select(std::string action_id, std::string& result);
+
+};
+
+}  // namespace utils
+
+#endif  // SQLITE_DB_H_
\ No newline at end of file
diff --git a/src/common/action_loader.hh b/src/common/action_loader.hh
deleted file mode 100644 (file)
index 6dd4d66..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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_LOADER_HH_
-#define COMMON_ACTION_LOADER_HH_
-
-namespace common {
-
-class IActionLoader {
- public:
-  virtual ~IActionLoader() = default;
-  virtual void ListActions() = 0;
-  virtual void GetAction(const std::string& name) = 0;
-};
-
-}  // namespace common
-
-#endif  // COMMON_ACTION_LOADER_HH_
diff --git a/src/common/sqlite_db.cc b/src/common/sqlite_db.cc
deleted file mode 100644 (file)
index 5ba070e..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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 "common/sqlite_db.hh"
-
-#include <database.hpp>
-
-#include "common/utils/logging.hh"
-
-namespace {
-
-constexpr char kDbPath[] = "/opt/dbspace/.tizen_action.db";
-constexpr char kGetActionQuery[] =
-    "SELECT pkgid, action_name, json_str FROM action WHERE name = ?";
-constexpr char kListActionQuery[] =
-    "SELECT json_str FROM action;";
-
-}  // namespace
-
-namespace common {
-
-// TODO: check smack label of db file
-SqliteDb::SqliteDb() : conn_(kDbPath, SQLITE_OPEN_READONLY) {
-}
-
-void SqliteDb::ListActions() {
-  // TODO
-  Select();
-}
-
-void SqliteDb::GetAction(const std::string& name) {
-  // TODO
-  Select(name);
-}
-
-void SqliteDb::Select(const std::string& name) {
-  auto q = std::move(tizen_base::Database::Sql(kGetActionQuery)
-      .Bind(name));
-  auto r = conn_.Exec(q);
-  if (!static_cast<bool>(r)) {
-    LOG(ERROR) << "Failed to execute select query: "
-        << static_cast<const char*>(r);
-    return;
-  }
-
-  auto rec = r.GetFirstRecord();
-  if (!rec) {
-    LOG(ERROR) << "No record found";
-    return;
-  }
-
-  auto [pkgid, action_name, json_str] =
-      (*rec).Get<tizen_base::_, tizen_base::_, tizen_base::_>();
-  LOG(DEBUG) << "pkgid: " << static_cast<std::string>(pkgid)
-      << ", name: " << static_cast<std::string>(action_name)
-      << ", json_str: " << static_cast<std::string>(json_str);
-}
-
-void SqliteDb::Select() {
-  auto q = tizen_base::Database::Sql(kListActionQuery);
-  auto r = conn_.Exec(q);
-  if (!static_cast<bool>(r)) {
-    LOG(ERROR) << "Failed to execute select query: "
-        << static_cast<const char*>(r);
-    return;
-  }
-
-  for (const auto& i : r) {
-    auto [pkgid, action_name, json_str] =
-        i.Get<tizen_base::_, tizen_base::_, tizen_base::_>();
-    LOG(DEBUG) << "pkgid: " << static_cast<std::string>(pkgid)
-        << ", name: " << static_cast<std::string>(action_name)
-        << ", json_str: " << static_cast<std::string>(json_str);
-  }
-}
-
-}  // namespace common
diff --git a/src/common/sqlite_db.hh b/src/common/sqlite_db.hh
deleted file mode 100644 (file)
index fa371b0..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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_SQLITE_DB_HH_
-#define COMMON_SQLITE_DB_HH_
-
-#include <database.hpp>
-
-#include <string>
-
-#include "common/action_loader.hh"
-
-namespace common {
-
-class SqliteDb : public IActionLoader {
- public:
-  SqliteDb();
-  ~SqliteDb() = default;
-
-  void ListActions() override;
-  void GetAction(const std::string& name) override;
-
-  void Select();
-  void Select(const std::string& name);
-
- private:
-  tizen_base::Database conn_;
-};
-
-}  // namespace common
-
-#endif  // COMMON_SQLITE_DB_HH_
\ No newline at end of file
diff --git a/src/service/.exportMap b/src/service/.exportMap
deleted file mode 100644 (file)
index 41d666c..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-       global: main; _IO_*;
-       local: *;
-};
-
diff --git a/src/service/.project b/src/service/.project
deleted file mode 100644 (file)
index 1c699b4..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-       <name>TizenActionFrameworkService</name>
-       <comment></comment>
-       <projects>
-       </projects>
-       <buildSpec>
-               <buildCommand>
-                       <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
-                       <arguments>
-                               <dictionary>
-                                       <key>?name?</key>
-                                       <value></value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.append_environment</key>
-                                       <value>true</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.autoBuildTarget</key>
-                                       <value>all</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.buildArguments</key>
-                                       <value></value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.buildCommand</key>
-                                       <value>sbi-make</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.buildLocation</key>
-                                       <value>${workspace_loc:/TizenActionFrameworkService/Debug}</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
-                                       <value>clean</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.contents</key>
-                                       <value>org.eclipse.cdt.make.core.activeConfigSettings</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
-                                       <value>true</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
-                                       <value>true</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.enableFullBuild</key>
-                                       <value>true</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.fullBuildTarget</key>
-                                       <value>all</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.stopOnError</key>
-                                       <value>true</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
-                                       <value>true</value>
-                               </dictionary>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
-                       <triggers>full,incremental,</triggers>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-       </buildSpec>
-       <natures>
-               <nature>org.eclipse.cdt.core.cnature</nature>
-               <nature>org.eclipse.cdt.core.ccnature</nature>
-               <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
-               <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
-       </natures>
-       <filteredResources>
-               <filter>
-                       <id>1360216703005</id>
-                       <name></name>
-                       <type>26</type>
-                       <matcher>
-                               <id>org.eclipse.ui.ide.multiFilter</id>
-                               <arguments>1.0-projectRelativePath-matches-false-false-*/.tpk</arguments>
-                       </matcher>
-               </filter>
-       </filteredResources>
-</projectDescription>
-
index 4b7537b554d723abc731b10f483f955a82e47103..2a607707f4012acecef50c34f6dc81aee0a7478b 100644 (file)
@@ -1 +1,23 @@
-ADD_SUBDIRECTORY(src)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} MAIN_SRCS)
+ADD_EXECUTABLE(${TARGET_TIZEN_ACTION_SERVICE} ${MAIN_SRCS})
+
+TARGET_INCLUDE_DIRECTORIES(${TARGET_TIZEN_ACTION_SERVICE} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../)
+
+APPLY_PKG_CONFIG(${TARGET_TIZEN_ACTION_SERVICE} PUBLIC
+  CAPI_APPFW_APP_COMMON_DEPS
+  CAPI_APPFW_APP_MANAGER_DEPS
+  CAPI_APPFW_PACKAGE_MANAGER_DEPS
+  CAPI_APPFW_SERVICE_APPLICATION_DEPS
+  DLOG_DEPS
+  GLIB_DEPS
+  TIZEN_DATABASE_DEPS
+  RPC_PORT_DEPS
+)
+
+TARGET_LINK_LIBRARIES(${TARGET_TIZEN_ACTION_SERVICE} PRIVATE ${TARGET_TIZEN_ACTION} ${TARGET_TIZEN_ACTION_COMMON})
+
+SET(MANIFESTDIR "${PREFIX}/share/packages")
+
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/tizen-manifest.xml DESTINATION ${MANIFESTDIR} RENAME ${SERVICE_PKGID}.xml)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/tizen-manifest.xml DESTINATION ${PREFIX}/apps/${SERVICE_PKGID})
+INSTALL(TARGETS ${TARGET_TIZEN_ACTION_SERVICE} DESTINATION ${PREFIX}/apps/${SERVICE_PKGID}/bin/)
diff --git a/src/service/build.sh b/src/service/build.sh
deleted file mode 100755 (executable)
index f909c5b..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-tizen build-native -C Debug -a x86_64 -c gcc && tizen package -t tpk -- ./Debug
diff --git a/src/service/main.cc b/src/service/main.cc
new file mode 100644 (file)
index 0000000..ade44ad
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2024 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 <tizen.h>
+#include <service_app.h>
+
+#include <memory>
+
+#include "action/action_request_handler.h"
+#include "common/utils/logging.hh"
+
+namespace {
+
+bool ServiceAppCreate(void* data) {
+  return true;
+}
+
+void ServiceAppTerminate(void* data) {
+  return;
+}
+
+void ServiceAppControl(app_control_h app_control, void* data) {
+  return;
+}
+
+void ServiceAppLangChanged(app_event_info_h event_info, void* user_data) {
+       /*APP_EVENT_LANGUAGE_CHANGED*/
+       return;
+}
+
+void ServiceAppRegionChanged(app_event_info_h event_info, void* user_data) {
+       /*APP_EVENT_REGION_FORMAT_CHANGED*/
+}
+
+void ServiceAppLowBattery(app_event_info_h event_info, void* user_data) {
+       /*APP_EVENT_LOW_BATTERY*/
+}
+
+void ServiceAppLowMemory(app_event_info_h event_info, void* user_data) {
+       /*APP_EVENT_LOW_MEMORY*/
+}
+
+}  // namespace
+
+int main(int argc, char* argv[]) {
+       service_app_lifecycle_callback_s event_callback;
+       app_event_handler_h handlers[5] = { nullptr, };
+
+       event_callback.create = ServiceAppCreate;
+       event_callback.terminate = ServiceAppTerminate;
+       event_callback.app_control = ServiceAppControl;
+
+       service_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY],
+      APP_EVENT_LOW_BATTERY, ServiceAppLowBattery, nullptr);
+       service_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY],
+      APP_EVENT_LOW_MEMORY, ServiceAppLowMemory, nullptr);
+       service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED],
+      APP_EVENT_LANGUAGE_CHANGED, ServiceAppLangChanged, nullptr);
+       service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED],
+      APP_EVENT_REGION_FORMAT_CHANGED, ServiceAppRegionChanged, nullptr);
+
+  service::ActionRequestHandler manager;
+  manager.Init();
+
+  LOG(DEBUG) << "service_app_main start...";
+
+       return service_app_main(argc, argv, &event_callback, nullptr);
+}
diff --git a/src/service/project_def.prop b/src/service/project_def.prop
deleted file mode 100644 (file)
index ec46e39..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-APPNAME = TizenActionFrameworkService
-type = app
-profile = tizen-9.0
-
-USER_SRCS = src/*.cc \
-    src/utils/*.cc
-
-USER_INC_DIRS = src
-
-USER_DEFS =
-USER_CPP_DEPS =
-
-USER_UNDEFS =
-USER_CPP_UNDEFS =
-
-USER_OBJS =
-
-USER_CPP_OPTS = -std=c++17
diff --git a/src/service/src/CMakeLists.txt b/src/service/src/CMakeLists.txt
deleted file mode 100644 (file)
index 22029ed..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SERVICE_SRCS)
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/utils SERVICE_UTILS_SRCS)
-ADD_EXECUTABLE(${TARGET_TIZEN_ACTION_SERVICE} ${SERVICE_SRCS} ${SERVICE_UTILS_SRCS})
-
-TARGET_INCLUDE_DIRECTORIES(${TARGET_TIZEN_ACTION_SERVICE} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../)
-
-APPLY_PKG_CONFIG(${TARGET_TIZEN_ACTION_SERVICE} PUBLIC
-  CAPI_APPFW_APP_COMMON_DEPS
-  CAPI_APPFW_APP_MANAGER_DEPS
-  CAPI_APPFW_PACKAGE_MANAGER_DEPS
-  CAPI_APPFW_SERVICE_APPLICATION_DEPS
-  DLOG_DEPS
-  GLIB_DEPS
-  TIZEN_DATABASE_DEPS
-  RPC_PORT_DEPS
-)
-
-TARGET_LINK_LIBRARIES(${TARGET_TIZEN_ACTION_SERVICE} PRIVATE ${TARGET_TIZEN_ACTION_COMMON})
-
-SET(MANIFESTDIR "${PREFIX}/share/packages")
-
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../tizen-manifest.xml DESTINATION ${MANIFESTDIR} RENAME ${SERVICE_PKGID}.xml)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../tizen-manifest.xml DESTINATION ${PREFIX}/apps/${SERVICE_PKGID})
-INSTALL(TARGETS ${TARGET_TIZEN_ACTION_SERVICE} DESTINATION ${PREFIX}/apps/${SERVICE_PKGID}/bin/)
-#INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res DESTINATION ${PREFIX}/apps/${SERVICE_PKGID})
-#INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/shared/res DESTINATION ${PREFIX}/apps/${SERVICE_PKGID}/shared)
diff --git a/src/service/src/action_request_handler.cc b/src/service/src/action_request_handler.cc
deleted file mode 100644 (file)
index 5b14d54..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2024 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 <string>
-
-#include "action_request_handler.h"
-#include "service.h"
-
-#include "common/sqlite_db.hh"
-
-namespace service {
-
-ActionRequestHandler::ActionRequestHandler() {
-}
-
-ActionRequestHandler::~ActionRequestHandler() {
-}
-
-void ActionRequestHandler::Init() {
-  service_.Listen(std::make_shared<service::Service::Factory>(*this));
-}
-
-void ActionRequestHandler::OnListActions() {
-  // TODO: db as member variable?
-  auto db = std::make_unique<common::SqliteDb>();
-  db->ListActions();
-}
-
-void ActionRequestHandler::OnGetAction(std::string id) {
-  auto db = std::make_unique<common::SqliteDb>();
-  db->GetAction(id);
-}
-
-void ActionRequestHandler::OnGetActionId(std::string user_description, int top_k,
-    float search_threshold) {
-}
-
-void ActionRequestHandler::OnExecute(std::string launch_req) {
-
-}
-
-}  // namespace service
diff --git a/src/service/src/action_request_handler.h b/src/service/src/action_request_handler.h
deleted file mode 100644 (file)
index dfbdd25..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2024 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 SRC_ACTION_MANAGER_H_
-#define SRC_ACTION_MANAGER_H_
-
-#include <vector>
-
-#include "irequest_handler.h"
-#include "tizen_action_service_stub.h"
-
-using Action = rpc_port::tizen_action_service_stub::Action;
-
-namespace service {
-
-class ActionRequestHandler : public IRequestHandler {
- public:
-  ActionRequestHandler();
-  ~ActionRequestHandler();
-  void Init();
-
-  void OnListActions() override;
-  void OnGetAction(std::string id) override;
-  void OnGetActionId(std::string user_description, int top_k,
-      float search_threshold) override;
-  void OnExecute(std::string request) override;
-
- private:
-  rpc_port::tizen_action_service_stub::stub::ActionService service_;
-};
-
-}  // namespace service
-
-#endif  // SRC_ACTION_MANAGER_H_
diff --git a/src/service/src/irequest_handler.h b/src/service/src/irequest_handler.h
deleted file mode 100644 (file)
index 57ca85d..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2024 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 SRC_IREQUEST_HANDLER_H_
-#define SRC_IREQUEST_HANDLER_H_
-
-#include <string>
-
-namespace service {
-
-class IRequestHandler {
- public:
-  virtual ~IRequestHandler() = default;
-  virtual void OnListActions() = 0;
-  virtual void OnGetAction(std::string id) = 0;
-  virtual void OnGetActionId(std::string user_description, int top_k,
-      float search_threshold) = 0;
-  virtual void OnExecute(std::string launch_req) = 0;
-};
-
-}  // namespace service
-
-#endif  // SRC_IREQUEST_HANDLER_H_
diff --git a/src/service/src/main.cc b/src/service/src/main.cc
deleted file mode 100644 (file)
index ea5f79b..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2024 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 <tizen.h>
-#include <service_app.h>
-
-#include <memory>
-
-#include "action_request_handler.h"
-#include "utils/logging.h"
-
-namespace {
-
-bool ServiceAppCreate(void* data) {
-  return true;
-}
-
-void ServiceAppTerminate(void* data) {
-  return;
-}
-
-void ServiceAppControl(app_control_h app_control, void* data) {
-  return;
-}
-
-void ServiceAppLangChanged(app_event_info_h event_info, void* user_data) {
-       /*APP_EVENT_LANGUAGE_CHANGED*/
-       return;
-}
-
-void ServiceAppRegionChanged(app_event_info_h event_info, void* user_data) {
-       /*APP_EVENT_REGION_FORMAT_CHANGED*/
-}
-
-void ServiceAppLowBattery(app_event_info_h event_info, void* user_data) {
-       /*APP_EVENT_LOW_BATTERY*/
-}
-
-void ServiceAppLowMemory(app_event_info_h event_info, void* user_data) {
-       /*APP_EVENT_LOW_MEMORY*/
-}
-
-}  // namespace
-
-int main(int argc, char* argv[]) {
-       service_app_lifecycle_callback_s event_callback;
-       app_event_handler_h handlers[5] = { nullptr, };
-
-       event_callback.create = ServiceAppCreate;
-       event_callback.terminate = ServiceAppTerminate;
-       event_callback.app_control = ServiceAppControl;
-
-       service_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY],
-      APP_EVENT_LOW_BATTERY, ServiceAppLowBattery, nullptr);
-       service_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY],
-      APP_EVENT_LOW_MEMORY, ServiceAppLowMemory, nullptr);
-       service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED],
-      APP_EVENT_LANGUAGE_CHANGED, ServiceAppLangChanged, nullptr);
-       service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED],
-      APP_EVENT_REGION_FORMAT_CHANGED, ServiceAppRegionChanged, nullptr);
-
-  service::ActionRequestHandler manager;
-  manager.Init();
-
-  LOG(DEBUG) << "service_app_main start...";
-
-       return service_app_main(argc, argv, &event_callback, nullptr);
-}
diff --git a/src/service/src/service.cc b/src/service/src/service.cc
deleted file mode 100644 (file)
index 337fac2..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2024 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 "irequest_handler.h"
-#include "service.h"
-#include "utils/logging.h"
-
-#include "utils/sqlite_db.h"
-#include "utils/json_parser.h"
-
-namespace service {
-
-Service::Service(std::string sender, std::string instance,
-    IRequestHandler& handler)
-    : rs::stub::ActionService::ServiceBase(std::move(sender),
-          std::move(instance)), handler_(handler) {
-}
-
-Service::~Service() {
-}
-
-std::vector<rs::Action> Service::ListActions() {
-  // return list of actions from db
-  // handler_->ListActions();
-  return {};
-}
-
-rs::Action Service::GetAction(std::string action_id) {
-  // return action by id
-  // handler_->GetAction(action_id);
-  LOG(DEBUG) << "GetAction : " << action_id;
-
-  std::string result;
-  utils::SqliteDb sqlite_db;
-
-  sqlite_db.Select(action_id, result);
-
-  LOG(DEBUG) << "GetAction result : " << result;
-
-  auto ps = new utils::JsonParser(result);
-
-  auto params = ps->GetParameters();
-
-  rs::Action action;
-  std::vector<rs::Parameter> actionparams;
-
-  action.Setapp_id(ps->GetAppId());
-  action.Setaction_id(ps->GetName());
-  action.Setlabel(ps->GetName());
-  action.Setdescription(ps->GetDescription());
-
-  for (auto const& iter : params) {
-    auto param_value = iter.second;
-
-    auto param = rs::Parameter(iter.first, param_value["type"], param_value["desc"],
-                              param_value["isMandatory"].compare("true") == 0 ? true : false);
-
-    actionparams.push_back(param);
-  }
-
-  action.Setparameters(actionparams);
-
-  LOG(DEBUG) << "appid : " << action.Getapp_id();
-  LOG(DEBUG) << "actionid : " << action.Getaction_id();
-
-  // return {};
-  return action;
-}
-
-std::vector<rs::VectorDbResult> Service::GetActionId(
-    std::string user_description, int top_k, float search_threshold) {
-  // return result from db
-  // handler_->GetActionId(user_description, top_k, search_threshold);
-  return {};
-}
-
-int Service::Execute(std::string launch_req) {
-  // return action exetution result
-  // handler_->Execute(std::move(launch_req));
-  return 0;
-}
-
-}  // namespace service
diff --git a/src/service/src/service.h b/src/service/src/service.h
deleted file mode 100644 (file)
index a6aec8c..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2024 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 SRC_SERVICE_H_
-#define SRC_SERVICE_H_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "irequest_handler.h"
-#include "tizen_action_service_stub.h"
-
-namespace service {
-
-namespace rs = rpc_port::tizen_action_service_stub;
-
-class Service : public rs::stub::ActionService::ServiceBase {
- public:
-  class Factory : public rs::stub::ActionService::ServiceBase::Factory {
-   public:
-    Factory(IRequestHandler& handler) : handler_(handler) {}
-    virtual ~Factory() = default;
-    std::unique_ptr<rs::stub::ActionService::ServiceBase> CreateService(
-        std::string sender, std::string instance) override {
-      return std::make_unique<Service>(sender, instance, handler_);
-    }
-
-   private:
-    IRequestHandler& handler_;
-  };
-
-  Service(std::string sender, std::string instance, IRequestHandler& handler);
-  ~Service();
-
-  void OnCreate() override {}
-  void OnTerminate() override {}
-  std::vector<rs::Action> ListActions() override;
-  rs::Action GetAction(std::string action_id) override;
-  std::vector<rs::VectorDbResult> GetActionId(std::string user_description,
-      int top_k, float search_threshold) override;
-  int Execute(std::string launch_req) override;
-
- private:
-  IRequestHandler& handler_;
-};
-
-}  // namespace service
-
-#endif  // SRC_SERVICE_H_
diff --git a/src/service/src/utils/json_parser.cc b/src/service/src/utils/json_parser.cc
deleted file mode 100644 (file)
index 3cf1393..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * 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 <stdexcept>
-
-#include "json_parser.h"
-
-#include "logging.h"
-
-namespace utils {
-
-JsonParser::JsonParser(std::string json_str)
-    : json_str_(json_str) {
-  LOG(DEBUG) << "ParseStr const";
-  
-  std::size_t pos = 0;
-  std::size_t lpos = 0;
-  std::string params;
-
-  // remove {}
-  pos = json_str_.find("{");
-  lpos = json_str_.rfind("}");
-  json_str_ = json_str_.substr(pos + 1, lpos - pos - 1);
-
-  // seperate params
-  pos = json_str_.find("{");
-  lpos = json_str_.rfind("}");
-  params = json_str_.substr(pos + 1, lpos - pos - 1);
-  json_str_.replace(pos + 1, lpos - pos - 1, " ");
-
-  // make nodes
-  while(true) {
-    pos = json_str_.find(",");
-
-    if (pos == std::string::npos)
-      break;
-    
-    std::string sub_ = json_str_.substr(0, pos);
-    std::size_t spos = sub_.find(":");
-    std::string key = sub_.substr(1, spos - 2);
-    sub_ = sub_.substr(spos + 1);
-    std::string value = sub_.substr(1, sub_.length() - 2);
-
-    nodes_[key] = value;
-
-    // LOG(DEBUG) << key << " : " << value;
-
-    json_str_ = json_str_.substr(pos + 1);
-  }
-
-//   LOG(DEBUG) << params;
-
-  std::size_t compos = 0;
-
-  // make params
-  while(true) {
-    pos = params.find("{");
-    lpos = params.find("}");
-
-    std::string key = params.substr(1, pos - 3);
-    std::string value = params.substr(pos + 1, lpos - pos - 1);
-
-    // LOG(DEBUG) << key << " : " << value;
-
-
-    std::size_t subpos = 0;
-    std::size_t nextpos = 0;
-    std::size_t compos_ = 0;
-    std::map<std::string, std::string> mvalue;
-
-    // make param value
-    while(true) {
-    //   LOG(DEBUG) << value;
-
-      subpos = value.find("\"");
-      nextpos = value.find("\"", subpos + 1);
-
-      std::string subkey = value.substr(1, nextpos - 1);
-
-      subpos = value.find("\"", nextpos + 1);
-      nextpos = value.find("\"", subpos + 1);
-
-      std::string subval = value.substr(subpos + 1, nextpos - subpos - 1);
-
-      mvalue[subkey] = subval;
-
-      compos_ = value.find(",", nextpos);
-      if (compos_ == std::string::npos)
-        break;
-
-      value = value.substr(compos_ + 1);
-    }
-    params_[key] = mvalue;
-
-    compos = params.find(",", lpos);
-    if (compos == std::string::npos)
-      break;
-
-    params = params.substr(lpos + 2);
-  }
-
-  LOG(DEBUG) << "ParseStr const end";
-}
-
-std::string JsonParser::GetAppId() {
-  return nodes_["appId"];
-}
-
-std::string JsonParser::GetName() {
-  return nodes_["name"];
-}
-
-std::string JsonParser::GetDescription() {
-  return nodes_["desc"];
-}
-
-std::string JsonParser::GetType() {
-  return nodes_["type"];
-}
-
-std::string JsonParser::GetVersion() {
-  return nodes_["version"];
-}
-
-std::string JsonParser::GetRequiredPrivilege() {
-  return nodes_["required-privileges"];
-}
-
-std::string JsonParser::GetReturns() {
-  return nodes_["required-privileges"];
-}
-
-std::map<std::string, std::map<std::string, std::string>> JsonParser::GetParameters() {
-  return params_;
-}
-
-}  // namespace utils
diff --git a/src/service/src/utils/json_parser.h b/src/service/src/utils/json_parser.h
deleted file mode 100644 (file)
index 10666fa..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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 JSON_PARSER_H_
-#define JSON_PARSER_H_
-
-// #include <json/json.h>
-
-#include <string>
-#include <map>
-
-namespace utils {
-
-/* temporary parser */
-/* need to be changed to use json */
-
-class JsonParser {
- public:
-  JsonParser(std::string json_str);
-  ~JsonParser() = default;
-
-  std::string GetAppId();
-  std::string GetName();
-  std::string GetDescription();
-  std::string GetType();
-  std::string GetVersion();
-  std::string GetRequiredPrivilege();
-  std::string GetReturns();
-  std::map<std::string, std::map<std::string, std::string>> GetParameters();
-
- private:
-  std::string json_str_;
-  std::map<std::string, std::string> nodes_;
-  std::map<std::string, std::map<std::string, std::string>> params_;
-};
-
-}  // namespace utils
-
-#endif  // 
diff --git a/src/service/src/utils/logging.cc b/src/service/src/utils/logging.cc
deleted file mode 100644 (file)
index 11f70d6..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by a apache 2.0 license that can be
-// found in the LICENSE file.
-
-#include "service/src/utils/logging.h"
-
-namespace utils {
-
-log_priority LogLevelToPriority(LogLevel level) {
-  switch (level) {
-    case LogLevel::LOG_ERROR:
-      return log_priority::DLOG_ERROR;
-    case LogLevel::LOG_WARNING:
-      return log_priority::DLOG_WARN;
-    case LogLevel::LOG_INFO:
-      return log_priority::DLOG_INFO;
-    case LogLevel::LOG_DEBUG:
-      return log_priority::DLOG_DEBUG;
-    default:
-      return log_priority::DLOG_UNKNOWN;
-  }
-}
-
-}  // namespace utils
diff --git a/src/service/src/utils/logging.h b/src/service/src/utils/logging.h
deleted file mode 100644 (file)
index 8dc1d72..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by a apache 2.0 license that can be
-// found in the LICENSE file.
-
-#ifndef LOGGING_HH_
-#define LOGGING_HH_
-
-#include <dlog.h>
-
-#ifndef PROJECT_TAG
-#define PROJECT_TAG "TAF"
-#endif
-
-#ifdef LOG
-#undef LOG
-#endif
-
-#include <cassert>
-#include <cstring>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <string>
-
-#ifndef __FILENAME__
-#define __FILENAME__                                                           \
-    (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
-#endif
-
-namespace utils {
-
-enum class LogLevel {
-  LOG_ERROR,
-  LOG_WARNING,
-  LOG_INFO,
-  LOG_DEBUG,
-};
-
-log_priority LogLevelToPriority(LogLevel level);
-
-template <class charT, class traits = std::char_traits<charT>>
-class StringStream : private std::basic_ostringstream<charT, traits> {
- public:
-  using std::basic_ostringstream<charT, traits>::str;
-
-  template <class T>
-  StringStream&  operator<<(const T& value) {
-    static_cast<std::basic_ostringstream<charT, traits> &>(*this) << value;
-    return *this;
-  }
-};
-
-class LogCatcher {
- public:
-  LogCatcher(LogLevel level, const char* tag)
-    : level_(level), tag_(tag) { }
-
-  void operator&(const StringStream<char>& str) const {
-    dlog_print(LogLevelToPriority(level_), tag_.c_str(), "%s",
-        Escape(str.str()).c_str());
-  }
-
- private:
-  // Since LogCatcher passes input to dlog_print(), the input which contains
-  // format string(such as %d, %n) can cause unexpected result.
-  // This is simple function to escape '%'.
-  // NOTE: Is there any gorgeous way instead of this?
-  std::string Escape(const std::string& str) const {
-    std::string escaped = std::string(str);
-    size_t start_pos = 0;
-    std::string from = "%";
-    std::string to = "%%";
-    while ((start_pos = escaped.find(from, start_pos)) != std::string::npos) {
-      escaped.replace(start_pos, from.length(), to);
-      start_pos += to.length();
-    }
-    return escaped;
-  }
-  LogLevel level_;
-  std::string tag_;
-};
-
-}  // namespace utils
-
-inline static const constexpr char* __tag_for_project() {
-  return PROJECT_TAG;
-}
-
-// Simple logging macro of following usage:
-//   LOG(LEVEL) << object_1 << object_2 << object_n;
-//     where:
-//       LEVEL = ERROR | WARNING | INFO | DEBUG
-#define LOG(LEVEL)                                                             \
-    ::utils::LogCatcher(                                                       \
-      ::utils::LogLevel::LOG_ ## LEVEL, __tag_for_project())                   \
-      & ::utils::StringStream<char>()                                          \
-      << std::setw(50) << std::right                                           \
-      << (std::string(__FILENAME__) + ": " + std::string(__FUNCTION__) + "(" + \
-          std::to_string(__LINE__) + ")").c_str()                              \
-      << std::setw(0) << " : "                                                 \
-
-#endif  // LOGGING_HH_
diff --git a/src/service/src/utils/sqlite_db.cc b/src/service/src/utils/sqlite_db.cc
deleted file mode 100644 (file)
index 3de6d9a..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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 "sqlite_db.h"
-
-#include "logging.h"
-
-namespace {
-
-constexpr char kDbPath[] = "/opt/dbspace/.tizen_action.db";
-constexpr char kSelectQuery[] =
-    "SELECT json_str FROM action WHERE action_name = ?";
-
-}  // namespace
-
-namespace utils {
-
-bool SqliteDb::Select(std::string action_id, std::string& result) {
-  LOG(DEBUG) << "select : " << action_id;
-
-  int ret;
-  char *val;
-  sqlite3 *db;
-  sqlite3_stmt *stmt = nullptr;
-
-       ret = sqlite3_open_v2(kDbPath, &db, SQLITE_OPEN_READONLY, nullptr);
-       if (ret != SQLITE_OK) {
-    LOG(ERROR) << "failed to open db : " << kDbPath << " , : " << ret;
-               return false;
-       }
-
-  ret = sqlite3_prepare_v2(db, kSelectQuery, strlen(kSelectQuery), &stmt, nullptr);
-       if (ret != SQLITE_OK) {
-               LOG(ERROR) << "failed to prepare : " << ret;
-    return false;
-       }
-
-  sqlite3_bind_text(stmt, 1, action_id.c_str(), -1, SQLITE_STATIC);
-
-  ret = sqlite3_step(stmt);
-  if (ret != SQLITE_ROW) {
-    LOG(ERROR) << "failed to step : " << sqlite3_errmsg(db);
-    return false;
-  }
-
-       val = (char *)sqlite3_column_text(stmt, 0);
-  LOG(DEBUG) << "result : " << val;
-
-  result = val;
-
-  sqlite3_finalize(stmt);
-       sqlite3_close_v2(db);
-
-  return true;
-}
-
-}  // namespace utils
diff --git a/src/service/src/utils/sqlite_db.h b/src/service/src/utils/sqlite_db.h
deleted file mode 100644 (file)
index cd67502..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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 SQLITE_DB_H_
-#define SQLITE_DB_H_
-
-// #include <database.hpp>
-#include <sqlite3.h>
-
-#include <string>
-
-/* need to be changed to use cpp tizen-database */
-/* neec to be changed smack label for .tizen_action.db */
-
-namespace utils {
-
-class SqliteDb {
- public:
-  SqliteDb() = default;
-  ~SqliteDb() = default;
-
-  bool Select(std::string action_id, std::string& result);
-
-};
-
-}  // namespace utils
-
-#endif  // SQLITE_DB_H_
\ No newline at end of file
index 927441f03371f6c3b1b814ae0e08a039cead23b2..30411e4fe6650b4f2a12c542994258db278df007 100644 (file)
@@ -9,4 +9,4 @@ if [ $? -ne 0 ]; then
 fi
 
 mv tizen_action_service_proxy.* $SCRIPT_DIR/../src/api/
-mv tizen_action_service_stub.* $SCRIPT_DIR/../src/service/src/
+mv tizen_action_service_stub.* $SCRIPT_DIR/../src/action/