Can an iPhone or iPod Touch communicate with another device in the same room? - iphone

I'm new to developing applications for the iPhone and iPod touch. Is it possible to communicate directly between 2 devices in the same room by using WiFi or perhaps even BlueTooth on the iPhone?
I've seen a demo of a fire application where one iPhone "lights" other iPhone when they get close to each other. How is this accomplished?
The point of all this is that I am exploring the option of developing a game that you can play with another person in the same room.

The iPhone supports Bonjour based service discovery and several applications take advantage of this to do things like syncing with a PC on the same network. Explore the samples and guides in the iPhone SDK. WiTap and BonjourWeb are good examples to start with. NSNetServices and CFNetServices are the APIs you'll be dealing with for Bonjour

iPhone - iPhone communication can also be accomplished over bluetooth using GameKit.

Related

Bluetooth data acquisition in background in iPhone 4G S

I want to develop an application for the iPhone 4GS that supports Bluetooth 4.
The application would continually listen to the data transmitted by a heart rate monitor over Bluetooth, and show information on a screen.
To achieve this, the application would have to listen to the data even when it's not the active foreground application.
Like Android, is it possible to silently listen to Bluetooth events on an iPhone as a background service?
I can't determine exactly what you're asking, but here are two tutorials for incorporating Bluetooth in iOS apps:
iPhone Bluetooth Programming
iOS Bluetooth Programming - Getting devices to see each other
Also, here is Apple's list of Supported Bluetooth profiles.
You won't find serial port profile (SPP) in iOS devices if you're looking for that.
So question about using it in the background would seem irrelevant.
You could use 'old style' FSK modem over BT audio an then decode the signal in
code. On the other hand you should consider going WiFi. Microchips MRF24WB0MA/RM for
example supports adhoc/infrastructure netwroks and it also has Bonjour support.

Can iPad know when your iPhone is close by?

Is there a way to create a background app( once this is available on the iPad ) that can detect when your iPhone is close by? So I'm thinking that it would require the use of bluetooth. I'm thinking you could use this for syncing and such.
Ignoring the aspect of backgrounding (which isn't really what you were asking about in totality):
The way this would work on a running application is that both devices would need to have the application running. Then, they would both have to register themselves through Bluetooth using Bonjour/GameKit.
With traditional bluetooth iPhone/iPad games, the game checks bluetooth and displays local bluetooth players, and then the user can select another player.
Your application would retrieve that list of local bluetooth iPhones, and compare the device name to the device name which you have determined to be your iPhone.
Here is some: GameKit Documentation.
You can do this with two actively running apps. But backgrounding these apps... of course: NDA.

iphone and bluetooth device

could i connect my nokia phone to iphone using the following Object..?
1)GKPeerPickerController
2)GKSession
i mean (GameKit)
note that here not two iPhone but it is one iPhone other one is only one Bluetooth device..
thanks and regards
jalju
Could you be a little bit more specific about what your purpose is?
Are you trying to create a cross-platform game or simply transferring data between the devices?
Though the documentation clearly states that:
The GKPeerPickerController class
provides a standard user interface to
allow an iPhone to discover and
connect to another iPhone.
So I don't think this is the right way to go.

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.

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).