mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	fix: Fix broken bluetooth_proxy and ble_clients after BLE enable/disable (#5704)
This commit is contained in:
		
				
					committed by
					
						 Jesse Hills
						Jesse Hills
					
				
			
			
				
	
			
			
			
						parent
						
							c40519ec6f
						
					
				
				
					commit
					29aa15b253
				
			| @@ -20,7 +20,14 @@ static const esp_bt_uuid_t NOTIFY_DESC_UUID = { | |||||||
| void BLEClientBase::setup() { | void BLEClientBase::setup() { | ||||||
|   static uint8_t connection_index = 0; |   static uint8_t connection_index = 0; | ||||||
|   this->connection_index_ = connection_index++; |   this->connection_index_ = connection_index++; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void BLEClientBase::loop() { | ||||||
|  |   if (!esp32_ble::global_ble->is_active()) { | ||||||
|  |     this->set_state(espbt::ClientState::INIT); | ||||||
|  |     return; | ||||||
|  |   } | ||||||
|  |   if (this->state_ == espbt::ClientState::INIT) { | ||||||
|     auto ret = esp_ble_gattc_app_register(this->app_id); |     auto ret = esp_ble_gattc_app_register(this->app_id); | ||||||
|     if (ret) { |     if (ret) { | ||||||
|       ESP_LOGE(TAG, "gattc app register failed. app_id=%d code=%d", this->app_id, ret); |       ESP_LOGE(TAG, "gattc app register failed. app_id=%d code=%d", this->app_id, ret); | ||||||
| @@ -28,8 +35,6 @@ void BLEClientBase::setup() { | |||||||
|     } |     } | ||||||
|     this->set_state(espbt::ClientState::IDLE); |     this->set_state(espbt::ClientState::IDLE); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| void BLEClientBase::loop() { |  | ||||||
|   // READY_TO_CONNECT means we have discovered the device |   // READY_TO_CONNECT means we have discovered the device | ||||||
|   // and the scanner has been stopped by the tracker. |   // and the scanner has been stopped by the tracker. | ||||||
|   if (this->state_ == espbt::ClientState::READY_TO_CONNECT) { |   if (this->state_ == espbt::ClientState::READY_TO_CONNECT) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user