Sl4aBluetoothUtil

public class Sl4aBluetoothUtil
extends Object

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


Một 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 công cộng

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 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ác cấu hình Bluetooth nhất định

boolean disable ( ITestDevice device)

Tắt Bluetooth trên thiết bị đích

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)

Bật Bluetooth trên thiết bị đích

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ị đích

getBondedDevices ( ITestDevice device)

Nhận bộ địa chỉ MAC Bluetooth của các thiết bị được liên kết (được 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 sang thiết bị phụ

void startSl4a ( ITestDevice device, File sl4aApkFile)

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

void stopSl4a ()

Dừng ứng dụng khách SL4A đã được mở.

boolean unpairAll ( ITestDevice device)

Bỏ 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 công cộng

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 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 cấu hình đã cho

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

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

trả lại
boolean đúng nếu thay đổi quyền 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ác 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 với

profiles : Cần có một bộ cấu hình Bluetooth để được 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ị đích

Thông số
device ITestDevice : thiết bị đích

trả lại
boolean true nếu tắt Bluetooth 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ý rình mò

trả lại
boolean đúng nếu vô hiệu hóa 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 : Yêu cầu ngắt kết nối tập hợp các cấu hình Bluetooth nhất định

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)

Bật Bluetooth trên thiết bị đích

Thông số
device ITestDevice : thiết bị đích

trả lại
boolean đúng nếu bật Bluetooth thành công

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

bậtBluetoothSnoopLog

public boolean enableBluetoothSnoopLog (ITestDevice device)

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

Thông số
device ITestDevice : để bật nhật ký rình mò

trả lại
boolean true 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ị đích

Thông số
device ITestDevice : thiết bị đích

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

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

getBondedDevices

public  getBondedDevices (ITestDevice device)

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

Thông số
device ITestDevice : thiết bị đích

trả lại
Bộ đị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

setBtPairTimeout

public void setBtPairTimeout (Duration timeout)

Thông số
timeout Duration

setProfilePƯ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 sang thiết bị phụ

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

secondary ITestDevice : thiết bị để đặt ư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 ư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 ứng dụng khách SL4A một cách rõ ràng 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 các hoạt động 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ừngSl4a

public void stopSl4a ()

Dừng ứng dụng khách SL4A đã được mở. Về cơ bản, nó cung cấp một cách để dọn dẹp máy 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)

Bỏ 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