]> granicus.if.org Git - esp-idf/commitdiff
component/bt : main api
authorTian Hao <tianhao@espressif.com>
Wed, 16 Nov 2016 03:28:41 +0000 (11:28 +0800)
committerTian Hao <tianhao@espressif.com>
Wed, 16 Nov 2016 03:28:41 +0000 (11:28 +0800)
1. use blufi check main api ok

components/bt/bluedroid/api/esp_bt_main.c [new file with mode: 0644]
components/bt/bluedroid/api/include/esp_bt_main.h [new file with mode: 0644]
components/bt/bluedroid/btc/core/btc_main.c
examples/07_blufi/components/blufi/blufi.c
examples/07_blufi/main/demo_main.c

diff --git a/components/bt/bluedroid/api/esp_bt_main.c b/components/bt/bluedroid/api/esp_bt_main.c
new file mode 100644 (file)
index 0000000..9e2fbe5
--- /dev/null
@@ -0,0 +1,26 @@
+#include "esp_bt_main.h"
+
+
+
+esp_err_t esp_enable_bluetooth(esp_bt_sec_cb_t *p_cback)
+{
+       return btc_enable_bluetooth(p_cback) == BT_STATUS_SUCCESS ? ESP_OK: ESP_FAIL;
+}
+
+esp_err_t esp_disable_bluetooth(void)
+{
+       return btc_disable_bluetooth() == BT_STATUS_SUCCESS ? ESP_OK: ESP_FAIL;
+}
+
+esp_err_t esp_init_bluetooth(bluetooth_init_cb_t cb)
+{
+       return btc_init_bluetooth(cb) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL;
+}
+
+
+void esp_deinit_bluetooth(void)
+{
+       btc_deinit_bluetooth();
+}
+
+
diff --git a/components/bt/bluedroid/api/include/esp_bt_main.h b/components/bt/bluedroid/api/include/esp_bt_main.h
new file mode 100644 (file)
index 0000000..247fbaa
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef __ESP_BT_MAIN_H__
+#define __ESP_BT_MAIN_H__
+
+#include "btc_main.h"
+#include "esp_err.h"
+
+esp_err_t esp_enable_bluetooth(esp_bt_sec_cb_t *p_cback);
+
+esp_err_t esp_disable_bluetooth(void);
+
+esp_err_t esp_init_bluetooth(bluetooth_init_cb_t cb);
+
+void esp_deinit_bluetooth(void);
+
+
+#endif /* __ESP_BT_MAIN_H__ */
index 08a2ff01190d26eddcb98373e9cde57a85bd5ef0..e2c6d57653efd4e9d9863e0c823a9141b05be0da 100644 (file)
@@ -16,7 +16,7 @@ bt_status_t btc_disable_bluetooth(void)
 
 bt_status_t btc_init_bluetooth(bluetooth_init_cb_t cb)
 {
-       return bte_main_boot_entry(cb) == 0 ? ESP_OK : ESP_FAIL;
+       return bte_main_boot_entry(cb) == 0 ? BT_STATUS_SUCCESS : BT_STATUS_FAIL;
 }
 
 
index 39c5a0aae434fc042abf2581a1303b71b1400fea..2ebe8bccda54e6918a85c09bc28fa6d622a992d2 100644 (file)
@@ -41,6 +41,7 @@
 #include "blufi_adv.h"
 
 #include "esp_bt_defs.h"
+#include "esp_bt_main.h"
 
 static void BlufiDataCallBack(UINT8 app_id, UINT8 event, UINT8 len, UINT8 *p_data);
 
index 3aeea617a9341adadb6232f14fe6812deb08b31a..6f49ac5ca712c090cb62c0a663159033cfa8bf89 100644 (file)
@@ -26,7 +26,8 @@
 #include "bt.h"
 #include "bta_api.h"
 
-#include "esp_bt_common.h"
+#include "esp_bt_defs.h"
+#include "esp_bt_main.h"
 #include "blufi.h"
 
 #define WIFI_LIST_NUM  10