Initial commit
authorSangyoon Jang <jeremy.jang@samsung.com>
Wed, 15 Jan 2025 07:13:41 +0000 (16:13 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Wed, 15 Jan 2025 07:16:17 +0000 (16:16 +0900)
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
20 files changed:
README.md [new file with mode: 0644]
api/inc/tizen_actions.h [new file with mode: 0644]
build.sh [new file with mode: 0755]
service/.exportMap [new file with mode: 0644]
service/.project [new file with mode: 0644]
service/build.sh [new file with mode: 0755]
service/project_def.prop [new file with mode: 0644]
service/src/action_request_handler.cc [new file with mode: 0644]
service/src/action_request_handler.h [new file with mode: 0644]
service/src/irequest_handler.h [new file with mode: 0644]
service/src/main.cc [new file with mode: 0644]
service/src/service.cc [new file with mode: 0644]
service/src/service.h [new file with mode: 0644]
service/src/utils/logging.cc [new file with mode: 0644]
service/src/utils/logging.h [new file with mode: 0644]
service/tizen-manifest.xml [new file with mode: 0644]
src/pkgmgr_plugin_parser/iaction_parser.h [new file with mode: 0644]
src/pkgmgr_plugin_parser/json_action_parser.cc [new file with mode: 0644]
src/pkgmgr_plugin_parser/json_action_parser.h [new file with mode: 0644]
tidl/tizen_actions.tidl [new file with mode: 0644]

diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..61ef518
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+# tizen-action-framework
diff --git a/api/inc/tizen_actions.h b/api/inc/tizen_actions.h
new file mode 100644 (file)
index 0000000..f712afc
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * 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.
+ */
\ No newline at end of file
diff --git a/build.sh b/build.sh
new file mode 100755 (executable)
index 0000000..98d32da
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+# generate tidl code
+tidlc -p -l C++ -i tidl/tizen_actions.tidl -o tizen_action_service_proxy && mv tizen_action_service_proxy.* api/src/
+tidlc -s -l C++ -i tidl/tizen_actions.tidl -o tizen_action_service_stub && mv tizen_action_service_stub.* service/src/
+
+if [ $? -ne 0 ]; then
+    echo "*** Failed to generate TIDL code ***"
+    exit 1
+fi
+
+# build service app
+cd service
+sh build.sh
\ No newline at end of file
diff --git a/service/.exportMap b/service/.exportMap
new file mode 100644 (file)
index 0000000..41d666c
--- /dev/null
@@ -0,0 +1,5 @@
+{
+       global: main; _IO_*;
+       local: *;
+};
+
diff --git a/service/.project b/service/.project
new file mode 100644 (file)
index 0000000..1c699b4
--- /dev/null
@@ -0,0 +1,94 @@
+<?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>
+
diff --git a/service/build.sh b/service/build.sh
new file mode 100755 (executable)
index 0000000..981676b
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+tizen build-native -C Debug -a arm -c gcc && tizen package -t tpk -- ./Debug
\ No newline at end of file
diff --git a/service/project_def.prop b/service/project_def.prop
new file mode 100644 (file)
index 0000000..ec46e39
--- /dev/null
@@ -0,0 +1,18 @@
+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/service/src/action_request_handler.cc b/service/src/action_request_handler.cc
new file mode 100644 (file)
index 0000000..3a12c4b
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * 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"
+
+namespace service {
+
+ActionRequestHandler::ActionRequestHandler() {
+}
+
+ActionRequestHandler::~ActionRequestHandler() {
+}
+
+void ActionRequestHandler::Init() {
+  service_.Listen(std::make_shared<service::Service::Factory>(*this));
+}
+
+void ActionRequestHandler::OnListActions() {
+}
+
+void ActionRequestHandler::OnGetAction(std::string id) {
+}
+
+void ActionRequestHandler::OnGetActionId(std::string user_description, int top_k,
+    float search_threshold) {
+}
+
+}  // namespace service
diff --git a/service/src/action_request_handler.h b/service/src/action_request_handler.h
new file mode 100644 (file)
index 0000000..e64feea
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * 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;
+
+ private:
+  rpc_port::tizen_action_service_stub::stub::ActionService service_;
+};
+
+}  // namespace service
+
+#endif  // SRC_ACTION_MANAGER_H_
diff --git a/service/src/irequest_handler.h b/service/src/irequest_handler.h
new file mode 100644 (file)
index 0000000..fa22135
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * 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;
+};
+
+}  // namespace service
+
+#endif  // SRC_IREQUEST_HANDLER_H_
diff --git a/service/src/main.cc b/service/src/main.cc
new file mode 100644 (file)
index 0000000..ea5f79b
--- /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_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/service/src/service.cc b/service/src/service.cc
new file mode 100644 (file)
index 0000000..fb0301b
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * 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"
+
+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);
+  return {};
+}
+
+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 {};
+}
+
+}  // namespace service
diff --git a/service/src/service.h b/service/src/service.h
new file mode 100644 (file)
index 0000000..f01e586
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * 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;
+
+ private:
+  IRequestHandler& handler_;
+};
+
+}  // namespace service
+
+#endif  // SRC_SERVICE_H_
diff --git a/service/src/utils/logging.cc b/service/src/utils/logging.cc
new file mode 100644 (file)
index 0000000..6701dda
--- /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 "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/service/src/utils/logging.h b/service/src/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/service/tizen-manifest.xml b/service/tizen-manifest.xml
new file mode 100644 (file)
index 0000000..db2247d
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="9.0" package="org.tizen.action-framework.service" version="1.0.0">
+    <profile name="tizen" />
+    <service-application appid="org.tizen.action-framework.service" exec="tizenactionframeworkservice" type="capp" multiple="false" taskmanage="false" nodisplay="true">
+        <icon>TizenActionFrameworkService.png</icon>
+        <label>TizenActionFrameworkService</label>
+       </service-application>
+</manifest>
diff --git a/src/pkgmgr_plugin_parser/iaction_parser.h b/src/pkgmgr_plugin_parser/iaction_parser.h
new file mode 100644 (file)
index 0000000..cb3d702
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * 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>
+
+namespace tas {
+
+class IActionParser {
+ public:
+  virtual ~IActionParser() = default;
+  virtual bool Parse(const std::string& json_string) = 0;
+};
+
+}  // namespace tas
diff --git a/src/pkgmgr_plugin_parser/json_action_parser.cc b/src/pkgmgr_plugin_parser/json_action_parser.cc
new file mode 100644 (file)
index 0000000..fcc4daf
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * 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 "json_action_parser.h"
+
+namespace tas {
+
+JsonActionParser::JsonActionParser() {
+}
+
+JsonActionParser::~JsonActionParser() {
+}
+
+bool JsonActionParser::Parse(const std::string& json_str) {
+  return true;
+}
+
+}  // namespace tas
diff --git a/src/pkgmgr_plugin_parser/json_action_parser.h b/src/pkgmgr_plugin_parser/json_action_parser.h
new file mode 100644 (file)
index 0000000..3a1a50a
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * 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 "iaction_parser.h"
+
+namespace tas {
+
+class JsonActionParser : public IActionParser {
+  public:
+  JsonActionParser();
+  ~JsonActionParser();
+  bool Parse(const std::string& json_string) override;
+};
+
+}  // namespace tas
\ No newline at end of file
diff --git a/tidl/tizen_actions.tidl b/tidl/tizen_actions.tidl
new file mode 100644 (file)
index 0000000..ee4c509
--- /dev/null
@@ -0,0 +1,37 @@
+protocol 2
+
+struct Parameter {
+    string key;
+    string type;
+    string description;
+    bool is_requied;
+}
+
+struct Result {
+    string key;
+    string type;
+}
+
+struct Action {
+    string action_id;
+    string app_id;
+    string label;
+    string description;
+    string uri;
+    string mime;
+    string operation;
+    array<Parameter> parameters;
+    array<Result> results;
+    array<string> privileges;
+}
+
+struct VectorDbResult {
+    string action_id;
+    float score;
+}
+
+interface ActionService {
+    array<Action> ListActions();
+    Action GetAction(string action_id);
+    array<VectorDbResult> GetActionId(string user_description, int top_k, float search_threshold);
+}