[OAL] Add support for 'Reset Adapter' 89/154189/1
authorAnupam Roy <anupam.r@samsung.com>
Mon, 9 Oct 2017 05:40:06 +0000 (11:10 +0530)
committerAnupam Roy <anupam.r@samsung.com>
Mon, 9 Oct 2017 10:42:48 +0000 (16:12 +0530)
Change-Id: I8f382e0ea22be537ef7dfbeaddb8b072b7fa1b24
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
bt-oal/include/oal-adapter-mgr.h
bt-oal/oal-adapter-mgr.c

index b8cde4e..193f407 100644 (file)
@@ -121,6 +121,20 @@ oal_status_t le_disable(void);
 oal_status_t adapter_start_custom_inquiry(discovery_type_t disc_type);
 
 /**
+ * @brief Reset Adapter.
+ *
+ * @remarks  Disables the BT stack and chip.
+ *
+ * @details EVENT: OAL_EVENT_ADAPTER_DISABLED
+ *
+ * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
+ * @retval #OAL_STATUS_SUCCESS  Successful
+ *
+ * @see  adapter_enable()
+ */
+oal_status_t adapter_reset(void);
+
+/**
  * @brief Start device discovery
  *
  * @details For each device found either OAL_EVENT_ADAPTER_INQUIRY_RESULT_BREDR_ONLY
index 58d262f..7bc9d71 100644 (file)
@@ -234,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;