Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Leopard & Bluetooth RFCOMM channels
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Leopard & Bluetooth RFCOMM channels

On 1/31/08, Joseph Kelly <email@hidden> wrote:
> Post the code that you're using to open the channel to the list and
> maybe somebody can spot something.

Here it goes:

	isConnected = false;
registerForConnectNotifications:self	selector:@selector(newConnection:fromDevice:)];

- (IBAction)click: (id)sender
	NSArray *devices = [IOBluetoothDevice pairedDevices];
	IOBluetoothDevice* dev = [devices objectAtIndex:0];
	[dev openConnection];

	NSLog(@"New connection from %@", [device getName]);

	IOReturn ret;
	NSArray* services = [device getServices];

	BluetoothRFCOMMChannelID rfcommChannelID;

	for (IOBluetoothSDPServiceRecord* service in services) {
		NSLog(@"Service: %@", [service getServiceName]);
		ret = [service getRFCOMMChannelID:&rfcommChannelID];
		if (ret == kIOReturnSuccess) {
			NSLog(@"ChannelID FOUND");

	[device openRFCOMMChannelAsync:&channel withChannelID:rfcommChannelID

This is just a cut from the source code that seems adequate to my
question. Console output for this code is:

2008-01-31 11:16:24.600 BluetoothGPS[1059:10b] New connection from BT GPS V10
2008-01-31 11:16:24.601 BluetoothGPS[1059:10b] Service: Spp
2008-01-31 11:16:24.603 BluetoothGPS[1059:10b] ChannelID FOUND

Ofcourse the class implements also all the RFCOMM delegate methods
which don't get called at all.

- (void)rfcommChannelOpenComplete:(IOBluetoothRFCOMMChannel*)rfcommChannel
- (void)rfcommChannelData:(IOBluetoothRFCOMMChannel*)rfcommChannel
data:(void *)dataPointer length:(size_t)dataLength;
- (void)rfcommChannelClosed:(IOBluetoothRFCOMMChannel*)rfcommChannel;
- (void)rfcommChannelControlSignalsChanged:(IOBluetoothRFCOMMChannel*)rfcommChannel;
- (void)rfcommChannelFlowControlChanged:(IOBluetoothRFCOMMChannel*)rfcommChannel;
- (void)rfcommChannelWriteComplete:(IOBluetoothRFCOMMChannel*)rfcommChannel
refcon:(void*)refcon status:(IOReturn)error;
- (void)rfcommChannelQueueSpaceAvailable:(IOBluetoothRFCOMMChannel*)rfcommChannel;

Janusz YANOUSHek Bossy
gg# 791964
tlen email@hidden
jabber email@hidden
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

 >Leopard & Bluetooth RFCOMM channels (From: "Janusz Bossy" <email@hidden>)

Visit the Apple Store online or at retail locations.

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.