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