deviceplug / btleplug

Rust Cross-Platform Host-Side Bluetooth LE Access Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong peripheral name on macOS

Massimiliano-solutiontech opened this issue · comments

Describe the bug
properties.local_name doesn't have the correct name because macOS caches the names

Expected behavior
Have the correct advertised name

Actual behavior
Returning the cached named

Additional context
Below the Swift code working on iOS, iPadOS, but I didn't tested it on macOS

https://developer.apple.com/documentation/corebluetooth/cbcentralmanagerdelegate/1518937-centralmanager

func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String: Any], rssi RSSI: NSNumber) {
    guard let name = advertisementData["kCBAdvDataLocalName"] as? String else { return }
}

I have experience with Swift and iOS development, if you need help to implement that I'll be happy to do so

Any news on that?

I've implemented this and checked if the advertisement data contains the LocalName but no luck.
Connecting to the device upon discovery seems to solve this issue.

Apple forums and GH link regarding this bug:
https://developer.apple.com/forums/thread/654654
https://github.com/ChrisMarshallNY/TestCBIssue