aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32wb/src/bin/gatt_server.rs
diff options
context:
space:
mode:
authorUlf Lilleengen <[email protected]>2024-01-12 08:33:37 +0100
committerUlf Lilleengen <[email protected]>2024-01-12 08:33:37 +0100
commit883b923fafc41a23c2ae7a3d26b93992e2726523 (patch)
tree8bb757328503e27b40ca33f44599caef47c54b3b /examples/stm32wb/src/bin/gatt_server.rs
parent08126d181a494e80bdd0e495f157445e15cfeb23 (diff)
fix: update after api change
Diffstat (limited to 'examples/stm32wb/src/bin/gatt_server.rs')
-rw-r--r--examples/stm32wb/src/bin/gatt_server.rs25
1 files changed, 12 insertions, 13 deletions
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}
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::{self, command::VendorReturnParameters, AttributeHandle, VendorEvent};
26use embassy_stm32_wpan::hci::{BdAddr, Event}; 26use embassy_stm32_wpan::hci::{BdAddr, Event};
27use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; 27use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp;
28use embassy_stm32_wpan::sub::ble::Ble; 28use 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 {