This repository was archived by the owner on Jul 31, 2025. It is now read-only.
Add L2CAP LE Credit Based Connection Support#321
Open
KhaosT wants to merge 1 commit intonoble:masterfrom
Open
Conversation
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 |
|
May I suggest to forward your changes to: https://github.com/abandonware/bleno/ Meanwhile, feedback welcome on latest release: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR added support for L2CAP LE Credit Based Connection support.
Tested with iOS 11.0b2.
Known Issues:
Requires bleno run with
HCI_CHANNEL_USERset 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
publishL2CAPChannelis 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-newStreamwith theL2CAPStreamobject.L2CAPStreamobject has a propertypsmwhich tells which channel the stream belongs to. And when it receives data from central, it will emitdataevent with data buffer. To write data, invokeL2CAPStream.write()with data buffer. Finally, when central request to close the channel, an 'invalidate' event will be emitted.