11
votes

I'm looking at development of an iOS app that will communicate with Bluetooth classic devices using iOS Supported Bluetooth Profiles

As I understand, this should be possible using the External Accessory framework and should not require participation in the MFi program. From the MFi FAQ:

What types of accessories and technologies are not part of the MFi Program?

Accessories that do not use any of the MFi licensed technology listed above are not part of the MFi Program. For example:

So far, so good. The External Accessory Framework doc introduction says (emphasis added):

The External Accessory framework provides support for communicating with external hardware connected to an iOS-based device through the 30-pin dock connector or wirelessly using Bluetooth. Applications that support external accessories must be sure to configure their Info.plist file correctly. Specifically, you must include the UISupportedExternalAccessoryProtocols key to declare the specific hardware protocols your application supports.

Where are the values for the for the "specific hardware protocols" noted above documented? I'm assuming that this is referring to Bluetooth profiles?

FWIW, I've downloaded and attempted to run Apple's EADemo app. It includes the values com.apple.p1 and com.apple.p2 for the UISupportedExternalAccessoryProtocols key. When I run the EADemo app on a 4th gen iPod Touch/iOS8.1.3 it does not find any BT devices. It should find the Jawbone speaker that it is connected to.

To simplify, I've also created a very small sample app to listen for EAAccessoryDidConnectNotification notifications:

- (void)viewDidLoad {
    [super viewDidLoad];        
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(accessoryDidConnect:) name:EAAccessoryDidConnectNotification object:nil];
    [[EAAccessoryManager sharedAccessoryManager] registerForLocalNotifications];

}

- (void) accessoryDidConnect:(NSNotification *)notification {
    EAAccessory *connectedAccessory = [[notification userInfo] objectForKey:EAAccessoryKey];
    NSLog(@"didConnect: %@", connectedAccessory.name);
}

When I run the code on the iPod Touch, no notifications are received. While the app is running. I've turned the Jawbone speaker off and then on to initiate a connection. (I can confirm that it does connect by looking at Settings->Bluetooth).

I've added the UISupportedExternalAccessoryProtocols key to the app plist and left the values array empty and added com.apple.p1 and com.apple.p2 (as in the EADemo app).

Any ideas on what I'm missing? How can an iOS app be made to communicate with a Bluetooth classic device?

1

1 Answers

11
votes

TL;DR: The EA Framework will work only with MFi devices.

From Apple Technical Developer Support:

Hello Tom,

In response to your questions regarding the use of the External Accessory framework

Q1. If I'm attempting to programmatically connect to a BT device with any of these profiles using the EA framework, must the device be MFi compliant? Response - yes. The Accessory must implement a special protocol to identify data to be sent/received across the selected transport as EA supported data.

Q2. As an example, can I write code using the EA framework to connect to a Bluetooth speaker that is not MFi compliant? Response - Most Classic Bluetooth speakers use AVRCP/A2DP to transport audio data across Bluetooth with an iPhone. Such data is completely separate from the data marked for External Accessory support. The EA framework cannot be used to access the data sent via AVRCP/A2DP. However some speakers do implement a separate EA data exchange, which will work with an EA Framework application. However the direct answer - no. An EA framework app will opnly function with an MFI compliant accessory - even more of a subset - one desigend for use with EA.

Comment - Jawbone speaker does not appear in UITableView in the EADemo application. Response - this is correct. The Jawbone speaker is not an EA accessory. However the Nike Fuelband is an EA Accessory. An important consideration - to use the EA Framework, you must work with the accessory vendor to learn the data protocol supported by the accessory - what the data looks like when receiving and sending data.