btleplug icon indicating copy to clipboard operation
btleplug copied to clipboard

Get Adapter Mac Address

Open DanielHabenicht opened this issue 7 months ago • 3 comments

Feature Description

To know which adapter is selected / select the right adapter it would be great to be able to access its mac address. As adapter_info should not be relied on.

Example:

impl Central for Adapter {
    async fn adapter_mac(&self) -> Result<BDAddr> {
        // Get actual adapter address...
        Ok(BDAddr::from("B8:27:EB:7C:51:30"))
    }
}

DanielHabenicht avatar May 18 '25 11:05 DanielHabenicht

Welp, yet another "not gonna work on all our platforms" issue. Android just gives everyone 02:00:00:00:00:00 for security reasons (this is a fingerprintable address after all). I'm guessing iOS just straight up bans access to it, wouldn't be surprised if macOS is the same. So we've gotta figure out what that's going to look like on the two platforms you didn't provide solutions for before we can do this.

qdot avatar May 18 '25 19:05 qdot

Sorry ;D

We could document it in the Readme and just give back 02:00:00:00:00:00 or 00:00:00:00:00:00 instead of the todo!. I mean if it is banned by the platform itself there is probably no a workaround available and if it is it would (hopefully) be patched...

DanielHabenicht avatar May 19 '25 07:05 DanielHabenicht

If you got control over the BLE service itself, you can add a service yourself which you can query for it's address

Fristi avatar Jul 07 '25 14:07 Fristi