Commit f0bdf8cc authored by 王金亮's avatar 王金亮

feat:变更点2:修改安卓系统手机先连接BLE蓝牙后连接经典蓝牙后无法连接问题

parent 57faad75
...@@ -256,7 +256,7 @@ static esp_ble_adv_params_t adv_params = { ...@@ -256,7 +256,7 @@ static esp_ble_adv_params_t adv_params = {
.adv_int_min = 0x20, .adv_int_min = 0x20,
.adv_int_max = 0x40, .adv_int_max = 0x40,
.adv_type = ADV_TYPE_IND, .adv_type = ADV_TYPE_IND,
.own_addr_type = BLE_ADDR_TYPE_PUBLIC, .own_addr_type = BLE_ADDR_TYPE_RANDOM,
.channel_map = ADV_CHNL_ALL, .channel_map = ADV_CHNL_ALL,
.adv_filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY, .adv_filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY,
}; };
...@@ -666,7 +666,7 @@ static void gatts_profile_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_ ...@@ -666,7 +666,7 @@ static void gatts_profile_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_
{ {
switch (event) { switch (event) {
case ESP_GATTS_REG_EVT:{ case ESP_GATTS_REG_EVT:{
// esp_ble_gap_set_rand_addr(rand_addr); esp_ble_gap_set_rand_addr(rand_addr);
esp_err_t set_dev_name_ret = esp_ble_gap_set_device_name((const char *)BT_Device_Name); esp_err_t set_dev_name_ret = esp_ble_gap_set_device_name((const char *)BT_Device_Name);
if (set_dev_name_ret){ if (set_dev_name_ret){
ESP_LOGE(GATTS_TABLE_TAG, "set device name failed, error code = %x", set_dev_name_ret); ESP_LOGE(GATTS_TABLE_TAG, "set device name failed, error code = %x", set_dev_name_ret);
...@@ -908,6 +908,14 @@ void Get_Mac_Init(void ) ...@@ -908,6 +908,14 @@ void Get_Mac_Init(void )
char temp[10] = {0}; char temp[10] = {0};
char temp1[20] = {0}; char temp1[20] = {0};
esp_read_mac(ble_mac, ESP_MAC_BT); esp_read_mac(ble_mac, ESP_MAC_BT);
for(i = 1; i<6; i++)
{
if (ble_mac[i])
{
rand_addr[i] = ble_mac[i] ;
}
}
// printf("%d\n",temp); // printf("%d\n",temp);
for(i = 6; i > 0; i--) for(i = 6; i > 0; i--)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment