views:

855

answers:

1

I'm having trouble understanding the API to set up a l2cap (or RFCOMM) client/server running on OSX like I can with BlueZ on Linux.

On Linux, I simply open a socket, bind, listen & then accept for the server, & socket, bind, connect for the client (w/ the bind taking in the BT address of the device I want to use). Also, there's no pairing done.

I can't figure out how to configure my application to start listening for connections on a particular device (or if OSX only supports 1 BT adapater at a time, then how to listen for any incoming connections).

I also can't figure out how to configure my application to send to one BT device using a particular device (this is irrelevant if OSX only supports 1 at a time).

Also, does the OSX stack require pairing to have occured between 2 devices before it'll pass through l2cap?

Any language examples would be appreciated, although C/C++ would be preferred.

Thanks

A: 

In Mac OS X 10.5 there's an example (in /Developer/Examples/Bluetooth, titled RFCOMM_Open_SPP_Example) that shows connecting to and reading data from a bluetooth device (i've used it to read NMEA lines from a BT GPS receiver). See also: Leopard & Bluetooth RFCOMM channels

Unfortunately I can't find a copy of the example project anywhere.

It looks like the code samples have been replaced with: Developing Bluetooth Applications

diciu
Thanks - I found it on my own and forgot to answer. There's a PDF for JSR-82 (Bluetooth for Java) describing what the values should be for the L2CAP server plist.Also, OSX's bluetooth stack only supports 1 bluetooth adapter at a time.
Vitali