BluetoothUtils

public class BluetoothUtils
extends Object

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


Hàm tiện ích để gọi BluetoothInstrumentation trên thiết bị

Bạn có thể tìm thấy mã BluetoothInstrumentation phía thiết bị trong AOSP tại: frameworks/base/core/tests/bluetoothtests

Tóm tắt

Trường

public static final String BTSNOOP_API

public static final String BTSNOOP_CMD

public static final String BTSNOOP_DISABLE_CMD

public static final String BTSNOOP_ENABLE_CMD

public static final String GOLD_BTSNOOP_LOG_PATH

public static final String O_BUILD

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

BluetoothUtils()

Phương thức công khai

static void cleanLogFile(ITestDevice device)

Xoá tệp nhật ký theo dõi khỏi thiết bị

static boolean disable(ITestDevice device)

Tắt Bluetooth trên thiết bị đã cho

static boolean disableBtsnoopLogging(ITestDevice device, File sl4aApkFile)

Tắt tính năng ghi nhật ký btsnoop bằng lệnh gọi sl4a

static boolean disableBtsnoopLogging(ITestDevice device)

Tắt tính năng ghi nhật ký btsnoop bằng lệnh gọi sl4a

static boolean enable(ITestDevice device)

Bật Bluetooth trên thiết bị đã cho

static boolean enableBtsnoopLogging(ITestDevice device, File sl4aApkFile)

Bật tính năng ghi nhật ký btsnoop bằng lệnh gọi sl4a

static boolean enableBtsnoopLogging(ITestDevice device)

Bật tính năng ghi nhật ký btsnoop bằng lệnh gọi sl4a

static String getBluetoothMac(ITestDevice device)

Truy xuất địa chỉ MAC BT của thiết bị đã cho

static getBondedDevices(ITestDevice device)

Trả về địa chỉ MAC Bluetooth của các thiết bị mà thiết bị đã cho đã liên kết

static String getBtSnoopLogFilePath(ITestDevice device)

Lấy đường dẫn tệp nhật ký snoop bt từ tệp bt_stack.config

static String runBluetoothInstrumentation(ITestDevice device, String command)

Phương thức thuận tiện để thực thi lệnh đo lường BT và trả về kết quả

static boolean runBluetoothInstrumentationWithRetry(ITestDevice device, String command)
static boolean toggleBtsnoopLogging(Sl4aClient client, boolean onOff)
static boolean unpairWithRetry(ITestDevice device)

Thử lại việc xoá chế độ ghép nối BT bằng thời gian đợi tuyến tính

static void uploadLogFiles(ITestInvocationListener listener, ITestDevice device, String type, int iteration)

Tải tệp nhật ký snoop lên để xem kết quả kiểm thử

Trường

BTSNOOP_API

public static final String BTSNOOP_API

BTSNOOP_CMD

public static final String BTSNOOP_CMD

BTSNOOP_DISABLE_CMD

public static final String BTSNOOP_DISABLE_CMD

BTSNOOP_ENABLE_CMD

public static final String BTSNOOP_ENABLE_CMD

GOLD_BTSNOOP_LOG_PATH

public static final String GOLD_BTSNOOP_LOG_PATH

O_BUILD

public static final String O_BUILD

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

BluetoothUtils

public BluetoothUtils ()

Phương thức công khai

cleanLogFile

public static void cleanLogFile (ITestDevice device)

Xoá tệp nhật ký theo dõi khỏi thiết bị

Tham số
device ITestDevice

Gửi
DeviceNotAvailableException

tắt

public static boolean disable (ITestDevice device)

Tắt Bluetooth trên thiết bị đã cho

Giá trị trả về
boolean Đúng nếu tắt thành công, sai nếu không thành công

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

disableBtsnoopLogging

public static boolean disableBtsnoopLogging (ITestDevice device, 
                File sl4aApkFile)

Tắt tính năng ghi nhật ký btsnoop bằng lệnh gọi sl4a

Tham số
sl4aApkFile File: vị trí tệp sl4a.apk, rỗng nếu tệp này đã được cài đặt

Giá trị trả về
boolean thành công hay không

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

disableBtsnoopLogging

public static boolean disableBtsnoopLogging (ITestDevice device)

Tắt tính năng ghi nhật ký btsnoop bằng lệnh gọi sl4a

Giá trị trả về
boolean thành công hay không

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

bật

public static boolean enable (ITestDevice device)

Bật Bluetooth trên thiết bị đã cho

Giá trị trả về
boolean Đúng nếu bật thành công, sai nếu không bật được

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

enableBtsnoopLogging

public static boolean enableBtsnoopLogging (ITestDevice device, 
                File sl4aApkFile)

Bật tính năng ghi nhật ký btsnoop bằng lệnh gọi sl4a

Tham số
sl4aApkFile File: vị trí tệp sl4a.apk, rỗng nếu tệp này đã được cài đặt

Giá trị trả về
boolean thành công hay không

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

enableBtsnoopLogging

public static boolean enableBtsnoopLogging (ITestDevice device)

Bật tính năng ghi nhật ký btsnoop bằng lệnh gọi sl4a

Giá trị trả về
boolean thành công hay không

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

getBluetoothMac

public static String getBluetoothMac (ITestDevice device)

Truy xuất địa chỉ MAC BT của thiết bị đã cho

Giá trị trả về
String Địa chỉ MAC BT hoặc giá trị rỗng nếu không tìm thấy

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

getBondedDevices

public static  getBondedDevices (ITestDevice device)

Trả về địa chỉ MAC Bluetooth của các thiết bị mà thiết bị đã cho đã liên kết

Giá trị trả về
địa chỉ MAC Bluetooth

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

getBtSnoopLogFilePath

public static String getBtSnoopLogFilePath (ITestDevice device)

Lấy đường dẫn tệp nhật ký snoop bt từ tệp bt_stack.config

Giá trị trả về
String Tên tệp cho bt_snoop_log hoặc rỗng nếu không tìm thấy

Gửi
DeviceNotAvailableException

runBluetoothInstrumentation

public static String runBluetoothInstrumentation (ITestDevice device, 
                String command)

Phương thức thuận tiện để thực thi lệnh đo lường BT và trả về kết quả

Tham số
command String: một chuỗi lệnh được gửi đến công cụ đo lường BT, hiện được hỗ trợ: enable, disable, unpairAll, getName, getAddress, getBondedDevices; tham khảo nguồn AOSP để biết thêm chi tiết

Giá trị trả về
String đầu ra của BluetoothInstrumentation

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

runBluetoothInstrumentationWithRetry

public static boolean runBluetoothInstrumentationWithRetry (ITestDevice device, 
                String command)

Tham số
device ITestDevice

command String

Giá trị trả về
boolean

Gửi
DeviceNotAvailableException

toggleBtsnoopLogging

public static boolean toggleBtsnoopLogging (Sl4aClient client, 
                boolean onOff)

Tham số
client Sl4aClient

onOff boolean

Giá trị trả về
boolean

Gửi
DeviceNotAvailableException

unpairWithRetry

public static boolean unpairWithRetry (ITestDevice device)

Thử lại việc xoá chế độ ghép nối BT bằng thời gian đợi tuyến tính

Giá trị trả về
boolean

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

uploadLogFiles

public static void uploadLogFiles (ITestInvocationListener listener, 
                ITestDevice device, 
                String type, 
                int iteration)

Tải tệp nhật ký snoop lên để xem kết quả kiểm thử

Tham số
listener ITestInvocationListener

device ITestDevice

type String

iteration int

Gửi
DeviceNotAvailableException