Kelas utilitas menyediakan operasi Bluetooth pada satu atau dua perangkat menggunakan SL4A
Kelas bersarang |
---|
enum | Sl4aBluetoothUtil.BluetoothAccessLevel Enum untuk tingkat akses perangkat Bluetooth yang didasarkan pada BluetoothDevice.java |
enum | Sl4aBluetoothUtil.BluetoothConnectionState Enum bagi negara-negara koneksi Bluetooth yang didasarkan pada BluetoothProfile.java |
enum | Sl4aBluetoothUtil.BluetoothPriorityLevel Enum untuk tingkat prioritas profil Bluetooth yang didasarkan pada BluetoothProfile.java |
enum | Sl4aBluetoothUtil.BluetoothProfile Enum untuk profil Bluetooth yang didasarkan pada BluetoothProfile.java |
Metode publik |
---|
boolean | changeProfileAccessPermission (ITestDevice primary, ITestDevice secondary, Sl4aBluetoothUtil.BluetoothProfile profile, Sl4aBluetoothUtil.BluetoothAccessLevel access) Ubah izin akses profil Bluetooth perangkat sekunder pada perangkat utama agar perangkat sekunder dapat mengakses perangkat utama pada profil yang diberikan |
boolean | connect (ITestDevice primary, ITestDevice secondary, profiles) connect (ITestDevice primary, ITestDevice secondary, profiles) Hubungkan perangkat utama ke perangkat sekunder pada profil Bluetooth yang diberikan |
boolean | disable (ITestDevice device) Nonaktifkan Bluetooth pada perangkat target |
boolean | disableBluetoothSnoopLog (ITestDevice device) Nonaktifkan log pengintai Bluetooth |
boolean | disconnect (ITestDevice primary, ITestDevice secondary, profiles) disconnect (ITestDevice primary, ITestDevice secondary, profiles) Putuskan sambungan perangkat utama dari perangkat sekunder |
boolean | enable (ITestDevice device) Aktifkan Bluetooth di perangkat target |
boolean | enableBluetoothSnoopLog (ITestDevice device) Aktifkan log pengintai Bluetooth |
String | getAddress (ITestDevice device) Dapatkan Alamat MAC Bluetooth perangkat target |
| getBondedDevices (ITestDevice device) Dapatkan set alamat MAC Bluetooth dari perangkat terikat (dipasangkan) pada perangkat target |
boolean | pair (ITestDevice primary, ITestDevice secondary) Pasangkan perangkat utama ke perangkat sekunder |
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) Ubah pengaturan prioritas profil yang diberikan pada perangkat utama ke perangkat sekunder |
void | startSl4a (ITestDevice device, File sl4aApkFile) Mulai klien SL4A secara eksplisit dengan perangkat yang diberikan dan file apk SL4A. |
void | stopSl4a () Hentikan klien SL4A yang sudah dibuka. |
boolean | unpairAll (ITestDevice device) Putuskan pemasangan semua perangkat yang dipasangkan untuk perangkat saat ini |
Metode yang dilindungi |
---|
void | finalize () Bersihkan semua koneksi SL4A |
Konstruktor publik
Sl4aBluetoothUtil
public Sl4aBluetoothUtil ()
Metode publik
ubah IzinAksesProfil
public boolean changeProfileAccessPermission (ITestDevice primary,
ITestDevice secondary,
Sl4aBluetoothUtil.BluetoothProfile profile,
Sl4aBluetoothUtil.BluetoothAccessLevel access)
Ubah izin akses profil Bluetooth perangkat sekunder pada perangkat utama agar perangkat sekunder dapat mengakses perangkat utama pada profil yang diberikan
Parameter |
---|
primary | ITestDevice : perangkat untuk izin perubahan |
secondary | ITestDevice : perangkat yang mengakses perangkat utama pada profil yang diberikan |
profile | Sl4aBluetoothUtil.BluetoothProfile profil Bluetooth untuk mengakses: |
access | Sl4aBluetoothUtil.BluetoothAccessLevel : tingkat akses, lihat BluetoothAccessLevel |
Kembali |
---|
boolean | benar jika izin berhasil diubah |
Melempar |
---|
DeviceNotAvailableException | |
Menghubung
public boolean connect (ITestDevice primary,
ITestDevice secondary,
profiles)
Hubungkan perangkat utama ke perangkat sekunder pada profil Bluetooth yang diberikan
Parameter |
---|
primary | ITestDevice : perangkat untuk menghubungkan |
secondary | ITestDevice : perangkat untuk terhubung ke |
profiles | : Satu set profil Bluetooth diperlukan untuk terhubung |
Kembali |
---|
boolean | benar jika koneksi berhasil |
Melempar |
---|
DeviceNotAvailableException | |
cacat
public boolean disable (ITestDevice device)
Nonaktifkan Bluetooth pada perangkat target
Parameter |
---|
device | ITestDevice : perangkat target |
Kembali |
---|
boolean | benar jika Bluetooth berhasil dinonaktifkan |
Melempar |
---|
DeviceNotAvailableException | |
nonaktifkanBluetoothSnoopLog
public boolean disableBluetoothSnoopLog (ITestDevice device)
Nonaktifkan log pengintai Bluetooth
Parameter |
---|
device | ITestDevice : untuk menonaktifkan log mengintip |
Kembali |
---|
boolean | benar jika dinonaktifkan berhasil |
Melempar |
---|
DeviceNotAvailableException | |
memutuskan
public boolean disconnect (ITestDevice primary,
ITestDevice secondary,
profiles)
Putuskan sambungan perangkat utama dari perangkat sekunder
Parameter |
---|
primary | ITestDevice : perangkat untuk melakukan operasi putuskan |
secondary | ITestDevice : perangkat yang akan terputus |
profiles | : Set profil Bluetooth yang diberikan diperlukan untuk diputuskan |
Kembali |
---|
boolean | benar jika terputus berhasil |
Melempar |
---|
DeviceNotAvailableException | |
memungkinkan
public boolean enable (ITestDevice device)
Aktifkan Bluetooth di perangkat target
Parameter |
---|
device | ITestDevice : perangkat target |
Kembali |
---|
boolean | benar jika Bluetooth berhasil diaktifkan |
Melempar |
---|
DeviceNotAvailableException | |
aktifkanBluetoothSnoopLog
public boolean enableBluetoothSnoopLog (ITestDevice device)
Aktifkan log pengintai Bluetooth
Parameter |
---|
device | ITestDevice : untuk mengaktifkan mengintip log |
Kembali |
---|
boolean | benar jika diaktifkan dengan sukses |
Melempar |
---|
DeviceNotAvailableException | |
dapatkanAlamat
public String getAddress (ITestDevice device)
Dapatkan Alamat MAC Bluetooth perangkat target
Parameter |
---|
device | ITestDevice : perangkat target |
Kembali |
---|
String | String Alamat MAC |
Melempar |
---|
DeviceNotAvailableException | |
getBondedDevices
public getBondedDevices (ITestDevice device)
Dapatkan set alamat MAC Bluetooth dari perangkat terikat (dipasangkan) pada perangkat target
Parameter |
---|
device | ITestDevice : perangkat target |
Kembali |
---|
| Set alamat MAC Bluetooth |
Melempar |
---|
DeviceNotAvailableException | |
pasangan
public boolean pair (ITestDevice primary,
ITestDevice secondary)
Pasangkan perangkat utama ke perangkat sekunder
Parameter |
---|
primary | ITestDevice : perangkat untuk memasangkan dari |
secondary | ITestDevice : perangkat untuk pasangan untuk |
Kembali |
---|
boolean | benar jika pasangan berhasil |
Melempar |
---|
DeviceNotAvailableException | |
setBtConnectionTimeout
public void setBtConnectionTimeout (Duration timeout)
Parameter |
---|
timeout | Duration |
setBtPairTimeout
public void setBtPairTimeout (Duration timeout)
Parameter |
---|
timeout | Duration |
setProfilePriority
public boolean setProfilePriority (ITestDevice primary,
ITestDevice secondary,
profiles,
Sl4aBluetoothUtil.BluetoothPriorityLevel priority)
Ubah pengaturan prioritas profil yang diberikan pada perangkat utama ke perangkat sekunder
Parameter |
---|
primary | ITestDevice : perangkat dengan prioritas ditetapkan pada |
secondary | ITestDevice : perangkat prioritas ditetapkan untuk |
profiles | : Profil Bluetooth untuk mengubah pengaturan prioritas |
priority | Sl4aBluetoothUtil.BluetoothPriorityLevel : tingkat prioritas |
Kembali |
---|
boolean | benar jika menetapkan prioritas berhasil |
Melempar |
---|
DeviceNotAvailableException | |
mulaiSl4a
public void startSl4a (ITestDevice device,
File sl4aApkFile)
Mulai klien SL4A secara eksplisit dengan perangkat yang diberikan dan file apk SL4A. Biasanya metode ini tidak diperlukan, karena koneksi SL4A akan selalu dibuat sebelum operasi yang sebenarnya.
Parameter |
---|
device | ITestDevice : perangkat yang akan terhubung menggunakan SL4A |
sl4aApkFile | File : opsional SL4A apk untuk menginstal dan menggunakan. |
Melempar |
---|
DeviceNotAvailableException | |
berhentiSl4a
public void stopSl4a ()
Hentikan klien SL4A yang sudah dibuka. Ini pada dasarnya menyediakan cara untuk membersihkan klien segera setelah mereka tidak lagi digunakan
putuskan semua
public boolean unpairAll (ITestDevice device)
Putuskan pemasangan semua perangkat yang dipasangkan untuk perangkat saat ini
Parameter |
---|
device | ITestDevice : perangkat sekarang untuk melakukan tindakan |
Kembali |
---|
boolean | benar jika un-pair berhasil |
Melempar |
---|
DeviceNotAvailableException | |
Metode yang dilindungi
menyelesaikan
protected void finalize ()
Bersihkan semua koneksi SL4A
Konten dan contoh kode di halaman ini tunduk pada lisensi yang dijelaskan dalam Lisensi Konten. Java dan OpenJDK adalah merek dagang atau merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2021-10-04 UTC.
[]
[]