BluetoothUtils
public
class
BluetoothUtils
extends Object
java.lang.Object | |
↳ | com.android.tradefed.util.BluetoothUtils |
Dienstfunktionen zum Aufrufen von BluetoothInstrumentation auf dem Gerät
Den geräteseitigen BluetoothInstrumentation-Code finden Sie in AOSP unter:
frameworks/base/core/tests/bluetoothtests
Zusammenfassung
Felder | |
---|---|
public
static
final
String |
BTSNOOP_API
|
public
static
final
String |
BTSNOOP_CMD
|
public
static
final
String |
BTSNOOP_DISABLE_CMD
|
public
static
final
String |
BTSNOOP_ENABLE_CMD
|
public
static
final
String |
GOLD_BTSNOOP_LOG_PATH
|
public
static
final
String |
O_BUILD
|
Öffentliche Konstruktoren | |
---|---|
BluetoothUtils()
|
Öffentliche Methoden | |
---|---|
static
void
|
cleanLogFile(ITestDevice device)
Snoop-Protokolldatei 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 BT-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)
Pfad zur BT-Snoop-Logdatei aus der Datei „bt_stack.config“ abrufen |
static
String
|
runBluetoothInstrumentation(ITestDevice device, String command)
Diese praktische Methode dient 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)
Wiederholen des Löschens der BT-Kopplung mit linearem Backoff |
static
void
|
uploadLogFiles(ITestInvocationListener listener, ITestDevice device, String type, int iteration)
Snoop-Protokolldatei für Testergebnisse hochladen |
Felder
BTSNOOP_API
public static final String BTSNOOP_API
BTSNOOP_CMD
public static final String BTSNOOP_CMD
BTSNOOP_DISABLE_CMD
public static final String BTSNOOP_DISABLE_CMD
BTSNOOP_ENABLE_CMD
public static final String BTSNOOP_ENABLE_CMD
GOLD_BTSNOOP_LOG_PATH
public static final String GOLD_BTSNOOP_LOG_PATH
O_BUILD
public static final String O_BUILD
Öffentliche Konstruktoren
BluetoothUtils
public BluetoothUtils ()
Öffentliche Methoden
cleanLogFile
public static void cleanLogFile (ITestDevice device)
Snoop-Protokolldatei 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 war 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 war 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 war 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 war oder nicht. |
Ausgabe | |
---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBluetoothMac
public static String getBluetoothMac (ITestDevice device)
Ruft die BT-MAC-Adresse des angegebenen Geräts ab
Returns | |
---|---|
String |
BT-MAC oder „null“, wenn 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)
Pfad zur BT-Snoop-Logdatei aus der Datei „bt_stack.config“ abrufen
Returns | |
---|---|
String |
Der Dateiname für „bt_snoop_log“ oder „null“, wenn die Datei nicht gefunden wird |
Ausgabe | |
---|---|
DeviceNotAvailableException |
runBluetoothInstrumentation
public static String runBluetoothInstrumentation (ITestDevice device, String command)
Diese praktische Methode dient 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 in der AOSP-Quelle. |
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)
Wiederholen des Löschens der BT-Kopplung mit linearem Backoff
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 |