Skip to content

Commit

Permalink
L2CAP Support for ISO 18013-5 Holders (#27)
Browse files Browse the repository at this point in the history
* L2CAP Support for ISO 18013-5 Holders

NOTE: Currently not working!  See below.

This provides L2CAP support for the holder for 18013-5.  This is
disabled at present; the code is in place, but calling connect() on
the L2CAP socket throws a "resources not available" exception for
reasons I have not yet tracked down.

The code should otherwise be ready, however; the request read and
the response write are both in place.  The presence of an L2CAP
characteristic on the peripheral no longer breaks the old flow for
the code, so we now properly do non-L2CAP connections to L2CAP
peripherals.

For convenience, this also includes a makefile to orchestrate
building and running; `make` or `make install` will build the
example app and attempt to install it on all connected android
devices.  `make run` will launch the example app on one device
and attempt to attach `logcat`. `make help` lists the available
commands.

* Lint fixes & a linter target in the makefile.

* Addressing PR comments.

* Fix makefile typos.

* L2CAP fixes for the holder.

This code adds a fallback so that in the event an exception is thrown by the
L2CAP socket during connection, it will fall back to the old flow.  This is
necessary when interacting with the iPhone reader, as Android devices do not
seem to get along with BLE link-layer encryption as implemented in iOS.

---------

Co-authored-by: Todd Showalter <[email protected]>
  • Loading branch information
todd-spruceid and Todd Showalter authored Oct 1, 2024
1 parent 18ccb4b commit e5c0f7d
Show file tree
Hide file tree
Showing 6 changed files with 448 additions and 164 deletions.
4 changes: 2 additions & 2 deletions MobileSdk/src/main/java/com/spruceid/mobile/sdk/BleCentral.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class BleCentral(
/**
* Starts to scan for devices/peripherals to connect to - looks for a specific service UUID.
*
* Scanning is limited with a timeout to preserve batter life of a device.
* Scanning is limited with a timeout to preserve battery life of a device.
*/
fun scan() {
val filter: ScanFilter = ScanFilter.Builder()
Expand Down Expand Up @@ -153,4 +153,4 @@ fun isBluetoothEnabled(context: Context): Boolean {

fun getBluetoothManager(context: Context): BluetoothManager? {
return context.getSystemService(BLUETOOTH_SERVICE) as? BluetoothManager
}
}
Loading

0 comments on commit e5c0f7d

Please sign in to comment.