What's the difference between the CoreBluetooth and ExternalAccessory frameworks?
Asked Answered
E

2

11

Apple provides the following two frameworks for communicating with nearby Bluetooth devices with iOS.

CoreBluetooth:

The Core Bluetooth framework provides the classes needed for your iOS and Mac apps to communicate with devices that are equipped with Bluetooth low energy wireless technology.

ExternalAccessory:

The External Accessory framework provides support for communicating with external hardware connected to an iOS-based device through either the Apple Lightning or 30-pin connector, or wirelessly using Bluetooth.

I have previously used the CoreBluetooth framework to successfully communicate with Bluetooth devices. However, I am now trying to communicate with a Bluetooth printer and it doesn't show up in the scan for nearby devices. Using the ExternalAccessory framework, it does.

How do these two frameworks differ as far as communicating with Bluetooth devices is concerned? Why do different Bluetooth devices require the use of different frameworks?

Eudoca answered 12/12, 2016 at 0:23 Comment(0)
M
6

There are two kinds of Bluetooth, Bluetooth LE which is very limited in bandwidth but that doesn't require any user pairing in the settings app and Bluetooth Classic, which requires the user to pair the device but gives you more functionality and bandwidth. CoreBluetooth supports Bluetooth LE and you can use it with a developer account. Bluetooth Classic requires that you join the Apple MFi program.

Marlyn answered 12/12, 2016 at 1:12 Comment(3)
I think I understand. So classic bluetooth devices won't show in CoreBluetooth's scan, even after pairing with them through Settings? And is joining the MFi program a legal requirement for all apps that communicate with classic bluetooth devices, or only if you want to look "authentic" and publish to the app store?Eudoca
If you aren't going to publish your app then you can use the external accessory framework to connect to the device.It
for external accessory: is the protocol key in info.plist also necessary if I don't want to publish it on the app store?Yearning
I
5

Core Bluetooth only allows you to communicate with Bluetooth Low Energy devices using the GATT profile.

The External Accessory framework allows communication with 'legacy' Bluetooth devices using profiles such as the Serial Port Protocol (SPP). In order to communicate with devices using the External Accessory framework, the device must be certified under the MFi program.

I also believe that in order to get an app that can communicate with with an MFi device using the External Accessory Framework approved, the MFi licensee (i.e. the printer vendor) needs to provide some paperwork to authorise your app.

It answered 12/12, 2016 at 0:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.