Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/configs/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ CONFIG_ETH_SPI_ETHERNET_DM9051=y
CONFIG_ETH_SPI_ETHERNET_W5500=y
CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL=y

# We don't have an example for classic BT - yet - we need to enable class BT
# specifically to workaround this bug in ESP IDF v5.2 (fixed in ESP IDF v5.2.1+):
# We need to enable class specifically to workaround this bug in ESP IDF v5.2 (fixed in ESP IDF v5.2.1+):
# https://github.com/espressif/esp-idf/issues/13113
# And, required for BT Classic examples
CONFIG_BT_CLASSIC_ENABLED=y

# BLE with Bluedroid
CONFIG_BT_ENABLED=y
CONFIG_BT_BLUEDROID_ENABLED=y
# Dual mode needed for SPP demo
# Dual mode needed for SPP demo
CONFIG_BTDM_CTRL_MODE_BLE_ONLY=n
CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n
CONFIG_BTDM_CTRL_MODE_BTDM=y
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/.vscode
/.zed
/.espressif
/.embuild
/target
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Breaking
- BT: `BtDriver::set_device_name` deprecated and not available with ESP-IDF 6.0+. Use the new `EspGap::set_device_name` instead
or the existing `EspBleGap::set_device_name`
- BT: `BleGapEvent::ScanResult` is now a struct instead of a wrapper around esp_ble_gap_cb_param_t_ble_scan_result_evt_param
- Implement MQTT outbox limit and get_outbox_size()
- Added argument `subprotocol_list` to `ws_handler` to allow subprotocols to be supported by WebSockets
- Thread enhancements (#592). Specifically:
Expand All @@ -29,6 +30,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `WifiDriver::get_ap_info` not takes `&self` instead of `&mut self`. Convenience method `EspWifi::get_ap_info` that delegates
to `WifiDriver::get_ap_info`
- BT: Fix BLE not working on the s3 and with ESP-IDF 5.3+
- BT: Fix `bt_gatt_server` example not allowing reconnect after client connect (#553) and handle sububscribe/unsubscribe to indications
- BT: Fix `EspBleGap::set_security_conf` not setting auth_req_mode, and returning ESP_ERR_INVALID_ARG when setting key sizes
- Fix wrong conversion from `ScanType` to `u32` in Wi-Fi configuration
- Fix wrong BT configuration version on the c6 (issue #556)
- Fix inconsistent mutability in NVS (#567)
Expand All @@ -46,10 +49,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- OTA: New method - `EspFirmwareInfoLoad::fetch_native` - returning the full native ESP-IDF image descriptor structures
- Added `use_serde` feature, which enables the `use_serde` feature of `embedded-svc` crate, allowing to deserialize configuration structs.
- OTA: Allow specifying image size to speed up erase
- Bluetooth: New methods `EspBleGap::start_scanning` and `EspBleGap::stop_scanning`
- Bluetooth: New methods `EspBleGap::set_scan_params`, `EspBleGap::start_scanning`, `EspBleGap::stop_scanning`,
`EspBleGap::resolve_adv_data_by_type`, `EspBleGap::disconnect` and `gatt::set_local_mtu`
- Bluetooth: New BLE Gatt Client `EspGattc`
- Bluetooth Classic: Added Serial Port Profile, `spp`
- New example, `bt_spp_acceptor` to demonstrate usage of bt classic spp profile
- New example, `bt_ble_gap_scanner` to demonstrate usage of added ble scanning methods
- New example, `bt_gatt_client` to demonstrate usage of added ble gatt client
- New example, `mdns_advertise` to demonstrate mDNS service advertisement
- NVS: Implemented `RawHandle` for `EspNvs<NvsDefault>`
- NVS: Added `EspNvs::erase_all` to remove all data stored in an nvs namespace
Expand Down
10 changes: 7 additions & 3 deletions examples/bt_ble_gap_scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ mod example {
use core::hash::{Hash, Hasher};
use std::sync::{Arc, Mutex};

use esp_idf_svc::bt::ble::gap::{BleGapEvent, EspBleGap};
use esp_idf_svc::bt::ble::gap::{BleGapEvent, EspBleGap, GapSearchEvent, GapSearchResult};
use esp_idf_svc::bt::{BdAddr, Ble, BtDriver};
use esp_idf_svc::hal::delay::FreeRtos;
use esp_idf_svc::hal::peripherals::Peripherals;
Expand Down Expand Up @@ -135,9 +135,13 @@ mod example {
fn on_gap_event(&self, event: BleGapEvent) -> Result<(), EspError> {
trace!("Got event: {event:?}");

if let BleGapEvent::ScanResult(result) = event {
if let BleGapEvent::ScanResult(GapSearchEvent::InquiryResult(GapSearchResult {
bda,
..
})) = event
{
let mut state = self.state.lock().unwrap();
let address = BluetoothAddress(BdAddr::from_bytes(result.bda));
let address = BluetoothAddress(bda);
match state.discovered.insert(address) {
Ok(true) => info!("Discovered new device {address}"),
Err(_) => warn!("Error while storing address: {address}"),
Expand Down
Loading