diff options
| -rw-r--r-- | examples/stm32wb/src/bin/eddystone_beacon.rs | 8 | ||||
| -rw-r--r-- | examples/stm32wb/src/bin/gatt_server.rs | 25 |
2 files changed, 15 insertions, 18 deletions
diff --git a/examples/stm32wb/src/bin/eddystone_beacon.rs b/examples/stm32wb/src/bin/eddystone_beacon.rs index cf9a5aa28..d3b3c15ca 100644 --- a/examples/stm32wb/src/bin/eddystone_beacon.rs +++ b/examples/stm32wb/src/bin/eddystone_beacon.rs | |||
| @@ -11,11 +11,9 @@ use embassy_stm32::rcc::WPAN_DEFAULT; | |||
| 11 | use embassy_stm32_wpan::hci::host::uart::UartHci; | 11 | use embassy_stm32_wpan::hci::host::uart::UartHci; |
| 12 | use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; | 12 | use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; |
| 13 | use embassy_stm32_wpan::hci::types::AdvertisingType; | 13 | use embassy_stm32_wpan::hci::types::AdvertisingType; |
| 14 | use embassy_stm32_wpan::hci::vendor::stm32wb::command::gap::{ | 14 | use embassy_stm32_wpan::hci::vendor::command::gap::{AdvertisingDataType, DiscoverableParameters, GapCommands, Role}; |
| 15 | AdvertisingDataType, DiscoverableParameters, GapCommands, Role, | 15 | use embassy_stm32_wpan::hci::vendor::command::gatt::GattCommands; |
| 16 | }; | 16 | use embassy_stm32_wpan::hci::vendor::command::hal::{ConfigData, HalCommands, PowerLevel}; |
| 17 | use embassy_stm32_wpan::hci::vendor::stm32wb::command::gatt::GattCommands; | ||
| 18 | use embassy_stm32_wpan::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel}; | ||
| 19 | use embassy_stm32_wpan::hci::BdAddr; | 17 | use embassy_stm32_wpan::hci::BdAddr; |
| 20 | use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; | 18 | use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; |
| 21 | use embassy_stm32_wpan::TlMbox; | 19 | use embassy_stm32_wpan::TlMbox; |
diff --git a/examples/stm32wb/src/bin/gatt_server.rs b/examples/stm32wb/src/bin/gatt_server.rs index 5ce620350..0dfe0ed09 100644 --- a/examples/stm32wb/src/bin/gatt_server.rs +++ b/examples/stm32wb/src/bin/gatt_server.rs | |||
| @@ -12,17 +12,17 @@ use embassy_stm32_wpan::hci::event::command::{CommandComplete, ReturnParameters} | |||
| 12 | use embassy_stm32_wpan::hci::host::uart::{Packet, UartHci}; | 12 | use embassy_stm32_wpan::hci::host::uart::{Packet, UartHci}; |
| 13 | use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; | 13 | use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; |
| 14 | use embassy_stm32_wpan::hci::types::AdvertisingType; | 14 | use embassy_stm32_wpan::hci::types::AdvertisingType; |
| 15 | use embassy_stm32_wpan::hci::vendor::stm32wb::command::gap::{ | 15 | use embassy_stm32_wpan::hci::vendor::command::gap::{ |
| 16 | AddressType, AuthenticationRequirements, DiscoverableParameters, GapCommands, IoCapability, LocalName, Pin, Role, | 16 | AddressType, AuthenticationRequirements, DiscoverableParameters, GapCommands, IoCapability, LocalName, Pin, Role, |
| 17 | SecureConnectionSupport, | 17 | SecureConnectionSupport, |
| 18 | }; | 18 | }; |
| 19 | use embassy_stm32_wpan::hci::vendor::stm32wb::command::gatt::{ | 19 | use embassy_stm32_wpan::hci::vendor::command::gatt::{ |
| 20 | AddCharacteristicParameters, AddServiceParameters, CharacteristicEvent, CharacteristicPermission, | 20 | AddCharacteristicParameters, AddServiceParameters, CharacteristicEvent, CharacteristicPermission, |
| 21 | CharacteristicProperty, EncryptionKeySize, GattCommands, ServiceType, UpdateCharacteristicValueParameters, Uuid, | 21 | CharacteristicProperty, EncryptionKeySize, GattCommands, ServiceType, UpdateCharacteristicValueParameters, Uuid, |
| 22 | WriteResponseParameters, | 22 | WriteResponseParameters, |
| 23 | }; | 23 | }; |
| 24 | use embassy_stm32_wpan::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel}; | 24 | use embassy_stm32_wpan::hci::vendor::command::hal::{ConfigData, HalCommands, PowerLevel}; |
| 25 | use embassy_stm32_wpan::hci::vendor::stm32wb::event::{self, AttributeHandle, Stm32Wb5xEvent}; | 25 | use embassy_stm32_wpan::hci::vendor::event::{self, command::VendorReturnParameters, AttributeHandle, VendorEvent}; |
| 26 | use embassy_stm32_wpan::hci::{BdAddr, Event}; | 26 | use embassy_stm32_wpan::hci::{BdAddr, Event}; |
| 27 | use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; | 27 | use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; |
| 28 | use embassy_stm32_wpan::sub::ble::Ble; | 28 | use embassy_stm32_wpan::sub::ble::Ble; |
| @@ -190,11 +190,11 @@ async fn main(_spawner: Spawner) { | |||
| 190 | mbox.ble_subsystem.set_discoverable(&discovery_params).await.unwrap(); | 190 | mbox.ble_subsystem.set_discoverable(&discovery_params).await.unwrap(); |
| 191 | } | 191 | } |
| 192 | Event::Vendor(vendor_event) => match vendor_event { | 192 | Event::Vendor(vendor_event) => match vendor_event { |
| 193 | Stm32Wb5xEvent::AttReadPermitRequest(read_req) => { | 193 | VendorEvent::AttReadPermitRequest(read_req) => { |
| 194 | defmt::info!("read request received {}, allowing", read_req); | 194 | defmt::info!("read request received {}, allowing", read_req); |
| 195 | mbox.ble_subsystem.allow_read(read_req.conn_handle).await | 195 | mbox.ble_subsystem.allow_read(read_req.conn_handle).await |
| 196 | } | 196 | } |
| 197 | Stm32Wb5xEvent::AttWritePermitRequest(write_req) => { | 197 | VendorEvent::AttWritePermitRequest(write_req) => { |
| 198 | defmt::info!("write request received {}, allowing", write_req); | 198 | defmt::info!("write request received {}, allowing", write_req); |
| 199 | mbox.ble_subsystem | 199 | mbox.ble_subsystem |
| 200 | .write_response(&WriteResponseParameters { | 200 | .write_response(&WriteResponseParameters { |
| @@ -206,7 +206,7 @@ async fn main(_spawner: Spawner) { | |||
| 206 | .await | 206 | .await |
| 207 | .unwrap() | 207 | .unwrap() |
| 208 | } | 208 | } |
| 209 | Stm32Wb5xEvent::GattAttributeModified(attribute) => { | 209 | VendorEvent::GattAttributeModified(attribute) => { |
| 210 | defmt::info!("{}", ble_context); | 210 | defmt::info!("{}", ble_context); |
| 211 | if attribute.attr_handle.0 == ble_context.chars.notify.0 + 2 { | 211 | if attribute.attr_handle.0 == ble_context.chars.notify.0 + 2 { |
| 212 | if attribute.data()[0] == 0x01 { | 212 | if attribute.data()[0] == 0x01 { |
| @@ -333,7 +333,7 @@ async fn gatt_add_service(ble_subsystem: &mut Ble, uuid: Uuid) -> Result<Attribu | |||
| 333 | 333 | ||
| 334 | if let Ok(Packet::Event(Event::CommandComplete(CommandComplete { | 334 | if let Ok(Packet::Event(Event::CommandComplete(CommandComplete { |
| 335 | return_params: | 335 | return_params: |
| 336 | ReturnParameters::Vendor(event::command::ReturnParameters::GattAddService(event::command::GattService { | 336 | ReturnParameters::Vendor(VendorReturnParameters::GattAddService(event::command::GattService { |
| 337 | service_handle, | 337 | service_handle, |
| 338 | .. | 338 | .. |
| 339 | })), | 339 | })), |
| @@ -370,11 +370,10 @@ async fn gatt_add_char( | |||
| 370 | 370 | ||
| 371 | if let Ok(Packet::Event(Event::CommandComplete(CommandComplete { | 371 | if let Ok(Packet::Event(Event::CommandComplete(CommandComplete { |
| 372 | return_params: | 372 | return_params: |
| 373 | ReturnParameters::Vendor(event::command::ReturnParameters::GattAddCharacteristic( | 373 | ReturnParameters::Vendor(VendorReturnParameters::GattAddCharacteristic(event::command::GattCharacteristic { |
| 374 | event::command::GattCharacteristic { | 374 | characteristic_handle, |
| 375 | characteristic_handle, .. | 375 | .. |
| 376 | }, | 376 | })), |
| 377 | )), | ||
| 378 | .. | 377 | .. |
| 379 | }))) = response | 378 | }))) = response |
| 380 | { | 379 | { |
