Nested classes |
enum |
Sl4aBluetoothUtil.BluetoothAccessLevel
Enums for Bluetooth device access level which are based on BluetoothDevice.java
|
enum |
Sl4aBluetoothUtil.BluetoothConnectionState
Enums for Bluetooth connection states which are based on BluetoothProfile.java
|
enum |
Sl4aBluetoothUtil.BluetoothPriorityLevel
Enums for Bluetooth profile priority level which are based on BluetoothProfile.java
|
enum |
Sl4aBluetoothUtil.BluetoothProfile
Enums for Bluetooth profiles which are based on BluetoothProfile.java
|
Public methods |
boolean
|
changeProfileAccessPermission(ITestDevice primary, ITestDevice secondary, Sl4aBluetoothUtil.BluetoothProfile profile, Sl4aBluetoothUtil.BluetoothAccessLevel access)
Change Bluetooth profile access permission of secondary device on primary device in order for
secondary device to access primary device on the given profile
|
boolean
|
connect(ITestDevice primary, ITestDevice secondary, profiles)
Connect primary device to secondary device on given Bluetooth profiles
|
boolean
|
disable(ITestDevice device)
Disable Bluetooth on target device
|
boolean
|
disableBluetoothSnoopLog(ITestDevice device)
Disable Bluetooth snoop log
|
boolean
|
disconnect(ITestDevice primary, ITestDevice secondary, profiles)
Disconnect primary device from secondary device
|
boolean
|
enable(ITestDevice device)
Enable Bluetooth on target device
|
boolean
|
enableBluetoothSnoopLog(ITestDevice device)
Enable Bluetooth snoop log
|
String
|
getAddress(ITestDevice device)
Get Bluetooth MAC Address of target device
|
|
getBondedDevices(ITestDevice device)
Get set of Bluetooth MAC addresses of the bonded (paired) devices on the target device
|
boolean
|
pair(ITestDevice primary, ITestDevice secondary)
Pair primary device to secondary device
|
void
|
setBtConnectionTimeout(Duration timeout)
|
void
|
setBtPairTimeout(Duration timeout)
|
boolean
|
setProfilePriority(ITestDevice primary, ITestDevice secondary, profiles, Sl4aBluetoothUtil.BluetoothPriorityLevel priority)
Change priority setting of given profiles on primary device towards secondary device
|
void
|
startSl4a(ITestDevice device, File sl4aApkFile)
Explicitly start SL4A client with the given device and SL4A apk file.
|
void
|
stopSl4a()
Stop SL4A clients that already being opened.
|
boolean
|
unpairAll(ITestDevice device)
Un-pair all paired devices for current device
|
Protected methods |
void
|
finalize()
Clean up all SL4A connections
|
Public constructors
Sl4aBluetoothUtil
public Sl4aBluetoothUtil ()
Public methods
changeProfileAccessPermission
public boolean changeProfileAccessPermission (ITestDevice primary,
ITestDevice secondary,
Sl4aBluetoothUtil.BluetoothProfile profile,
Sl4aBluetoothUtil.BluetoothAccessLevel access)
Change Bluetooth profile access permission of secondary device on primary device in order for
secondary device to access primary device on the given profile
Parameters |
primary |
ITestDevice : device to change permission |
secondary |
ITestDevice : device that accesses primary device on the given profile |
profile |
Sl4aBluetoothUtil.BluetoothProfile : Bluetooth profile to access |
access |
Sl4aBluetoothUtil.BluetoothAccessLevel : level of access, see BluetoothAccessLevel |
Returns |
boolean |
true if permission changed successfully |
Throws |
DeviceNotAvailableException |
|
connect
public boolean connect (ITestDevice primary,
ITestDevice secondary,
profiles)
Connect primary device to secondary device on given Bluetooth profiles
Parameters |
primary |
ITestDevice : device to connect from |
secondary |
ITestDevice : device to connect to |
profiles |
: A set of Bluetooth profiles are required to be connected |
Returns |
boolean |
true if connection are successful |
Throws |
DeviceNotAvailableException |
|
disable
public boolean disable (ITestDevice device)
Disable Bluetooth on target device
Parameters |
device |
ITestDevice : target device |
Returns |
boolean |
true if Bluetooth successfully disabled |
Throws |
DeviceNotAvailableException |
|
disableBluetoothSnoopLog
public boolean disableBluetoothSnoopLog (ITestDevice device)
Disable Bluetooth snoop log
Parameters |
device |
ITestDevice : to disable snoop log |
Returns |
boolean |
true if disabled successfully |
Throws |
DeviceNotAvailableException |
|
disconnect
public boolean disconnect (ITestDevice primary,
ITestDevice secondary,
profiles)
Disconnect primary device from secondary device
Parameters |
primary |
ITestDevice : device to perform disconnect operation |
secondary |
ITestDevice : device to be disconnected |
profiles |
: Given set of Bluetooth profiles required to be disconnected |
Returns |
boolean |
true if disconnected successfully |
Throws |
DeviceNotAvailableException |
|
enable
public boolean enable (ITestDevice device)
Enable Bluetooth on target device
Parameters |
device |
ITestDevice : target device |
Returns |
boolean |
true if Bluetooth successfully enabled |
Throws |
DeviceNotAvailableException |
|
enableBluetoothSnoopLog
public boolean enableBluetoothSnoopLog (ITestDevice device)
Enable Bluetooth snoop log
Parameters |
device |
ITestDevice : to enable snoop log |
Returns |
boolean |
true if enabled successfully |
Throws |
DeviceNotAvailableException |
|
getAddress
public String getAddress (ITestDevice device)
Get Bluetooth MAC Address of target device
Parameters |
device |
ITestDevice : target device |
Returns |
String |
MAC Address string |
Throws |
DeviceNotAvailableException |
|
getBondedDevices
public getBondedDevices (ITestDevice device)
Get set of Bluetooth MAC addresses of the bonded (paired) devices on the target device
Parameters |
device |
ITestDevice : target device |
Returns |
|
Set of Bluetooth MAC addresses |
Throws |
DeviceNotAvailableException |
|
pair
public boolean pair (ITestDevice primary,
ITestDevice secondary)
Pair primary device to secondary device
Parameters |
primary |
ITestDevice : device to pair from |
secondary |
ITestDevice : device to pair to |
Returns |
boolean |
true if pairing is successful |
Throws |
DeviceNotAvailableException |
|
setBtConnectionTimeout
public void setBtConnectionTimeout (Duration timeout)
Parameters |
timeout |
Duration |
setBtPairTimeout
public void setBtPairTimeout (Duration timeout)
Parameters |
timeout |
Duration |
setProfilePriority
public boolean setProfilePriority (ITestDevice primary,
ITestDevice secondary,
profiles,
Sl4aBluetoothUtil.BluetoothPriorityLevel priority)
Change priority setting of given profiles on primary device towards secondary device
Parameters |
primary |
ITestDevice : device to set priority on |
secondary |
ITestDevice : device to set priority for |
profiles |
: Bluetooth profiles to change priority setting |
priority |
Sl4aBluetoothUtil.BluetoothPriorityLevel : level of priority |
Returns |
boolean |
true if set priority successfully |
Throws |
DeviceNotAvailableException |
|
startSl4a
public void startSl4a (ITestDevice device,
File sl4aApkFile)
Explicitly start SL4A client with the given device and SL4A apk file. Normally this method is
not required, because SL4A connection will always be established before actual operations.
Parameters |
device |
ITestDevice : the device to be connected using SL4A |
sl4aApkFile |
File : the optional SL4A apk to install and use. |
Throws |
DeviceNotAvailableException |
|
stopSl4a
public void stopSl4a ()
Stop SL4A clients that already being opened. It basically provide a way to cleanup clients
immediately after they are no longer used
unpairAll
public boolean unpairAll (ITestDevice device)
Un-pair all paired devices for current device
Parameters |
device |
ITestDevice : Current device to perform the action |
Returns |
boolean |
true if un-pair successfully |
Throws |
DeviceNotAvailableException |
|
Protected methods
finalize
protected void finalize ()
Clean up all SL4A connections
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2022-08-03 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-08-03 UTC."],[],[]]