mirror of
				https://github.com/espressif/esp-idf.git
				synced 2025-10-31 04:59:55 +00:00 
			
		
		
		
	fix(ble/bluedroid): Optimize BLE API "esp_ble_gattc_enh_open"
This commit is contained in:
		 zhanghaipeng
					zhanghaipeng
				
			
				
					committed by
					
						 chenjianhua
						chenjianhua
					
				
			
			
				
	
			
			
			 chenjianhua
						chenjianhua
					
				
			
						parent
						
							2904494228
						
					
				
				
					commit
					3a85b1b6ce
				
			| @@ -68,7 +68,7 @@ esp_err_t esp_ble_gattc_app_unregister(esp_gatt_if_t gattc_if) | ||||
|     return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); | ||||
| } | ||||
|  | ||||
| esp_err_t esp_ble_gattc_enh_open(esp_gatt_if_t gattc_if, esp_ble_gatt_creat_conn_params_t esp_gatt_create_conn) | ||||
| esp_err_t esp_ble_gattc_enh_open(esp_gatt_if_t gattc_if, esp_ble_gatt_creat_conn_params_t *creat_conn_params) | ||||
| { | ||||
|     btc_msg_t msg = {0}; | ||||
|     btc_ble_gattc_args_t arg; | ||||
| @@ -79,11 +79,11 @@ esp_err_t esp_ble_gattc_enh_open(esp_gatt_if_t gattc_if, esp_ble_gatt_creat_conn | ||||
|     msg.pid = BTC_PID_GATTC; | ||||
|     msg.act = BTC_GATTC_ACT_OPEN; | ||||
|     arg.open.gattc_if = gattc_if; | ||||
|     memcpy(arg.open.remote_bda, esp_gatt_create_conn.remote_bda, ESP_BD_ADDR_LEN); | ||||
|     arg.open.remote_addr_type = esp_gatt_create_conn.remote_addr_type; | ||||
|     arg.open.is_direct = esp_gatt_create_conn.is_direct; | ||||
|     arg.open.is_aux= esp_gatt_create_conn.is_aux; | ||||
|     arg.open.own_addr_type = esp_gatt_create_conn.own_addr_type; | ||||
|     memcpy(arg.open.remote_bda, creat_conn_params->remote_bda, ESP_BD_ADDR_LEN); | ||||
|     arg.open.remote_addr_type = creat_conn_params->remote_addr_type; | ||||
|     arg.open.is_direct = creat_conn_params->is_direct; | ||||
|     arg.open.is_aux= creat_conn_params->is_aux; | ||||
|     arg.open.own_addr_type = creat_conn_params->own_addr_type; | ||||
|  | ||||
|     return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); | ||||
| } | ||||
| @@ -91,26 +91,26 @@ esp_err_t esp_ble_gattc_enh_open(esp_gatt_if_t gattc_if, esp_ble_gatt_creat_conn | ||||
| #if (BLE_42_FEATURE_SUPPORT == TRUE) | ||||
| esp_err_t esp_ble_gattc_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, esp_ble_addr_type_t remote_addr_type, bool is_direct) | ||||
| { | ||||
|     esp_ble_gatt_creat_conn_params_t esp_gatt_create_conn; | ||||
|     memcpy(esp_gatt_create_conn.remote_bda, remote_bda, ESP_BD_ADDR_LEN); | ||||
|     esp_gatt_create_conn.remote_addr_type = remote_addr_type; | ||||
|     esp_gatt_create_conn.is_direct = is_direct; | ||||
|     esp_gatt_create_conn.is_aux = false; | ||||
|     esp_gatt_create_conn.own_addr_type = 0xff; //undefined, will use local value | ||||
|     return esp_ble_gattc_enh_open(gattc_if, esp_gatt_create_conn); | ||||
|     esp_ble_gatt_creat_conn_params_t creat_conn_params; | ||||
|     memcpy(creat_conn_params.remote_bda, remote_bda, ESP_BD_ADDR_LEN); | ||||
|     creat_conn_params.remote_addr_type = remote_addr_type; | ||||
|     creat_conn_params.is_direct = is_direct; | ||||
|     creat_conn_params.is_aux = false; | ||||
|     creat_conn_params.own_addr_type = 0xff; //undefined, will use local value | ||||
|     return esp_ble_gattc_enh_open(gattc_if, &creat_conn_params); | ||||
| } | ||||
| #endif // #if (BLE_42_FEATURE_SUPPORT == TRUE) | ||||
|  | ||||
| #if (BLE_50_FEATURE_SUPPORT == TRUE) | ||||
| esp_err_t esp_ble_gattc_aux_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, esp_ble_addr_type_t remote_addr_type, bool is_direct) | ||||
| { | ||||
|     esp_ble_gatt_creat_conn_params_t esp_gatt_create_conn; | ||||
|     memcpy(esp_gatt_create_conn.remote_bda, remote_bda, ESP_BD_ADDR_LEN); | ||||
|     esp_gatt_create_conn.remote_addr_type = remote_addr_type; | ||||
|     esp_gatt_create_conn.is_direct = is_direct; | ||||
|     esp_gatt_create_conn.is_aux = true; | ||||
|     esp_gatt_create_conn.own_addr_type = 0xff; //undefined, will use local value | ||||
|     return esp_ble_gattc_enh_open(gattc_if, esp_gatt_create_conn); | ||||
|     esp_ble_gatt_creat_conn_params_t creat_conn_params; | ||||
|     memcpy(creat_conn_params.remote_bda, remote_bda, ESP_BD_ADDR_LEN); | ||||
|     creat_conn_params.remote_addr_type = remote_addr_type; | ||||
|     creat_conn_params.is_direct = is_direct; | ||||
|     creat_conn_params.is_aux = true; | ||||
|     creat_conn_params.own_addr_type = 0xff; //undefined, will use local value | ||||
|     return esp_ble_gattc_enh_open(gattc_if, &creat_conn_params); | ||||
| } | ||||
| #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user