Handle FM radio status with BT on / off senario 37/89537/1
authorDoHyun Pyun <dh79.pyun@samsung.com>
Mon, 26 Sep 2016 04:02:27 +0000 (13:02 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Mon, 26 Sep 2016 04:02:27 +0000 (13:02 +0900)
Change-Id: I48458da8c571e2a1e2b4ce075d813e4bfce72ed6
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
bt-core/bt-core-adapter.c
packaging/bluetooth-frwk.spec

index 503f5dd..3db0fa4 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <vconf.h>
 #include <vconf-keys.h>
+#include <vconf-internal-radio-keys.h>
 #include <bundle.h>
 #include <eventsystem.h>
 
@@ -216,12 +217,31 @@ int _bt_disable_adapter(void)
                /* Forcely terminate */
 #ifdef USB_BLUETOOTH
                char *argv_down[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "down", NULL};
-               if (__execute_command("/usr/bin/hciconfig", argv_down) < 0) {
-#else
-               if (__execute_command("/usr/etc/bluetooth/bt-stack-down.sh", NULL) < 0) {
-#endif
+               if (__execute_command("/usr/bin/hciconfig", argv_down) < 0)
                        BT_ERR("running script failed");
+#else
+
+#ifdef TIZEN_FEATURE_RADIO
+               int radio_status = VCONFKEY_RADIO_STATUS_OFF;
+
+               /* Check if radio status on or off */
+               if (vconf_get_int(VCONFKEY_RADIO_STATUS, &radio_status) < 0)
+                       BT_ERR("Fail to get radio status");
+
+               BT_DBG("Radio status: %d", radio_status);
+
+               if (radio_status == VCONFKEY_RADIO_STATUS_ON) {
+                       if (__execute_command("/usr/etc/bluetooth/bt-stack-down-with-radio.sh", NULL) < 0)
+                               BT_ERR("running script failed");
+               } else {
+                       if (__execute_command("/usr/etc/bluetooth/bt-stack-down.sh", NULL) < 0)
+                               BT_ERR("running script failed");
                }
+#else
+               if (__execute_command("/usr/etc/bluetooth/bt-stack-down.sh", NULL) < 0)
+                       BT_ERR("running script failed");
+#endif
+#endif
                _bt_core_terminate();
                return 0;
        } else if (status != BT_ACTIVATED) {
@@ -233,13 +253,41 @@ int _bt_disable_adapter(void)
 #ifdef USB_BLUETOOTH
        char *argv_down[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "down", NULL};
        if (__execute_command("/usr/bin/hciconfig", argv_down) < 0) {
-#else
-       if (__execute_command("/usr/etc/bluetooth/bt-stack-down.sh", NULL) < 0) {
-#endif
                BT_ERR("running script failed");
                __bt_core_set_status(BT_ACTIVATED);
                return -1;
        }
+#else
+#ifdef TIZEN_FEATURE_RADIO
+       int radio_status = VCONFKEY_RADIO_STATUS_OFF;
+
+       /* Check if radio status on or off */
+       if (vconf_get_int(VCONFKEY_RADIO_STATUS, &radio_status) < 0)
+               BT_ERR("Fail to get radio status");
+
+       BT_DBG("Radio status: %d", radio_status);
+
+       if (radio_status == VCONFKEY_RADIO_STATUS_ON) {
+               if (__execute_command("/usr/etc/bluetooth/bt-stack-down-with-radio.sh", NULL) < 0) {
+                       BT_ERR("running script failed");
+                       __bt_core_set_status(BT_ACTIVATED);
+                       return -1;
+               }
+       } else {
+               if (__execute_command("/usr/etc/bluetooth/bt-stack-down.sh", NULL) < 0) {
+                       BT_ERR("running script failed");
+                       __bt_core_set_status(BT_ACTIVATED);
+                       return -1;
+               }
+       }
+#else
+       if (__execute_command("/usr/etc/bluetooth/bt-stack-down.sh", NULL) < 0) {
+                       BT_ERR("running script failed");
+                       __bt_core_set_status(BT_ACTIVATED);
+                       return -1;
+       }
+#endif
+#endif
 
        return 0;
 }
index 4de209a..740fb36 100644 (file)
@@ -4,7 +4,7 @@
 
 Name:       bluetooth-frwk
 Summary:    Bluetooth framework for BlueZ and Obexd. This package is Bluetooth framework based on BlueZ and Obexd stack.
-Version:    0.2.151
+Version:    0.2.152
 Release:    1
 Group:      Network & Connectivity/Bluetooth
 License:    Apache-2.0
@@ -151,6 +151,13 @@ export CXXFLAGS="$CXXFLAGS -DTIZEN_TEST_EMUL"
 export FFLAGS="$FFLAGS -DTIZEN_TEST_EMUL"
 %endif
 
+
+%if "%{?tizen_target_name}" == "TM1"
+export CFLAGS="${CFLAGS} -DTIZEN_FEATURE_RADIO"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_FEATURE_RADIO"
+export FFLAGS="$FFLAGS -DTIZEN_FEATURE_RADIO"
+%endif
+
 cmake . -DCMAKE_INSTALL_PREFIX=/usr \
 -DCMAKE_LIB_DIR=%{_libdir} \
 -DTZ_SYS_USER_GROUP=%TZ_SYS_USER_GROUP \