How to use bluetooth classic instead of le

In reference to Dennis Mathews answer how do you specify bluetooth classic instead of LE on iOS? Is there a different api from Core Bluetooth Framework?


Solution 1:

Joels there is a very clear way to use Bluetooth classic on iOS. It is with the External Accessory framework (it also includes direct hardware connections in addition to Bluetooth classic however).

You need to add the ExternalAccessory.framework and specify "App communicates with an accessory" in the required background modes inside your plist to get started. It should be noted however that with Bluetooth classic, the user must add your Bluetooth device from the System Bluetooth settings. It is only with Bluetooth LE that we are able to add devices from the app side.

Check out the docs on the External Accessory Framework

In response to your question regarding the MFi program, this should clarify:

I want to develop an iOS app that communicates with an MFi accessory. Do I need to join the MFi Program? No. iOS app developers do not need to join the MFi Program. Everything app developers need is in the External Accessory Framework, which is provided in the iOS SDK. To access the iOS SDK, please join the iOS Developer Program: https://developer.apple.com/programs/ios/.

If you'd like to learn more, consult the MFi FAQ

Solution 2:

If your external accessory doesn't need high bandwidth in the connection to iOS, and you wish to use (or must use) 2.x/classic BT, (instead of 4.x/LE/Smart, which is very low bandwidth but requires no MFi dancing) you may be able to communicate by emulating a BT HID keyboard in your accessory.

It's hardly optimal, especially since the HID reverse channel is pretty limited (I think to things like lighting the caps lock key in the basic keyboard configuration (HID page 7 mapping, if I recall correctly.) OTOH, if your primary task is to push data to the iOS device, sending the data as keystrokes would not be too awful. (and might even be seen as virtue during testing :)

HID devices can declare additional capabilities in table defined keymaps, but I'm not sure if an iOS app can get at those alternate mappings with sanctioned APIs.