@NotThreadSafe @Implements(android.bluetooth.BluetoothHeadset.class) public class ShadowBluetoothHeadset extends Object
BluetoothHeadset
Constructor | Description |
---|---|
ShadowBluetoothHeadset() |
@Implementation protected List<BluetoothDevice> getConnectedDevices()
getConnectedDevices()
. Returns list of devices that is set up by
call(s) to addConnectedDevice(android.bluetooth.BluetoothDevice)
. Returns an empty list by default.public void addConnectedDevice(BluetoothDevice device)
@Implementation protected int getConnectionState(BluetoothDevice device)
getConnectionState(android.bluetooth.BluetoothDevice)
.BluetoothProfile.STATE_CONNECTED
if the given device has been previously added
by a call to addConnectedDevice(android.bluetooth.BluetoothDevice)
, and
BluetoothProfile.STATE_DISCONNECTED
otherwise.@Implementation protected boolean startVoiceRecognition(BluetoothDevice bluetoothDevice)
startVoiceRecognition(android.bluetooth.BluetoothDevice)
. Returns false if 'bluetoothDevice' is null
or voice recognition is already started. Users can listen to ACTION_AUDIO_STATE_CHANGED
. If this function returns true, this intent will be broadcasted
once with BluetoothProfile.EXTRA_STATE
set to STATE_AUDIO_CONNECTING
and once
set to STATE_AUDIO_CONNECTED
.@Implementation protected boolean stopVoiceRecognition(BluetoothDevice bluetoothDevice)
stopVoiceRecognition(android.bluetooth.BluetoothDevice)
. Returns false if voice recognition was
not started or voice recogntion has already ended on this headset. If this function returns
true, ACTION_AUDIO_STATE_CHANGED
intent is broadcasted with BluetoothProfile.EXTRA_STATE
set to STATE_DISCONNECTED
.@Implementation protected boolean isAudioConnected(BluetoothDevice bluetoothDevice)
@Implementation(minSdk=19) protected boolean sendVendorSpecificResultCode(BluetoothDevice device, String command, String arg)
sendVendorSpecificResultCode(android.bluetooth.BluetoothDevice,java.lang.String,java.lang.String)
.addConnectedDevice(android.bluetooth.BluetoothDevice)
and setAllowsSendVendorSpecificResultCode(boolean)
has not been called with
'false' argument.IllegalArgumentException
- if 'command' argument is null, per Android APIpublic void setAllowsSendVendorSpecificResultCode(boolean allowsSendVendorSpecificResultCode)
BluetoothHeadset.sendVendorSpecificResultCode(android.bluetooth.BluetoothDevice, java.lang.String, java.lang.String)
allowsSendVendorSpecificResultCode
- can be set to 'false' to simulate the situation where
the system is unable to send vendor-specific result codes to a device