Add L2CAP LE Credit Based Connection Support #321
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_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 theL2CAPStream
object.L2CAPStream
object has a propertypsm
which tells which channel the stream belongs to. And when it receives data from central, it will emitdata
event 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.