none
Bluetooth Address Public or Random RRS feed

  • Question

  • Hello,

    I've managed to see advertising devices with a BluetoothLEAdvertisementWatcher. Now I want to extract the MAC address of the advertising device. In Bluetooth LE, the address is 48 bit long and either of type public, or random. The public/random information is contained in the TxAdd field of the PDU header. I’ve managed to find the correct 48 address bits in the 64 bits returned by BluetoothLEAdvertisementReceivedEventArgs::get_BluetoothAddress(). But where do I find the random / public information?

    thanks in advance and kind regards,

    Torsten

    Wednesday, September 27, 2017 12:38 PM

Answers

  • The BluetoothLEAdvertisementReceivedEventArgs doesn't have the BluetoothAddressType enum as a property.  Instead you'll need to get the BluetoothLEDevice object that using the address. This should work from v10.0.10586.0 forward.
    Wednesday, September 27, 2017 7:40 PM
  • Construction of that object doesn't necessarily create a connection. On Windows we don't allow apps to control connections, we perform the connecting and disconnecting when needed. The address and baseband are the two elements that are used as the primary key for the device not the type of address. The type is used for other purposes like when bonded knowing to resolve it. Our own code uses this strategy. If you have actual issues let me know. Also I agree it would be nice to have the property on the ad itself. It or the device object.
    Wednesday, September 27, 2017 10:14 PM

All replies

  • The BluetoothLEAdvertisementReceivedEventArgs doesn't have the BluetoothAddressType enum as a property.  Instead you'll need to get the BluetoothLEDevice object that using the address. This should work from v10.0.10586.0 forward.
    Wednesday, September 27, 2017 7:40 PM
  • Hi Frank,

    thanks again, for the fast response. So I have to connect the device, to get access to the address type, right? If so, this would sound like a bug to me, as one would need the address and address type to be able to connect to the device. In the (very theoretical) case when two devices with the same address, but different address types are discovered, it would be impossible to choose between them.

    kind regards,

    Torsten

    Wednesday, September 27, 2017 9:30 PM
  • Construction of that object doesn't necessarily create a connection. On Windows we don't allow apps to control connections, we perform the connecting and disconnecting when needed. The address and baseband are the two elements that are used as the primary key for the device not the type of address. The type is used for other purposes like when bonded knowing to resolve it. Our own code uses this strategy. If you have actual issues let me know. Also I agree it would be nice to have the property on the ad itself. It or the device object.
    Wednesday, September 27, 2017 10:14 PM