2

This question has already been asked on Stack Overflow in 2013, but it is in need of an update. Functionality of Core Bluetooth for macOS was changed to bring it more in line with iOS since macOS 10.13.

The answers in that question are

CoreBluetooth is an iOS framework for Bluetooth LE communication. IOBluetooth is an OS X framework

This is not true anymore, Core Bluetooth is not exclusively an iOS framework, though IOBluetooth is exclusive to macOS

CoreBluetooth is for accessing Bluetooth Low Energy APIs. and IOBluetooth is for Bluetooth Classic Interface

This is also not true as Core Bluetooth is not exclusively for BLE.

CoreBluetooth documentation states:

Communicate with Bluetooth low energy and BR/EDR (“Classic”) Devices.

which seems straight forward; Core Bluetooth is used for Bluetooth comms, both BLE and Classic.

IOBluetooth documentation states:

Gain user-space access to Bluetooth devices.

but this is not particularly enlightening.

In the age of CoreBluetooth on macOS 10.13+, what is the primary modern use case of IOBluetooth vs CoreBluetooth on macOS?

fdcpp
  • 1,677
  • 1
  • 14
  • 25
  • The answer you linked is still correct. What do you believe needs updating? Core Bluetooth still handles BLE, and IOBluetooth offers access to some of the "classic" protocols. Do you have a specific question about these frameworks? – Rob Napier Aug 15 '21 at 17:35
  • @RobNapier It’s tricky, as there is little in way of a digest on IOBluetooth. You can advertise and connect to devices from Core Bluetooth for both BLE and Classic. What does IOBluetooth primarily make easier? – fdcpp Aug 15 '21 at 17:39
  • Answered, but IOBluetooth is still an OS X (macOS) framework. CoreBluetooth is still for accessing BLE, with a small number of additions that relate closely to BLE even if they touch on classic slightly, and IOBluetooth is still for classic. There have beens some improvements, but I don't think things have changed as radically as you may be thinking. – Rob Napier Aug 15 '21 at 18:00

1 Answers1

6

CoreBluetooth supports BLE, GATT over BR/EDR, and L2CAP. Despite it's summary, it does not support most classic profiles. In particular, it only supports GATT over BR/EDR. It does not support other protocols. (GATT over BR/EDR is pretty rare in my experience. I've never encountered a device that actually supports it.) It does not support SDP and cannot be used to discover most classic devices.

IOBluetooth supports various classic protocols including SDP, RFCOMM, and L2CAP. It supports things like audio and HCI devices. It doesn't directly support BLE to my knowledge; it embeds CoreBluetooth for that. (I believe it can do some very low-level discovery of BLE, but it's not what you'd want to use.)

I don't believe this has radically changed in 10.13. What mostly changed (mostly I think to support Catalyst) is that Core Bluetooth was made more uniform between the platforms. I don't think this radically changed what the frameworks are used for.

Rob Napier
  • 286,113
  • 34
  • 456
  • 610
  • Those first two paragraphs! that’s it, that’s the kicker. If you have citations for those that sums it up so succinctly then I‘ll eat all my down-votes with gusto. If not, then I will die on this hill. Either way, as always you’re invaluable Rob Napier, thank you. – fdcpp Aug 15 '21 at 18:03
  • 1
    Probably the most useful are the "What's New in Core Bluetooth" videos, though some have unfortunately have been taken down. (I hate that Apple does that; they don't document this anywhere else.) https://developer.apple.com/videos/play/wwdc2019/901/ You can search for the ones they've deleted at asciiwwdc.com which has some good stuff. They've never documented IOBluetooth very well, though. They assume you know exactly what you're looking for already. I've built some simple things with it, but it's a real pain and I don't have a good source of docs. – Rob Napier Aug 15 '21 at 18:16