BluetoothUtils
public
class
BluetoothUtils
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.util.BluetoothUtils |
Fungsi utilitas untuk memanggil BluetoothInstrumentation di perangkat
Kode BluetoothInstrumentation sisi perangkat dapat ditemukan di AOSP di:
frameworks/base/core/tests/bluetoothtests
Ringkasan
Konstanta | |
|---|---|
String |
BTSNOOP_API
|
String |
BTSNOOP_CMD
|
String |
BTSNOOP_DISABLE_CMD
|
String |
BTSNOOP_ENABLE_CMD
|
String |
GOLD_BTSNOOP_LOG_PATH
|
String |
O_BUILD
|
Konstruktor publik | |
|---|---|
BluetoothUtils()
|
|
Metode publik | |
|---|---|
static
void
|
cleanLogFile(ITestDevice device)
Menghapus file log intip dari perangkat |
static
boolean
|
disable(ITestDevice device)
Menonaktifkan bluetooth di perangkat yang ditentukan |
static
boolean
|
disableBtsnoopLogging(ITestDevice device, File sl4aApkFile)
Menonaktifkan logging btsnoop dengan panggilan sl4a |
static
boolean
|
disableBtsnoopLogging(ITestDevice device)
Menonaktifkan logging btsnoop dengan panggilan sl4a |
static
boolean
|
enable(ITestDevice device)
Mengaktifkan bluetooth di perangkat yang ditentukan |
static
boolean
|
enableBtsnoopLogging(ITestDevice device, File sl4aApkFile)
Aktifkan logging btsnoop dengan panggilan sl4a |
static
boolean
|
enableBtsnoopLogging(ITestDevice device)
Aktifkan logging btsnoop dengan panggilan sl4a |
static
String
|
getBluetoothMac(ITestDevice device)
Mengambil MAC BT perangkat yang ditentukan |
static
|
getBondedDevices(ITestDevice device)
Menampilkan alamat MAC bluetooth perangkat yang telah dipasangkan dengan perangkat tertentu |
static
String
|
getBtSnoopLogFilePath(ITestDevice device)
Mendapatkan jalur file log bt snoop dari file bt_stack.config |
static
String
|
runBluetoothInstrumentation(ITestDevice device, String command)
Metode praktis untuk menjalankan perintah instrumentasi BT dan menampilkan output |
static
boolean
|
runBluetoothInstrumentationWithRetry(ITestDevice device, String command)
|
static
boolean
|
toggleBtsnoopLogging(Sl4aClient client, boolean onOff)
|
static
boolean
|
unpairWithRetry(ITestDevice device)
Mencoba lagi penghapusan penyambungan BT dengan backoff linear |
static
void
|
uploadLogFiles(ITestInvocationListener listener, ITestDevice device, String type, int iteration)
Mengupload file log snoop untuk hasil pengujian |
Konstanta
BTSNOOP_API
public static final String BTSNOOP_API
Nilai Konstanta: "bluetoothConfigHciSnoopLog"
BTSNOOP_CMD
public static final String BTSNOOP_CMD
Nilai Konstanta: "setprop persist.bluetooth.btsnoopenable "
BTSNOOP_DISABLE_CMD
public static final String BTSNOOP_DISABLE_CMD
Nilai Konstanta: "setprop persist.bluetooth.btsnoopenable false"
BTSNOOP_ENABLE_CMD
public static final String BTSNOOP_ENABLE_CMD
Nilai Konstanta: "setprop persist.bluetooth.btsnoopenable true"
GOLD_BTSNOOP_LOG_PATH
public static final String GOLD_BTSNOOP_LOG_PATH
Nilai Konstanta: "/data/misc/bluetooth/logs/btsnoop_hci.log"
O_BUILD
public static final String O_BUILD
Nilai Konstanta: "O"
Konstruktor publik
BluetoothUtils
public BluetoothUtils ()
Metode publik
cleanLogFile
public static void cleanLogFile (ITestDevice device)
Menghapus file log intip dari perangkat
| Parameter | |
|---|---|
device |
ITestDevice |
| Menampilkan | |
|---|---|
DeviceNotAvailableException |
|
nonaktifkan
public static boolean disable (ITestDevice device)
Menonaktifkan bluetooth di perangkat yang ditentukan
| Hasil | |
|---|---|
boolean |
Benar jika penonaktifan berhasil, salah jika tidak |
| Menampilkan | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
|
disableBtsnoopLogging
public static boolean disableBtsnoopLogging (ITestDevice device, File sl4aApkFile)
Menonaktifkan logging btsnoop dengan panggilan sl4a
| Parameter | |
|---|---|
sl4aApkFile |
File: lokasi file sl4a.apk, null jika telah diinstal |
| Hasil | |
|---|---|
boolean |
berhasil atau tidak |
| Menampilkan | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
|
disableBtsnoopLogging
public static boolean disableBtsnoopLogging (ITestDevice device)
Menonaktifkan logging btsnoop dengan panggilan sl4a
| Hasil | |
|---|---|
boolean |
berhasil atau tidak |
| Menampilkan | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
|
aktifkan
public static boolean enable (ITestDevice device)
Mengaktifkan bluetooth di perangkat yang ditentukan
| Hasil | |
|---|---|
boolean |
Benar jika pengaktifan berhasil, salah jika tidak |
| Menampilkan | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
|
enableBtsnoopLogging
public static boolean enableBtsnoopLogging (ITestDevice device, File sl4aApkFile)
Mengaktifkan logging btsnoop dengan panggilan sl4a
| Parameter | |
|---|---|
sl4aApkFile |
File: lokasi file sl4a.apk, null jika telah diinstal |
| Hasil | |
|---|---|
boolean |
berhasil atau tidak |
| Menampilkan | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
|
enableBtsnoopLogging
public static boolean enableBtsnoopLogging (ITestDevice device)
Aktifkan logging btsnoop dengan panggilan sl4a
| Hasil | |
|---|---|
boolean |
berhasil atau tidak |
| Menampilkan | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
|
getBluetoothMac
public static String getBluetoothMac (ITestDevice device)
Mengambil MAC BT perangkat yang diberikan
| Hasil | |
|---|---|
String |
BT mac atau null jika tidak ditemukan |
| Menampilkan | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
|
getBondedDevices
public staticgetBondedDevices (ITestDevice device)
Menampilkan alamat MAC bluetooth perangkat yang telah dipasangkan dengan perangkat tertentu
| Hasil | |
|---|---|
|
alamat MAC bluetooth |
| Menampilkan | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
|
getBtSnoopLogFilePath
public static String getBtSnoopLogFilePath (ITestDevice device)
Mendapatkan jalur file log bt snoop dari file bt_stack.config
| Hasil | |
|---|---|
String |
Nama file untuk bt_snoop_log atau null jika tidak ditemukan |
| Menampilkan | |
|---|---|
DeviceNotAvailableException |
|
runBluetoothInstrumentation
public static String runBluetoothInstrumentation (ITestDevice device, String command)
Metode praktis untuk menjalankan perintah instrumentasi BT dan menampilkan output
| Parameter | |
|---|---|
command |
String: string perintah yang dikirim ke instrumentasi BT, yang saat ini didukung:
enable, disable, unpairAll, getName, getAddress, getBondedDevices; lihat sumber AOSP untuk mengetahui detail selengkapnya |
| Hasil | |
|---|---|
String |
output BluetoothInstrumentation |
| Menampilkan | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
|
runBluetoothInstrumentationWithRetry
public static boolean runBluetoothInstrumentationWithRetry (ITestDevice device, String command)
| Parameter | |
|---|---|
device |
ITestDevice |
command |
String |
| Hasil | |
|---|---|
boolean |
|
| Menampilkan | |
|---|---|
DeviceNotAvailableException |
|
toggleBtsnoopLogging
public static boolean toggleBtsnoopLogging (Sl4aClient client, boolean onOff)
| Parameter | |
|---|---|
client |
Sl4aClient |
onOff |
boolean |
| Hasil | |
|---|---|
boolean |
|
| Menampilkan | |
|---|---|
DeviceNotAvailableException |
|
unpairWithRetry
public static boolean unpairWithRetry (ITestDevice device)
Mencoba lagi penghapusan penyambungan BT dengan backoff linear
| Hasil | |
|---|---|
boolean |
|
| Menampilkan | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
|
uploadLogFiles
public static void uploadLogFiles (ITestInvocationListener listener, ITestDevice device, String type, int iteration)
Mengupload file log snoop untuk hasil pengujian
| Parameter | |
|---|---|
listener |
ITestInvocationListener |
device |
ITestDevice |
type |
String |
iteration |
int |
| Menampilkan | |
|---|---|
DeviceNotAvailableException |
|