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