Sl4aBluetoothUtil

public class Sl4aBluetoothUtil
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.Sl4aBluetoothUtil


Lớp tiện ích cung cấp các thao tác Bluetooth trên một hoặc hai thiết bị bằng SL4A

Tóm tắt

Hàm khởi tạo công khai

Sl4aBluetoothUtil()

Phương thức công khai

boolean changeProfileAccessPermission(ITestDevice primary, ITestDevice secondary, Sl4aBluetoothUtil.BluetoothProfile profile, Sl4aBluetoothUtil.BluetoothAccessLevel access)

Thay đổi quyền truy cập vào hồ sơ Bluetooth của thiết bị phụ trên thiết bị chính để thiết bị phụ có thể truy cập vào thiết bị chính trên hồ sơ đã cho

boolean connect(ITestDevice primary, ITestDevice secondary, profiles)

Kết nối thiết bị chính với thiết bị phụ trên các hồ sơ Bluetooth nhất định

boolean disable(ITestDevice device)

Tắt Bluetooth trên thiết bị mục tiêu

boolean disableBluetoothSnoopLog(ITestDevice device)

Tắt nhật ký theo dõi Bluetooth

boolean disconnect(ITestDevice primary, ITestDevice secondary, profiles)

Ngắt kết nối thiết bị chính khỏi thiết bị phụ

boolean enable(ITestDevice device)

Bật Bluetooth trên thiết bị mục tiêu

boolean enableBluetoothSnoopLog(ITestDevice device)

Bật nhật ký theo dõi Bluetooth

String getAddress(ITestDevice device)

Lấy địa chỉ MAC Bluetooth của thiết bị mục tiêu

getBondedDevices(ITestDevice device)

Lấy tập hợp địa chỉ MAC Bluetooth của các thiết bị đã liên kết (đã ghép nối) trên thiết bị mục tiêu

boolean pair(ITestDevice primary, ITestDevice secondary)

Ghép nối thiết bị chính với thiết bị phụ

void setBtConnectionTimeout(Duration timeout)
void setBtPairTimeout(Duration timeout)
boolean setProfilePriority(ITestDevice primary, ITestDevice secondary, profiles, Sl4aBluetoothUtil.BluetoothPriorityLevel priority)

Thay đổi chế độ cài đặt mức độ ưu tiên của các hồ sơ nhất định trên thiết bị chính thành thiết bị phụ

void startSl4a(ITestDevice device, File sl4aApkFile)

Khởi động rõ ràng ứng dụng khách SL4A bằng thiết bị và tệp apk SL4A đã cho.

void stopSl4a()

Dừng các ứng dụng SL4A đã mở.

boolean unpairAll(ITestDevice device)

Huỷ ghép nối tất cả thiết bị đã ghép nối cho thiết bị hiện tại

Phương thức được bảo vệ

void finalize()

Dọn dẹp tất cả kết nối SL4A

Hàm khởi tạo công khai

Sl4aBluetoothUtil

public Sl4aBluetoothUtil ()

Phương thức công khai

changeProfileAccessPermission

public boolean changeProfileAccessPermission (ITestDevice primary, 
                ITestDevice secondary, 
                Sl4aBluetoothUtil.BluetoothProfile profile, 
                Sl4aBluetoothUtil.BluetoothAccessLevel access)

Thay đổi quyền truy cập vào hồ sơ Bluetooth của thiết bị phụ trên thiết bị chính để thiết bị phụ có thể truy cập vào thiết bị chính trên hồ sơ đã cho

Tham số
primary ITestDevice: thiết bị để thay đổi quyền

secondary ITestDevice: thiết bị truy cập vào thiết bị chính trên hồ sơ đã cho

profile Sl4aBluetoothUtil.BluetoothProfile: Cấu hình Bluetooth để truy cập

access Sl4aBluetoothUtil.BluetoothAccessLevel: cấp truy cập, xem BluetoothAccessLevel

Giá trị trả về
boolean true nếu thay đổi quyền thành công

Gửi
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

kết nối

public boolean connect (ITestDevice primary, 
                ITestDevice secondary, 
                 profiles)

Kết nối thiết bị chính với thiết bị phụ trên các hồ sơ Bluetooth nhất định

Tham số
primary ITestDevice: thiết bị để kết nối

secondary ITestDevice: thiết bị cần kết nối

profiles : Cần có một bộ hồ sơ Bluetooth để kết nối

Giá trị trả về
boolean đúng nếu kết nối thành công

Gửi
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

tắt

public boolean disable (ITestDevice device)

Tắt Bluetooth trên thiết bị mục tiêu

Tham số
device ITestDevice: thiết bị mục tiêu

Giá trị trả về
boolean đúng nếu Bluetooth đã tắt thành công

Gửi
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

disableBluetoothSnoopLog

public boolean disableBluetoothSnoopLog (ITestDevice device)

Tắt nhật ký theo dõi Bluetooth

Tham số
device ITestDevice: để tắt nhật ký theo dõi

Giá trị trả về
boolean true nếu tắt thành công

Gửi
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

ngắt kết nối

public boolean disconnect (ITestDevice primary, 
                ITestDevice secondary, 
                 profiles)

Ngắt kết nối thiết bị chính khỏi thiết bị phụ

Tham số
primary ITestDevice: thiết bị để thực hiện thao tác ngắt kết nối

secondary ITestDevice: thiết bị sẽ bị ngắt kết nối

profiles : Một tập hợp các hồ sơ Bluetooth cần được ngắt kết nối

Giá trị trả về
boolean true nếu ngắt kết nối thành công

Gửi
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

bật

public boolean enable (ITestDevice device)

Bật Bluetooth trên thiết bị mục tiêu

Tham số
device ITestDevice: thiết bị mục tiêu

Giá trị trả về
boolean đúng nếu Bluetooth đã bật thành công

Gửi
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

enableBluetoothSnoopLog

public boolean enableBluetoothSnoopLog (ITestDevice device)

Bật nhật ký theo dõi Bluetooth

Tham số
device ITestDevice: để bật nhật ký theo dõi

Giá trị trả về
boolean true nếu bật thành công

Gửi
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getAddress

public String getAddress (ITestDevice device)

Lấy địa chỉ MAC Bluetooth của thiết bị mục tiêu

Tham số
device ITestDevice: thiết bị mục tiêu

Giá trị trả về
String Chuỗi địa chỉ MAC

Gửi
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBondedDevices

public  getBondedDevices (ITestDevice device)

Lấy tập hợp địa chỉ MAC Bluetooth của các thiết bị đã liên kết (đã ghép nối) trên thiết bị mục tiêu

Tham số
device ITestDevice: thiết bị mục tiêu

Giá trị trả về
Tập hợp địa chỉ MAC Bluetooth

Gửi
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

ghép nối

public boolean pair (ITestDevice primary, 
                ITestDevice secondary)

Ghép nối thiết bị chính với thiết bị phụ

Tham số
primary ITestDevice: thiết bị để ghép nối

secondary ITestDevice: thiết bị để ghép nối

Giá trị trả về
boolean true nếu ghép nối thành công

Gửi
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

setBtConnectionTimeout

public void setBtConnectionTimeout (Duration timeout)

Tham số
timeout Duration

setBtPairTimeout

public void setBtPairTimeout (Duration timeout)

Tham số
timeout Duration

setProfilePriority

public boolean setProfilePriority (ITestDevice primary, 
                ITestDevice secondary, 
                 profiles, 
                Sl4aBluetoothUtil.BluetoothPriorityLevel priority)

Thay đổi chế độ cài đặt mức độ ưu tiên của các hồ sơ nhất định trên thiết bị chính thành thiết bị phụ

Tham số
primary ITestDevice: thiết bị cần đặt mức độ ưu tiên

secondary ITestDevice: thiết bị cần đặt mức độ ưu tiên

profiles : Cấu hình Bluetooth để thay đổi chế độ cài đặt mức độ ưu tiên

priority Sl4aBluetoothUtil.BluetoothPriorityLevel: mức độ ưu tiên

Giá trị trả về
boolean true nếu đặt mức độ ưu tiên thành công

Gửi
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

startSl4a

public void startSl4a (ITestDevice device, 
                File sl4aApkFile)

Khởi động rõ ràng ứng dụng khách SL4A bằng thiết bị và tệp apk SL4A đã cho. Thông thường, phương thức này không bắt buộc vì kết nối SL4A sẽ luôn được thiết lập trước khi thực hiện các thao tác.

Tham số
device ITestDevice: thiết bị cần kết nối bằng SL4A

sl4aApkFile File: tệp APK SL4A không bắt buộc để cài đặt và sử dụng.

Gửi
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

stopSl4a

public void stopSl4a ()

Dừng các ứng dụng SL4A đã mở. Về cơ bản, lớp này cung cấp một cách để dọn dẹp ứng dụng ngay sau khi ứng dụng không còn được sử dụng

unpairAll

public boolean unpairAll (ITestDevice device)

Huỷ ghép nối tất cả thiết bị đã ghép nối cho thiết bị hiện tại

Tham số
device ITestDevice: Thiết bị hiện tại để thực hiện hành động

Giá trị trả về
boolean true nếu huỷ ghép nối thành công

Gửi
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

Phương thức được bảo vệ

hoàn tất

protected void finalize ()

Dọn dẹp tất cả kết nối SL4A