Re: Leopard & Bluetooth RFCOMM channels
Re: Leopard & Bluetooth RFCOMM channels
- Subject: Re: Leopard & Bluetooth RFCOMM channels
- From: "Janusz Bossy" <email@hidden>
- Date: Thu, 31 Jan 2008 11:21:51 +0100
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:
-(void)awakeFromNib
{
isConnected = false;
[IOBluetoothDevice
registerForConnectNotifications:self selector:@selector(newConnection:fromDevice:)];
}
- (IBAction)click: (id)sender
{
NSArray *devices = [IOBluetoothDevice pairedDevices];
IOBluetoothDevice* dev = [devices objectAtIndex:0];
[dev openConnection];
}
-(void)newConnection:(IOBluetoothUserNotification*)notification
fromDevice:(IOBluetoothDevice*)device
{
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");
break;
}
}
[device openRFCOMMChannelAsync:&channel withChannelID:rfcommChannelID
delegate:self];
}
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
status:(IOReturn)error;
- (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;
--
Pozdrawiam
Janusz YANOUSHek Bossy
http://digigal.art.pl
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