[OAL] Add support for 'Reset Adapter'
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / oal-adapter-mgr.c
index 7170b53..7bc9d71 100644 (file)
@@ -163,13 +163,14 @@ oal_status_t adapter_disable(void)
        return OAL_STATUS_SUCCESS;
 }
 
-#ifdef TIZEN_BT_HAL
 oal_status_t le_enable(void)
 {
        int ret = BT_STATUS_SUCCESS;
 
        API_TRACE();
        CHECK_OAL_INITIALIZED();
+
+#ifdef TIZEN_BT_HAL
        if (OAL_STATUS_SUCCESS != hw_is_module_ready()) {
                g_timeout_add(200, retry_enable_le, NULL);
                return OAL_STATUS_PENDING;
@@ -181,8 +182,12 @@ oal_status_t le_enable(void)
                BT_ERR("Enable failed: [%s]", status2string(ret));
                return convert_to_oal_status(ret);
        }
+#else
+       BT_INFO("Not Supported");
+       ret = OAL_STATUS_NOT_SUPPORT;
+#endif
 
-       return OAL_STATUS_SUCCESS;
+       return ret;
 }
 
 oal_status_t le_disable(void)
@@ -193,16 +198,19 @@ oal_status_t le_disable(void)
 
        CHECK_OAL_INITIALIZED();
 
+#ifdef TIZEN_BT_HAL
        ret = blued_api->le_disable();
 
        if (ret != BT_STATUS_SUCCESS) {
                BT_ERR("Disable failed: [%s]", status2string(ret));
                return convert_to_oal_status(ret);
        }
-       return OAL_STATUS_SUCCESS;
-}
-
+#else
+       BT_INFO("Not Supported");
+       ret = OAL_STATUS_NOT_SUPPORT;
 #endif
+       return ret;
+}
 
 oal_status_t adapter_start_custom_inquiry(discovery_type_t disc_type)
 {
@@ -226,6 +234,28 @@ oal_status_t adapter_start_custom_inquiry(discovery_type_t disc_type)
        return ret;
 }
 
+oal_status_t adapter_reset(void)
+{
+       int ret;
+
+       API_TRACE();
+
+       CHECK_OAL_INITIALIZED();
+       BT_INFO("Adapter Reset");
+
+#ifdef TIZEN_BT_HAL
+       ret = blued_api->reset();
+       if (ret != BT_STATUS_SUCCESS) {
+               BT_ERR("Adapter Reset failed: [%s]", status2string(ret));
+               return convert_to_oal_status(ret);
+       }
+#else
+       BT_INFO("Not Supported");
+       ret = OAL_STATUS_NOT_SUPPORT;
+#endif
+       return ret;
+}
+
 oal_status_t adapter_start_inquiry(unsigned short duration)
 {
        int ret;