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

Hằng số

String BTSNOOP_API

String BTSNOOP_CMD

String BTSNOOP_DISABLE_CMD

String BTSNOOP_ENABLE_CMD

String GOLD_BTSNOOP_LOG_PATH

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)

Nhận đường dẫn tệp nhật ký bt snoop 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ề đầu ra

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á ghép nối Bluetooth với thời gian đợi tăng dần

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ử

Hằng số

BTSNOOP_API

public static final String BTSNOOP_API

Giá trị không đổi: "bluetoothConfigHciSnoopLog"

BTSNOOP_CMD

public static final String BTSNOOP_CMD

Giá trị không đổi: "setprop persist.bluetooth.btsnoopenable "

BTSNOOP_DISABLE_CMD

public static final String BTSNOOP_DISABLE_CMD

Giá trị không đổi: "setprop persist.bluetooth.btsnoopenable false"

BTSNOOP_ENABLE_CMD

public static final String BTSNOOP_ENABLE_CMD

Giá trị không đổi: "setprop persist.bluetooth.btsnoopenable true"

GOLD_BTSNOOP_LOG_PATH

public static final String GOLD_BTSNOOP_LOG_PATH

Giá trị không đổi: "/data/misc/bluetooth/logs/btsnoop_hci.log"

O_BUILD

public static final String O_BUILD

Giá trị không đổi: "O"

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 True nếu vô hiệu hoá thành công, false nếu khô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, giá trị rỗng nếu đã 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 True nếu bật thành công, false nếu không

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, giá trị rỗng nếu đã 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 BT mac 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 của Bluetooth

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

getBtSnoopLogFilePath

public static String getBtSnoopLogFilePath (ITestDevice device)

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

Giá trị trả về
String Tên tệp cho bt_snoop_log hoặc giá trị 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ề đầu ra

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; hãy tham khảo nguồn AOSP để biết thêm thông tin 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á ghép nối Bluetooth với thời gian đợi tăng dần

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