28import java.lang.ref.WeakReference;
29import java.nio.ByteOrder;
30import java.util.ArrayList;
31import java.util.Iterator;
33import java.util.concurrent.atomic.AtomicBoolean;
34import java.util.concurrent.atomic.AtomicInteger;
35import java.util.concurrent.atomic.AtomicReference;
37import org.direct_bt.AdapterSettings;
38import org.direct_bt.AdapterStatusListener;
39import org.direct_bt.BDAddressAndType;
40import org.direct_bt.BDAddressType;
41import org.direct_bt.BTAdapter;
42import org.direct_bt.BTDevice;
43import org.direct_bt.BTException;
44import org.direct_bt.BTManager;
45import org.direct_bt.BTMode;
46import org.direct_bt.BTRole;
47import org.direct_bt.BTSecurityLevel;
48import org.direct_bt.DBGattServer;
49import org.direct_bt.DiscoveryPolicy;
50import org.direct_bt.EIRDataTypeSet;
51import org.direct_bt.EInfoReport;
52import org.direct_bt.HCIStatusCode;
53import org.direct_bt.HCIWhitelistConnectType;
54import org.direct_bt.LE_Features;
55import org.direct_bt.LE_PHYs;
56import org.direct_bt.PairingMode;
57import org.direct_bt.SMPIOCapability;
58import org.direct_bt.SMPPairingState;
59import org.direct_bt.ScanType;
60import org.jau.io.PrintUtil;
61import org.jau.net.EUI48;
66 static final boolean PRINT_DEVICE_LISTS =
false;
68 private static AtomicInteger globThreadID =
new AtomicInteger(0);
69 private static int discoverTimeoutMS = 100;
71 private final int dev_id;
76 private String name_cached;
82 private final Object discoveryLock =
new Object();
83 private final Object discoveredDevicesLock =
new Object();
85 private final AtomicBoolean isClosing =
new AtomicBoolean(
false);
87 private final AtomicBoolean powered_state =
new AtomicBoolean(
false);
89 private final AtomicReference<ScanType> currentMetaScanType =
new AtomicReference<ScanType>(
ScanType.
NONE);
91 private final List<WeakReference<BTDevice>> discoveredDevices =
new ArrayList<WeakReference<BTDevice>>();
96 final byte byteAddress[],
97 final byte byteAddressType,
98 final String name,
final int dev_id)
100 super(nativeInstance, compHash(java.util.Arrays.hashCode(byteAddress), 31+byteAddressType));
101 this.dev_id = dev_id;
102 this.addressAndType =
new BDAddressAndType(byteAddress, 0, byteAddressType);
103 this.name_cached = name;
104 this.visibleAddressAndType = addressAndType;
115 private native
byte getRoleImpl();
121 private native
byte getBTModeImpl();
129 if( !isClosing.compareAndSet(
false,
true) ) {
133 removeAllStatusListenerImpl();
138 for(
final Iterator<BTDevice>
id = devices.iterator();
id.hasNext(); ) {
147 mngr.removeAdapter(
this);
152 private final void poweredOff() {
153 powered_state.set(
false);
158 public final boolean equals(
final Object obj)
163 if (obj ==
null || !(obj instanceof
DBTAdapter)) {
167 return dev_id == other.dev_id && addressAndType.
equals(other.addressAndType);
187 final String v = getNameImpl();
192 private native String getNameImpl();
199 final String v = getShortNameImpl();
204 private native String getShortNameImpl();
210 private native
byte setNameImpl(
final String name, String short_name);
214 return findDeviceInCache(name, addressAndType);
219 return find(name, addressAndType, 0);
224 private final native
boolean isDeviceWhitelistedImpl(
final byte[] address,
byte address_type);
229 final short conn_interval_min,
final short conn_interval_max,
230 final short conn_latency,
final short timeout) {
232 conn_interval_min, conn_interval_max, conn_latency, timeout);
234 private final native
boolean addDeviceToWhitelistImpl1(
final byte[] address,
final byte address_type,
final int ctype,
235 final short conn_interval_min,
final short conn_interval_max,
236 final short conn_latency,
final short timeout);
243 private native
boolean addDeviceToWhitelistImpl2(
final byte[] address,
final byte address_type,
final int ctype);
247 return removeDeviceFromWhitelistImpl(addressAndType.
address.b, addressAndType.
type.
value);
249 private native
boolean removeDeviceFromWhitelistImpl(
final byte[] address,
final byte address_type);
255 return currentMetaScanType.
get();
260 return ScanType.NONE != currentMetaScanType.get();
265 return gattServerData;
271 return "Adapter" +
"\u271D" +
"["+addressAndType+
", '"+name_cached+
"', id "+dev_id+
"]";
273 return toStringImpl();
280 private native String toStringImpl();
283 public final native
boolean setPowered(
final boolean power_on);
289 private native
byte setPrivacyImpl(
boolean enable);
298 private native
byte setSecureConnectionsImpl(
final boolean enable);
302 final short conn_latency,
final short supervision_timeout) {
303 return HCIStatusCode.
get( setDefaultConnParamImpl(conn_interval_min, conn_interval_max,
304 conn_latency, supervision_timeout) );
306 private native
byte setDefaultConnParamImpl(
final short conn_interval_min,
final short conn_interval_max,
307 final short conn_latency,
final short supervision_timeout);
311 setServerConnSecurityImpl(sec_level.
value, io_cap.
value);
313 private final native
void setServerConnSecurityImpl(
final byte sec_level,
final byte io_cap);
322 private native
byte initializeImpl(
final byte btModeInt,
final boolean powerOn);
331 private native
byte resetImpl();
337 private native
byte setDefaultLE_PHYImpl(
final byte Tx,
final byte Rx);
341 return connectDeviceImpl(addressAndType.
address.b, addressAndType.
type.
value);
343 private native
BTDevice connectDeviceImpl(
byte[] address,
byte addressType);
350 private native
boolean isPoweredImpl();
354 private native
boolean isSuspendedImpl();
357 public final boolean isValid() {
return super.isNativeValid() && isValidImpl(); }
358 private native
boolean isValidImpl();
364 private native
long getLEFeaturesImpl();
377 return startDiscovery(
null, policy, le_scan_active, (
short)24, (
short)24, (
byte)0,
true );
382 final short le_scan_interval,
final short le_scan_window,
383 final byte filter_policy,
385 synchronized( discoveryLock ) {
388 removeDiscoveredDevicesImpl2j();
391 startDiscoveryImpl(gattServerData, policy.value, le_scan_active, le_scan_interval, le_scan_window, filter_policy, filter_dup) );
392 if( PRINT_DEVICE_LISTS || DEBUG ) {
393 PrintUtil.fprintf_td(System.err,
"BTAdapter::startDiscovery: res %s, %s", res,
toString());
399 private native
byte startDiscoveryImpl(
final DBGattServer gattServerData,
400 final byte policy,
final boolean le_scan_active,
401 final short le_scan_interval,
final short le_scan_window,
402 final byte filter_policy,
407 synchronized( discoveryLock ) {
410 if( PRINT_DEVICE_LISTS || DEBUG ) {
411 PrintUtil.fprintf_td(System.err,
"BTAdapter::stopDiscovery: res %s, %s", res,
toString());
417 private native
byte stopDiscoveryImpl() throws
BTException;
423 private native
byte getCurrentDiscoveryPolicyImpl();
429 private native List<BTDevice> getDiscoveredDevicesImpl();
433 final int cj = removeDiscoveredDevicesImpl2j();
434 final int cn = removeDiscoveredDevicesImpl1();
437 PrintUtil.println(System.err,
"DBTAdapter::removeDevices: Unexpected discovered device count: Native "+cn+
", callback "+cj);
442 private native
int removeDiscoveredDevicesImpl1() throws
BTException;
443 private
int removeDiscoveredDevicesImpl2j() {
444 synchronized(discoveredDevicesLock) {
445 final int n = discoveredDevices.size();
446 discoveredDevices.clear();
450 final boolean removeDiscoveredDevice(
final BTDevice device) {
451 return removeDiscoveredDeviceImpl2j( device.getAddressAndType() );
456 final boolean cj = removeDiscoveredDeviceImpl2j(addressAndType);
457 final boolean cn = removeDiscoveredDeviceImpl1(addressAndType.
address.b, addressAndType.
type.
value);
460 PrintUtil.println(System.err,
"DBTAdapter::removeDevices("+addressAndType+
"): Unexpected discovered device count: Native "+cn+
", callback "+cj);
465 private native
boolean removeDiscoveredDeviceImpl1(
final byte[] address,
final byte addressType);
467 private boolean removeDiscoveredDeviceImpl2j(
final BDAddressAndType addressAndType) {
468 synchronized(discoveredDevicesLock) {
469 for(
final Iterator<WeakReference<BTDevice>> it = discoveredDevices.iterator(); it.hasNext();) {
483 final ArrayList<BTDevice> res =
new ArrayList<BTDevice>();
484 synchronized(discoveredDevicesLock) {
485 for(
final Iterator<WeakReference<BTDevice>> it = discoveredDevices.iterator(); it.hasNext();) {
496 private final void cleanDiscoveredDevice() {
497 synchronized(discoveredDevicesLock) {
498 for(
final Iterator<WeakReference<BTDevice>> it = discoveredDevices.iterator(); it.hasNext();) {
509 final boolean added = addStatusListenerImpl(
null, l);
510 if( PRINT_DEVICE_LISTS || DEBUG ) {
511 PrintUtil.fprintf_td(System.err,
"BTAdapter::addStatusListener: added %b, %s", added,
toString());
521 if( !isClosing.get() ) {
522 res = removeStatusListenerImpl(l);
524 if( PRINT_DEVICE_LISTS || DEBUG ) {
525 PrintUtil.fprintf_td(System.err,
"BTAdapter::removeStatusListener: removed %b, %s", res,
toString());
534 final int r = removeAllStatusListenerImpl();
538 private native
int removeAllStatusListenerImpl();
542 printDeviceListsImpl();
543 List<WeakReference<BTDevice>> _discoveredDevices;
544 synchronized(discoveredDevicesLock) {
546 _discoveredDevices =
new ArrayList<WeakReference<BTDevice>>(discoveredDevices);
548 final int sz = _discoveredDevices.size();
549 PrintUtil.fprintf_td(System.err,
"- BTAdapter::DiscoveredDevicesJ: %d elements%s", sz, System.lineSeparator());
551 for(
final Iterator<WeakReference<BTDevice>> it = _discoveredDevices.iterator(); it.hasNext(); ++idx) {
554 PrintUtil.fprintf_td(System.err,
" - %d / %d: nil%s", (idx+1), sz, System.lineSeparator());
556 PrintUtil.fprintf_td(System.err,
" - %d / %d: %s, name '%s'%s", (idx+1), sz,
561 private final native
void printDeviceListsImpl();
569 final boolean initialSetting = oldmask.
isEmpty();
571 if( initialSetting ) {
572 PrintUtil.println(System.err,
"Adapter.StatusListener.SETTINGS: "+oldmask+
" -> "+newmask+
", initial "+changedmask+
" on "+a);
574 PrintUtil.println(System.err,
"Adapter.StatusListener.SETTINGS: "+oldmask+
" -> "+newmask+
", changed "+changedmask+
" on "+a);
577 if( initialSetting ) {
578 powered_state.set( newmask.
isSet(AdapterSettings.SettingType.POWERED) );
581 if( changedmask.
isSet(AdapterSettings.SettingType.POWERED) ) {
582 final boolean _isPowered = newmask.
isSet(AdapterSettings.SettingType.POWERED);
583 if( powered_state.compareAndSet(!_isPowered, _isPowered) ) {
591 public void discoveringChanged(
final BTAdapter adapter,
final ScanType currentMeta,
final ScanType changedType,
final boolean changedEnabled,
final DiscoveryPolicy policy,
final long timestamp) {
593 PrintUtil.println(System.err,
"Adapter.StatusListener.DISCOVERING: meta "+currentMeta+
", changed["+changedType+
", enabled "+changedEnabled+
", keepAlive "+policy+
"] on "+adapter);
596 currentMetaScanType.set(currentMeta);
599 public boolean deviceFound(
final BTDevice device,
final long timestamp) {
600 synchronized(discoveredDevicesLock) {
601 cleanDiscoveredDevice();
602 discoveredDevices.add(
new WeakReference<BTDevice>(device));
604 if( PRINT_DEVICE_LISTS || DEBUG ) {
605 PrintUtil.println(System.err,
"Adapter.FOUND: discoveredDevices "+ discoveredDevices.size() +
": "+device+
", on "+device.getAdapter());
611 public void deviceUpdated(
final BTDevice device,
final EIRDataTypeSet updateMask,
final long timestamp) {
612 if( updateMask.isSet( EIRDataTypeSet.DataType.BDADDR ) ) {
613 ((DBTDevice)device).updateAddress();
616 final boolean rssiUpdated = updateMask.isSet( EIRDataTypeSet.DataType.RSSI );
617 final boolean mdUpdated = updateMask.isSet( EIRDataTypeSet.DataType.MANUF_DATA );
618 if( DEBUG && !rssiUpdated && !mdUpdated && 0 != updateMask.get(EIRDataTypeSet.EIR_DATA_TYPE_MASK) ) {
619 PrintUtil.println(System.err,
"Adapter.UPDATED: "+updateMask+
" of "+device+
" on "+device.getAdapter());
625 public void deviceConnected(
final BTDevice device,
final boolean discovered,
final long timestamp) {
627 PrintUtil.println(System.err,
"Adapter.CONNECTED (discovered "+discovered+
"): "+device+
" on "+device.getAdapter());
629 final DBTDevice device_ = (DBTDevice)device;
630 if( device_.isConnected.compareAndSet(
false,
true) ) {
636 public void devicePairingState(
final BTDevice device,
final SMPPairingState state,
final PairingMode mode,
final long timestamp) {
638 PrintUtil.println(System.err,
"Adapter.PAIRING_STATE: state "+state+
", mode "+mode+
": "+device);
643 public void deviceReady(
final BTDevice device,
final long timestamp) {
645 PrintUtil.println(System.err,
"Adapter.READY: "+device);
650 public void deviceDisconnected(
final BTDevice device,
final HCIStatusCode reason,
final short handle,
final long timestamp) {
652 PrintUtil.println(System.err,
"Adapter.DISCONNECTED: Reason "+reason+
", old handle 0x"+Integer.toHexString(handle)+
": "+device+
" on "+device.getAdapter());
654 gattServerData =
null;
656 final DBTDevice device_ = (DBTDevice)device;
657 if( device_.isConnected.compareAndSet(
true,
false) ) {
658 device_.clearServiceCache();
664 return "AdapterStatusListener[adapter "+addressAndType.
toString()+
"]";
669 DBTDevice findDeviceInCache(
final String name,
final BDAddressAndType addressAndType) {
670 synchronized(discoveredDevicesLock) {
671 cleanDiscoveredDevice();
673 if(
null == name &&
null == addressAndType ) {
675 if( discoveredDevices.size() > 0 ) {
676 return (DBTDevice) discoveredDevices.get(0).get();
680 for(
int devIdx = discoveredDevices.size() - 1; devIdx >= 0; devIdx-- ) {
681 final DBTDevice device = (DBTDevice) discoveredDevices.get(devIdx).get();
682 if(
null != name &&
null != addressAndType &&
683 device.getName().equals(name) &&
684 device.getAddressAndType().equals(addressAndType)
689 if(
null != addressAndType &&
690 device.getAddressAndType().equals(addressAndType)
696 device.getName().equals(name)
711 final short adv_interval_min,
final short adv_interval_max,
712 final byte adv_type,
final byte adv_chan_map,
final byte filter_policy) {
714 adv_interval_min, adv_interval_max, adv_type, adv_chan_map, filter_policy) );
716 gattServerData = gattServerData_;
720 private native
byte startAdvertising1Impl(
final DBGattServer gattServerData,
723 final int scanrsp_mask,
724 final short adv_interval_min,
final short adv_interval_max,
725 final byte adv_type,
final byte adv_chan_map,
final byte filter_policy);
729 final short adv_interval_max,
final byte adv_type,
final byte adv_chan_map,
730 final byte filter_policy) {
731 final HCIStatusCode res =
HCIStatusCode.
get( startAdvertising2Impl(gattServerData_, adv_interval_min, adv_interval_max, adv_type, adv_chan_map, filter_policy) );
733 gattServerData = gattServerData_;
737 private native
byte startAdvertising2Impl(
final DBGattServer gattServerData,
final short adv_interval_min,
738 final short adv_interval_max,
final byte adv_type,
final byte adv_chan_map,
739 final byte filter_policy);
744 (
byte)0x07, (
byte)0x00);
751 private native
byte stopAdvertisingImpl();
final boolean isSuspended()
Returns whether the adapter is suspended, i.e.
final boolean equals(final Object obj)
final LE_Features getLEFeatures()
Return LE_Features for this controller.
final HCIStatusCode startDiscovery(final DiscoveryPolicy policy, final boolean le_scan_active)
Starts discovery using default arguments, see startDiscovery(DiscoveryPolicy, boolean,...
final HCIStatusCode startAdvertising(final DBGattServer gattServerData)
Starts advertising using all default arguments, see startAdvertising(short, short,...
final HCIStatusCode startDiscovery()
Starts discovery using all default arguments, see startDiscovery(DiscoveryPolicy, boolean,...
final int removeAllStatusListener()
Remove all AdapterStatusListener from the list.
final HCIStatusCode stopDiscovery()
Turns off device discovery if it is enabled.
final HCIStatusCode initialize(final BTMode btMode, final boolean powerOn)
Initialize the adapter with default values, including power-on.
final HCIStatusCode setDefaultConnParam(final short conn_interval_min, final short conn_interval_max, final short conn_latency, final short supervision_timeout)
Set default connection parameter of incoming connections for this adapter when in server mode,...
final BTDevice find(final String name, final BDAddressAndType addressAndType)
Find a BluetoothDevice.
final ScanType getCurrentScanType()
Returns the current meta discovering ScanType.
native void deleteImpl(long nativeInstance)
Deletes the native instance.
final boolean addDeviceToWhitelist(final BDAddressAndType addressAndType, final HCIWhitelistConnectType ctype)
Add the given device to the adapter's autoconnect whitelist.
final void printDeviceLists()
Print the internally maintained BTDevice lists to stderr:
native boolean isAdvertising()
Returns the adapter's current advertising state.
final boolean addDeviceToWhitelist(final BDAddressAndType addressAndType, final HCIWhitelistConnectType ctype, final short conn_interval_min, final short conn_interval_max, final short conn_latency, final short timeout)
Add the given device to the adapter's autoconnect whitelist.
final boolean removeStatusListener(final AdapterStatusListener l)
Remove the given AdapterStatusListener from the list.
final String getName()
Returns the name.
final boolean isValid()
Returns whether the adapter is valid, i.e.
final int getDevID()
Returns the BluetoothAdapter's internal temporary device id.
final native boolean isInitialized()
Returns true, if initialize(BTMode) has already been called for this adapter, otherwise false.
final HCIStatusCode startAdvertising(final DBGattServer gattServerData_, final EInfoReport eir, final EIRDataTypeSet adv_mask, final EIRDataTypeSet scanrsp_mask, final short adv_interval_min, final short adv_interval_max, final byte adv_type, final byte adv_chan_map, final byte filter_policy)
Starts advertising.
final void setServerConnSecurity(final BTSecurityLevel sec_level, final SMPIOCapability io_cap)
Sets the given ::BTSecurityLevel and ::SMPIOCapability for connecting device when in server (peripher...
final HCIStatusCode stopAdvertising()
Ends advertising.
final HCIStatusCode setPrivacy(final boolean enable)
Toggle adapter privacy address mode, i.e.
final BDAddressAndType getVisibleAddressAndType()
Returns the adapter's currently visible BDAddressAndType.
final List< BTDevice > getDiscoveredDevices()
Returns a list of discovered BluetoothDevices from this adapter.
final HCIStatusCode setSecureConnections(final boolean enable)
Enable or disable Secure Connections (SC) of the adapter.
final native boolean removeDevicePausingDiscovery(final BTDevice device)
Manual DiscoveryPolicy intervention point, allowing user to remove the ready device from the queue of...
final boolean isPowered()
Returns whether the adapter is valid, plugged in and powered.
final HCIStatusCode startDiscovery(final DBGattServer gattServerData, final DiscoveryPolicy policy, final boolean le_scan_active, final short le_scan_interval, final short le_scan_window, final byte filter_policy, final boolean filter_dup)
Starts discovery.
final int removeDiscoveredDevices()
Remove all the discovered devices found on this adapter.
final BTMode getBTMode()
Returns the current BTMode of this adapter.
final DBGattServer getGATTServerData()
Return the user's DBGattServer shared reference if in BTRole#Slave mode as set via and valid until su...
final boolean addStatusListener(final AdapterStatusListener l)
Add the given AdapterStatusListener to the list if not already present.
final native void setSMPKeyPath(final String path)
Set the adapter's persistent storage directory for SMPKeyBin files.
final HCIStatusCode startAdvertising(final DBGattServer gattServerData_, final short adv_interval_min, final short adv_interval_max, final byte adv_type, final byte adv_chan_map, final byte filter_policy)
Starts advertising.
final void close()
Release the native memory associated with this object The object should not be used following a call ...
final HCIStatusCode setDefaultLE_PHY(final LE_PHYs Tx, final LE_PHYs Rx)
Sets default preference of LE_PHYs.
final native boolean setPowered(final boolean power_on)
Sets the power state the adapter.
final boolean removeDeviceFromWhitelist(final BDAddressAndType addressAndType)
Remove the given device from the adapter's autoconnect whitelist.
final HCIStatusCode setName(final String name, final String short_name)
Sets the name and short-name.
final boolean getPoweredState()
Returns the power state the adapter.
final native boolean getSecureConnectionsEnabled()
Returns whether Secure Connections (SC) is enabled.
final String getShortName()
Returns the short name.
final DiscoveryPolicy getCurrentDiscoveryPolicy()
Return the current DiscoveryPolicy, set via startDiscovery(DiscoveryPolicy, boolean,...
final boolean isDeviceWhitelisted(final BDAddressAndType addressAndType)
Returns true, if the adapter's device is already whitelisted.
final BTRole getRole()
Return the current BTRole of this adapter.
final native int getBTMajorVersion()
Returns the Bluetooth major version of this adapter.
final boolean removeDiscoveredDevice(final BDAddressAndType addressAndType)
Discards matching discovered devices.
final boolean isDiscovering()
Returns true if the meta discovering state is not ScanType#NONE.
final BTDevice find(final String name, final BDAddressAndType addressAndType, final long timeoutMS)
Find a BluetoothDevice.
final BTManager getManager()
Returns the used singleton BTManager instance, used to create this adapter.
final HCIStatusCode reset()
Reset the adapter.
final BTDevice connectDevice(final BDAddressAndType addressAndType)
This method connects to device without need of performing General Discovery.
final BDAddressAndType getAddressAndType()
Returns the adapter's public BDAddressAndType.
void close()
Release the native memory associated with this object The object should not be used following a call ...
static final boolean DEBUG
static final BTManager getManager()
Returns an instance of BluetoothManager, to be used instead of constructor.
Author: Sven Gothel sgothel@jausoft.com Copyright (c) 2020 Gothel Software e.K.
boolean isSet(final SettingType bit)
BTAdapter status listener for remote BTDevice discovery events: Added, updated and removed; as well a...
Unique Bluetooth EUI48 address and BDAddressType tuple.
final boolean equals(final Object obj)
If both types are of BDAddressAndType, it compares their EUI48 address and BDAddressType.
Representing a complete list of Gatt Service objects from the GATT server perspective,...
Bit mask of 'Extended Inquiry Response' (EIR) data fields, indicating a set of related data.
Collection of 'Extended Advertising Data' (EAD), 'Advertising Data' (AD) or 'Extended Inquiry Respons...
LE Link Layer Feature Set (bitmask)
LE Transport PHY bit values (bitmask)
Bluetooth adapter operating mode.
static BTMode get(final String name)
Maps the specified name to a constant of BTMode.
Bluetooth roles from the perspective of the link layer (connection initiator).
static BTRole get(final String name)
Maps the specified name to a constant of BTRole.
Bluetooth Security Level.
Discovery policy defines the BTAdapter discovery mode after connecting a remote BTDevice:
static DiscoveryPolicy get(final byte value)
Maps the specified integer value to a constant of DiscoveryPolicy.
PAUSE_CONNECTED_UNTIL_READY
Pause discovery until all connected BTDevice reach readiness inclusive optional SMP pairing (~120ms) ...
BT Core Spec v5.2: Vol 1, Part F Controller Error Codes: 1.3 List of Error Codes.
static HCIStatusCode get(final String name)
Maps the specified name to a constant of HCIStatusCode.
HCI Whitelist connection type.
Meta ScanType as derived from BTMode with defined value mask consisting of BDAddressType bits.
static ScanType get(final byte value)
Maps the specified integer value to a constant of ScanType.
BTAdapter represents one local Bluetooth Controller.
BTDevice represents one remote Bluetooth device.
String getName()
Returns the remote device name.
boolean remove()
Remove this device from the system (like an unpair).
BDAddressAndType getAddressAndType()
Returns the devices' unique EUI48 address and BDAddressType type tuple, might be its initially report...
A thread safe singleton handler of the BTAdapter manager, e.g.