Move some directories
authorSangyoon Jang <jeremy.jang@samsung.com>
Tue, 21 Jan 2025 00:56:27 +0000 (09:56 +0900)
committer장상윤/Tizen Platform Lab(SR)/삼성전자 <jeremy.jang@samsung.com>
Tue, 21 Jan 2025 02:09:14 +0000 (11:09 +0900)
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
30 files changed:
api/inc/tizen_actions.h [deleted file]
build.sh
service/.exportMap [deleted file]
service/.project [deleted file]
service/build.sh [deleted file]
service/project_def.prop [deleted file]
service/src/action_request_handler.cc [deleted file]
service/src/action_request_handler.h [deleted file]
service/src/irequest_handler.h [deleted file]
service/src/main.cc [deleted file]
service/src/service.cc [deleted file]
service/src/service.h [deleted file]
service/src/utils/logging.cc [deleted file]
service/src/utils/logging.h [deleted file]
service/tizen-manifest.xml [deleted file]
src/api/inc/tizen_actions.h [new file with mode: 0644]
src/service/.exportMap [new file with mode: 0644]
src/service/.project [new file with mode: 0644]
src/service/build.sh [new file with mode: 0755]
src/service/project_def.prop [new file with mode: 0644]
src/service/src/action_request_handler.cc [new file with mode: 0644]
src/service/src/action_request_handler.h [new file with mode: 0644]
src/service/src/irequest_handler.h [new file with mode: 0644]
src/service/src/main.cc [new file with mode: 0644]
src/service/src/service.cc [new file with mode: 0644]
src/service/src/service.h [new file with mode: 0644]
src/service/src/utils/logging.cc [new file with mode: 0644]
src/service/src/utils/logging.h [new file with mode: 0644]
src/service/tizen-manifest.xml [new file with mode: 0644]
tidl/prebuild.sh

diff --git a/api/inc/tizen_actions.h b/api/inc/tizen_actions.h
deleted file mode 100644 (file)
index f712afc..0000000
+++ /dev/null
@@ -1,15 +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.
- */
\ No newline at end of file
index 98183bfaf517ebfff301625077b9425f2ff9ca87..6cbda956e062cdc5bfdac565197e9a5b82ceb4b6 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -4,5 +4,5 @@
 /bin/bash tidl/prebuild.sh
 
 # build service app
-cd service
+cd src/service
 /bin/bash build.sh
diff --git a/service/.exportMap b/service/.exportMap
deleted file mode 100644 (file)
index 41d666c..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-       global: main; _IO_*;
-       local: *;
-};
-
diff --git a/service/.project b/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>
-
diff --git a/service/build.sh b/service/build.sh
deleted file mode 100755 (executable)
index 981676b..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/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
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/service/src/action_request_handler.cc b/service/src/action_request_handler.cc
deleted file mode 100644 (file)
index 3a12c4b..0000000
+++ /dev/null
@@ -1,44 +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"
-
-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
deleted file mode 100644 (file)
index e64feea..0000000
+++ /dev/null
@@ -1,46 +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;
-
- 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
deleted file mode 100644 (file)
index fa22135..0000000
+++ /dev/null
@@ -1,35 +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;
-};
-
-}  // namespace service
-
-#endif  // SRC_IREQUEST_HANDLER_H_
diff --git a/service/src/main.cc b/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/service/src/service.cc b/service/src/service.cc
deleted file mode 100644 (file)
index fb0301b..0000000
+++ /dev/null
@@ -1,50 +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"
-
-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
deleted file mode 100644 (file)
index f01e586..0000000
+++ /dev/null
@@ -1,62 +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;
-
- private:
-  IRequestHandler& handler_;
-};
-
-}  // namespace service
-
-#endif  // SRC_SERVICE_H_
diff --git a/service/src/utils/logging.cc b/service/src/utils/logging.cc
deleted file mode 100644 (file)
index 6701dda..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 "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
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/service/tizen-manifest.xml b/service/tizen-manifest.xml
deleted file mode 100644 (file)
index db2247d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?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/api/inc/tizen_actions.h b/src/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/src/service/.exportMap b/src/service/.exportMap
new file mode 100644 (file)
index 0000000..41d666c
--- /dev/null
@@ -0,0 +1,5 @@
+{
+       global: main; _IO_*;
+       local: *;
+};
+
diff --git a/src/service/.project b/src/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/src/service/build.sh b/src/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/src/service/project_def.prop b/src/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/src/service/src/action_request_handler.cc b/src/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/src/service/src/action_request_handler.h b/src/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/src/service/src/irequest_handler.h b/src/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/src/service/src/main.cc b/src/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/src/service/src/service.cc b/src/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/src/service/src/service.h b/src/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/src/service/src/utils/logging.cc b/src/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/src/service/src/utils/logging.h b/src/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/src/service/tizen-manifest.xml b/src/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>
index 76cfdfc4011323badd425492d870f1b229c51097..927441f03371f6c3b1b814ae0e08a039cead23b2 100644 (file)
@@ -8,5 +8,5 @@ if [ $? -ne 0 ]; then
     exit 1
 fi
 
-mv tizen_action_service_proxy.* $SCRIPT_DIR/../api/src/
-mv tizen_action_service_stub.* $SCRIPT_DIR/../service/src/
+mv tizen_action_service_proxy.* $SCRIPT_DIR/../src/api/
+mv tizen_action_service_stub.* $SCRIPT_DIR/../src/service/src/