http://lightblue.sourceforge.net
Bea Lam <blammit@gmail.com>
This project is no longer maintained.
LightAquaBlue is an Objective-C framework included in the Python LightBlue library, as part of the Mac OS X implementation. You can use it to:
Of course, all of this functionality is already available in Apple's IOBluetooth framework; however, LightAquaBlue wraps IOBluetooth to provide a simpler API. The BBBluetoothOBEXClient and BBBluetoothOBEXServer enable the implementation of OBEX client and server sessions without the low-level request and response handling that is required when using IOBluetooth's OBEXSession class.
To get LightAquaBlue, download the LightBlue source package and look inside src/mac/LightAquaBlue/ for the XCode project file and accompanying sources.
The significant header files of the LightAquaBlue framework can be viewed online:
The source distribution for LightBlue includes two example applications for using the LightAquaBlue framework, inside the examples/LightAquaBlue directory:
To use BBBluetoothOBEXClient to send an OBEX Connect request, for example, from within your awakeFromNib method:
- (void)awakeFromNib
{
NSString *address = @"aa:bb:cc:dd:ee:ff";
int rfcommChannel = 15;
BluetoothDeviceAddress deviceAddress;
IOBluetoothNSStringToDeviceAddress(address, &deviceAddress);
BBBluetoothOBEXClient *client = [[BBBluetoothOBEXClient alloc] initWithRemoteDeviceAddress:&deviceAddress
channelID:rfcommChannel
delegate:self];
OBEXError status = [client sendConnectRequestWithHeaders:nil];
if (status == kOBEXSuccess) {
NSLog(@"Sent 'Connect' request, waiting for response...");
}
And implement the accompanying delegate method to be notified when the Connect request has finished:
- (void)client:(BBBluetoothOBEXClient *)client
didFinishConnectRequestWithError:(OBEXError)error
response:(BBOBEXResponse *)response
{
if ([response responseCode] == kOBEXResponseCodeSuccessWithFinalBit)
NSLog(@"Connected.");
else
NSLog(@"Connect request refused (%@)", [response responseCodeDescription]);
}