嵌套類 |
---|
enum | Sl4aBluetoothUtil.BluetoothAccessLevel 藍牙設備的訪問級別枚舉是基於BluetoothDevice.java |
enum | Sl4aBluetoothUtil.BluetoothConnectionState 藍牙連接狀態枚舉是基於BluetoothProfile.java |
enum | Sl4aBluetoothUtil.BluetoothPriorityLevel 藍牙配置文件的優先級枚舉是基於BluetoothProfile.java |
enum | Sl4aBluetoothUtil.BluetoothProfile 藍牙配置文件枚舉是基於BluetoothProfile.java |
公共方法 |
---|
boolean | changeProfileAccessPermission (ITestDevice primary, ITestDevice secondary, Sl4aBluetoothUtil.BluetoothProfile profile, Sl4aBluetoothUtil.BluetoothAccessLevel access) 更改主設備上輔助設備的藍牙配置文件訪問權限,以便輔助設備訪問給定配置文件上的主設備 |
boolean | connect (ITestDevice primary, ITestDevice secondary, profiles) connect (ITestDevice primary, ITestDevice secondary, profiles) 在給定的藍牙配置文件上將主設備連接到輔助設備 |
boolean | disable (ITestDevice device) 禁用目標設備上的藍牙 |
boolean | disableBluetoothSnoopLog (ITestDevice device) 禁用藍牙監聽日誌 |
boolean | disconnect (ITestDevice primary, ITestDevice secondary, profiles) disconnect (ITestDevice primary, ITestDevice secondary, profiles) 斷開主要設備與次要設備的連接 |
boolean | enable (ITestDevice device) 在目標設備上啟用藍牙 |
boolean | enableBluetoothSnoopLog (ITestDevice device) 啟用藍牙監聽日誌 |
String | getAddress (ITestDevice device) 獲取目標設備的藍牙 MAC 地址 |
| getBondedDevices (ITestDevice device) 獲取目標設備上綁定(配對)設備的藍牙 MAC 地址集 |
boolean | pair (ITestDevice primary, ITestDevice secondary) 將主要設備與次要設備配對 |
void | setBtConnectionTimeout (Duration timeout) |
void | setBtPairTimeout (Duration timeout) |
boolean | setProfilePriority (ITestDevice primary, ITestDevice secondary, profiles, Sl4aBluetoothUtil.BluetoothPriorityLevel priority) setProfilePriority (ITestDevice primary, ITestDevice secondary, profiles, Sl4aBluetoothUtil.BluetoothPriorityLevel priority) 將主設備上給定配置文件的優先級設置更改為輔助設備 |
void | startSl4a (ITestDevice device, File sl4aApkFile) 使用給定的設備和 SL4A apk 文件顯式啟動 SL4A 客戶端。 |
void | stopSl4a () 停止已經打開的 SL4A 客戶端。 |
boolean | unpairAll (ITestDevice device) 取消當前設備的所有配對設備的配對 |
公共構造函數
Sl4a藍牙實用程序
public Sl4aBluetoothUtil ()
公共方法
更改配置文件訪問權限
public boolean changeProfileAccessPermission (ITestDevice primary,
ITestDevice secondary,
Sl4aBluetoothUtil.BluetoothProfile profile,
Sl4aBluetoothUtil.BluetoothAccessLevel access)
更改主設備上輔助設備的藍牙配置文件訪問權限,以便輔助設備訪問給定配置文件上的主設備
參數 |
---|
primary | ITestDevice :設備變更許可 |
secondary | ITestDevice :設備訪問給定簡檔主設備 |
profile | Sl4aBluetoothUtil.BluetoothProfile :藍牙配置文件訪問 |
access | Sl4aBluetoothUtil.BluetoothAccessLevel :訪問級別,見BluetoothAccessLevel |
退貨 |
---|
boolean | 如果權限更改成功,則為 true |
投擲 |
---|
DeviceNotAvailableException | |
連接
public boolean connect (ITestDevice primary,
ITestDevice secondary,
profiles)
在給定的藍牙配置文件上將主設備連接到輔助設備
參數 |
---|
primary | ITestDevice :設備從連接 |
secondary | ITestDevice :設備連接到 |
profiles | :需要連接一組藍牙配置文件 |
投擲 |
---|
DeviceNotAvailableException | |
禁用
public boolean disable (ITestDevice device)
禁用目標設備上的藍牙
參數 |
---|
device | ITestDevice :目標設備 |
退貨 |
---|
boolean | 如果藍牙成功禁用,則為 true |
投擲 |
---|
DeviceNotAvailableException | |
禁用藍牙監聽日誌
public boolean disableBluetoothSnoopLog (ITestDevice device)
禁用藍牙監聽日誌
參數 |
---|
device | ITestDevice :要禁用窺探日誌 |
投擲 |
---|
DeviceNotAvailableException | |
斷開
public boolean disconnect (ITestDevice primary,
ITestDevice secondary,
profiles)
斷開主要設備與次要設備的連接
參數 |
---|
primary | ITestDevice :設備執行斷開操作 |
secondary | ITestDevice :設備被斷開 |
profiles | :給定一組需要斷開連接的藍牙配置文件 |
退貨 |
---|
boolean | 如果成功斷開連接,則為 true |
投擲 |
---|
DeviceNotAvailableException | |
使能夠
public boolean enable (ITestDevice device)
在目標設備上啟用藍牙
參數 |
---|
device | ITestDevice :目標設備 |
退貨 |
---|
boolean | 如果藍牙成功啟用,則為 true |
投擲 |
---|
DeviceNotAvailableException | |
啟用藍牙監聽日誌
public boolean enableBluetoothSnoopLog (ITestDevice device)
啟用藍牙監聽日誌
參數 |
---|
device | ITestDevice :啟用探聽日誌 |
投擲 |
---|
DeviceNotAvailableException | |
獲取地址
public String getAddress (ITestDevice device)
獲取目標設備的藍牙 MAC 地址
參數 |
---|
device | ITestDevice :目標設備 |
投擲 |
---|
DeviceNotAvailableException | |
獲取綁定設備
public getBondedDevices (ITestDevice device)
獲取目標設備上綁定(配對)設備的藍牙 MAC 地址集
參數 |
---|
device | ITestDevice :目標設備 |
投擲 |
---|
DeviceNotAvailableException | |
一對
public boolean pair (ITestDevice primary,
ITestDevice secondary)
將主要設備與次要設備配對
參數 |
---|
primary | ITestDevice :設備從配對 |
secondary | ITestDevice :設備配對以 |
投擲 |
---|
DeviceNotAvailableException | |
設置連接超時
public void setBtConnectionTimeout (Duration timeout)
設置BtPair超時
public void setBtPairTimeout (Duration timeout)
設置配置文件優先級
public boolean setProfilePriority (ITestDevice primary,
ITestDevice secondary,
profiles,
Sl4aBluetoothUtil.BluetoothPriorityLevel priority)
將主設備上給定配置文件的優先級設置更改為輔助設備
參數 |
---|
primary | ITestDevice :設備上設置優先級 |
secondary | ITestDevice :設備的優先級設置 |
profiles | :更改優先級設置的藍牙配置文件 |
priority | Sl4aBluetoothUtil.BluetoothPriorityLevel :優先級別 |
退貨 |
---|
boolean | 如果成功設置優先級,則為 true |
投擲 |
---|
DeviceNotAvailableException | |
啟動Sl4a
public void startSl4a (ITestDevice device,
File sl4aApkFile)
使用給定的設備和 SL4A apk 文件顯式啟動 SL4A 客戶端。通常不需要這種方法,因為在實際操作之前總是會建立 SL4A 連接。
參數 |
---|
device | ITestDevice :該設備使用SL4A連接 |
sl4aApkFile | File :可選SL4A APK安裝和使用。 |
投擲 |
---|
DeviceNotAvailableException | |
停止Sl4a
public void stopSl4a ()
停止已經打開的 SL4A 客戶端。它基本上提供了一種在不再使用後立即清理客戶端的方法
取消配對
public boolean unpairAll (ITestDevice device)
取消當前設備的所有配對設備的配對
參數 |
---|
device | ITestDevice :當前設備執行動作 |
投擲 |
---|
DeviceNotAvailableException | |
受保護的方法
敲定
protected void finalize ()
清理所有 SL4A 連接
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 2021-10-04 UTC.
[]
[]