Bluetooth HFP (1.5) communication on iPhone - iphone

The Bluetooth v2.1 specifies the so called "Secure Simple Pairings" methods - one of those methods is called Out of band (OOB) and according to Wikipedia This method uses an external means of communication, such as Near Field Communication (NFC) to exchange some information used in the pairing process.
Whatever is the "external means of communication" of getting the PIN, the handsfree device id, etc. - is it possible on iPhone to initiate the hands-free connection from the code? I.e. if i have all necessary information in my application can I say iPhone to connect to the handsfree using given information?
If it is not part of the public API, has Apple some process to allow some companies to get access to some additional non-public features?

If you want to connect a Bluetooth 2.1 device to your iOS device, you must do it through the Settings->General->Bluetooth screen.
However, for the iPhone4S and the New iPad, you can detect and connect Bluetooth devices that Low-Energy devices.
The Bluetooth Low-Energy specification is part of the (some-what) new Bluetooth 4.0 protocol and only these two Apple devices have the necessary components to connect with low energy devices.

Related

Bluetooth Connection with Handheld and iPhone

I am trying to establish a bluetooth connection between a Windows CE handheld device(A bank card reader) and iPhone. I want to make data transfer betweeen the two. I have read that prior to IOS 6.0 this was not possible. But with IOS 6.0 I can use core bluetooth to establish a connection.
I would like to know whether the handheld devices bluetooth should be of certain spec to make it work with IOS devices? Or are there any restriction fro any bluetooth device to communicate with an IOS device?
I have read here that the device should be Bluetooth LE. How can I detect whether my handheld device is bluetooth LE?
Thanks
It would be nice if you would provide more information about this Windows CE device.
Just search for the specs of it. If it supports Bluetooth 4.0 LE you have to look if it specifies any of the known profiles. If not the manufacturer may have implemented an own profile to provide certain services and characteristics.
If this is not the case, there is no possibility to establish a connection over CoreBluetooth.
But if its a bank card reader I can't imagine, that it supports BLE.
If the device just supports Bluetooth 2.x you can only connect via the External Accessories Framework. But this only works if the manufacturer bought the MFi (Made for iPod) license and implemented the required specs into the hardware (only then the device is "MFi approved").

What can MFI enable?

I'm trying to determine what functionality I can add to a BT accessory by paying for the MFI authentication coprocessor. For example, could I...
A. Pass location data to the accessory?
B. Push incoming SMS messages to the accessory?
C. Launch my app on the phone from the accessory?
As Dennis mentioned, all information regarding the MFi program is covered under a VERY water tight NDA. However, what can be said is that all devices that connect to the iPad through Bluetooth or the docking connector port are accessed through the External Accessory framework. Documentation on the External Accessory framework is easily accessibly from Apple's documentation pages and can also be easily googled.
Communication with devices through the External Accessory framework is fairly simple once you've established a connection with a device. In short, the process is to find the desired connected accessory from an array of devices, establish a connection session and the session object contains a input and output stream. Data by creating a delegate that with the device and finally, monitor the associated input and output streams which you use to communicate with the device.
Again, the majority of the information associated with MFi is tightly sealed. However, as far as connecting to devices (that you have the right to connect to) is simple, well documented and is easily searchable since the framework is part of the standard, iOS library.
One other note on Bluetooth. There is also a Core Bluetooth framework that is available with iOS 5.0 and up. This is a much simpler framework that you can use to discover and auto pair with Bluetooth Low-Energy devices (which are part of the new Bluetooth 4.0 spec.)
If you are planning on making an iPad application or desire to have a fairly high level of backwards compatibility with earlier iOS devices, I wouldn't recommend using the new CoreBluetooth framework. The reason is because only the iPhone 4S and the soon to be released "New iPad" have the necessary Bluetooth chipset to connect with Bluetooth LE devices.
All Mfi information is under NDA.
It dosent cost anything to sign up and get access to the information , you can do it here.
https://developer.apple.com/programs/mfi/

iPhone Bluetooth Communication Examples

I've been trying to find examples on communicating with bluetooth devices on iOS and have been coming up short. As I understand it SPP is not yet supported. At the simplest level, I'd like to send a simple 1 or 0 signal to the bluetooth device I'm creating. (It's a bluetooth switch that would turn something on and off). Is there a way to cleverly do this through the HID or HFP profiles?
The short answer to your question is that you can't connect to an arbitrary Bluetooth device you may happen to have, you can only connect to a Bluetooth device that has come through Apple's licensing program (i.e. the "Made for iPod/iPhone" label). From Apple's documentation:
Q: [The External Accessory framework allows] 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.
So there is no public API for accessing an arbitrary Bluetooth device from within iOS: you have to go through the External Accessory Framework to communicate via Bluetooth, and the EAF's mission is "communicate with MFi devices," not "communicate with arbitrary external devices." A sufficiently ingenious developer could probably hack something in there, but -
it's a non-trivial undertaking
you are spectacularly unlikely to get past the App Store approval process
So there's just not much percentage in it - the effort of doing so is unlikely to reward you.
If there already exists an MFi device that can be coerced into doing something that you want, that's probably your best chance - short of going through the MFi approval/licensing process yourself, of course. If you want to do so, have at it and good luck.
I'm answering this question late because Zeroxide's answer is incorrect (you can use a random Bluetooth keyboard with your iOS device because Apple implemented that connection, which is different from giving you a public API path to doing likewise) and I find Rokridi's answer to be incomplete-though-headed-in-the-right-direction.
Edit: A caveat has since been added to the linked Apple page about Bluetooth Low-Energy devices. So there's a loophole, but it's not a big one because very, very few Bluetooth LE devices have actually been produced as yet.
As far as i know, if your external device is non iOs device then you should use External Accessory Framework to communicate your application with it. Threfore, you external device should be certified by Apple through the Made for Ipod program (MFI). Hope this helps.
If you want to use classic Bluetooth (not BLE), then you have to first PAIR the iOS device to the Bluetooth device (in Settings). If you can't do that then you can't communicate with it with your app.
NO. whether device is MFi certified or not, you can connect device to iphone if bluetooth profile is HFP, or HID's (ordinary profiles. not iAP profile). Think about bluetooth headset or keyboard. does it need MFi mark on it to use? NO. Never.

Where can I get a complete list of Made For iPod devices that use Bluetooth?

Am working with a client to interface an iPad with a 3rd party device, a weight scale, that transmits its data via Bluetooth. I'm not building a an interface FOR the device, just trying to receive data FROM the device over Bluetooth.
The Apple doc indicates I need to use the External Accessory framework to communicate. You also "must include the UISupportedExternalAccessoryProtocols key in your application’s Info.plist" and list the specific protocol.
1) Is there a complete list of those protocols and what the format is for the Info.plist somewhere? The Manufacturer doc indicates it is certified as a Continua member, meaning it uses the ISO/IEEE 11073-104XX Personal Area Network device protocol. How do I plug that in?
2) Do I really need to use External Accessory framework for an ISO/IEEE standard device?
So, unfortunately the External Accessory framework is for communicating with devices that are certified as part of the MFI (Made For iPod/iPhone) program. If your bluetooth scales are not certified by Apple you are SOL.
You can apply to have a device entered into the MFI program here: http://developer.apple.com/programs/mfi/ - but it's not a trivial enrolment process.
See more information on a similar question here: What are the protocols supported in Iphone's External Accessory Framework

How can an iPhone access another non-iPhone device over wireless or Bluetooth?

I'm trying to figure out if an iPhone can connect to another non-iPhone device over wireless or Bluetooth and have seen conflicting information. Much of what I've found was before version 3.0 of the SDK came out, when it certainly wasn't possible. Looking at Stack Overflow questions, like Can the iPhone 3.0 SDK provide full access to Bluetooth devices (headsets)? mention you can't connect to an arbitrary device unless if it's part of the "Works for iPhone" device. Do I need hardware that is part of this program?
Looking through the Apple documentation, Peer-to-Peer Connectivity, it mentions connecting two iPhones, not an iPhone to another Bluetooth device. Then there are articles like iPhone SDK focus: Bluetooth enhancements that includes this quote
...and with the newly-announced "standard support" should allow file transfer between the iPhone and a computer, as well as between nearby iPhones
Another Stack Overflow question, GameKit in iPhone SDK 3.0, mentions Bonjour, and the Apple documentation for Bonjour talks about connecting to Bonjour devices, but can an iPhone connect to any Bonjour device? Does it have to have a Wi-Fi connection, or can it use Bluetooth?
Even if I could use Bluetooth to connect to another device, it won't be available on first generation iPhones and iTouches, I believe. Is that correct? I'm thinking of an iPhone application that would need to communicate with other non-iPhone devices in the area, probably using Bluetooth, but possibly a direct wireless connection. What are the possibilities and limitations of this approach? Is it not possible to have an iPhone connect to an arbitrary Bluetooth device? Does the other device have to be on a wireless Bonjour network that? I'm trying to figure out if it's even possible for this to work or if it's not worth the effort.
The only way to communicate with other Bluetooth devices via the External Accessory framework in iPhone OS 3.0 is if they are in the Made for iPod accessory program. Even though they communicate through standard Bluetooth connections, accessories need special hardware in order to process the data stream coming from the iPhone / iPod touch. Unfortunately, this means that your idea of communicating with generic Bluetooth devices won't work on iPhone OS 3.0.
If the devices you want to talk to are Bonjour-discoverable via Wi-Fi, they don't need to be part of the Made for iPod program. However, that doesn't sound like your case.
Third-party developers in the near future may produce dongles that connect through the 30-pin dock port and give access to existing Bluetooth devices. If these developers opened up their communication protocol, that might enable your goal of communicating with these devices.
You can use NSStream for opening IPv4/IPv6 sockets on the iPhone. The devices to which you're connecting do not have to be iPhones or use Wi-Fi necessarily. Because of how network communication protocols are laid out, you simply don't have to care what kind of device your iPhone is communicating with.
Bonjour, on the other hand, uses NSStream internally. It's basically a nifty little wrapper which allows for auto-discovery. You need the Bonjour protocol installed on all devices which you want to participate in the auto-discovery process. There is even an implementation for Windows.
As part of the iPhone OS 3.0 SDK, Apple announced the ability to control hardware accessories through either Bluetooth or the dock connector. The dock connector supports standard protocols (that is, play, pause, etc.) as well as any custom protocols the developer wants to implement.
As far as connecting via Bluetooth, you can talk to other iPhones or other devices. For example, you can use stereo Bluetooth to connect compatible Bluetooth stereo headphones, car kits, or other accessories.
As far as what devices support Bluetooth communication, everything except the first generation iPod Touch should be okay.
See also Apple's page on iPhone OS accessories.