Services Listed With No Service Data
ztroop opened this issue · comments
Hello!
I can identify services while scanning but the service_data
field doesn't appear to be populated. Is this potentially a case where the platform is limiting functionality of the library? Appreciate any input on this.
I'm using a Mac M2, btleplug = "0.11"
.
...
central.start_scan(ScanFilter::default()).await?;
let mut events = central.events().await?;
while let Some(event) = events.next().await {
if let CentralEvent::DeviceDiscovered(id) = event {
if let Ok(device) = central.peripheral(&id).await {
let properties = device
.properties()
.await?
.unwrap_or(PeripheralProperties::default());
if properties.services.len() > 0 {
println!("Services: {:?}", properties.services);
// Services: [b42e1c08-ade7-11e4-89d3-123b93f75cba]
println!("Service Data: {:?}", properties.service_data);
// No data.
}
...
The services
property contains the UUIDs of the services that the device advertises it supports. However, service_data
refers to specific data associated with these services and may be advertised separately. Not all devices that advertise service UUIDs also advertise service data in their advertisement packets. A connection is required to get services and characteristics.