Merge branch 'bugfix/add_macro_to_blufi' into 'release/v3.3'

component/bt: Add a macro to control the compilation of blufi.(backport v3.3)

See merge request espressif/esp-idf!11891
This commit is contained in:
Jiang Jiang Jian
2021-01-11 11:45:14 +08:00
8 changed files with 26 additions and 7 deletions

View File

@@ -480,6 +480,13 @@ menu Bluetooth
help help
This option can be disabled when the app work only on gatt client mode This option can be disabled when the app work only on gatt client mode
config GATTS_BLUFI_ENABLE
bool "Include blufi function"
depends on GATTS_ENABLE
default y
help
This option can be close when the app does not require blufi function.
choice GATTS_SEND_SERVICE_CHANGE_MODE choice GATTS_SEND_SERVICE_CHANGE_MODE
prompt "GATTS Service Change Mode" prompt "GATTS Service Change Mode"
default GATTS_SEND_SERVICE_CHANGE_AUTO default GATTS_SEND_SERVICE_CHANGE_AUTO

View File

@@ -23,7 +23,7 @@
#include "osi/future.h" #include "osi/future.h"
#include "btc_gatts.h" #include "btc_gatts.h"
#include "btc_gatt_util.h" #include "btc_gatt_util.h"
#if (BLUFI_INCLUDED == TRUE)
esp_err_t esp_blufi_register_callbacks(esp_blufi_callbacks_t *callbacks) esp_err_t esp_blufi_register_callbacks(esp_blufi_callbacks_t *callbacks)
{ {
if (esp_bluedroid_get_status() == ESP_BLUEDROID_STATUS_UNINITIALIZED) { if (esp_bluedroid_get_status() == ESP_BLUEDROID_STATUS_UNINITIALIZED) {
@@ -162,3 +162,4 @@ esp_err_t esp_blufi_send_custom_data(uint8_t *data, uint32_t data_len)
return (btc_transfer_context(&msg, &arg, sizeof(btc_blufi_args_t), btc_blufi_call_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); return (btc_transfer_context(&msg, &arg, sizeof(btc_blufi_args_t), btc_blufi_call_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
} }
#endif ///BLUFI_INCLUDED == TRUE

View File

@@ -38,7 +38,7 @@
#include "esp_blufi_api.h" #include "esp_blufi_api.h"
#include "esp_gatt_common_api.h" #include "esp_gatt_common_api.h"
#if (GATTS_INCLUDED == TRUE) #if (BLUFI_INCLUDED == TRUE)
#define BT_BD_ADDR_STR "%02x:%02x:%02x:%02x:%02x:%02x" #define BT_BD_ADDR_STR "%02x:%02x:%02x:%02x:%02x:%02x"
#define BT_BD_ADDR_HEX(addr) addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] #define BT_BD_ADDR_HEX(addr) addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]
@@ -1135,4 +1135,4 @@ uint16_t btc_blufi_get_version(void)
return BTC_BLUFI_VERSION; return BTC_BLUFI_VERSION;
} }
#endif ///GATTS_INCLUDED == TRUE #endif ///BLUFI_INCLUDED == TRUE

View File

@@ -35,7 +35,7 @@
//#include "esp_wifi.h" //#include "esp_wifi.h"
#if (GATTS_INCLUDED == TRUE) #if (BLUFI_INCLUDED == TRUE)
extern tBLUFI_ENV blufi_env; extern tBLUFI_ENV blufi_env;
void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len) void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len)
@@ -269,4 +269,5 @@ void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len)
} }
} }
#endif ///(GATTS_INCLUDED == TRUE) #endif ///BLUFI_INCLUDED == TRUE

View File

@@ -15,6 +15,7 @@
#ifndef __BLUFI_INT_H__ #ifndef __BLUFI_INT_H__
#define __BLUFI_INT_H__ #define __BLUFI_INT_H__
#if (BLUFI_INCLUDED == TRUE)
#define BTC_BLUFI_GREAT_VER 0x01 //Version + Subversion #define BTC_BLUFI_GREAT_VER 0x01 //Version + Subversion
#define BTC_BLUFI_SUB_VER 0x02 //Version + Subversion #define BTC_BLUFI_SUB_VER 0x02 //Version + Subversion
#define BTC_BLUFI_VERSION ((BTC_BLUFI_GREAT_VER<<8)|BTC_BLUFI_SUB_VER) //Version + Subversion #define BTC_BLUFI_VERSION ((BTC_BLUFI_GREAT_VER<<8)|BTC_BLUFI_SUB_VER) //Version + Subversion
@@ -184,3 +185,4 @@ void btc_blufi_cb_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
void btc_blufi_cb_deep_free(btc_msg_t *msg); void btc_blufi_cb_deep_free(btc_msg_t *msg);
#endif /* __BLUFI_INT_H__ */ #endif /* __BLUFI_INT_H__ */
#endif ///BLUFI_INCLUDED == TRUE

View File

@@ -131,6 +131,12 @@
#define GATTC_INCLUDED FALSE #define GATTC_INCLUDED FALSE
#endif /* CONFIG_GATTC_ENABLE */ #endif /* CONFIG_GATTC_ENABLE */
#if (CONFIG_GATTS_BLUFI_ENABLE)
#define BLUFI_INCLUDED TRUE
#else
#define BLUFI_INCLUDED FALSE
#endif /* UC_BT_BLUFI_ENABLE */
#if (CONFIG_GATTC_ENABLE && CONFIG_GATTC_CACHE_NVS_FLASH) #if (CONFIG_GATTC_ENABLE && CONFIG_GATTC_CACHE_NVS_FLASH)
#define GATTC_CACHE_NVS TRUE #define GATTC_CACHE_NVS TRUE
#else #else

View File

@@ -78,9 +78,9 @@ static btc_func_t profile_tab[BTC_PID_NUM] = {
[BTC_PID_GAP_BLE] = {btc_gap_ble_call_handler, btc_gap_ble_cb_handler }, [BTC_PID_GAP_BLE] = {btc_gap_ble_call_handler, btc_gap_ble_cb_handler },
[BTC_PID_BLE_HID] = {NULL, NULL}, [BTC_PID_BLE_HID] = {NULL, NULL},
[BTC_PID_SPPLIKE] = {NULL, NULL}, [BTC_PID_SPPLIKE] = {NULL, NULL},
#if (GATTS_INCLUDED == TRUE) #if (BLUFI_INCLUDED == TRUE)
[BTC_PID_BLUFI] = {btc_blufi_call_handler, btc_blufi_cb_handler }, [BTC_PID_BLUFI] = {btc_blufi_call_handler, btc_blufi_cb_handler },
#endif ///GATTS_INCLUDED == TRUE #endif //BLUFI_INCLUDED == TRUE
[BTC_PID_DM_SEC] = {NULL, btc_dm_sec_cb_handler }, [BTC_PID_DM_SEC] = {NULL, btc_dm_sec_cb_handler },
#endif #endif
[BTC_PID_ALARM] = {btc_alarm_handler, NULL }, [BTC_PID_ALARM] = {btc_alarm_handler, NULL },

View File

@@ -53,7 +53,9 @@ typedef enum {
BTC_PID_GAP_BLE, BTC_PID_GAP_BLE,
BTC_PID_BLE_HID, BTC_PID_BLE_HID,
BTC_PID_SPPLIKE, BTC_PID_SPPLIKE,
#if (BLUFI_INCLUDED == TRUE)
BTC_PID_BLUFI, BTC_PID_BLUFI,
#endif ///BLUFI_INCLUDED == TRUE
BTC_PID_DM_SEC, BTC_PID_DM_SEC,
BTC_PID_ALARM, BTC_PID_ALARM,
#if CONFIG_CLASSIC_BT_ENABLED #if CONFIG_CLASSIC_BT_ENABLED