22

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?

Community
  • 1
  • 1
joels
  • 6,153
  • 10
  • 47
  • 83
  • No, there is not. Bluetooth classic is not supported. – borrrden Aug 13 '13 at 16:18
  • Thanks. Can you make it an answer so I can choose it please? – joels Aug 13 '13 at 16:32
  • Technical Q&A QA1657: Using External Accessory framework with Bluetooth devices. Q: I understand that the External Accessory framework in iOS 3.0 and later will allow my application to communicate with Bluetooth devices. So why doesn't my application see the Bluetooth accessory sitting next to my iPhone? – joels Aug 14 '13 at 05:39
  • 1
    A: The ExternalAccessoryframework is designed to allow iOS applications to communicate only with hardware accessories that are developed under Apple's MFi licensee program MFi compliant accessories can be implemented as wired devices, meaning they plug in to the iOS device's 30-pin connector, or as wireless devices, whereby they use Bluetooth as the communication channel. Either way, an application that uses the External Accessory framework will not be notified of an accessory's presence unless the accessory identifies itself as being MFi compliant – joels Aug 14 '13 at 05:40
  • @joels I am facing the same problem , were you able to use BT classic ? – user844541 Feb 19 '14 at 15:19

2 Answers2

25

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

Tommy Devoy
  • 13,279
  • 3
  • 46
  • 75
  • 1
    That means my bluetooth device has to be MFI certified though, right? – joels Aug 13 '13 at 17:08
  • In short NO. Unless you're making the hardware and want technical specifications or want to be able to put the MFi logo on your packaging etc. Check out my edit – Tommy Devoy Aug 13 '13 at 17:23
  • No problem! Hope your project goes great – Tommy Devoy Aug 13 '13 at 19:11
  • 2
    I was hoping to work with non MFI, but as all the docs say, it only works with MFI accessories :( – joels Aug 14 '13 at 05:41
  • @joels There are several profiles that do not need MFi: MAP, HFP, A2DP... but RFCOMM requires MFi, for sure. – allprog Aug 14 '13 at 20:28
  • @allprog Great. What does all that stand for? – joels Aug 15 '13 at 00:15
  • @joels Sorry. Take a look at this: http://en.wikipedia.org/wiki/Bluetooth_profile – allprog Aug 15 '13 at 07:31
  • @tdevoy - Any accessory that communicates via the External Accessory Framework must be MFi-approved. The ones that don't require approval are audio accessories, etc. that are handled at a system level, not via the External Accessory framework. – Brad Larson Aug 15 '13 at 18:37
  • @BradLarson is it possible that an iOS developer can make an app that utilizes an MFi approved accessory, although created by someone else? – Tommy Devoy Aug 15 '13 at 19:19
  • 1
    @tdevoy - The accessory and company making the accessory must be MFi approved, but anyone else can target that accessory once it's on the market. You don't need to be in the MFi program to develop applications that target an MFi-approved device (as stated in the quoted language you have above). – Brad Larson Aug 15 '13 at 19:24
  • @BradLarson okay awesome that was how I was reading it too. Well hopefully the OP might be looking to do something like that – Tommy Devoy Aug 15 '13 at 20:44
  • @BradLarson I am designing an App integrating with in house Standard BT Hardware (A Gumstix board), which is not yet MFi approved. I do not intend to get this app on the App store. Can I get started with the software development (Using the ExternalAccessory Framework) or will I need to get my hardware approved even before starting? Also, will I be required to make Hardware/ SW changes to the Gumstix to make it talk to the iPhone? – TanB Jan 07 '14 at 21:41
  • 2
    @TanB - A non-LE Bluetooth device needs to be MFi-approved to be used with the External Accessory framework (it needs to use a specific Apple chip and a proprietary communication protocol). You won't be able to build applications to access this device unless it either uses the more open Bluetooth LE or has this chip in it for standard Bluetooth. There might be ways to do this via jailbreak, but pretty much everyone I know has moved over to Bluetooth LE. – Brad Larson Jan 07 '14 at 21:49
  • @BradLarson I thought with ExternalAccessory Framework, you did not need MFi provided you are only going to be using Standard BT profiles such as HFP, A2DP etc. This is based on the apple documentation at https://mfi.apple.com/MFiWeb/getFAQ.action "Non-electronic cases and accessories which do not use MFi licensed technology (e.g., Bluetooth Low Energy or standard Bluetooth profiles supported by iOS) are not part of the MFi Program." Am I missing something? – TanB Jan 08 '14 at 02:46
  • 2
    @TanB - Anything that uses a standard Bluetooth (non-LE) profile is handled at the OS level, not the application level. For example, Bluetooth headsets are paired and sent audio by the system, but your application isn't even really aware the connection has been made. You can't work with them via the External Accessory framework, as that's only for MFi devices. The list of supported standard profiles is restricted to audio, keyboards, and a few other things, and probably won't cover your Gumstix board. – Brad Larson Jan 08 '14 at 15:13
  • This link shows a list of the supported profiles. The iOS device will not pair with a device using a profile that is not on the list. http://ipod.about.com/od/ipodiphonehardwareterms/qt/Iphone-Bluetooth-Support-Details.htm – Cliff Harris Jan 28 '14 at 02:59
  • Here is the list of supported protocols from Apple: http://support.apple.com/en-us/HT3647 – ThomasW Jan 20 '15 at 09:25
  • @BradLarson To be clear, if I have an accessory using one of the standard non-LE BT profiles and want to pair with it from the app, the device needs to be MFi approved, right? Or is it not possible at all to have the app triggering the pairing (even if it's MFi approved)? – Ixx May 29 '19 at 14:26
  • 1
    @Ixx - It's been a long while, so things may have changed, but it was my understanding that standard-profile non-LE Bluetooth devices can pair and be compatible without being MFi-approved. If you want to use a nonstandard profile, they do need to be approved (unless working with BTLE). Pairing for non-LE devices was at the OS level, not application level (BTLE devices can be paired in-application). All this may have changed in the years since, or I may be misremembering details, however. – Brad Larson May 29 '19 at 14:33
  • @BradLarson Thanks. Yes, the question is specifically about BT classic pairing at app (non OS) level. According to this answer/code snippet https://stackoverflow.com/a/41010888/930450 it appears to at least be possible to show a picker with the discovered devices from the app. It seems that the peripheral would need MFi approval to be listed by the picker. Initiating the pairing programmatically seems to be not possible at all. – Ixx May 29 '19 at 14:58
3

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.

Taryn
  • 1,585
  • 1
  • 14
  • 21