Expand description
The Android BLE APIs, reached through JNI.
Shaped like the other backends’ sys layers: an Event enum, an
EventSink to receive it, and a Central that owns the adapter. What
differs is where the events come from — Android delivers them to callback
objects, which is why crate::dex and crate::runtime exist.
§Threading
Callbacks arrive on binder threads the VM owns but Rust has never seen, so every entry point attaches, pushes a local frame, and pops it before returning. Without the frame, a scan that runs for a minute exhausts the 512-entry local reference table and aborts the process.
§Permissions
BLUETOOTH_SCAN and BLUETOOTH_CONNECT from API 31, and
ACCESS_FINE_LOCATION for scanning on 23–30. A missing permission surfaces
as a SecurityException from the framework — caught, cleared and reported
rather than left pending.
Structs§
- Ref
- A retained Java object.
Enums§
- Event
- What Android tells us.
- Manager
State BluetoothAdapter.STATE_*, plus the cases that are not adapter states.
Traits§
- Event
Sink - Where events go. Called on a binder thread, one at a time per callback.
Functions§
- advertise_
natives - The
(name, signature, function)table forAdvertiseCallback. - bind_
sink - Register a sink for a callback object.
- gatt_
natives - The
(name, signature, function)table forGattCallback. - scan_
natives - The
(name, signature, function)table forScanCallback. - server_
natives - The
(name, signature, function)table forBluetoothGattServerCallback. - unbind_
sink