Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

l2cap server/client using IOBluetooth (osx bluetooth stack)

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

like image 781
Vitali Avatar asked Oct 17 '09 06:10

Vitali


1 Answers

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

like image 87
diciu Avatar answered Nov 02 '22 17:11

diciu