How to use bluetooth classic instead of LE - ios

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?

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

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.

Related

Does Bluetooth Low Energy devices still not show under iOS Bluetooth settings (My Devices)?

I'm trying to set up a hobby project and I'm wondering - if my device uses Bluetooth Low Energy module, will this device show under the list of Bluetooth Devices under Settings for iOS? Or will my app have to search for this device specifically before connecting? If it doesn't show in the Settings, what type of Bluetooth module would I need for that?
No, you will not see your LE devices under Settings for iOS.
See LE best practices - your app should search for the LE device.
You only see the BT classic devices in that settings. However, only few protocols could be used without a required MFi chip, which is out of your scope for your Hobby project.
Use The CoreBluetooth on the iOS side for your app.
UPDATE per #Brejuro request in the comment below:
MFi coprocessor is required to be in your custom HW, which wants to communicate using the majority of profiles/protocols defined for Bluetooth Classic (not LE), e.g the pure RFCOMM. Coprocessor is used for the initial authentication - then, iOS knows that your custom HW is certified and allows to use it.
However, Apple will ask you for big money and your device needs to pass through Apple certification - that's why I told that this is out of the scope for any hobby project. You will also need to sign very restrictive NDA. However, you will get very very good documentation describing many details.
Built-in Bluetooth panel in iOS Settings app is actually a merge of two different things:
a list of known (paired) devices whatever the profile they use (so that you have a central place to unpair them),
a tool for discovering nearby devices to pair to.
Unpaired devices will only show in discovery list if they actually implement at least one profile that is recognized by core bluetooth services of iOS. Other devices are masked (user would not be able to do anything useful with them anyway).
If you hobby project is to do something related to built-in supported devices, like HID (keyboard, mouse, remote control, etc.), you will actually see them during discovery from Settings app.
If you create a device with a custom service, with your own Service Type UUID, it will not show in built-in panel, and your app will have to look for it for pairing. Once paired, device will show in settings.
Out of core services, you can also make compatible devices without being MFi. For instance, MIDI over BLE profile is such thing that gets recognized transparently by garageband and other music apps.
Using BLE and not BR/EDR, Authentication chip is only required for very specific profiles, like HomeKit.

Test Bluetooth on iOS

I'd really like to start testing my iOS apps Bluetooth capabilities, but have run into a few problems:
I have a device made with a RN-42 module, but it's not the Apple version and I don't have the Apple authentication module at the moment (I ordered it, but shipping from China can take a while). I know what the messages will look like, but can't send them to my iPhone!
I can use the module with my Macbook, but not in the iOS simulator! Apple has taken down all of the documentation related to getting the iOS < 7.0 to use a separate bluetooth dongle, and my efforts have left my 6.1 simulator endlessly spinning on the bluetooth screen.
I'm new to using Bluetooth, so this may be a dumb question...
Is there a way of getting a bluetooth client device (I have a Mac, another iPhone, and an Android tab) to act as a server module that can send (and receive) Bluetooth data to my iPhone?
Client/Server as per developer.bluetooth.org
Thanks!
Not 100% sure your meaning of "server module". But in CoreBluetooth, you can use CBPeripheralManager to broadcast data to other iOS or Mac apps.
https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/CBPeripheralManager_Class/Reference/CBPeripheralManager.html
If you're using standard Bluetooth (i.e. not Bluetooth LE or Bluetooth Smart or whatever you want to call it), you'll need to enroll in the MFI program or work with an MFI certified device (such as a Redpark cable) and use the External Accessories library provided by Apple. If you're using Bluetooth LE, you can use the Core Bluetooth library provided by Apple. If you fall into neither of those cases, sorry, you can't use Bluetooth on iOS.

Passing objects between different applications

I am trying to develop a Bluetooth Fitness Watch (Bluetooth LE only) as a project of mine. I have created an application (for now we can call it FitX) that allows the user to connect to the watch, similar to the the Pebble Watch, and the object within this app is called fitXWatch (handles the connection and all of that).
However, I now wish to be able to reference this fitXWatch object in another test app so users would be able to integrate my watch into there respective apps. This is the same principal again as Pebble.
I know iOS in general is very sandboxed, but based on Pebble, it gives me hope it can be done.
So my question is this, How can I pass an object from one app to another app similar to Pebble?
Thanks!
According to Apple's Technical Q&A QA1657:
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?
A: The External Accessory framework 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 Apple device's 30-pin or Lightning 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, i.e., it was specifically designed to interface with an iOS application.
First of all, are you sure you can't combine the two apps into one single app? Or, maybe convert APP A into a framework and include that framework in APP B?
There is no way to do what you ask locally. You will have to save your object to a file and then upload that file to a remote server. When APP B is opened, it should contact that server and download the file.

Using custom/existing bluetooth HID with iOS Devices?

I am working on building or using an existing bluetooth HID device (something like this http://www.icontrolpad.com) and to get my iOS device to read the data coming from it. So i have some questions regarding this:-
Is it possible at all to do this, considering that the Bluetooth stack is not available on non jail broken devices.
Do i need to register with apples Mfi program? If i don't need to, what are the alternatives?
If i do register with Apple's Mfi program will i get access frameworks that will allow me to read data off the Bluetooth stack.
Considering that there will be a custom application sitting on the iOS device that needs to communicate with the HW im building, what are the implications w.r.t the approval of the app from Apple's side?
Thanks in advance, any help is greatly appreciated!
Core Bluetooth framework is available for Bluetooth Low Energy devices on iOS 5, no MFi membership is required.
With Made for iPhone, you basically get a serial pipe to your device using the ExternalAccesory Framework (in fact, it IS using the serial port profile plus some authentication). So you while you cannot use an actual HID device, you could send your data over.

IPhone Bluetooth Connectivity to Non IOS Devices

I was wondering, if there is a way to use IPhone as an HID device, with some other device like PS3. I checked out the Bluetooth specification and IOS Devices do support HID Profile. So I thought it would be easy to pair my iPhone using passkey mechanism and should be able to start using my iPhone as keyboard or mouse without much hassle. But I found very soon that this assumption is naive and I need to develop custom solution.
I was initially thinking about using GameKit framework, but I think it only works between two compatible IOS Devices. If I want to extend this capability, then I have to use iPhone External Accessory API .In my analysis, I also found that iPhone will only communicate and pair with devices that are licensed by Apple. (Made for iPhone\iPod program). Does it mean that, if I want to use iPhone with another device, I need to get that device approved by Apple. ( Which will not surprise me one bit). Also if someone could point me to more detailed documentation on this, that will also be helpful.( What is an MFI developer board ??)
I do not want a solution that needs me to jailbreak an iPhone. (or any solution that will disqualify my app by Apple).
So to summarize:
1- Please validate my findings, correct them if they are wrong?
2a- How does External Accessory API Work?
b- Can I use this to connect to third party accessories ? (or is this only for accessory developers).
3- Or is there a better solution without using External Accessory API?
Please provide supportive documentation or link if you can. Thank You.
You are unlikely to get on the External accessory program from apple unless you are a big company ( you can try, but I have read this a number of places) . iPhones use a proprietary Bluetooth interface that and hardware must also implement this interface, so not much chance of getting it to connect to any other hardware directly.
Most apps like this (Remote Mouse) for example, connect to your wifi network, and have another application installed on your computer. The iphone can then talk to this application over the wi-fi network, but not bluetooth. I would suggest that the only way I can see this would be possible to to create the server app that you install on a computer on the wi-fi network that then in turn controls the 3rd party device if there is an API that you can use from the desktop app to control the 3rd party device.
This is just what I have found when I researched about this for making an app for iPhone to control a bluetooth watch. I had to jailbreak in the end to replace the bluetooth stack on the iPhone with one that could connect to any hardware device. Not limited by apple.

Resources