@Implements(value=android.bluetooth.BluetoothAdapter.class) public class ShadowBluetoothAdapter extends Object
| Constructor and Description | 
|---|
| ShadowBluetoothAdapter() | 
| Modifier and Type | Method and Description | 
|---|---|
| protected boolean | cancelDiscovery() | 
| protected static boolean | checkBluetoothAddress(String address)Validate a Bluetooth address, such as “00:43:A8:23:10:F0” Alphabetic characters must be uppercase to be valid. | 
| protected void | closeProfileProxy(int profile,
                 BluetoothProfile proxy)Overrides behavior of  closeProfileProxyifsetProfileProxy(int, android.bluetooth.BluetoothProfile)has been previously called. | 
| protected boolean | disable() | 
| protected boolean | enable() | 
| protected String | getAddress() | 
| protected Set<BluetoothDevice> | getBondedDevices() | 
| protected static BluetoothAdapter | getDefaultAdapter() | 
| Set<BluetoothAdapter.LeScanCallback> | getLeScanCallbacks() | 
| protected String | getName() | 
| protected int | getProfileConnectionState(int profile)Returns the connection state for the given Bluetooth  profile, defaulting toBluetoothProfile.STATE_DISCONNECTEDif the profile’s connection state was never set. | 
| protected boolean | getProfileProxy(Context context,
               BluetoothProfile.ServiceListener listener,
               int profile)Overrides behavior of  getProfileProxyifsetProfileProxy(int, android.bluetooth.BluetoothProfile)has been previously called. | 
| protected int | getScanMode() | 
| BluetoothAdapter.LeScanCallback | getSingleLeScanCallback() | 
| protected int | getState() | 
| boolean | hasActiveProfileProxy(int profile) | 
| protected boolean | isDiscovering() | 
| protected boolean | isEnabled() | 
| protected boolean | isMultipleAdvertisementSupported() | 
| protected BluetoothServerSocket | listenUsingInsecureRfcommWithServiceRecord(String serviceName,
                                          UUID uuid) | 
| protected BluetoothServerSocket | listenUsingRfcommWithServiceRecord(String serviceName,
                                  UUID uuid) | 
| void | setAddress(String address) | 
| void | setBondedDevices(Set<BluetoothDevice> bluetoothDevices) | 
| void | setEnabled(boolean enabled) | 
| void | setIsMultipleAdvertisementSupported(boolean supported) | 
| protected boolean | setName(String name) | 
| void | setProfileConnectionState(int profile,
                         int state)Sets the connection state  statefor the given BluetoothProfileprofile | 
| void | setProfileProxy(int profile,
               BluetoothProfile proxy)Sets the active BluetoothProfile  proxyfor the givenprofile. | 
| protected boolean | setScanMode(int scanMode) | 
| void | setState(int state) | 
| protected boolean | startDiscovery() | 
| protected boolean | startLeScan(BluetoothAdapter.LeScanCallback callback) | 
| protected boolean | startLeScan(UUID[] serviceUuids,
           BluetoothAdapter.LeScanCallback callback) | 
| protected void | stopLeScan(BluetoothAdapter.LeScanCallback callback) | 
@Implementation protected static BluetoothAdapter getDefaultAdapter()
@Implementation protected Set<BluetoothDevice> getBondedDevices()
public void setBondedDevices(Set<BluetoothDevice> bluetoothDevices)
@Implementation protected BluetoothServerSocket listenUsingInsecureRfcommWithServiceRecord(String serviceName, UUID uuid)
@Implementation protected BluetoothServerSocket listenUsingRfcommWithServiceRecord(String serviceName, UUID uuid) throws IOException
IOException@Implementation protected boolean startDiscovery()
@Implementation protected boolean cancelDiscovery()
@Implementation(minSdk=18) protected boolean startLeScan(BluetoothAdapter.LeScanCallback callback)
@Implementation(minSdk=18) protected boolean startLeScan(UUID[] serviceUuids, BluetoothAdapter.LeScanCallback callback)
@Implementation(minSdk=18) protected void stopLeScan(BluetoothAdapter.LeScanCallback callback)
public Set<BluetoothAdapter.LeScanCallback> getLeScanCallbacks()
public BluetoothAdapter.LeScanCallback getSingleLeScanCallback()
@Implementation protected boolean isDiscovering()
@Implementation protected boolean isEnabled()
@Implementation protected boolean enable()
@Implementation protected boolean disable()
@Implementation protected String getAddress()
@Implementation protected int getState()
@Implementation protected String getName()
@Implementation protected boolean setName(String name)
@Implementation protected boolean setScanMode(int scanMode)
@Implementation protected int getScanMode()
@Implementation(minSdk=21) protected boolean isMultipleAdvertisementSupported()
@Implementation protected static boolean checkBluetoothAddress(String address)
Validate a Bluetooth address, such as “00:43:A8:23:10:F0” Alphabetic characters must be uppercase to be valid.
address - Bluetooth address as string@Implementation protected int getProfileConnectionState(int profile)
Returns the connection state for the given Bluetooth profile, defaulting to BluetoothProfile.STATE_DISCONNECTED if the profile’s connection state was never set.
Set a Bluetooth profile’s connection state via setProfileConnectionState(int, int).
public void setAddress(String address)
public void setState(int state)
public void setEnabled(boolean enabled)
public void setIsMultipleAdvertisementSupported(boolean supported)
public void setProfileConnectionState(int profile,
                                      int state)
Sets the connection state state for the given BluetoothProfile profile
public void setProfileProxy(int profile,
                            @Nullable
                            BluetoothProfile proxy)
Sets the active BluetoothProfile proxy for the given profile. Will always affect behavior of BluetoothAdapter.getProfileProxy(android.content.Context, android.bluetooth.BluetoothProfile.ServiceListener, int) and BluetoothAdapter.closeProfileProxy(int, android.bluetooth.BluetoothProfile). Call to BluetoothAdapter.closeProfileProxy(int, android.bluetooth.BluetoothProfile) can remove the set active proxy.
proxy - can be ‘null’ to simulate the situation where BluetoothAdapter.getProfileProxy(android.content.Context, android.bluetooth.BluetoothProfile.ServiceListener, int) would return ‘false’. This can happen on older Android  versions for Bluetooth profiles introduced in later Android versions.public boolean hasActiveProfileProxy(int profile)
setProfileProxy(int, android.bluetooth.BluetoothProfile) for the given profile AND it has not been  “deactivated” by a call to BluetoothAdapter.closeProfileProxy(int, android.bluetooth.BluetoothProfile). Only meaningful if  setProfileProxy(int, android.bluetooth.BluetoothProfile) has been previously called.@Implementation protected boolean getProfileProxy(Context context, BluetoothProfile.ServiceListener listener, int profile)
Overrides behavior of getProfileProxy if setProfileProxy(int, android.bluetooth.BluetoothProfile) has been previously called.
If active (non-null) proxy has been set by setProfileProxy for the given profile, getProfileProxy will immediately call onServiceConnected of the given BluetoothProfile.ServiceListener listener.
setProfileProxy for the given  BluetoothProfile profile@Implementation protected void closeProfileProxy(int profile, BluetoothProfile proxy)
Overrides behavior of closeProfileProxy if setProfileProxy(int, android.bluetooth.BluetoothProfile) has been previously called.
If the given non-null BluetoothProfile proxy was previously set for the given profile by setProfileProxy(int, android.bluetooth.BluetoothProfile), this proxy will be “deactivated”.