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 Set<String> 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)

Wiederholungsversuche zum Löschen der Bluetooth-Kopplung mit linearem Backoff

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

Löst aus
DeviceNotAvailableException

deaktivieren

public static boolean disable (ITestDevice device)

Deaktiviert Bluetooth auf dem angegebenen Gerät

Gibt Folgendes zurück:
boolean „True“, wenn die Deaktivierung erfolgreich war, andernfalls „false“

Löst aus
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

Gibt Folgendes zurück:
boolean erfolgreich oder nicht

Löst aus
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

disableBtsnoopLogging

public static boolean disableBtsnoopLogging (ITestDevice device)

btsnoop-Logging über sl4a-Aufruf deaktivieren

Gibt Folgendes zurück:
boolean erfolgreich oder nicht

Löst aus
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

aktivieren

public static boolean enable (ITestDevice device)

Aktiviert Bluetooth auf dem angegebenen Gerät

Gibt Folgendes zurück:
boolean „True“, wenn die Aktivierung erfolgreich war, andernfalls „false“

Löst aus
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

Gibt Folgendes zurück:
boolean erfolgreich oder nicht

Löst aus
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

enableBtsnoopLogging

public static boolean enableBtsnoopLogging (ITestDevice device)

btsnoop-Logging über SL4A-Aufruf aktivieren

Gibt Folgendes zurück:
boolean erfolgreich oder nicht

Löst aus
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBluetoothMac

public static String getBluetoothMac (ITestDevice device)

Ruft die Bluetooth-MAC-Adresse des angegebenen Geräts ab.

Gibt Folgendes zurück:
String BT-MAC oder „null“, falls nicht gefunden

Löst aus
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBondedDevices

public static Set<String> getBondedDevices (ITestDevice device)

Gibt die Bluetooth-MAC-Adressen der Geräte zurück, mit denen das angegebene Gerät gekoppelt ist.

Gibt Folgendes zurück:
Set<String> Bluetooth-MAC-Adressen

Löst aus
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBtSnoopLogFilePath

public static String getBtSnoopLogFilePath (ITestDevice device)

bt-Snoop-Logdateipfad aus der Datei „bt_stack.config“ abrufen

Gibt Folgendes zurück:
String Der Dateiname für bt_snoop_log oder „null“, wenn er nicht gefunden wird.

Löst aus
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.

Gibt Folgendes zurück:
String Ausgabe von BluetoothInstrumentation

Löst aus
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

runBluetoothInstrumentationWithRetry

public static boolean runBluetoothInstrumentationWithRetry (ITestDevice device, 
                String command)

Parameter
device ITestDevice

command String

Gibt Folgendes zurück:
boolean

Löst aus
DeviceNotAvailableException

toggleBtsnoopLogging

public static boolean toggleBtsnoopLogging (Sl4aClient client, 
                boolean onOff)

Parameter
client Sl4aClient

onOff boolean

Gibt Folgendes zurück:
boolean

Löst aus
DeviceNotAvailableException

unpairWithRetry

public static boolean unpairWithRetry (ITestDevice device)

Löschen der Bluetooth-Kopplung mit linearem Backoff wird wiederholt

Gibt Folgendes zurück:
boolean

Löst aus
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

uploadLogFiles

public static void uploadLogFiles (ITestInvocationListener listener, 
                ITestDevice device, 
                String type, 
                int iteration)

Snoop-Logdatei für Testergebnisse hochladen

Parameter
listener ITestInvocationListener

device ITestDevice

type String

iteration int

Löst aus
DeviceNotAvailableException