linux: include IsRandom bit in Address type
Unlike what I previously thought, BlueZ does expose it. Unfortunately it doesn't seem to respect it: the bit is not included in D-Bus paths. Windows also supports the bit, which I hope to fix in a future commit. Like BlueZ, it appears to ignore it when connecting to a device.
This commit is contained in:
parent
6c7d25c022
commit
8129f7e092
3 changed files with 8 additions and 4 deletions
|
@ -1,5 +1,8 @@
|
|||
// +build !baremetal
|
||||
|
||||
// Some documentation for the BlueZ D-Bus interface:
|
||||
// https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc
|
||||
|
||||
package bluetooth
|
||||
|
||||
import (
|
||||
|
|
2
gap.go
2
gap.go
|
@ -54,8 +54,6 @@ type Address struct {
|
|||
// random. Sometimes, it contains a hash.
|
||||
// For more information:
|
||||
// https://www.novelbits.io/bluetooth-address-privacy-ble/
|
||||
//
|
||||
// This field is unused under Windows and Linux.
|
||||
IsRandom bool
|
||||
}
|
||||
|
||||
|
|
|
@ -163,8 +163,11 @@ func makeScanResult(dev *device.Device1) ScanResult {
|
|||
}
|
||||
|
||||
return ScanResult{
|
||||
RSSI: dev.Properties.RSSI,
|
||||
Address: Address{addr, false}, // the 'IsRandom' bit is not supported
|
||||
RSSI: dev.Properties.RSSI,
|
||||
Address: Address{
|
||||
MAC: addr,
|
||||
IsRandom: dev.Properties.AddressType == "random",
|
||||
},
|
||||
AdvertisementPayload: &advertisementFields{
|
||||
AdvertisementFields{
|
||||
LocalName: dev.Properties.Name,
|
||||
|
|
Loading…
Reference in a new issue