how to make iOS app connecting with bluetooth? - ios

how to make iOS app with bluetooth?
I need an app which connects and exchange data via bluetooth with other devices, laptop for example.
Many packages for BLE and cant find for classic bluetooth

If you want to use the classic Bluetooth interface of an Apple iOS device, you have to comply with/accept Apple's MFi licensing programme (Made for iPhone/iPod/iPad), which is a major hurdle and the reason for the lack of corresponding libraries.

Short answer: you don't want classic Bluetooth for this. You want BLE. It supports everything you want for this kind of use case. See Core Bluetooth.
Much too long answer about classic Bluetooth and iPhones from my years building earbuds:
Continuing from Risto's answer, even with MFi certification (which requires adding an extra chip to your device, not just licensing), you still don't get general access to the BR/EDR ("classic") interface. You only get access to iAP2, which is an SPP-like serial protocol, but is not SPP. If you're porting from Android, you probably are using SPP, and sorry, that's just not available. You're going to need to switch to BLE.
MFi certification is a useful if you build an audio device that also needs a non-audio control channel. It makes it easy to ensure that both the audio connection and control connection are connected to the same device. This is extremely difficult to do with BLE. But iAP2 isn't a particularly nice protocol, and has weird corner cases. You should not go through the cost and trouble of MFi just to get a SPP-like serial protocol.
On iPhones, access to BR/EDR non-audio profiles is limited to the proprietary iAP2 and GATT over BR/EDR (which is less useful than it sounds since most chips don't support it). Classic audio profiles are limited to what Apple's audio frameworks support, which is not very flexible.
If you make a Bluetooth audio device, have a little extra room on your board, enough margin to add a chip to your BOM, and your SoC supports it, MFi is definitely worth exploring. You can improve the pairing experience marginally and it makes it a bit easier to manage an extra control channel. Plus, you get to add that "Made for iPhone" logo to your packaging. For hearing aids (which I have less experience with), I expect that MFi is a must-have today. From my casual investigation, it looks like it adds some really nice capabilities.
For everyone else, you want BLE.

Related

How to transfer data from classic Bluetooth device to iOS?

I am writing an app for iOS that needs to receive data from a Bluetooth device (classic Bluetooth, not BLE). I need a pretty fast data transfer, 1Mbit/s or faster if possible. This already works using SPP in Android.
Apple only supports some Bluetooth profiles as listed here: https://support.apple.com/en-us/HT204387 I think these profiles are the only ones supported without being in the MFi program. MFi is too difficult to deal with so I would really like to avoid it. SPP is of course not available.
Of these profiles, PAN and maybe A2DP and HFP seem likely to be usable for bulk data transfer. A2DP or HFP would be a hack as they are really not designed for non-audio data. This seems to leave PAN.
How can an iOS app transfer data from a classic Bluetooth device using PAN? I would like the app to connect and somehow establish a data connection. This may be over IP (like tethering or reverse tethering using PAN) or non-IP. I want something which behaves a lot like the SPP profile, in other words a bidirectional serial link between the two sides.
Note: The Bluetooth device on the other side of this can do anything that is needed (I am writing the device firmware at the same time using a bluetooth stack, probably the TI dual-mode stack). Extra bounty if you can give me example of PAN tethering using any Bluetooth stack (TI, Synergy, dotstack etc).
See also: Is possible to communicate via Bluetooth PAN in iOS with tethered devices

MFi , CoreBluetooth or External Accesory framework?

I am trying to build an iOS app which would communicate with another non-apple device via bluetooth. It would be a  Bluetooth Stereo Transmitter which uses the bluetooth A2DP-profile which is supported by apple :
http://support.apple.com/kb/HT3647?viewlocale=en_US&locale=en_US
I have read tons of articles and pages. I have many unanswered questions and hope to recieve some answers and write something that will help me and others in future work with iOS and bluetooth.
Evaluating the available bluetooth connection options
Here's a list with possible approaches and informations I found. Please feel free to answer/edit anything that is not correct.
Edited from http://www.pocketmagic.net/2012/07/bluetooth-and-ios-use-bluetooth-in-your-iphone-apps/ :
A) Enroll in the made for iPhone/iPod/iPad (MFi) program. Details on costs are not available, but this is not for the small development companies, barely selling a few licenses.indicate costs depending on project, and starting numbers somewhere at 10K USD. Not really an option IMO, as the costs involved and trouble getting certified are ridiculously high, for something so basic and simple such as building a Bluetooth application. I have found a Bluetooth stereo transmitter with bluetooth version 2.1 (Class II). I can not find if the device is MFi compliant.
Based on this article :
Existing bluetooth device and Apple MFI
Q1: How can I be sure or find out if the device is Mfi compliant?
Q2: If the device is Mfi compliant will I be able to pair it with the device in the settings option?
B) CoreBluetooth framework, currently usable only with Low Energy Bluetooth 4 devices. Since these are not largely spread this is not really an option. You won't be able to connect to standard headsets, keyboards, or other non-Bluetooth 4 devices.
Q3: Will I need to pair the non-apple bluetooth device with my iPad (in settings) to use the CoreBluetooth framework?
I am asking beacuse I have no experience with iOS and bluetooth and beacuse my budget is low, so I dont want to waste money buying stuff I will not be able to use for development.
C) GameKit framework, this allows some basic Bluetooth functionality, such as finding nearby devices and establishing a serial communication link, but it only intended for use between iOS devices. So Android plus iPhone via GameKit is a no go.
D) Private APIs. There is a BluetoothManager framework, in the private APIs, inside the SDK. This can be used to achieve the proposed task, but you won't get your App approved on Appstore, as private API's is not allowed by Apple. Since this is so convenient, and working so nice, almost like the real thing Apple didn't want to include.
Q4: Can I use private APIs within the iOS Eneteprise program and distribute my apps since there is no App store approval process?
Q5: Does anyone know some more private APIs I could use beside bluetoothManager framework?
E)Jailbreaking and using Ringwald's BTStack. Jailbreaking = rooting = freedom, probably the best way to go . But this places you so far away from Apple's guidelines, and the Appstore itself. So better decide what your project is all about, and who your users will be.
Q6: For bluetooth I need CoreBluetooth Framework. What framework do I need to import if I want to use wifi communication?
Thanks for any help :).

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.

iOS app with bluetooth as a trigger

I'm trying to help produce a location-specific iOS app that needs an external trigger to start audio playback when it approaches a given location within the building. (no GPS access)
Has anyone had experience doing something similar? One thought I had was to lay out some bluetooth "transmitters" (like an xbee+arduino) around the building, and if the iPhone's bluetooth was close enough to identify it, it would trigger the audio.
I've never worked with bluetooth or an application of this sort before, so any advice would be much appreciated.
Bluetooth would certainly work, although other methods might, too. The only downside to Bluetooth is that you would either need to work within the APple MFi program for standard Bluetooth or restrict the devices used to the iPhone 4s or later or the iPad 3rd Generation or later so you could use Bluetooth LE (Bluetooth 4.0).
Assuming you can use Bluetooth LE, it's not only possible, Apple demoed one such technology. Once you're signed up as a developer, check out Session 705, Advanced Core Bluetooth, from WWDC 2012. The ending demo is exactly what you're looking for, and the session describes how to do it and provides source code.

Transfer pictures from external camera circuit within my iOS app programmatically

I'm working on my senior engineering design project and I need your help! For this I have my iPhone app receiving images from a external camera circuit, which I built.
To interface my iPhone app to the camera circuit, I have looked into the following approaches:
Build a bluetooth module on the camera circuit, to transfer images to the iPhone
Use Eye-Fi SD card to transfer images to my app somehow! link:http://www.eye.fi/products/iphone
Build a circuit, to make a wired connection to the iPhone with the 30-Pin dock connector
Here are the problems I'm facing with each of these. My actual questions for you guys are highlighted in BOLD:
The iOS BlueTooth framework (4S only), only supports Low Energy Devices. Looking at the the modules out there like this one, I'm doubting it will work for image transfer, which seems to be a bulky task for low energy bluetooth. I know there are jailbreak apps on the cydia store, which do regular bluetooth transfers, but I was unable to find those private APIs for such a task. (NOTE: I'm making this app for my purposes, so feel free to suggest any private/unofficial APIs). Question#1: How can I interface to a regular bluetooth device (not another iPhone) and transfer data?
EYE-FI card sounded amazing as a consumer because the company has their proprietary iPhone app to transfer the images from the EYE-FI SD card. Problem is I can't figure out how to easily interface with the EYE-Fi card in my code. I researched the iOS CFNetwork framework, but haven't had any luck. Question#2:How can I interface with the EYE-FI card in my app?
Building a circuit seems simple enough with this development board, but I read somewhere that the iPhone may not recognize an "un-registered" accessory. I have a developer license but not a MFi licence. Question#3: Do I need to be registered as a MFi developer to create and use this external accessory in my App for my own purposes???
You might try setting something up through a serial port since joining the MPi program is prohibited for individuals. You could possible use a connector like this one http://www.amazon.com/neXplug-Ultra-Small-Micro-Adapter/dp/B0055PCVDO/ref=sr_1_1?ie=UTF8&qid=1339309918&sr=8-1
The Apple website recommends individuals/hobbyists to use " recommend that you use a third-party solution which will allow you to connect iOS devices to serial devices and to write iOS apps that communicate with these serial devices" (from mfi.apple.com/faq).
I am also working on an external camera that can hook to the iphone/ipad. I will be using a serial port in order to get around the MFi requirement for external iphone/pad devices. Trying to use bluetooth is too complicated and the data stream isn't big enough for pictures. the wired version will work much better.
I hope this helps and that your college term and project are not already finished. Best of luck.
As T Reddy has already mentioned, if you want to create hardware the interfaces with external hardware framework, you have to sign up with the Apple MFi program which you, as an individual, can not do.
I'm not sure of how the Eye-Fi system works but it sounds to me that it basically syncs the images to their server and once you download their Apple App, the app can sync the photos for you.
Whether you are using Bluetooth or the 30-pin connector, there is no way to interface to an external device unless that device is MFi compliant and a part of the MFi program. I suggest you try the following options to solve this delimma--
If this is a "Senior Project" at some University, see if your University is part of MFi. Apple will not let individuals join the program, so if you are going to gain access, you have to access it through another organization or, possibly, an educational institution. I don't know if Apple has worked with schools in this regard, but you never know. It might be possible.
If your school isn't in the MFi program then you may want to consider re-writing your application for an Android device. Android devices are not locked down like iOS devices, so that may be a more reasonable approach.
I hate to bring bad news but circumventing these hardware restrictions on an iOS device is excessively prohibited. Your options are quite limited and none of them are probably what you either want or need to hear.

Resources