iPhone/iOS - connect and disconnect from a Bluetooth headset - iphone

I have paired my iPhone with a specific Bluetooth headset. I would like to programmatically connect and disconnect from the headset but cannot seem to find the API to accomplish this.
Am I simply missing something?
Thanks!

Unfortunately, there is no API to interact with Bluetooth headsets.
There are APIs for connecting to Bluetooth LE devices, called CoreBluetooth. But these APIs cannot be used to connect to bluetooth headsets. Users have to use the settings application to connect to them.

Related

find peers on wifi network ios

I'm trying to figure out how to search for other devices logged into a wifi network that are hosting the application on a specific port.
How can I detect the presence of these other devices without knowing their address or even necessarily the port they are hosting on?
Once discovered, I should be able to contact the device and establish a connection with it.
The most standard "iOS way" would be to use Bonjour to announce and listen for announcements for the application.
EDIT:
As of iOS7 GKSession is deprecated..
Why don't you use a GameKit Session
Apple GKSession Docs:
A GKSession object provides the ability to discover and connect to nearby iOS devices using Bluetooth or Wi-fi.
Just because it's called GameKit, doesn't mean it can only be used in games :)

Bluetooth connection to other External USB Bluetooth devises with out accessory?

I have a requirement - I need to connect the my iPhone application with external Bluetooth Devices like (Thermometer, Oximeter) without External Accessory and I need to transfer the data with my application to Bluetooth Device. Is it possible? Can I connect my iPhone to any other devices (not a Apple device)? Is anyone aware of this?
if you are asking for connect bluetooth with any other bluetooth than its possible from now.
in ios apple introduce core bluetooth for connect with external bluetooth devices. The CoreBluetooth framework provides access to Bluetooth 4.0 low energy devices. but its support after ios 5.0 .
you can get more information and demo source code for it from below url.
http://developer.apple.com/library/ios/#documentation/CoreBluetooth/Reference/CoreBluetooth_Framework/_index.html
hope this will help you.
if you are asking for connect bluetooth with any other bluetooth than its possible from now.
you have aslo get more information from given below url.
http://developer.apple.com/library/ios/#samplecode/TemperatureSensor/Introduction/Intro.html

Is it possible to stream music over a bluetooth p2p connection using iPhones

I am trying to connect multiple iPhones using bluetooth. I was thinking of having a server/client system. I just want to know upto how many devices can be connected using bluetooth? I am not able to find a reliable answer online.
Also If you know of any good tutorials regarding this it would great if you could point me to it.
Thanks
AC
A single Bluetooth device can connect with upto 7 devices in a piconet. If a device can do scatternet it can be connected to even more devices..
Application level connection can happen only if both devices supports the required profiles and corresponding role.
If you are trying to stream music , the profile to be used is A2DP , one device will need to be the A2DP source and other A2DP sink,
In case of Iphone it supports only A2DP source. So 2 iPhone will not connect with each other.
you can implement the bluetooth profile for this (A2DP), the big issue here is not the music streaming but the roles, you iPhones are going to play, for instance, you can be a "sound-source" and transfer audio to a "sound-sink" device, those roles have to be previously defined on the handshake and paring action, furthermore, if you are able to browse the properties of an iPhone you will get what port and what roles are supported, sadly muss I said, there is no sink role supported jet for iPhones, so the most that you can get till now is stream audio from iPhone to another bt capable device (speakers, pc, headset unit, etc) more info can be reached on the official bluetooth web site and what iOS until now supports.

iPhone Bluetooth application to connect to a Bluetooth printer

Has anybody succeeded in developing a bluetooth application on the iPhone that prints to a Bluetooth printer?
I have been investigating the feasibility of developing an iPhone application that could print to a Bluetooth-enabled printer. I've gone through the most of the postings in this thread and was confused by the mail exchanges.
As per my analysis:
Gamekit - can be used for bluetooth connectivity between iPhones and IPods ONLY
Bonjour - can be used for wi-fi connectivity between iPhones/IPods and bonjour-enabled printer
We can use an external accessory to connect to a third party Bluetooth-enabled printer provided the 3rd-party printer complies with the necessary regulations from Apple (registering for either “Made for iPod”/ “Works with iPhone”, and also customizing their printer with specific hardware/software, etc.)
Could someone please share their experiences?
You want their external accessory framework. Not GameKit. Happy coding!
The External Accessory framework provides support for communicating with external hardware connected to an iPhone OS–based device through the 30-pin dock connector or wirelessly using Bluetooth.
(This is exactly what you were looking for)
To detect and connect to external devices ExternalAccessoryFramework should be used.Me too developing an application for connecting iphone to other hardware devices via bluetooth .A'm facing the problem with the protocol.The protocol should be the hardware supported ones and the protocol should be given in the info plist file..
Happy coding.
You can want to try this Bluetooth printer, which is Apple MFI approved
http://www.bluebamboo.com/other_file/P25i%20Datasheet%20%28EN%29%20v1.0%2009-Oct-2011.pdf
I would bet that you would need to use Bonjour and Wi-Fi for this application. The bluetooth hardware is restricted to gameplay from what I've seen.
well i have sucsessfully accomplished bt printing on a customers I-phone both devices have to be in discovery mode to do so and then the combination wireless and bt will allow only photo printing though otherwise you will need an app

GKPeerPickerController and GKSession

we can connect by bluetooth only iPodtouch or iPhone using GKSession and GKPeerPickerController right ? , or can we connect other bluetooth device ?
Bluetooth communication using GameKit (GKPeerPickerController and GKSession) is limited to iPhoneOS devices.
You can also use the internet instead of bluetooth, but once again, you are still limited to iPhoneOS devices.
If you are interested in using External Accessories, I suggest you check out Apple's Documentation on the matter. Their documentation states that:
Accessories can be physically connected to the device through the 30-pin dock connector or wirelessly using Bluetooth.
This still will not enable you to play games between devices that aren't iPhoneOS, as you need the iPhoneOS, and it's GameKit framework on both ends. If you are interested in setting such a thing up, you will have to look into managing it manually.
I would strongly advise against using bluetooth, as it's buggy, slow, and has a short range. Peer to peer Wifi or LAN play will be your best bets. I suggest looking into using Bonjour of you're using LAN play. Here are two tutorials (one, two) on using Bonjour. Happy gaming!
the last i heard, bluetooth is 'crippled' on the iphone meaning you can only transfer data via bluetooth to another device with an Apple approved bluetooth chip in it. check out the apple docs for developing 'accessories'.