BluetoothUtils

public class BluetoothUtils
extends Object

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


ฟังก์ชันยูทิลิตีสำหรับการเรียกใช้ BluetoothInstrumentation ในอุปกรณ์

คุณดูโค้ด BluetoothInstrumentation ฝั่งอุปกรณ์ได้ใน AOSP ที่ frameworks/base/core/tests/bluetoothtests

สรุป

ค่าคงที่

String BTSNOOP_API

String BTSNOOP_CMD

String BTSNOOP_DISABLE_CMD

String BTSNOOP_ENABLE_CMD

String GOLD_BTSNOOP_LOG_PATH

String O_BUILD

เครื่องมือสร้างสาธารณะ

BluetoothUtils()

เมธอดสาธารณะ

static void cleanLogFile(ITestDevice device)

ลบไฟล์บันทึกการดักฟังออกจากอุปกรณ์

static boolean disable(ITestDevice device)

ปิดใช้บลูทูธในอุปกรณ์ที่ระบุ

static boolean disableBtsnoopLogging(ITestDevice device, File sl4aApkFile)

ปิดใช้การบันทึก btsnoop โดยการเรียก sl4a

static boolean disableBtsnoopLogging(ITestDevice device)

ปิดใช้การบันทึก btsnoop โดยการเรียก sl4a

static boolean enable(ITestDevice device)

เปิดใช้บลูทูธในอุปกรณ์ที่ระบุ

static boolean enableBtsnoopLogging(ITestDevice device, File sl4aApkFile)

เปิดใช้การบันทึก btsnoop โดยการเรียก sl4a

static boolean enableBtsnoopLogging(ITestDevice device)

เปิดใช้การบันทึก btsnoop โดยการเรียก sl4a

static String getBluetoothMac(ITestDevice device)

เรียกข้อมูล MAC ของ BT ของอุปกรณ์ที่ระบุ

static getBondedDevices(ITestDevice device)

แสดงที่อยู่ MAC ของบลูทูธของอุปกรณ์ที่อุปกรณ์ที่ระบุจับคู่ด้วย

static String getBtSnoopLogFilePath(ITestDevice device)

รับเส้นทางไฟล์บันทึก bt snoop จากไฟล์ bt_stack.config

static String runBluetoothInstrumentation(ITestDevice device, String command)

วิธีที่สะดวกในการเรียกใช้คำสั่งการวัด BT และแสดงผลลัพธ์

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

ลองล้างการจับคู่ BT อีกครั้งโดยใช้ Linear Backoff

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

อัปโหลดไฟล์บันทึกการสอดแนมสำหรับผลการทดสอบ

ค่าคงที่

BTSNOOP_API

public static final String BTSNOOP_API

ค่าคงที่ "bluetoothConfigHciSnoopLog"

BTSNOOP_CMD

public static final String BTSNOOP_CMD

ค่าคงที่: "setprop persist.bluetooth.btsnoopenable "

BTSNOOP_DISABLE_CMD

public static final String BTSNOOP_DISABLE_CMD

ค่าคงที่: "setprop persist.bluetooth.btsnoopenable false"

BTSNOOP_ENABLE_CMD

public static final String BTSNOOP_ENABLE_CMD

ค่าคงที่ "setprop persist.bluetooth.btsnoopenable true"

GOLD_BTSNOOP_LOG_PATH

public static final String GOLD_BTSNOOP_LOG_PATH

ค่าคงที่ "/data/misc/bluetooth/logs/btsnoop_hci.log"

O_BUILD

public static final String O_BUILD

ค่าคงที่: "O"

เครื่องมือสร้างสาธารณะ

BluetoothUtils

public BluetoothUtils ()

เมธอดสาธารณะ

cleanLogFile

public static void cleanLogFile (ITestDevice device)

ลบไฟล์บันทึกการดักฟังออกจากอุปกรณ์

พารามิเตอร์
device ITestDevice

การขว้าง
DeviceNotAvailableException

ปิดใช้

public static boolean disable (ITestDevice device)

ปิดใช้บลูทูธในอุปกรณ์ที่ระบุ

คิกรีเทิร์น
boolean เป็นจริงหากปิดใช้สำเร็จ หากไม่ จะเป็นเท็จ

การขว้าง
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

disableBtsnoopLogging

public static boolean disableBtsnoopLogging (ITestDevice device, 
                File sl4aApkFile)

ปิดใช้การบันทึก btsnoop โดยการเรียก sl4a

พารามิเตอร์
sl4aApkFile File: ตำแหน่งไฟล์ sl4a.apk, null หากติดตั้งแล้ว

คิกรีเทิร์น
boolean สำเร็จหรือไม่

การขว้าง
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

disableBtsnoopLogging

public static boolean disableBtsnoopLogging (ITestDevice device)

ปิดใช้การบันทึก btsnoop โดยการเรียก sl4a

คิกรีเทิร์น
boolean สำเร็จหรือไม่

การขว้าง
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

เปิดใช้

public static boolean enable (ITestDevice device)

เปิดใช้บลูทูธในอุปกรณ์ที่ระบุ

คิกรีเทิร์น
boolean เป็นจริงหากเปิดใช้สำเร็จ หากไม่ จะเป็นเท็จ

การขว้าง
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

enableBtsnoopLogging

public static boolean enableBtsnoopLogging (ITestDevice device, 
                File sl4aApkFile)

เปิดใช้การบันทึก btsnoop โดยการเรียก sl4a

พารามิเตอร์
sl4aApkFile File: ตำแหน่งไฟล์ sl4a.apk, null หากติดตั้งแล้ว

คิกรีเทิร์น
boolean สำเร็จหรือไม่

การขว้าง
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

enableBtsnoopLogging

public static boolean enableBtsnoopLogging (ITestDevice device)

เปิดใช้การบันทึก btsnoop โดยการเรียก sl4a

คิกรีเทิร์น
boolean สำเร็จหรือไม่

การขว้าง
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBluetoothMac

public static String getBluetoothMac (ITestDevice device)

เรียกข้อมูล MAC ของ BT ของอุปกรณ์ที่ระบุ

คิกรีเทิร์น
String BT mac หรือ null หากไม่พบ

การขว้าง
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBondedDevices

public static  getBondedDevices (ITestDevice device)

แสดงที่อยู่ MAC ของบลูทูธของอุปกรณ์ที่อุปกรณ์ที่ระบุจับคู่ด้วย

คิกรีเทิร์น
ที่อยู่ MAC ของบลูทูธ

การขว้าง
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBtSnoopLogFilePath

public static String getBtSnoopLogFilePath (ITestDevice device)

รับเส้นทางไฟล์บันทึก bt snoop จากไฟล์ bt_stack.config

คิกรีเทิร์น
String ชื่อไฟล์สำหรับ bt_snoop_log หรือ null หากไม่พบ

การขว้าง
DeviceNotAvailableException

runBluetoothInstrumentation

public static String runBluetoothInstrumentation (ITestDevice device, 
                String command)

วิธีที่สะดวกในการเรียกใช้คำสั่งการวัด BT และแสดงผลลัพธ์

พารามิเตอร์
command String: สตริงคำสั่งที่ส่งไปยังการวัดผล BT ซึ่งปัจจุบันรองรับคำสั่งต่อไปนี้ enable, disable, unpairAll, getName, getAddress, getBondedDevices โปรดดูรายละเอียดเพิ่มเติมใน แหล่งที่มาของ AOSP

คิกรีเทิร์น
String เอาต์พุตของ BluetoothInstrumentation

การขว้าง
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

runBluetoothInstrumentationWithRetry

public static boolean runBluetoothInstrumentationWithRetry (ITestDevice device, 
                String command)

พารามิเตอร์
device ITestDevice

command String

คิกรีเทิร์น
boolean

การขว้าง
DeviceNotAvailableException

toggleBtsnoopLogging

public static boolean toggleBtsnoopLogging (Sl4aClient client, 
                boolean onOff)

พารามิเตอร์
client Sl4aClient

onOff boolean

คิกรีเทิร์น
boolean

การขว้าง
DeviceNotAvailableException

unpairWithRetry

public static boolean unpairWithRetry (ITestDevice device)

ลองล้างการจับคู่ BT อีกครั้งโดยใช้ Linear Backoff

คิกรีเทิร์น
boolean

การขว้าง
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

uploadLogFiles

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

อัปโหลดไฟล์บันทึกการสอดแนมสำหรับผลการทดสอบ

พารามิเตอร์
listener ITestInvocationListener

device ITestDevice

type String

iteration int

การขว้าง
DeviceNotAvailableException