Package org.robolectric.shadows
Class ShadowBluetoothManager
- java.lang.Object
-
- org.robolectric.shadows.ShadowBluetoothManager
-
@Implements(value=android.bluetooth.BluetoothManager.class, minSdk=18) public class ShadowBluetoothManager extends Object
Shadow ofBluetoothManagerthat makes the testing possible.
-
-
Constructor Summary
Constructors Constructor Description ShadowBluetoothManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDevice(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 BluetoothAdaptergetAdapter()Get theBluetoothAdapterfor this device.protected List<BluetoothDevice>getDevicesMatchingConnectionStates(int profile, int[] states)protected BluetoothGattServeropenGattServer(Context context, BluetoothGattServerCallback callback, int transport)protected BluetoothGattServeropenGattServer(Context context, BluetoothGattServerCallback callback, int transport, boolean eattSupport)Overrides behavior ofopenGattServer(android.content.Context,android.bluetooth.BluetoothGattServerCallback,int)and returnsShadowBluetoothGattServerafter creating and using a nullProxy forIBluetoothGatt.
-
-
-
Method Detail
-
getAdapter
@Implementation protected BluetoothAdapter getAdapter()
Get theBluetoothAdapterfor this device.- Returns:
- BluetoothAdapter instance
-
getDevicesMatchingConnectionStates
@Implementation protected List<BluetoothDevice> getDevicesMatchingConnectionStates(int profile, int[] states)
-
addDevice
public void 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.- Parameters:
profile-BluetoothProfile.GATTorBluetoothProfile.GATT_SERVER.state- State of the profile connection. One ofBluetoothProfile.STATE_CONNECTED,BluetoothProfile.STATE_CONNECTING,BluetoothProfile.STATE_DISCONNECTEDandBluetoothProfile.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 returnsShadowBluetoothGattServerafter creating and using a nullProxy forIBluetoothGatt.
-
-