Sl4aBluetoothSử dụng

public class Sl4aBluetoothUtil
extends Object

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


Lớp tiện ích cung cấp các hoạt động Bluetooth trên một hoặc hai thiết bị sử dụng SL4A

Bản tóm tắt

Nhà thầu xây dựng công cộng

Sl4aBluetoothUtil ()

Phương pháp công cộng

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

Thay đổi quyền truy cập cấu hình Bluetooth của thiết bị phụ trên thiết bị chính để thiết bị phụ truy cập thiết bị chính trên cấu hình đã cho

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

Kết nối thiết bị chính với thiết bị phụ trên cấu hình 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ý rình mò Bluetooth

boolean disconnect ( ITestDevice primary, ITestDevice secondary, profiles) 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)

Kích hoạt Bluetooth trên thiết bị mục tiêu

boolean enableBluetoothSnoopLog ( ITestDevice device)

Bật nhật ký rình mò Bluetooth

String getAddress ( ITestDevice device)

Nhận địa chỉ MAC Bluetooth của thiết bị mục tiêu

getBondedDevices ( ITestDevice device)

Nhận bộ địa chỉ MAC Bluetooth của các thiết bị được liên kết (ghép nối) trên thiết bị đích

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) setProfilePriority ( ITestDevice primary, ITestDevice secondary, profiles, Sl4aBluetoothUtil.BluetoothPriorityLevel priority)

Thay đổi cài đặt ưu tiên của các cấu hình 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 với thiết bị đã cho và tệp apk SL4A.

void stopSl4a ()

Dừng các máy khách SL4A đã được mở.

boolean unpairAll ( ITestDevice device)

Hủy ghép nối tất cả các thiết bị đã ghép nối cho thiết bị hiện tại

Phương pháp được bảo vệ

void finalize ()

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

Nhà thầu xây dựng công cộng

Sl4aBluetoothSử dụng

public Sl4aBluetoothUtil ()

Phương pháp công cộng

thay đổiProfileAccessPermission

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

Thay đổi quyền truy cập cấu hình Bluetooth của thiết bị phụ trên thiết bị chính để thiết bị phụ truy cập thiết bị chính trên cấu hình đã cho

Thông số
primary ITestDevice : thiết bị thay đổi quyền

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

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

access Sl4aBluetoothUtil.BluetoothAccessLevel : mức độ truy cập, xem BluetoothAccessLevel

Trả lại
boolean đúng nếu quyền thay đổi thành công

Ném
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ấu hình Bluetooth nhất định

Thông số
primary ITestDevice : thiết bị để kết nối từ

secondary ITestDevice : thiết bị để kết nối

profiles : Cần có một bộ cấu hình Bluetooth để kết nối

Trả lại
boolean đúng nếu kết nối thành công

Ném
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

vô hiệu hóa

public boolean disable (ITestDevice device)

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

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

Trả lại
boolean đúng nếu Bluetooth bị tắt thành công

Ném
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

vô hiệu hóaBluetoothSnoopLog

public boolean disableBluetoothSnoopLog (ITestDevice device)

Tắt nhật ký rình mò Bluetooth

Thông số
device ITestDevice : để tắt nhật ký snoop

Trả lại
boolean đúng nếu tắt thành công

Ném
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ụ

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

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

profiles : Đã cho một bộ cấu hình Bluetooth cần được ngắt kết nối

Trả lại
boolean đúng nếu ngắt kết nối thành công

Ném
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

cho phép

public boolean enable (ITestDevice device)

Kích hoạt Bluetooth trên thiết bị mục tiêu

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

Trả lại
boolean đúng nếu Bluetooth được kích hoạt thành công

Ném
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

bật BluetoothSnoopLog

public boolean enableBluetoothSnoopLog (ITestDevice device)

Bật nhật ký rình mò Bluetooth

Thông số
device ITestDevice : để kích hoạt nhật ký snoop

Trả lại
boolean đúng nếu kích hoạt thành công

Ném
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

lấy địa chỉ

public String getAddress (ITestDevice device)

Nhận địa chỉ MAC Bluetooth của thiết bị mục tiêu

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

Trả lại
String Chuỗi địa chỉ MAC

Ném
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBondedThiết bị

public  getBondedDevices (ITestDevice device)

Nhận bộ địa chỉ MAC Bluetooth của các thiết bị được liên kết (ghép nối) trên thiết bị đích

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

Trả lại
Tập hợp địa chỉ MAC Bluetooth

Ném
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

đôi

public boolean pair (ITestDevice primary, 
                ITestDevice secondary)

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

Thông số
primary ITestDevice : thiết bị để ghép nối từ

secondary ITestDevice : thiết bị ghép nối với

Trả lại
boolean đúng nếu ghép nối thành công

Ném
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

setBtConnectionTimeout

public void setBtConnectionTimeout (Duration timeout)

Thông số
timeout Duration

setBtPairHết thời gian chờ

public void setBtPairTimeout (Duration timeout)

Thông số
timeout Duration

setProfileƯu tiên

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

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

Thông số
primary ITestDevice : thiết bị để đặt mức độ ưu tiên

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

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

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

Trả lại
boolean đúng nếu đặt mức độ ưu tiên thành công

Ném
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

bắt đầuSl4a

public void startSl4a (ITestDevice device, 
                File sl4aApkFile)

Khởi động rõ ràng ứng dụng khách SL4A với thiết bị đã cho và tệp apk SL4A. Thông thường, phương pháp 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 vận hành thực tế.

Thông số
device ITestDevice : thiết bị được kết nối bằng SL4A

sl4aApkFile File : apk SL4A tùy chọn để cài đặt và sử dụng.

Ném
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

dừng lạiSl4a

public void stopSl4a ()

Dừng các máy khách SL4A đã được mở. Về cơ bản, nó cung cấp cách dọn dẹp ứng dụng khách ngay sau khi chúng không còn được sử dụng nữa.

hủy ghép nốiTất cả

public boolean unpairAll (ITestDevice device)

Hủy ghép nối tất cả các thiết bị đã ghép nối cho thiết bị hiện tại

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

Trả lại
boolean đúng nếu hủy ghép nối thành công

Ném
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

Phương pháp được bảo vệ

hoàn thiện

protected void finalize ()

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