Sl4aบลูทูธยูทิลิตี้
public class Sl4aBluetoothUtil
extends Object
java.lang.Object |
↳ | com.android.tradefed.util.Sl4aBluetoothUtil |
คลาสยูทิลิตี้ช่วยให้ใช้งาน Bluetooth บนอุปกรณ์หนึ่งหรือสองเครื่องโดยใช้ SL4A
สรุป
วิธีการสาธารณะ |
---|
boolean | changeProfileAccessPermission ( ITestDevice primary, ITestDevice secondary, Sl4aBluetoothUtil.BluetoothProfile profile, Sl4aBluetoothUtil.BluetoothAccessLevel access) เปลี่ยนการอนุญาตการเข้าถึงโปรไฟล์ Bluetooth ของอุปกรณ์รองบนอุปกรณ์หลักเพื่อให้อุปกรณ์รองสามารถเข้าถึงอุปกรณ์หลักในโปรไฟล์ที่กำหนด |
boolean | connect ( ITestDevice primary, ITestDevice secondary, profiles) connect ( ITestDevice primary, ITestDevice secondary, profiles) เชื่อมต่ออุปกรณ์หลักกับอุปกรณ์รองในโปรไฟล์ Bluetooth ที่กำหนด |
boolean | disable ( ITestDevice device) ปิดการใช้งาน Bluetooth บนอุปกรณ์เป้าหมาย |
boolean | disableBluetoothSnoopLog ( ITestDevice device) ปิดการใช้งานบันทึกการสอดแนม Bluetooth |
boolean | disconnect ( ITestDevice primary, ITestDevice secondary, profiles) disconnect ( ITestDevice primary, ITestDevice secondary, profiles) ตัดการเชื่อมต่ออุปกรณ์หลักจากอุปกรณ์รอง |
boolean | enable ( ITestDevice device) เปิดใช้งาน Bluetooth บนอุปกรณ์เป้าหมาย |
boolean | enableBluetoothSnoopLog ( ITestDevice device) เปิดใช้งานบันทึกการสอดแนม Bluetooth |
String | getAddress ( ITestDevice device) รับที่อยู่ MAC Bluetooth ของอุปกรณ์เป้าหมาย |
| getBondedDevices ( ITestDevice device) รับชุดที่อยู่ MAC ของ Bluetooth ของอุปกรณ์ที่ถูกผูกมัด (จับคู่) บนอุปกรณ์เป้าหมาย |
boolean | pair ( ITestDevice primary, ITestDevice secondary) จับคู่อุปกรณ์หลักกับอุปกรณ์รอง |
void | setBtConnectionTimeout (Duration timeout) |
void | setBtPairTimeout (Duration timeout) |
boolean | setProfilePriority ( ITestDevice primary, ITestDevice secondary, profiles, Sl4aBluetoothUtil.BluetoothPriorityLevel priority) 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)
เปลี่ยนการอนุญาตการเข้าถึงโปรไฟล์ Bluetooth ของอุปกรณ์รองบนอุปกรณ์หลักเพื่อให้อุปกรณ์รองสามารถเข้าถึงอุปกรณ์หลักในโปรไฟล์ที่กำหนด
พารามิเตอร์ |
---|
primary | ITestDevice : อุปกรณ์สำหรับเปลี่ยนการอนุญาต |
secondary | ITestDevice : อุปกรณ์ที่เข้าถึงอุปกรณ์หลักบนโปรไฟล์ที่กำหนด |
profile | Sl4aBluetoothUtil.BluetoothProfile : โปรไฟล์ Bluetooth เพื่อเข้าถึง |
access | Sl4aBluetoothUtil.BluetoothAccessLevel : ระดับการเข้าถึง โปรดดูที่ BluetoothAccessLevel |
การส่งคืน |
---|
boolean | เป็นจริงหากการเปลี่ยนแปลงการอนุญาตสำเร็จ |
เชื่อมต่อ
public boolean connect (ITestDevice primary,
ITestDevice secondary,
profiles)
เชื่อมต่ออุปกรณ์หลักกับอุปกรณ์รองในโปรไฟล์ Bluetooth ที่กำหนด
พารามิเตอร์ |
---|
primary | ITestDevice : อุปกรณ์สำหรับเชื่อมต่อ |
secondary | ITestDevice : อุปกรณ์ที่จะเชื่อมต่อ |
profiles | : จำเป็นต้องเชื่อมต่อชุดโปรไฟล์ Bluetooth |
การส่งคืน |
---|
boolean | เป็นจริงหากการเชื่อมต่อสำเร็จ |
ปิดการใช้งาน
public boolean disable (ITestDevice device)
ปิดการใช้งาน Bluetooth บนอุปกรณ์เป้าหมาย
พารามิเตอร์ |
---|
device | ITestDevice : อุปกรณ์เป้าหมาย |
การส่งคืน |
---|
boolean | เป็นจริงหากปิดใช้งาน Bluetooth สำเร็จ |
ปิดการใช้งาน BluetoothSnoopLog
public boolean disableBluetoothSnoopLog (ITestDevice device)
ปิดการใช้งานบันทึกการสอดแนม Bluetooth
พารามิเตอร์ |
---|
device | ITestDevice : เพื่อปิดการใช้งานบันทึกการสอดแนม |
การส่งคืน |
---|
boolean | จริงหากปิดการใช้งานสำเร็จ |
ตัดการเชื่อมต่อ
public boolean disconnect (ITestDevice primary,
ITestDevice secondary,
profiles)
ตัดการเชื่อมต่ออุปกรณ์หลักจากอุปกรณ์รอง
พารามิเตอร์ |
---|
primary | ITestDevice : อุปกรณ์สำหรับดำเนินการตัดการเชื่อมต่อ |
secondary | ITestDevice : อุปกรณ์ที่จะตัดการเชื่อมต่อ |
profiles | : จำเป็นต้องตัดการเชื่อมต่อชุดโปรไฟล์ Bluetooth ที่กำหนด |
การส่งคืน |
---|
boolean | เป็นจริงหากยกเลิกการเชื่อมต่อสำเร็จ |
เปิดใช้งาน
public boolean enable (ITestDevice device)
เปิดใช้งาน Bluetooth บนอุปกรณ์เป้าหมาย
พารามิเตอร์ |
---|
device | ITestDevice : อุปกรณ์เป้าหมาย |
การส่งคืน |
---|
boolean | เป็นจริงหากเปิดใช้งาน Bluetooth สำเร็จ |
เปิดใช้งานบลูทูธSnoopLog
public boolean enableBluetoothSnoopLog (ITestDevice device)
เปิดใช้งานบันทึกการสอดแนม Bluetooth
พารามิเตอร์ |
---|
device | ITestDevice : เพื่อเปิดใช้งานบันทึกการสอดแนม |
การส่งคืน |
---|
boolean | จริงหากเปิดใช้งานสำเร็จ |
รับที่อยู่
public String getAddress (ITestDevice device)
รับที่อยู่ MAC Bluetooth ของอุปกรณ์เป้าหมาย
พารามิเตอร์ |
---|
device | ITestDevice : อุปกรณ์เป้าหมาย |
การส่งคืน |
---|
String | สตริงที่อยู่ MAC |
รับอุปกรณ์ผูกมัด
public getBondedDevices (ITestDevice device)
รับชุดที่อยู่ MAC ของ Bluetooth ของอุปกรณ์ที่ถูกผูกมัด (จับคู่) บนอุปกรณ์เป้าหมาย
พารามิเตอร์ |
---|
device | ITestDevice : อุปกรณ์เป้าหมาย |
การส่งคืน |
---|
| ชุดที่อยู่ MAC ของบลูทูธ |
คู่
public boolean pair (ITestDevice primary,
ITestDevice secondary)
จับคู่อุปกรณ์หลักกับอุปกรณ์รอง
พารามิเตอร์ |
---|
primary | ITestDevice : อุปกรณ์ที่จะจับคู่ |
secondary | ITestDevice : อุปกรณ์ที่จะจับคู่ |
การส่งคืน |
---|
boolean | เป็นจริงหากการจับคู่สำเร็จ |
setBtConnectionหมดเวลา
public void setBtConnectionTimeout (Duration timeout)
พารามิเตอร์ |
---|
timeout | Duration |
setBtPairหมดเวลา
public void setBtPairTimeout (Duration timeout)
พารามิเตอร์ |
---|
timeout | Duration |
setProfilePriority
public boolean setProfilePriority (ITestDevice primary,
ITestDevice secondary,
profiles,
Sl4aBluetoothUtil.BluetoothPriorityLevel priority)
เปลี่ยนการตั้งค่าลำดับความสำคัญของโปรไฟล์ที่กำหนดบนอุปกรณ์หลักเป็นอุปกรณ์รอง
พารามิเตอร์ |
---|
primary | ITestDevice : อุปกรณ์ที่จะตั้งค่าลำดับความสำคัญ |
secondary | ITestDevice : อุปกรณ์สำหรับกำหนดลำดับความสำคัญ |
profiles | : โปรไฟล์ Bluetooth เพื่อเปลี่ยนการตั้งค่าลำดับความสำคัญ |
priority | Sl4aBluetoothUtil.BluetoothPriorityLevel : ระดับความสำคัญ |
การส่งคืน |
---|
boolean | เป็นจริงหากตั้งค่าลำดับความสำคัญสำเร็จ |
startSl4a
public void startSl4a (ITestDevice device,
File sl4aApkFile)
เริ่มต้นไคลเอ็นต์ SL4A อย่างชัดเจนด้วยอุปกรณ์ที่กำหนดและไฟล์ APK SL4A โดยปกติไม่จำเป็นต้องใช้วิธีนี้ เนื่องจากการเชื่อมต่อ SL4A จะถูกสร้างขึ้นก่อนการดำเนินการจริงเสมอ
พารามิเตอร์ |
---|
device | ITestDevice : อุปกรณ์ที่จะเชื่อมต่อโดยใช้ SL4A |
sl4aApkFile | File : apk SL4A เสริมเพื่อติดตั้งและใช้งาน |
หยุดSl4a
public void stopSl4a ()
หยุดไคลเอ็นต์ SL4A ที่ถูกเปิดอยู่แล้ว โดยพื้นฐานแล้วมันเป็นวิธีในการล้างข้อมูลไคลเอนต์ทันทีหลังจากที่ไม่ได้ใช้งานอีกต่อไป
เลิกจับคู่ทั้งหมด
public boolean unpairAll (ITestDevice device)
ยกเลิกการจับคู่อุปกรณ์ที่จับคู่ทั้งหมดสำหรับอุปกรณ์ปัจจุบัน
พารามิเตอร์ |
---|
device | ITestDevice : อุปกรณ์ปัจจุบันที่จะดำเนินการ |
การส่งคืน |
---|
boolean | เป็นจริงหากยกเลิกการจับคู่สำเร็จ |
วิธีการที่ได้รับการป้องกัน
จบ
protected void finalize ()
ทำความสะอาดการเชื่อมต่อ SL4A ทั้งหมด