Re: choosing a RFCOMMChannel channelID ?
Re: choosing a RFCOMMChannel channelID ?
- Subject: Re: choosing a RFCOMMChannel channelID ?
- From: Aurélien Hugelé <email@hidden>
- Date: Thu, 24 Jun 2004 15:18:39 +0200
On 24 Jun 2004, at 15:00, Petteri Kamppuri wrote:
On 24.6.2004, at 15:45, Aurilien Hugeli wrote:
How am i supposed to choose the channelID ? is it a manufacturer
document ? can i be sure the channel is available and not already in
use ? am i supposed to scan channelID until connection succeed ?
I think the correct channelID depends on the service you are going to
use on the Bluetooth device. I'm not sure of this.
yes the problem here is hat i do not know what is the service since i
did not publish it. i just want to communicate with the internal
modem... and i dont know the name of this service !
This is what I use:
// Find the correct serviceRecord on the device, maybe itarete through
them all
IOBluetoothSDPServiceRecord *serviceRecord = [self
findCorrectServiceOnDevice:mainBTDevice];
if(serviceRecord == nil)
{
NSLog(@"ERROR Couldn't find right service for device '%@'",
[mainBTDevice getNameOrAddress]);
return;
}
IOReturn error = 0;
BluetoothRFCOMMChannelID channelID = -1;
// Correct service found, ask for the RFCOMM Channel ID
error = [serviceRecord getRFCOMMChannelID:&channelID];
if(error == kIOReturnSuccess)
{
// Great, we found the channel ID! Now we can use it.
[mainBTDevice openRFCOMMChannelSync:&modemConnectionChannel
withChannelID:channelID delegate:self];
}
Apple documentation is really poor an the subject, or i did not found
it !
I think Apple needs to clarify and extend Bluetooth documentation.
Also I'd like to see documents which actually tell how and why to use
the API calls and what implications they have. And what are all the
possible error codes and what should the program do when it gets a
certain error code from a method.
Despite of quite sparse documentation, I think that the Bluetooth API
itself is very well thought of and quite elegant. Async methods are
easy and handy to use. Thank you all at the Bluetooth Cocoa team!
Maybe we'll see at the WWDC.
yes i hope the WWDC BT session will learn us the arcane of IOKit for BT
!
--
Petteri Kamppuri
email@hidden
MK&C
_______________________________________________
bluetooth-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/bluetooth-dev
Do not post admin requests to the list. They will be ignored.