[FRWK] Implement 'Reset Adapter' API
[platform/core/connectivity/bluetooth-frwk.git] / bt-service-adaptation / services / adapter / bt-service-core-adapter.c
index 06dc457..3958cd9 100644 (file)
@@ -136,15 +136,32 @@ int _bt_enable_adapter(void)
 int _bt_enable_core(void)
 {
        /* TODO_40 : 4.0 merge  */
+       BT_INFO("Not Supported");
        return BLUETOOTH_ERROR_NOT_SUPPORT;
 }
 
 int _bt_recover_adapter(void)
 {
        /* TODO_40 : 4.0 merge  */
+       BT_INFO("Not Supported");
        return BLUETOOTH_ERROR_NOT_SUPPORT;
 }
 
+int _bt_reset_adapter(void)
+{
+       BT_INFO("+");
+       if (OAL_STATUS_SUCCESS != adapter_reset())
+               return BLUETOOTH_ERROR_INTERNAL;
+
+       /* TODO_40 : 4.0 merge  */
+       /* TODO Currently bt-service is not terminated in tizen next.
+           It should be handled in future patch */
+       if (_bt_adapter_get_status() == BT_DEACTIVATED)
+               g_idle_add((GSourceFunc)_bt_terminate_service, NULL);
+
+       return BLUETOOTH_ERROR_NONE;
+}
+
 int _bt_disable_adapter(void)
 {
        return __bt_adapter_state_handle_request(FALSE);
@@ -976,9 +993,11 @@ static void __bt_post_oal_init(void)
                BT_ERR("Fail to get the enabled value");
        }
 
+#if 0
        /* Update Bluetooth Status to OFF */
        if (vconf_set_int(VCONFKEY_BT_STATUS, VCONFKEY_BT_STATUS_OFF) != 0)
                BT_ERR("Set vconf failed\n");
+#endif
 
        if (status & VCONFKEY_BT_STATUS_ON) {
                ret = _bt_enable_adapter();