Re: Incoming L2CAP?
Re: Incoming L2CAP?
- Subject: Re: Incoming L2CAP?
- From: Eric Brown <email@hidden>
- Date: Thu, 20 Jun 2002 13:12:11 -0700
On Wednesday, June 19, 2002, at 12:28 AM, Bjvrn Davidsson wrote:
I am having some problems understanding how to set my application up to accept incoming L2CAP requests. The only function I've found for opening L2CAP channels is IOBluetoothDevice::openL2CAPChannel:findExisting:newChannel:, but it does not seem to do what I want.
Our device first opens an RFCOMM channel - for BasicImagingProfile OBEX - and then tries to open an L2CAP channel for HID interrupts.
Support for third-party profiles is not complete in the PR2/SDK release (as you've found). Our formal 1.0 release will be included in Jaguar and has new API to allow clients to register for incoming channel notifications (L2CAP and RFCOMM).
The RFCOMM connection works (on Jaguar, IOBluetoothAddServiceDict seems to be broken on 10.1.5), but the L2CAP connection fails, probably because I have not properly told the stack to accept it. I see nothing in the PacketDecoder relating to this connection attempt, and nothing in the system log or console.
Is it possible to accept incoming L2CAP channels, and how do I do it?
When registering an L2CAP-based service using IOBluetoothAddServiceDict(), the system will automatically accept incoming L2CAP channels with the specified PSM. If you have the PacketDecoder running, you will see any incoming L2CAP channel connect attempts (even those that get rejected). You also should see the incoming connection request HCI event and the subsequent allow connection HCI command. Make sure you have the 'CMD & EVENTS' and 'L2CAP' options selected in the PacketDecoder. If not, those packet types will not be displayed.
One other issue that you may be hitting is that the IOBluetoothAddServiceDict() API in the SDK only keeps that service registered as long as the app that registered it is running. Once that app quits, the service is un-registered and the L2CAP channel is no longer accepted.
Another profile-supporting feature coming in 1.0 is the ability to register persistent services. With that feature, you don't have to remain running all of the time. The system will continue to vend your service and allow the channel and can be configured to launch your app when an incoming channel with the specified PSM is received.
- Eric
_______________________________________________
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.