views:

100

answers:

3

Hello,

I need to develop an iPhone/iPod Touch application that creates a server to send some data stream (characters or bytes) to a Windows C++ application via Bluetooth. I'm thinking of creating a TCP connection, but don't know where to start.

What iPhone API should I use do to something like this? Does anyone knows some code examples that i can use to do this?

And in Windows, what should I use to support this kind of communication?

Thanks

A: 

I'm pretty sure third-party developers don't have sufficient access to the Bluetooth stack to do this via published APIs (i.e. via an app you publish to the App Store).

Is using WiFi an option? That's what most developers seem to be using for client/server communications. If that's the case, see if you can distribute Apple's Bonjour runtime with your app. If you search the developer site for Bonjour, they have code samples (though probably no Windows examples).

Frank Schmitt
Actually, WiFi isn't an option because of some other problems. This application won't be published in App Store, don't know if that helps.I just want to connect an iPhone to a Windows PC via Bluetooth and send some stream bytes, but don't know where to start...Is there any way to do this?Thanks for the answer.
PLinhol
By the way, it isn't necessary to be over bluetooth. I must connect the iPod to a private LAN network (not wireless) to send data using a tcp connection.Is there any other option to do this?One thing that i can think of is connect my laptop to this LAN network and then make the iPod use the network via laptop, is this possible? How?
PLinhol
A: 

Yes. From what it looks like you can use the PAN bluetooth profile (the same profile used for tethering) with everything except the original iPhone.

Here's an article doing bluetooth over iPhone/iPad using GameKit. The article notes that you would need at least 2 iPhone/iPad devices running iPhone OS 3.0, but I wouldn't take that as an impossibility to talk to any other bluetooth capable device.

Update This forum indicates that the iPhone is only capable of headset pairing. It could be that the iPhone is "picky" about what you can pair it with.

"The iPhone only recognizes the "headset" profile. Another well thought out idea from Apple. No A2DP profiles, no OBEX." -sapporobaby

Update 2 As jamone as indicated iPhone 3.0 supports A2DP. How nice is that?

Here's a table listing of iPhone/iPad bluetooth supported profiles

manifest
A2DP was added a while ago. OS 3.0 if I remember correctly.
jamone
That's awful news...There is any way to connect the iPhone/iPod to a local network?
PLinhol
Thanks, that seems good news. Probably I can do what I want using a PAN bluetooth profile.But now, how do I do that? Or, where should I start? What iPhone/iPod API should I use to do that?Thank you very much for the help.
PLinhol
First thing I would do is make sure an iPhone can connect using bluetooth with a windows machine using existing software. There should be no reason that it can't. Once you know it's possible with existing software I would use the GameKit on the iPhone side and BlueZ
manifest
I've been searching for information about GameKit, and seems it doesn't works to communicate between iPhone and non-iPhone devices (in my casse, Windows C++ application). So, I searched about NSNetServices and CFNetServices and Apple says: "If developers want to add Bonjour functionality into a non-Cocoa, or a BSD-style application, it is recommended that they investigate the DNS Service Discovery Programming Guide first.".Knowing this, I think I must use DNS Service Discovery and Boujour to resolve the service and NSNetService/CFNetService to send data. Am I correct?
PLinhol
@PLinhol - GameKit leverages Bonjour over a Bluetooth PAN. Don't worry about the specifics of Bonjour until you are able to make a PAN connection between the iPhone and the desktop application.
Brad Larson
@PLinhol Yes. Bonjour seems to be some functionality built on top of the bluetooth capability. I'm agreeing with Larson in that you should just attempt to get an iPhone and a PC to make PAN connection before doing any development. Then determine how to do it with NetService.
manifest
I've been trying to do some tests using dns-sd (Bonjour SDK sample) and Witap (iPhone OS code sample).If I have the Witap application running on the iPod and use the command line "dns-sd.exe -B _witap._tcp local" for browsing the service _witap, shouldn't that appear listed? Even using WiFi, it doesn't shows up... Am I doing something wrong or do I need some extra configuration?
PLinhol
A: 

Is it possible to connect the iPhone/iPod to my laptop and use the Local network it is to connected using and ad-hoc or VPN network?

PLinhol