Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add L2CAP LE Credit Based Connection Support #321

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KhaosT
Copy link

@KhaosT KhaosT commented Jun 23, 2017

This PR added support for L2CAP LE Credit Based Connection support.
Tested with iOS 11.0b2.

Known Issues:
Requires bleno run with HCI_CHANNEL_USER set to true. Otherwise kernel will handle the request event and response PSM not supported.
Didn't actually do credit based flow control.

Usage:
On bleno object, a new method publishL2CAPChannel is introduced to allow client register L2CAP channel. A PSM between 0x0080 and 0x00FF is required as per Bluetooth Core Spec 5.0 Vol 3, Part A Section 4.22 Table 4.19. Callback has two parameters, success and error message.

Once BLE central request to establish a connection for published L2CAP channel, bleno will emit event l2cap-newStream with the L2CAPStream object.

L2CAPStream object has a property psm which tells which channel the stream belongs to. And when it receives data from central, it will emit data event with data buffer. To write data, invoke L2CAPStream.write() with data buffer. Finally, when central request to close the channel, an 'invalidate' event will be emitted.

@sandeepmistry
Copy link
Collaborator

@KhaosT thanks awesome work!

Unfortunately, I don't have an extra iOS to load iOS 11 beta on to test this out now. I'll review and test it out in a few months.

cc/ @jacobrosenthal

@rzr
Copy link

rzr commented Mar 5, 2020

May I suggest to forward your changes to:

https://github.com/abandonware/bleno/

Meanwhile, feedback welcome on latest release:

https://www.npmjs.com/package/@abandonware/bleno/v/0.5.1-2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants