How to get bluetooth l2cap callbacks work properly?
How to get bluetooth l2cap callbacks work properly?
- Subject: How to get bluetooth l2cap callbacks work properly?
- From: luc bergevin <email@hidden>
- Date: Thu, 08 Apr 2004 13:22:17 -0400
Hi,
I have a problem concerning listening to incoming channel on the l2cap
stack level with bluetooth. The way I understood the API was the
following:
1-) the one that initiates the channel simply calls :
[remoteDevice openL2CAPChannel:psm findExisting:FALSE
newChannel:&mChannel];
when he wants to get a channel ( on a Mac computer).
2-) But the one that receives ( on another Mac) doesn't know when a
call will be initiated and has to become a listener, as:
// server impl
-(void)receiveAny
{
SEL mySel = @selector(L2CAPIncomingChannelOpened:withChannel:);
connectRef = [IOBluetoothL2CAPChannel
registerForChannelOpenNotifications:self selector:mySel];
}
-(void)L2CAPIncomingChannelOpened:(IOBluetoothUserNotification *)ref
withChannel:(IOBluetoothL2CAPChannel *)newChannel
{
mChannel = newChannel;
if(mChannel != NULL)
{
mIOReturn = [mChannel setDelegate:self];
[mInChannelWaitLock unlockWithCondition:CHANNEL_OPENED];
printf("channel opened");
}
}
Then the server registers itself as a listener of the channel for
incoming data.
3-) But my problem is that the server (receiver) never gets called. In
the debugger of the caller, it seems as if everything goes well. I
assume that the data are sent but are lost in the server since it never
gets called by the hardware or the framework functions or whatsoever.
Also, it seems as if the caller gets a channel and sends the data when
I check the pointers in the debugger, but in fact, the delegate methods
- (void)l2capChannelOpenComplete:(IOBluetoothL2CAPChannel*)l2capChannel
status:(IOReturn)error; and
-
(void)l2capChannelWriteComplete:(IOBluetoothL2CAPChannel*)l2capChannel
refcon:(void*)refcon status:(IOReturn)error;
never get called either.
4-) I tried something. I started the server side on my Mac. As
explained in the API, it is supposed to listen for ANY incoming
channel. Then I started a HP iPAQ equipped with Bluetooth and made a
file transfer with the Bluetooth application from Apple included with
my PowerBook. The transfer did very well, but my listener still never
got called. It should have been, since file transfer works over RFComm
over L2CAP.
Any idea ( or any link to an answer)?
Thanks.
luc bergevin,
computer programming student.
_______________________________________________
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.