BluetoothUtils

public class BluetoothUtils
extends Object

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


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

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

สรุป

ช่อง

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

ตัวสร้างแบบสาธารณะ

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 จากไฟล์ 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

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

ตัวสร้างแบบสาธารณะ

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)

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

คิกรีเทิร์น
String ชื่อไฟล์สําหรับ bt_snoop_log หรือเป็นค่าว่างหากไม่พบ

การโยน
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