android_ble/lib.rs
1//! Android Bluetooth API wrapper, currently supporting BLE client role operations.
2//!
3//! Version 0.1.x of this crate is supposed to be API-compatible with version 0.6.x of `bluest` library.
4//! Anything incompatible with `bluest` in the API may be reported as a bug.
5//!
6//! This crate uses `ndk_context::AndroidContext`, which is automatically initialized by `android_activity`.
7//! The basic Android test template is provided in the crate page.
8
9pub use adapter::{Adapter, AdapterConfig};
10pub use btuuid::BluetoothUuidExt;
11pub use characteristic::Characteristic;
12pub use descriptor::Descriptor;
13pub use device::{Device, ServicesChanged};
14pub use error::Error;
15pub use l2cap_channel::{L2capChannel, L2capChannelReader, L2capChannelWriter};
16pub use service::Service;
17
18/// Convenience alias for a result with [`Error`].
19pub type Result<T, E = Error> = core::result::Result<T, E>;
20
21// These are migrated from `bluest` for maintaining API compatibility with that library.
22pub use uuid::Uuid;
23pub mod btuuid;
24pub mod error;
25mod types;
26pub use types::*;
27
28mod adapter;
29mod async_util;
30mod characteristic;
31mod descriptor;
32mod device;
33mod event_receiver;
34mod gatt_tree;
35mod l2cap_channel;
36mod service;
37mod util;
38
39// **NOTE**: it is important to use `jni_get_vm` or `jni_with_env` instead of `Global::vm`
40// so that a few bugs in `java-spaghetti` 0.2.0 may be avoided.
41#[allow(mismatched_lifetime_syntaxes)]
42mod bindings;
43mod callback;
44mod jni;
45mod vm_context;