Bluetooth Communication Possibilities - ios

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.

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.

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.

What is the simplest way to connect a device to an iPad from an application?

I am working on a major product release for my company. We are designing a new device that we would like to integrate into an iOS app. (FYI, we have recently been accepted into the Apple MFi program so we are past that step.)
What we desire is to create a hardware/software eco-system where our users can start our iPad app (yes, it is specific to the iPad and the not iPhone or iPod Touch devices) and the application will automatically discover and link up with any close-proximity hardware that we've developed.
This means that I will need to implement some form of device connection process on both the iPad and within the hardware.
Is there any way to code automatic connectivity to a Bluetooth device from within an iOS application?
I am aware of the Core Bluetooth Framework which has this capability, however, it only works with the new iPhone 4S. That's not an option.
I've also researched about the External Accessory Framework, which can be used to connect to external devices whether they are connected via the iPod port or Bluetooth. This is an option but, if my understanding is correct, our hardware must already be paired with iPad before the iOS software can connect to it. This is less than preferable because although many of our devices may not be in immediate vicinity at one point in time, our customers could potentially own 100's devices that they may desire to connect to with our software.
What are my reasonable options or alternatives? The end goal is to provide a very easy means for our users to be able to connect to our devices, from within our software, on an iPad.
NOTE: I MUST NOT jailbreak the iPad or break any Apple TOS agreements.
UPDATE (3-7-2012) I saw today that the 'New iPad' (as it is being officially called) will be Bluetooth 4.0 capable. I assume this means that this iPad device will be able to use the Core Bluetooth Framework. This doesn't immediately solve my problem because we do want remain compatible with at least the "last generation" iPad device, but this is worth pointing out for others who may be looking for such an answer.
You cannot connect an iOS device to a bluetooth device without pairing first. It is purposely built that way by Apple to reduce the likelihood that someone could connect a bluetooth device without the user knowing about it. If pairing each device is unacceptable (and it sounds like it is), and you don't want to develop a dongle, the only remaining path I can see is to make your devices capable of relaying data between them like a mesh network. That way the user would only have to pair with a single device, and that paired unit would relay communications between the other devices and the iPad.
One of your alternatives would be going WiFi (AdHoc or Infrastructure) with Bonjour. For example you would be able to detect the device nearby (if it is maintaining it's own AdHoc then by SSID; if it's in infrastructure network then by service being announced). One big drawback would be that you couldn't connect directly (from app) to the device's network - user would have to do it manually.
As for BT: big drawback is lack of a serial protocol (not implemented in iPhone/iPod/iPad).

RS232 for iOS device

Is it possible to pair an iDevice to an rs232-bluetooth adapter for the purpose of sending serial commands like it would through an iDevice dock connector to rs232 (just like the Redpark Serial Cable does)? I ask because the company I work for is thinking of having an iDevice control one of our systems for demo. I know it doesn't relate to anything specific but any information would be greatly appreciated.
(See also iPhone to RS-232 via Bluetooth)
Bluetooth modules exists that support MFi (Made For iPhone) such as this one from connectBlue http://www.connectblue.com/products/bluetooth-products/bluetooth-modules/bluetooth-iphone-ios-accessory-module-obs414/ So the standard iPhone Bluetooth stack can make a SPP/RFCOMM connection to that device. That device could be added to a board along with RS232 level-conversion etc... And thus success.
I don't know whether someone sells such a device. The RS232 device that connectBlue sells seems not to support MFi, http://www.connectblue.com/products/bluetooth-products/bluetooth-devices/bluetooth-rugged-serial-port-adapter-rbs433/
Not really. The GameKit is one way to access bluetooth in iOS, but it is very limited in what that API allows you to do.
Depending on what you are building, you might be able to use the Apple Made for iPod program, but it's probably a long shot.
http://developer.apple.com/programs/mfi/
The best way to go is probably to design a device that connects via WiFi. I've gone this route, and it worked out well. If you must interface with something with an RS-232 interface, you might design an intermediary "adapter" that connects via WiFi to the iOS device, and via RS-232 to the other device.
If you don't have a need to distribute your app via the App Store, you can use Redpark's iOS serial cable: http://redpark.com/c2db9.html. (Disclaimer, I've never tried one, but according to someone at Redpark, jailbreaking is not required, you just can't distribute your app on the app store.)
You could design a small dongle that attaches via the dock connector, and broadcasts over bluetooth to your other device.
Or you could use WiFi instead of bluetooth... perhaps communicating over WiFi to something that's physically plugged into whatever you want to control.
I worked on a jailbroken app which used BTStack to communicate with a serial device. You might be able to use this for your demo.
If you're still looking to use bluetooth, this helped me out alot to facilitate the standard serial connection for prototyping without jailbreaking:
http://www.seeedstudio.com/depot/bleshield-based-on-bluegigas-ble112-module-p-1367.html
It works on the Bluetooth 4.0 enabled iOS devices and all of the schematic, boardfiles, firmware sources and the iOS App sources are available here:
https://github.com/michaelkroll/BLE-Shield

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