fix: update after api change

This commit is contained in:
Ulf Lilleengen 2024-01-12 08:33:37 +01:00
parent 08126d181a
commit 883b923faf
2 changed files with 15 additions and 18 deletions

View File

@ -11,11 +11,9 @@ use embassy_stm32::rcc::WPAN_DEFAULT;
use embassy_stm32_wpan::hci::host::uart::UartHci; use embassy_stm32_wpan::hci::host::uart::UartHci;
use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
use embassy_stm32_wpan::hci::types::AdvertisingType; use embassy_stm32_wpan::hci::types::AdvertisingType;
use embassy_stm32_wpan::hci::vendor::stm32wb::command::gap::{ use embassy_stm32_wpan::hci::vendor::command::gap::{AdvertisingDataType, DiscoverableParameters, GapCommands, Role};
AdvertisingDataType, DiscoverableParameters, GapCommands, Role, use embassy_stm32_wpan::hci::vendor::command::gatt::GattCommands;
}; use embassy_stm32_wpan::hci::vendor::command::hal::{ConfigData, HalCommands, PowerLevel};
use embassy_stm32_wpan::hci::vendor::stm32wb::command::gatt::GattCommands;
use embassy_stm32_wpan::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel};
use embassy_stm32_wpan::hci::BdAddr; use embassy_stm32_wpan::hci::BdAddr;
use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp;
use embassy_stm32_wpan::TlMbox; use embassy_stm32_wpan::TlMbox;

View File

@ -12,17 +12,17 @@ use embassy_stm32_wpan::hci::event::command::{CommandComplete, ReturnParameters}
use embassy_stm32_wpan::hci::host::uart::{Packet, UartHci}; use embassy_stm32_wpan::hci::host::uart::{Packet, UartHci};
use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
use embassy_stm32_wpan::hci::types::AdvertisingType; use embassy_stm32_wpan::hci::types::AdvertisingType;
use embassy_stm32_wpan::hci::vendor::stm32wb::command::gap::{ use embassy_stm32_wpan::hci::vendor::command::gap::{
AddressType, AuthenticationRequirements, DiscoverableParameters, GapCommands, IoCapability, LocalName, Pin, Role, AddressType, AuthenticationRequirements, DiscoverableParameters, GapCommands, IoCapability, LocalName, Pin, Role,
SecureConnectionSupport, SecureConnectionSupport,
}; };
use embassy_stm32_wpan::hci::vendor::stm32wb::command::gatt::{ use embassy_stm32_wpan::hci::vendor::command::gatt::{
AddCharacteristicParameters, AddServiceParameters, CharacteristicEvent, CharacteristicPermission, AddCharacteristicParameters, AddServiceParameters, CharacteristicEvent, CharacteristicPermission,
CharacteristicProperty, EncryptionKeySize, GattCommands, ServiceType, UpdateCharacteristicValueParameters, Uuid, CharacteristicProperty, EncryptionKeySize, GattCommands, ServiceType, UpdateCharacteristicValueParameters, Uuid,
WriteResponseParameters, WriteResponseParameters,
}; };
use embassy_stm32_wpan::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel}; use embassy_stm32_wpan::hci::vendor::command::hal::{ConfigData, HalCommands, PowerLevel};
use embassy_stm32_wpan::hci::vendor::stm32wb::event::{self, AttributeHandle, Stm32Wb5xEvent}; use embassy_stm32_wpan::hci::vendor::event::{self, command::VendorReturnParameters, AttributeHandle, VendorEvent};
use embassy_stm32_wpan::hci::{BdAddr, Event}; use embassy_stm32_wpan::hci::{BdAddr, Event};
use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp;
use embassy_stm32_wpan::sub::ble::Ble; use embassy_stm32_wpan::sub::ble::Ble;
@ -190,11 +190,11 @@ async fn main(_spawner: Spawner) {
mbox.ble_subsystem.set_discoverable(&discovery_params).await.unwrap(); mbox.ble_subsystem.set_discoverable(&discovery_params).await.unwrap();
} }
Event::Vendor(vendor_event) => match vendor_event { Event::Vendor(vendor_event) => match vendor_event {
Stm32Wb5xEvent::AttReadPermitRequest(read_req) => { VendorEvent::AttReadPermitRequest(read_req) => {
defmt::info!("read request received {}, allowing", read_req); defmt::info!("read request received {}, allowing", read_req);
mbox.ble_subsystem.allow_read(read_req.conn_handle).await mbox.ble_subsystem.allow_read(read_req.conn_handle).await
} }
Stm32Wb5xEvent::AttWritePermitRequest(write_req) => { VendorEvent::AttWritePermitRequest(write_req) => {
defmt::info!("write request received {}, allowing", write_req); defmt::info!("write request received {}, allowing", write_req);
mbox.ble_subsystem mbox.ble_subsystem
.write_response(&WriteResponseParameters { .write_response(&WriteResponseParameters {
@ -206,7 +206,7 @@ async fn main(_spawner: Spawner) {
.await .await
.unwrap() .unwrap()
} }
Stm32Wb5xEvent::GattAttributeModified(attribute) => { VendorEvent::GattAttributeModified(attribute) => {
defmt::info!("{}", ble_context); defmt::info!("{}", ble_context);
if attribute.attr_handle.0 == ble_context.chars.notify.0 + 2 { if attribute.attr_handle.0 == ble_context.chars.notify.0 + 2 {
if attribute.data()[0] == 0x01 { if attribute.data()[0] == 0x01 {
@ -333,7 +333,7 @@ async fn gatt_add_service(ble_subsystem: &mut Ble, uuid: Uuid) -> Result<Attribu
if let Ok(Packet::Event(Event::CommandComplete(CommandComplete { if let Ok(Packet::Event(Event::CommandComplete(CommandComplete {
return_params: return_params:
ReturnParameters::Vendor(event::command::ReturnParameters::GattAddService(event::command::GattService { ReturnParameters::Vendor(VendorReturnParameters::GattAddService(event::command::GattService {
service_handle, service_handle,
.. ..
})), })),
@ -370,11 +370,10 @@ async fn gatt_add_char(
if let Ok(Packet::Event(Event::CommandComplete(CommandComplete { if let Ok(Packet::Event(Event::CommandComplete(CommandComplete {
return_params: return_params:
ReturnParameters::Vendor(event::command::ReturnParameters::GattAddCharacteristic( ReturnParameters::Vendor(VendorReturnParameters::GattAddCharacteristic(event::command::GattCharacteristic {
event::command::GattCharacteristic { characteristic_handle,
characteristic_handle, .. ..
}, })),
)),
.. ..
}))) = response }))) = response
{ {