iphone bluetooth connection - iphone

is there an iOS api to communicate to a paired bluetooth device? Looking for a starting point.
Thanks in advance!
Rob

Like ing0 said you can use GameKit. But it depends what you want to do with bluetooth. You can't access the bluetooth PAN by default, and the lower level bluetooth API requires that you sign an agreement with Apple and join the MFi (made for iPod) program to make a hardware divice that works with Bluetooth.
http://developer.apple.com/programs/mfi/

Read up on the GameKit framework. There are some good examples on Apple's Resources sending and receiving byte arrays. This definitely works with other iDevices but not sure about any old device...

Related

Bluetooth on iOS

What are the limitations of the Bluetooth on iOS? Can I program a Bluetooth in a way it makes the discovery procedure to find neighbor devices, selects a device from list, pair with it and starts over sockets exchanging some data (e.g. for peer2peer game? Is that possible?
All hardware that can communicate with iOS devices using Bluetooh must comply with the MFI (made for iPhone) program. It requires the vendor to use certain kinds of hardware and require a device certification. The program is under a strict NDA.
It basically means that you can only make a connection between iOS devices or devices with the MFI label and not just connect to a another cellphone -unless your iOS device is Jailbroken of course.
yes it is possible. BTW only iOS devices are supported.
Take a look at GameKit framework in the documentation.

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.

iOS and Infrared

Is it possible to communicate with an Infrared device (USB Infrared, TV, Mobile Phone, etc) using iOS (iPhone or iPad)?
Well, i know it's possible, since there are many remote/universal remote applications in the AppStore. I basically want to know how?
What are the limitations and
requirements?
What kind of additional hardware is
required? If it's available in the
market?
Which protocols should i know about?
Which iOS libraries can help me in
the process.
Can anyone point me in the right direction. Thanks.
Any devices using IR for controllers are either wifi or have custom hardware that outputs IR signals based off of output from the device. So without using your own hardware, I don't believe this is possible
Infrared isn't unbuilt in iPhone. All those remote apps are wifi based.
The hardware isn't available but there is a hack you can make to the headphone socket.
http://arstechnica.com/apple/news/2011/01/project-hijack-uses-iphone-audio-jack-to-make-cheap-sensors.ars?utm_source=Ars+Technica+Newsletter&utm_campaign=05bfd22285-January_21_2011_Newsletter&utm_medium=email
There is no infrared connectivity within iOS.However there are bluetooth and wifi.Generally you can use bluetooth functionality by importing GameKit framework.Thanks

How can I create a Bluetooth serial connection between an iPhone and an Arduino+Bluetooth Mate?

I have a project where I need my iPhone to communicate with an Arduino. Bluetooth seems like the best option for the communication. How should I program my iPhone (what framework?) to communicate with the Bluetooth Mate or do Apple's restrictions prevent this? Is it possible with a jailbroken iPhone? Is there a better way other than Bluetooth? Sample code would be helpful.
Thanks in advance
Actually you can make it happen now without Jailbreaking or MFi enrollment.
Take a look ate Bluetooth 4.0 in newer iOS devices and Arduino BT 4.0 shield.
This might help: http://blog.makezine.com/2012/03/19/bluetooth-4-0-from-arduino-to-iphone-no-jailbreaking-no-mfi/
Meanwhile there is an Arduino shield available from Seeedstudio: Bluetooth Low Energy Shield
Devices following the Bluetooth 4.0 specification can be accessed by all iPhone/iPad models with a Bluetooth 4.0 chip inside (currently iPhone 4S, 5 and iPad 3) running with iOS 6. You no longer need to be part of the MFI program or jailbreak the device for most purposes. Use the Core Bluetooth Framework that's also discussed in the WWDC 2012 videos Core Bluetooth 101 (Core OS) and Advanced Core Bluetooth (Core OS).
It's been a while since I was in contact with embedded bluetooth-to-iphone devices, but as far as I remember you have to buy authentication chips from apple.
Apple MFi
But as jailbreak is an option this might work. But I never tried this, because I once was in possession of some authentication chips.
I found btstack with a quick googling, maybe it's helpful.
Try instaling bluetoth iBlueNova, and it will comunicate with each device.
Yes, the best way to do this would be to use Blynk. Make an account, copy the example code, and get started with the Blynk app!
Apple's OS app sandbox prevents generic (Classic non-BLE) Bluetooth serial data comm on stock OS devices, except for a few companies registered in their MFi program.
The most reliable and possibly the easiest solution is to the use the Arduino Ethernet shield with a physical network connection to your WiFi router. The Arduino would host web pages or respond directly to http that did your work for you.
No jailbreaking, no BT programming, no serial com port stuff. Just regular old web pages. Sweet stuff.
The simplest solution would be to navigate with any browser on your network, including your iPhone, to your Arduino and issues commands.
Example:
http://192.168.1.101/?1
192.168.1.101 = the IP of your Arduino
?1 would mean PIN13 pulled high (i.e. turn on the LED)
Your code would be something like:
EthernetClient client = server.available();
while (client.connected())
{
if (client.available())
{
char cVar = client.read();
if (cVar != '?') return;
Serial.Print(cVar)
if (cVar == '1') digitalWrite(13, HIGH); //turn on the led
}
}
That code is quick and dirty so don't hold it against me!
Let me know what you decide and how it works out. I need to go read up on http://blog.makezine.com/2012/03/19/bluetooth-4-0-from-arduino-to-iphone-no-jailbreaking-no-mfi/
Thanks for that link ygbr!

iPhone SDK 3.0: where is the Bluetooth?

i'm participating in the iPhone Developer Program and i have access to the iPhone 3.0 firmware and SDK.
one of the new features of the iPhone 3.0 -- is ability to use Bluetooth, but i can't find any documentation about it.
can someone point me please -- where is it?
The only way of using bluetooth directly is if you join the Made for iPod / Works With iPhone program and integrate the Apple authentication chip into your custom device. Once you've done that, you can use the ExternalAccessory framework which exposes a low-level IO stream API to the device.
Frameworks like Core Audio will let you play and record music via bluetooth headsets and the Gamekit framework will let you discover and talk to other devices via bluetooth, but the fact that it's bluetooth is not exposed to the developer at all.
Look at the GameKit API - it provides simple high level access to BlueTooth connections between devices (built on Apple's Bonjour discovery service).
If I recall correctly, you aren't allowed direct access to the Bluetooth, but rather, you are able to use certain API calls that will search for nearby devices. However, I'm not a developer currently, so I can't point you at any documentation. Perhaps someone else can back me up with a bit more information.
My iphone 3G & 4 will connect to my Sony BT1500 car head unit which was made well before iPhone existed (i.e it's not iPod signed).