Replace the systemd service activation method 95/211895/3
authorDoHyun Pyun <dh79.pyun@samsung.com>
Mon, 12 Aug 2019 01:17:58 +0000 (10:17 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Mon, 12 Aug 2019 03:42:56 +0000 (12:42 +0900)
This patchset will use the systemd actd API instead of
the path activation method.

Change-Id: If1d320d49802def8302a4eb61366102f8e262b64
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
bt-core/CMakeLists.txt
bt-core/bt-core-adapter.c
bt-core/include/bt-core-adapter.h
packaging/bluetooth-frwk.spec

index c6ac939..c782570 100644 (file)
@@ -23,7 +23,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED dlog vconf gio-2.0 gio-unix-2.0 eventsystem capi-system-info)
+pkg_check_modules(pkgs REQUIRED dlog vconf gio-2.0 gio-unix-2.0 eventsystem capi-system-info libactd)
 
 FOREACH(flag ${pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index ee43d10..c2b142f 100644 (file)
@@ -21,6 +21,9 @@
 #include <bundle.h>
 #include <eventsystem.h>
 #include <stdio.h>
+#ifdef TIZEN_FEATURE_ACTD
+#include <actd/unit_control.h>
+#endif
 
 #include "bt-core-main.h"
 #include "bt-core-adapter.h"
@@ -116,6 +119,24 @@ gboolean _bt_core_is_flight_mode_enabled(void)
        }
 }
 
+#ifdef TIZEN_FEATURE_ACTD
+static int __bt_call_systemact_service(const char *service_name)
+{
+       int ret;
+
+       BT_DBG("Use System Activated : %s", service_name);
+
+       ret = actd_start_unit(UNIT_CONTROL_BUS_TYPE_SYSTEM, service_name, 5000);
+
+       if (ret != UNIT_CONTROL_OK) {
+               BT_ERR("Failed to activate the %s: %d", service_name, ret);
+               /* Return Success even if the activating result is fail */
+               return 0;
+       }
+
+       return 0;
+}
+#else
 static int __bt_call_systemact_service(const char *file_path)
 {
        BT_DBG("+");
@@ -143,6 +164,7 @@ static int __bt_call_systemact_service(const char *file_path)
        return 0;
 
 }
+#endif
 
 static int __execute_command(const char *cmd, char *const arg_list[])
 {
index 3f4ecc6..5b42a75 100755 (executable)
@@ -34,6 +34,19 @@ extern "C" {
 #define BT_CORE_NAME "org.projectx.bt_core"
 #define BT_CORE_PATH "/org/projectx/bt_core"
 
+#ifdef TIZEN_FEATURE_ACTD
+#define BT_SYSTEMACT_HCI_LOGGER_START "bluetooth-hci-logger.service"
+#define BT_SYSTEMACT_HCI_LOGGER_STOP "bluetooth-hci-logger-stop.service"
+#define BT_SYSTEMACT_HCI_UP "bluetooth-hci-up.service"
+#define BT_SYSTEMACT_HCI_DOWN "bluetooth-hci-down.service"
+#define BT_SYSTEMACT_BLUEZ_START "bluez-start.service"
+#define BT_SYSTEMACT_BLUETOOTH_SHARE_START "bluetooth-share-start.service"
+#define BT_SYSTEMACT_RFKILL_UNBLOCK "bluetooth-rfkill-unblock.service"
+#define BT_SYSTEMACT_RFKILL_BLOCK "bluetooth-rfkill-block.service"
+#define BT_SYSTEMACT_STACK_UP "bluetooth-stack-up.service"
+#define BT_SYSTEMACT_STACK_DOWN "bluetooth-stack-down.service"
+#define BT_SYSTEMACT_STACK_DOWN_WITH_RADIO "bluetooth-stack-down-with-radio.service"
+#else
 #define BT_SYSTEMACT_HCI_LOGGER_START "/run/.hci_logger_start"
 #define BT_SYSTEMACT_HCI_LOGGER_STOP "/run/.hci_logger_stop"
 #define BT_SYSTEMACT_HCI_UP "/run/.hci_up"
@@ -45,6 +58,7 @@ extern "C" {
 #define BT_SYSTEMACT_STACK_UP "/run/.bt_stack_up"
 #define BT_SYSTEMACT_STACK_DOWN "/run/.bt_stack_down"
 #define BT_SYSTEMACT_STACK_DOWN_WITH_RADIO "/run/.bt_stack_down_with_radio"
+#endif
 
 #define BT_CORE_TYPE (bt_core_get_type())
 
index bb7a546..5ce4954 100644 (file)
@@ -42,6 +42,7 @@ BuildRequires:  pkgconfig(storage)
 BuildRequires:  pkgconfig(capi-system-info)
 BuildRequires:  pkgconfig(capi-appfw-app-control)
 BuildRequires:  pkgconfig(gmock)
+BuildRequires:  pkgconfig(libactd)
 
 Requires(post): /usr/bin/vconftool
 Requires(post): /sbin/ldconfig
@@ -204,6 +205,7 @@ export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_IPSP"
 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
 export CFLAGS="$CFLAGS -DTIZEN_GATT_CLIENT"
+export CFLAGS="$CFLAGS -DTIZEN_FEATURE_ACTD"
 
 %define _servicefile packaging/bluetooth-frwk-common.service
 %define _servicedir starter.target.wants