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

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.

Related

Bluetooth Communication Possibilities

I have a simple question.
I know that when you pair bluetooth headphones to a phone it automatically takes over the sound and it starts playing on your headphones.
Is it possible to program a device so that, as soon as it pairs with a phone, it turns on the phone's flashlight for example?
I know that you can probably program anything to do anything, but I'm curious to know if there are any limitations? Does Apple restrict developers and engineers from creating devices that tamper with their iPhone (like the flashlight thing)? Or is it pretty much an open market?
Yes, this is very restricted to protect users.
Bluetooth works by communicating over defined profiles. Pairing does not have a side effect (like turning on the flashlight), it just bonds the two devices. To control each other, the devices have to use profiles. For example, when you connect your headphones to a phone, they probably connect both AVRCP (Audio/Video Remote Control Profile) and A2DP (Advanced Audio Distribution Profile). These profiles have very fixed scope so that developers and engineers cannot tamper with users devices in unexpected ways.
Apple is especially careful with their devices. For any Bluetooth classic device that wants to implement a profile outside of the default ones, a MFi chip is required. Bluetooth LE devices are much more open, and users can connect them to their phone either through an app or the OS itself. Apps are able to turn on the flashlight, like you describe, but it requires camera permissions and is not allowed to run in the background.
Assuming you could be talking about software as well (the question is vague enough that it doesn't point to hardware only)...
I worked extensively with CoreBluetooth, the framework allows you to create both sides of the connection (transmitter, receiver or client, server; depending on how you want to look at it). Should you wish to create an app on the phone as one of them, and another app an a phone or a mac (or iBeacons) as the other, you'd be able to create that connection and control stuff on the "client" from the "server" and vice versa. You could control as much as the Apple API allows you to control.

Is a Bluetooth profile always required to be used when sending data between an iOS device and a Bluetooth device?

I'm new to Bluetooth, but searching the web, I've found the following description of Bluetooth profiles:
"A Bluetooth profile is a specification regarding an aspect of Bluetooth-based wireless communication between devices. In order to use Bluetooth technology, a device must be compatible with the subset of Bluetooth profiles necessary to use the desired services. A Bluetooth profile resides on top of the Bluetooth Core Specification and (optionally) additional protocols. While the profile may use certain features of the core specification, specific versions of profiles are rarely tied to specific versions of the core specification. For example, there are Hands-Free Profile (HFP) 1.5 implementations using both Bluetooth 2.0 and Bluetooth 1.2 core specifications."
So, I have an MSP430 board with the CC256X Bluetooth module on it, and I want to transfer data between that device and my iOS device. Does that device always have to communicate with my iOS device using a Bluetooth profile? If so, could you please shed some light as to what the simplest profile to make this happen is? As far as my design constraints, all I want to do is press a button on my iOS application, and have that turn an LED on my board. Thus, I just need the board to react to a simple characteristic change.
Please check
profiles/SimpleProfile/simpleGATTProfile.c
and
profiles/SimpleProfile/simpleGATTProfile.h
That's as simple as it ever gets. Once you write a profile with service and characteristics, you just have to include it in your code and use them just like any other service and characteristic.
Coming to your requirement, you need to have a characteristic with write permission in your profile. When you press the button in iOS application, write a value 1 to this characteristic. This will trigger writeCB to your embedded application code. You can use
HalLedSet( HAL_LED_2, HAL_LED_MODE_ON );
to turn on the LED in this callback.

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?
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.

Connecting to a Bluetooth device from iOS, no MFi

The vibe I'm getting from Stackoverflow and the internet at large is that unless I'm using an LE device, any Bluetooth device I make for an iOS app must be MFi certified.
However, on the MFi FAQ page, I found this line:
...developers of accessories that rely solely on standard technology
(e.g., Bluetooth Low Energy or standard Bluetooth profiles) do not
need to join the MFi Program.
My device will be able to use the standard Bluetooth profile File Transfer Protocol (FTP).
Now this sounds like some conflicting advice to me, or perhaps I'm just not understanding correctly. So, having provided the above evidence, I'm just going to ask outright: Can I write and publish an iOS app that connects to a proprietary Bluetooth device using the standard Bluetooth profile FTP without certifying my device as MFi? And if so, what details, caveats, etc do I need to know?
The new Bluetooth 4.0 Low Energy (hereafter BLE 4.0) specification which is implemented in Apple's latest iOS devices does allow one to create app-specific profiles and connect to BLE 4.0 devices without jailbreaking, using an approved Bluetooth 2.1 profile, or becoming part of Apple'd MFI program and using the previously required MFI cryptographic chips.
In other words with the proper BLE 4.0 compatible bluetooth radios you can create wireless devices that connect to iOS apps without having the device pre-approved by Apple. However, you must write a custom app for the device, and Apple still holds the ability to reject that app if they want to. So they still control this to a great degree. This is essentially Apple's answer to the Android ADK, while not fully relinquishing the ability to shut down apps and devices they don't like.
Your app must include specific XML schema for your app's bluetooth profile, and use CoreBluetoothFramework APIs, so it's very obvious to Apple during the app approval process that your app connects to a device. If your app does not work without the device present, then it's likely to be rejected if you are not part of the MFI program, as Apple cannot test the app without your device. The apps that appear to be successful in passing this test use the device as an accessory to app functionality, rather than a requirement. For instance an exercise app might connect to a BLE 4.0 heart rate monitor, but the app doesn't depend on it.
Some apps seem to be getting around this by displaying simulated, or online information in place of the device information when no device is present. Thus the app can be tested without the device, and functionally works when the device is present.
You can find out some successful efforts online:
http://blog.makezine.com/2012/03/19/bluetooth-4-0-from-arduino-to-iphone-no-jailbreaking-no-mfi/
BlueGiga in particular has been pushing their devices specifically for this use, so there are probably forums and support for this elsewhere.
Keep in mind that the devices that currently support BLE 4.0 are limited, and currently only include
iPhone 4S and later iPhones
recent MacBook Air, Mac Mini
iPad (3rd generation and later, and iPad mini)
Macbook Pro Retina
There may be other Apple devices that support this standard, it's something Apple is advertising openly on each product's technical specifications page so it's easy to find for current products.
That line is referring to standard profiles supported natively by ios devices, such as HFP or A2DP. If you build a headset device that does HFP, the iphone will be able to connect to it and route your call to the headset without the headset being part of MFi.
If you want to write an app that does other things with bluetooth, inlcuding FTP, you would have to use MFi.

iOS - How to integrate bluetooth devices in my app

I'm trying to create some application that connects to blue tooth devices. A simple thing like a bluetooth barcode scanner that scans and sends a number to my app. I want to know which framework or something to be used in my app that can integrate the barcode scanner with my app. Is there any API or examples or tutorials etc that can help me implement such things?
Apple provides an API called the External Accessory framework, which can be used to interact with paired Bluetooth devices or devices connected through wired, Apple Connector at the base of the device.
However, to be able to use a paired device from within your application as you desire, you will have to a device that is designed to be compatible with iOS devices (meaning, the manufacturer must be a member of the Apple MFi program) and the device manufacturer must provide a protocol that you must add to your applications info.plist file.
If you have bought an off-the-shelf, Bluetooth barcode reader, there is a fair chance that you can not do what you are trying to do. If the device states that it can be integrated into custom iOS applications, consult the device manufacturer for further support regarding setting up your application to interact with their hardware.

Resources