@Implements(value=android.bluetooth.BluetoothDevice.class) public class ShadowBluetoothDevice extends Object
Constructor and Description |
---|
ShadowBluetoothDevice() |
Modifier and Type | Method and Description |
---|---|
protected BluetoothGatt |
connectGatt(Context context,
boolean autoConnect,
BluetoothGattCallback callback) |
protected BluetoothGatt |
connectGatt(Context context,
boolean autoConnect,
BluetoothGattCallback callback,
int transport) |
protected BluetoothGatt |
connectGatt(Context context,
boolean autoConnect,
BluetoothGattCallback callback,
int transport,
int phy,
Handler handler) |
protected boolean |
createBond()
Returns whether this device has been bonded with.
|
protected boolean |
fetchUuidsWithSdp()
Overrides behavior of
BluetoothDevice.fetchUuidsWithSdp() . |
List<BluetoothGatt> |
getBluetoothGatts()
Returns all
BluetoothGatt objects created by calling connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback) . |
protected int |
getBondState()
Overrides behavior of
BluetoothDevice.getBondState() to return pre-set result. |
int |
getFetchUuidsWithSdpCount()
Returns the number of times fetchUuidsWithSdp has been called.
|
protected String |
getName() |
protected static IBluetooth |
getService()
Implements getService() in the same way the original method does, but ignores any Exceptions from invoking
BluetoothAdapter.getBluetoothService(android.bluetooth.IBluetoothManagerCallback) . |
protected int |
getType()
Overrides behavior of
BluetoothDevice.getType() to return pre-set result. |
protected ParcelUuid[] |
getUuids()
Overrides behavior of
BluetoothDevice.getUuids() to return pre-set result. |
static BluetoothDevice |
newInstance(String address) |
void |
setBondState(int bondState)
Sets value of bond state for
BluetoothDevice.getBondState() . |
void |
setCreatedBond(boolean createdBond)
Sets whether this device has been bonded with.
|
void |
setFetchUuidsWithSdpResult(boolean fetchUuidsWithSdpResult)
Sets value of the return result for
BluetoothDevice.fetchUuidsWithSdp() . |
void |
setName(String name) |
void |
setType(int type)
Sets the return value for
BluetoothDevice.getType() . |
void |
setUuids(ParcelUuid[] uuids)
Sets the return value for
BluetoothDevice.getUuids() . |
void |
simulateGattConnectionChange(int status,
int newState)
Causes {@link BluetoothGattCallback#onConnectionStateChange to be called for every GATT client.
|
public static BluetoothDevice newInstance(String address)
@Implementation protected static IBluetooth getService()
Implements getService() in the same way the original method does, but ignores any Exceptions from invoking BluetoothAdapter.getBluetoothService(android.bluetooth.IBluetoothManagerCallback)
.
public void setName(String name)
@Implementation protected String getName()
public void setType(int type)
Sets the return value for BluetoothDevice.getType()
.
@Implementation(minSdk=18) protected int getType()
Overrides behavior of BluetoothDevice.getType()
to return pre-set result.
setType(int)
. If setType has not previously been called, will return BluetoothDevice.DEVICE_TYPE_UNKNOWN.public void setUuids(ParcelUuid[] uuids)
Sets the return value for BluetoothDevice.getUuids()
.
@Implementation protected ParcelUuid[] getUuids()
Overrides behavior of BluetoothDevice.getUuids()
to return pre-set result.
public void setBondState(int bondState)
Sets value of bond state for BluetoothDevice.getBondState()
.
@Implementation protected int getBondState()
Overrides behavior of BluetoothDevice.getBondState()
to return pre-set result.
public void setCreatedBond(boolean createdBond)
Sets whether this device has been bonded with.
@Implementation protected boolean createBond()
Returns whether this device has been bonded with.
public void setFetchUuidsWithSdpResult(boolean fetchUuidsWithSdpResult)
Sets value of the return result for BluetoothDevice.fetchUuidsWithSdp()
.
@Implementation protected boolean fetchUuidsWithSdp()
Overrides behavior of BluetoothDevice.fetchUuidsWithSdp()
. This method updates the counter which counts the number of invocations of this method.
public int getFetchUuidsWithSdpCount()
Returns the number of times fetchUuidsWithSdp has been called.
@Implementation(minSdk=18) protected BluetoothGatt connectGatt(Context context, boolean autoConnect, BluetoothGattCallback callback)
@Implementation(minSdk=23) protected BluetoothGatt connectGatt(Context context, boolean autoConnect, BluetoothGattCallback callback, int transport)
@Implementation(minSdk=26) protected BluetoothGatt connectGatt(Context context, boolean autoConnect, BluetoothGattCallback callback, int transport, int phy, Handler handler)
public List<BluetoothGatt> getBluetoothGatts()
Returns all BluetoothGatt
objects created by calling connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback)
.
public void simulateGattConnectionChange(int status, int newState)
Causes {@link BluetoothGattCallback#onConnectionStateChange to be called for every GATT client.
status
- Status of the GATT operationnewState
- The new state of the GATT profile