pub struct Adapter { /* private fields */ }Expand description
The Bluetooth adapter and its scanner.
Implementations§
Source§impl Adapter
impl Adapter
Sourcepub fn open(runtime: &Runtime) -> Result<Self, Error>
pub fn open(runtime: &Runtime) -> Result<Self, Error>
((BluetoothManager) context.getSystemService(BLUETOOTH_SERVICE)).getAdapter().
pub fn as_ptr(&self) -> JObject
Sourcepub fn is_enabled(&self, env: Env) -> bool
pub fn is_enabled(&self, env: Env) -> bool
Whether the adapter is on.
Sourcepub fn name(&self, env: Env) -> Option<String>
pub fn name(&self, env: Env) -> Option<String>
adapter.getName() — what this device advertises itself as.
Sourcepub fn address(&self, env: Env) -> Option<String>
pub fn address(&self, env: Env) -> Option<String>
adapter.getAddress() — the controller’s own address.
Since Android 6 this returns a fixed 02:00:00:00:00:00 to any app
without LOCAL_MAC_ADDRESS_PERMISSION, which is a system permission an
ordinary app cannot hold. The caller is expected to recognise that and
report nothing rather than a placeholder every device shares.
Sourcepub fn scanner(&self, env: Env) -> Result<JObject, Error>
pub fn scanner(&self, env: Env) -> Result<JObject, Error>
adapter.getBluetoothLeScanner() — null while Bluetooth is off.
Sourcepub fn remote_device(&self, env: Env, address: &str) -> Result<JObject, Error>
pub fn remote_device(&self, env: Env, address: &str) -> Result<JObject, Error>
adapter.getRemoteDevice(address).
Sourcepub fn bonded_device_addresses(&self, env: Env) -> Result<Vec<String>, Error>
pub fn bonded_device_addresses(&self, env: Env) -> Result<Vec<String>, Error>
Return addresses of devices in BluetoothAdapter.getBondedDevices().
Auto Trait Implementations§
impl Forget for Adapter
impl Freeze for Adapter
impl Move for Adapter
impl RefUnwindSafe for Adapter
impl Send for Adapter
impl Sync for Adapter
impl Unpin for Adapter
impl UnsafeUnpin for Adapter
impl UnwindSafe for Adapter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more