4

I've looked over the IOBluetooth framework what feels like a dozen times, but I can't for the life of me find a way to retrieve the Bluetooth device address for the current device. I've written an application that scans for devices in range utilizing IOBluetoothDeviceInquiry, but this doesn't seem to offer up the address of the device doing the scanning.

How might this be accomplished programatically? (Without opening up System Profiler)

1 Answers1

7
[[IOBluetoothHostController defaultController] addressAsString]

or getAddress: if you want a BluetoothDeviceAddress.

LaC
  • 12,624
  • 5
  • 39
  • 38
  • 1
    You're welcome! BTW, when you get a satisfying answer, you should click the checkmark besides it to accept it. – LaC Jul 12 '11 at 03:35
  • Done! Sorry I'm a little late, I'm also a little new to StackOverflow – Oscar McDonald Aug 08 '11 at 03:48
  • I don't see a `getAddress:` in `IOBluetoothHostController.h`. I'd rather deal with a `BluetoothDeviceAddress` instead of a formatted `NSString`. Any suggestions? – Ford Sep 03 '12 at 19:34
  • Not perfect, but `IOBluetoothNSStringToDeviceAddress` will parse an NSString like @"00-00-00-00-00-00" into a `BluetoothDeviceAddress`. – Ford Sep 04 '12 at 01:36