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 support for L2CAP #810

Open
ErikHellman opened this issue Dec 3, 2024 · 2 comments
Open

Add support for L2CAP #810

ErikHellman opened this issue Dec 3, 2024 · 2 comments

Comments

@ErikHellman
Copy link
Contributor

An alternative to GATT for BLE communication is to use L2CAP. This let's use use a connection-oriented channel towards the peripheral instead of the message-based method GATT uses. Think of this like TCP vs UDP. On an API level we two streams (InputStream and OutputStream), so it makes it much easier to work with.

This is supported by both Android and iOS, but doesn't exist for Web.
https://developer.apple.com/documentation/corebluetooth/cbperipheral/openl2capchannel(_:)
https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothDevice?hl=en#createl2capchannel

I suggest this is added as an additional API in Kable. If this sounds good (despite the API missing on Web) I can start on an initial implementation.

@twyatt
Copy link
Member

twyatt commented Dec 3, 2024

@ErikHellman this sounds like a great addition!

P.S. Loved your "Bluetooth Low Energy on Android" article series (that were posted on hellsoft); they helped shape Kable and avoid many Android pitfalls in its early development. ❤️

@ErikHellman
Copy link
Contributor Author

Thanks! Kable is now my preferred library for this and also what I recommend when I end up with BLE code in apps. Great work! :)

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

No branches or pull requests

2 participants