BluetoothUtils
public
class
BluetoothUtils
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.util.BluetoothUtils |
Hilfsfunktionen zum Aufrufen von „BluetoothInstrumentation“ auf dem Gerät
Der BluetoothInstrumentation-Code auf Geräteseite ist in AOSP unter frameworks/base/core/tests/bluetoothtests zu finden.
Zusammenfassung
Konstanten | |
|---|---|
String |
BTSNOOP_API
|
String |
BTSNOOP_CMD
|
String |
BTSNOOP_DISABLE_CMD
|
String |
BTSNOOP_ENABLE_CMD
|
String |
GOLD_BTSNOOP_LOG_PATH
|
String |
O_BUILD
|
Öffentliche Konstruktoren | |
|---|---|
BluetoothUtils()
|
|
Öffentliche Methoden | |
|---|---|
static
void
|
cleanLogFile(ITestDevice device)
Snoop-Logdatei vom Gerät löschen |
static
boolean
|
disable(ITestDevice device)
Deaktiviert Bluetooth auf dem angegebenen Gerät |
static
boolean
|
disableBtsnoopLogging(ITestDevice device, File sl4aApkFile)
btsnoop-Logging über SL4A-Aufruf deaktivieren |
static
boolean
|
disableBtsnoopLogging(ITestDevice device)
btsnoop-Logging über SL4A-Aufruf deaktivieren |
static
boolean
|
enable(ITestDevice device)
Aktiviert Bluetooth auf dem angegebenen Gerät |
static
boolean
|
enableBtsnoopLogging(ITestDevice device, File sl4aApkFile)
btsnoop-Logging über SL4A-Aufruf aktivieren |
static
boolean
|
enableBtsnoopLogging(ITestDevice device)
btsnoop-Logging über SL4A-Aufruf aktivieren |
static
String
|
getBluetoothMac(ITestDevice device)
Ruft die Bluetooth-MAC-Adresse des angegebenen Geräts ab. |
static
|
getBondedDevices(ITestDevice device)
Gibt die Bluetooth-MAC-Adressen der Geräte zurück, mit denen das angegebene Gerät gekoppelt ist. |
static
String
|
getBtSnoopLogFilePath(ITestDevice device)
bt-Snoop-Logdateipfad aus der Datei „bt_stack.config“ abrufen |
static
String
|
runBluetoothInstrumentation(ITestDevice device, String command)
Bequeme Methode zum Ausführen eines BT-Instrumentierungsbefehls und zum Zurückgeben der Ausgabe |
static
boolean
|
runBluetoothInstrumentationWithRetry(ITestDevice device, String command)
|
static
boolean
|
toggleBtsnoopLogging(Sl4aClient client, boolean onOff)
|
static
boolean
|
unpairWithRetry(ITestDevice device)
Löschen der Bluetooth-Kopplung mit linearem Backoff wird wiederholt |
static
void
|
uploadLogFiles(ITestInvocationListener listener, ITestDevice device, String type, int iteration)
Snoop-Protokolldatei für Testergebnisse hochladen |
Konstanten
BTSNOOP_API
public static final String BTSNOOP_API
Konstanter Wert: "bluetoothConfigHciSnoopLog"
BTSNOOP_CMD
public static final String BTSNOOP_CMD
Konstanter Wert: "setprop persist.bluetooth.btsnoopenable "
BTSNOOP_DISABLE_CMD
public static final String BTSNOOP_DISABLE_CMD
Konstanter Wert: "setprop persist.bluetooth.btsnoopenable false"
BTSNOOP_ENABLE_CMD
public static final String BTSNOOP_ENABLE_CMD
Konstanter Wert: "setprop persist.bluetooth.btsnoopenable true"
GOLD_BTSNOOP_LOG_PATH
public static final String GOLD_BTSNOOP_LOG_PATH
Konstanter Wert: "/data/misc/bluetooth/logs/btsnoop_hci.log"
O_BUILD
public static final String O_BUILD
Konstanter Wert: „O“
Öffentliche Konstruktoren
BluetoothUtils
public BluetoothUtils ()
Öffentliche Methoden
cleanLogFile
public static void cleanLogFile (ITestDevice device)
Snoop-Logdatei vom Gerät löschen
| Parameter | |
|---|---|
device |
ITestDevice |
| Ausgabe | |
|---|---|
DeviceNotAvailableException |
|
deaktivieren
public static boolean disable (ITestDevice device)
Deaktiviert Bluetooth auf dem angegebenen Gerät
| Returns | |
|---|---|
boolean |
„True“, wenn die Deaktivierung erfolgreich war, andernfalls „false“ |
| Ausgabe | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
|
disableBtsnoopLogging
public static boolean disableBtsnoopLogging (ITestDevice device, File sl4aApkFile)
btsnoop-Logging über sl4a-Aufruf deaktivieren
| Parameter | |
|---|---|
sl4aApkFile |
File: Speicherort der Datei „sl4a.apk“, „null“, wenn sie installiert wurde |
| Returns | |
|---|---|
boolean |
erfolgreich oder nicht |
| Ausgabe | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
|
disableBtsnoopLogging
public static boolean disableBtsnoopLogging (ITestDevice device)
btsnoop-Logging über SL4A-Aufruf deaktivieren
| Returns | |
|---|---|
boolean |
erfolgreich oder nicht |
| Ausgabe | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
|
Aktivieren
public static boolean enable (ITestDevice device)
Aktiviert Bluetooth auf dem angegebenen Gerät
| Returns | |
|---|---|
boolean |
„True“, wenn die Aktivierung erfolgreich war, andernfalls „false“ |
| Ausgabe | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
|
enableBtsnoopLogging
public static boolean enableBtsnoopLogging (ITestDevice device, File sl4aApkFile)
btsnoop-Logging über SL4A-Aufruf aktivieren
| Parameter | |
|---|---|
sl4aApkFile |
File: Speicherort der Datei „sl4a.apk“, „null“, wenn sie installiert wurde |
| Returns | |
|---|---|
boolean |
erfolgreich oder nicht |
| Ausgabe | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
|
enableBtsnoopLogging
public static boolean enableBtsnoopLogging (ITestDevice device)
btsnoop-Logging über SL4A-Aufruf aktivieren
| Returns | |
|---|---|
boolean |
erfolgreich oder nicht |
| Ausgabe | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
|
getBluetoothMac
public static String getBluetoothMac (ITestDevice device)
Ruft die Bluetooth-MAC-Adresse des angegebenen Geräts ab.
| Returns | |
|---|---|
String |
BT-MAC oder „null“, falls nicht gefunden |
| Ausgabe | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
|
getBondedDevices
public staticgetBondedDevices (ITestDevice device)
Gibt die Bluetooth-MAC-Adressen der Geräte zurück, mit denen das angegebene Gerät gekoppelt ist.
| Returns | |
|---|---|
|
Bluetooth-MAC-Adressen |
| Ausgabe | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
|
getBtSnoopLogFilePath
public static String getBtSnoopLogFilePath (ITestDevice device)
bt-Snoop-Logdateipfad aus der Datei „bt_stack.config“ abrufen
| Returns | |
|---|---|
String |
Der Dateiname für bt_snoop_log oder „null“, wenn er nicht gefunden wird. |
| Ausgabe | |
|---|---|
DeviceNotAvailableException |
|
runBluetoothInstrumentation
public static String runBluetoothInstrumentation (ITestDevice device, String command)
Bequeme Methode zum Ausführen eines BT-Instrumentierungsbefehls und zum Zurückgeben der Ausgabe
| Parameter | |
|---|---|
command |
String: Ein Befehlsstring, der an die BT-Instrumentierung gesendet wird. Derzeit werden folgende Befehle unterstützt: enable, disable, unpairAll, getName, getAddress, getBondedDevices. Weitere Informationen finden Sie im AOSP-Quellcode. |
| Returns | |
|---|---|
String |
Ausgabe von BluetoothInstrumentation |
| Ausgabe | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
|
runBluetoothInstrumentationWithRetry
public static boolean runBluetoothInstrumentationWithRetry (ITestDevice device, String command)
| Parameter | |
|---|---|
device |
ITestDevice |
command |
String |
| Returns | |
|---|---|
boolean |
|
| Ausgabe | |
|---|---|
DeviceNotAvailableException |
|
toggleBtsnoopLogging
public static boolean toggleBtsnoopLogging (Sl4aClient client, boolean onOff)
| Parameter | |
|---|---|
client |
Sl4aClient |
onOff |
boolean |
| Returns | |
|---|---|
boolean |
|
| Ausgabe | |
|---|---|
DeviceNotAvailableException |
|
unpairWithRetry
public static boolean unpairWithRetry (ITestDevice device)
Löschen der Bluetooth-Kopplung mit linearem Backoff wird wiederholt
| Returns | |
|---|---|
boolean |
|
| Ausgabe | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
|
uploadLogFiles
public static void uploadLogFiles (ITestInvocationListener listener, ITestDevice device, String type, int iteration)
Snoop-Protokolldatei für Testergebnisse hochladen
| Parameter | |
|---|---|
listener |
ITestInvocationListener |
device |
ITestDevice |
type |
String |
iteration |
int |
| Ausgabe | |
|---|---|
DeviceNotAvailableException |
|