Sl4aบลูทูธยูทิลิตี

public class Sl4aBluetoothUtil
extends Object

java.lang.Object
com.android.tradefed.util.Sl4aบลูทูธยูทิลิตี


คลาสยูทิลิตี้ให้การดำเนินการบลูทูธในอุปกรณ์ 1 หรือ 2 เครื่องโดยใช้ SL4A

สรุป

ชั้นเรียนที่ซ้อนกัน

enum Sl4aBluetoothUtil.BluetoothAccessLevel

Enum สำหรับระดับการเข้าถึงอุปกรณ์บลูทูธที่อิงตาม BluetoothDevice.java

enum Sl4aBluetoothUtil.BluetoothConnectionState

Enum สำหรับสถานะการเชื่อมต่อบลูทูธซึ่งอิงตาม BluetoothProfile.java

enum Sl4aBluetoothUtil.BluetoothPriorityLevel

Enum สำหรับระดับความสำคัญของโปรไฟล์บลูทูธซึ่งอิงตาม BluetoothProfile.java

enum Sl4aBluetoothUtil.BluetoothProfile

Enum สำหรับโปรไฟล์บลูทูธที่อิงตาม BluetoothProfile.java

ช่างก่อสร้างสาธารณะ

Sl4aBluetoothUtil()

วิธีการสาธารณะ

boolean changeProfileAccessPermission(ITestDevice primary, ITestDevice secondary, Sl4aBluetoothUtil.BluetoothProfile profile, Sl4aBluetoothUtil.BluetoothAccessLevel access)

เปลี่ยนสิทธิ์เข้าถึงโปรไฟล์บลูทูธของอุปกรณ์รองในอุปกรณ์หลักเพื่อให้ อุปกรณ์รองสำหรับเข้าถึงอุปกรณ์หลักในโปรไฟล์ที่ระบุ

boolean connect(ITestDevice primary, ITestDevice secondary, profiles)

เชื่อมต่ออุปกรณ์หลักกับอุปกรณ์รองในโปรไฟล์บลูทูธที่ระบุ

boolean disable(ITestDevice device)

ปิดใช้บลูทูธในอุปกรณ์เป้าหมาย

boolean disableBluetoothSnoopLog(ITestDevice device)

ปิดใช้บันทึก Bluetooth Snoop

boolean disconnect(ITestDevice primary, ITestDevice secondary, profiles)

ยกเลิกการเชื่อมต่ออุปกรณ์หลักจากอุปกรณ์รอง

boolean enable(ITestDevice device)

เปิดบลูทูธในอุปกรณ์เป้าหมาย

boolean enableBluetoothSnoopLog(ITestDevice device)

เปิดใช้บันทึก Bluetooth Snoop

String getAddress(ITestDevice device)

รับที่อยู่ MAC ของบลูทูธของอุปกรณ์เป้าหมาย

getBondedDevices(ITestDevice device)

รับการตั้งค่าที่อยู่ MAC ของบลูทูธของอุปกรณ์ที่ผูก (จับคู่) กันในอุปกรณ์เป้าหมาย

boolean pair(ITestDevice primary, ITestDevice secondary)

จับคู่อุปกรณ์หลักกับอุปกรณ์รอง

void setBtConnectionTimeout(Duration timeout)
void setBtPairTimeout(Duration timeout)
boolean setProfilePriority(ITestDevice primary, ITestDevice secondary, profiles, Sl4aBluetoothUtil.BluetoothPriorityLevel priority)

เปลี่ยนการตั้งค่าลำดับความสำคัญของโปรไฟล์ที่ระบุในอุปกรณ์หลักไปยังอุปกรณ์รอง

void startSl4a(ITestDevice device, File sl4aApkFile)

เริ่มต้นไคลเอ็นต์ SL4A อย่างชัดแจ้งด้วยอุปกรณ์ที่ระบุและไฟล์ APK ของ SL4A

void stopSl4a()

หยุดไคลเอ็นต์ SL4A ที่เปิดอยู่แล้ว

boolean unpairAll(ITestDevice device)

เลิกจับคู่อุปกรณ์ที่จับคู่ทั้งหมดกับอุปกรณ์ปัจจุบัน

วิธีการป้องกัน

void finalize()

ล้างข้อมูลการเชื่อมต่อ SL4A ทั้งหมด

ช่างก่อสร้างสาธารณะ

Sl4aบลูทูธยูทิลิตี

public Sl4aBluetoothUtil ()

วิธีการสาธารณะ

เปลี่ยนสิทธิ์เข้าถึงโปรไฟล์

public boolean changeProfileAccessPermission (ITestDevice primary, 
                ITestDevice secondary, 
                Sl4aBluetoothUtil.BluetoothProfile profile, 
                Sl4aBluetoothUtil.BluetoothAccessLevel access)

เปลี่ยนสิทธิ์เข้าถึงโปรไฟล์บลูทูธของอุปกรณ์รองในอุปกรณ์หลักเพื่อให้ อุปกรณ์รองสำหรับเข้าถึงอุปกรณ์หลักในโปรไฟล์ที่ระบุ

พารามิเตอร์
primary ITestDevice: อุปกรณ์ที่จะเปลี่ยนสิทธิ์

secondary ITestDevice: อุปกรณ์ที่เข้าถึงอุปกรณ์หลักในโปรไฟล์ที่ระบุ

profile Sl4aBluetoothUtil.BluetoothProfile: โปรไฟล์บลูทูธสำหรับการเข้าถึง

access Sl4aBluetoothUtil.BluetoothAccessLevel: ระดับการเข้าถึง โปรดดู BluetoothAccessLevel

คิกรีเทิร์น
boolean จริงถ้าเปลี่ยนสิทธิ์สำเร็จ

การขว้าง
DeviceNotAvailableException

เชื่อมต่อ

public boolean connect (ITestDevice primary, 
                ITestDevice secondary, 
                 profiles)

เชื่อมต่ออุปกรณ์หลักกับอุปกรณ์รองในโปรไฟล์บลูทูธที่ระบุ

พารามิเตอร์
primary ITestDevice: อุปกรณ์ที่จะเชื่อมต่อ

secondary ITestDevice: อุปกรณ์ที่จะเชื่อมต่อ

profiles : ต้องมีชุดโปรไฟล์บลูทูธเพื่อเชื่อมต่อ

คิกรีเทิร์น
boolean จริง หากการเชื่อมต่อสำเร็จ

การขว้าง
DeviceNotAvailableException

ปิดใช้

public boolean disable (ITestDevice device)

ปิดใช้บลูทูธในอุปกรณ์เป้าหมาย

พารามิเตอร์
device ITestDevice: อุปกรณ์เป้าหมาย

คิกรีเทิร์น
boolean จริง หากปิดใช้บลูทูธสำเร็จ

การขว้าง
DeviceNotAvailableException

ปิดใช้ BluetoothSnoopLog

public boolean disableBluetoothSnoopLog (ITestDevice device)

ปิดใช้บันทึก Bluetooth Snoop

พารามิเตอร์
device ITestDevice: เพื่อปิดใช้บันทึก Snoop

คิกรีเทิร์น
boolean true ถ้าปิดใช้สำเร็จ

การขว้าง
DeviceNotAvailableException

ยกเลิกการเชื่อมต่อ

public boolean disconnect (ITestDevice primary, 
                ITestDevice secondary, 
                 profiles)

ยกเลิกการเชื่อมต่ออุปกรณ์หลักจากอุปกรณ์รอง

พารามิเตอร์
primary ITestDevice: อุปกรณ์เพื่อดำเนินการยกเลิกการเชื่อมต่อ

secondary ITestDevice: อุปกรณ์ที่จะยกเลิกการเชื่อมต่อ

profiles : ต้องยกเลิกการเชื่อมต่อโปรไฟล์บลูทูธชุดหนึ่ง

คิกรีเทิร์น
boolean true ถ้ายกเลิกการเชื่อมต่อสำเร็จ

การขว้าง
DeviceNotAvailableException

เปิดใช้

public boolean enable (ITestDevice device)

เปิดบลูทูธในอุปกรณ์เป้าหมาย

พารามิเตอร์
device ITestDevice: อุปกรณ์เป้าหมาย

คิกรีเทิร์น
boolean จริง หากเปิดใช้บลูทูธสำเร็จ

การขว้าง
DeviceNotAvailableException

เปิดใช้งาน BluetoothSnoopLog

public boolean enableBluetoothSnoopLog (ITestDevice device)

เปิดใช้บันทึก Bluetooth Snoop

พารามิเตอร์
device ITestDevice: เพื่อเปิดใช้บันทึก Snoop

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

การขว้าง
DeviceNotAvailableException

getAddress

public String getAddress (ITestDevice device)

รับที่อยู่ MAC ของบลูทูธของอุปกรณ์เป้าหมาย

พารามิเตอร์
device ITestDevice: อุปกรณ์เป้าหมาย

คิกรีเทิร์น
String สตริงที่อยู่ MAC

การขว้าง
DeviceNotAvailableException

อุปกรณ์ getBonded

public  getBondedDevices (ITestDevice device)

รับการตั้งค่าที่อยู่ MAC ของบลูทูธของอุปกรณ์ที่ผูก (จับคู่) กันในอุปกรณ์เป้าหมาย

พารามิเตอร์
device ITestDevice: อุปกรณ์เป้าหมาย

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

การขว้าง
DeviceNotAvailableException

จับคู่

public boolean pair (ITestDevice primary, 
                ITestDevice secondary)

จับคู่อุปกรณ์หลักกับอุปกรณ์รอง

พารามิเตอร์
primary ITestDevice: อุปกรณ์ที่จะจับคู่

secondary ITestDevice: อุปกรณ์ที่จะจับคู่กับ

คิกรีเทิร์น
boolean เป็นจริงหากการจับคู่สำเร็จ

การขว้าง
DeviceNotAvailableException

setBtConnectionระยะหมดเวลา

public void setBtConnectionTimeout (Duration timeout)

พารามิเตอร์
timeout Duration

ตั้งค่าBtPairระยะหมดเวลา

public void setBtPairTimeout (Duration timeout)

พารามิเตอร์
timeout Duration

ตั้งค่าลำดับความสำคัญของโปรไฟล์

public boolean setProfilePriority (ITestDevice primary, 
                ITestDevice secondary, 
                 profiles, 
                Sl4aBluetoothUtil.BluetoothPriorityLevel priority)

เปลี่ยนการตั้งค่าลำดับความสำคัญของโปรไฟล์ที่ระบุในอุปกรณ์หลักไปยังอุปกรณ์รอง

พารามิเตอร์
primary ITestDevice: อุปกรณ์ที่จะตั้งลำดับความสำคัญ

secondary ITestDevice: อุปกรณ์ที่จะตั้งลำดับความสำคัญ

profiles : โปรไฟล์บลูทูธเพื่อเปลี่ยนการตั้งค่าลำดับความสำคัญ

priority Sl4aBluetoothUtil.BluetoothPriorityLevel: ระดับความสำคัญ

คิกรีเทิร์น
boolean จริง หากตั้งค่าลำดับความสำคัญสำเร็จ

การขว้าง
DeviceNotAvailableException

StartSl4a

public void startSl4a (ITestDevice device, 
                File sl4aApkFile)

เริ่มต้นไคลเอ็นต์ SL4A อย่างชัดแจ้งด้วยอุปกรณ์ที่ระบุและไฟล์ APK ของ SL4A โดยปกติแล้ววิธีนี้ ไม่จำเป็น เนื่องจากการเชื่อมต่อ SL4A จะสร้างก่อนการทำงานจริงเสมอ

พารามิเตอร์
device ITestDevice: อุปกรณ์ที่จะเชื่อมต่อโดยใช้ SL4A

sl4aApkFile File: apk ของ SL4A ที่ไม่บังคับสำหรับติดตั้งและใช้งาน

การขว้าง
DeviceNotAvailableException

StopSl4a

public void stopSl4a ()

หยุดไคลเอ็นต์ SL4A ที่เปิดอยู่แล้ว พูดง่ายๆ ก็คือ ทำให้มีวิธีการที่จะทำให้ลูกค้าสะอาด ทันทีหลังจากไม่ได้ใช้งาน

เลิกจับคู่ทั้งหมด

public boolean unpairAll (ITestDevice device)

เลิกจับคู่อุปกรณ์ที่จับคู่ทั้งหมดกับอุปกรณ์ปัจจุบัน

พารามิเตอร์
device ITestDevice: อุปกรณ์ปัจจุบันสำหรับดำเนินการ

คิกรีเทิร์น
boolean จริง หากเลิกจับคู่สำเร็จ

การขว้าง
DeviceNotAvailableException

วิธีการป้องกัน

เสร็จสิ้น

protected void finalize ()

ล้างข้อมูลการเชื่อมต่อ SL4A ทั้งหมด