嵌套类 |
---|
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 :优先级别 |
投掷 |
---|
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 连接
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
Last updated 2021-10-04 UTC.
[]
[]