Package org.robolectric.shadows
Class ShadowBluetoothManager
java.lang.Object
org.robolectric.shadows.ShadowBluetoothManager
@Implements(android.bluetooth.BluetoothManager.class)
public class ShadowBluetoothManager
extends Object
Shadow of
BluetoothManager
that makes the testing possible.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDevice
(int profile, int state, BluetoothDevice device) Add a remote bluetooth device that will be served byBluetoothManager.getDevicesMatchingConnectionStates(int, int[])
for the specified profile and states of the profile connection.protected BluetoothAdapter
Get theBluetoothAdapter
for this device.protected List<BluetoothDevice>
getDevicesMatchingConnectionStates
(int profile, int[] states) protected BluetoothGattServer
openGattServer
(Context context, BluetoothGattServerCallback callback, int transport) protected BluetoothGattServer
openGattServer
(Context context, BluetoothGattServerCallback callback, int transport, boolean eattSupport) Overrides behavior ofopenGattServer(android.content.Context,android.bluetooth.BluetoothGattServerCallback,int)
and returnsShadowBluetoothGattServer
after creating and using a nullProxy forIBluetoothGatt
.static void
reset()
-
Constructor Details
-
ShadowBluetoothManager
public ShadowBluetoothManager()
-
-
Method Details
-
reset
-
getAdapter
Get theBluetoothAdapter
for this device.- Returns:
- BluetoothAdapter instance
-
getDevicesMatchingConnectionStates
@Implementation protected List<BluetoothDevice> getDevicesMatchingConnectionStates(int profile, int[] states) -
addDevice
Add a remote bluetooth device that will be served byBluetoothManager.getDevicesMatchingConnectionStates(int, int[])
for the specified profile and states of the profile connection.- Parameters:
profile
-BluetoothProfile.GATT
orBluetoothProfile.GATT_SERVER
.state
- State of the profile connection. One ofBluetoothProfile.STATE_CONNECTED
,BluetoothProfile.STATE_CONNECTING
,BluetoothProfile.STATE_DISCONNECTED
andBluetoothProfile.STATE_DISCONNECTING
.device
- The remote bluetooth device.
-
openGattServer
@Implementation(minSdk=26, maxSdk=30) protected BluetoothGattServer openGattServer(Context context, BluetoothGattServerCallback callback, int transport) -
openGattServer
@Implementation(minSdk=31) protected BluetoothGattServer openGattServer(Context context, BluetoothGattServerCallback callback, int transport, boolean eattSupport) Overrides behavior ofopenGattServer(android.content.Context,android.bluetooth.BluetoothGattServerCallback,int)
and returnsShadowBluetoothGattServer
after creating and using a nullProxy forIBluetoothGatt
.
-