Sl4aBluetoothUtil
public class Sl4aBluetoothUtil
extends Object
java.lang.Object |
↳ | com.android.tradefed.util.Sl4aBluetoothUtil |
Eine Utility-Klasse stellt Bluetooth-Operationen auf einem oder zwei Geräten mithilfe von SL4A bereit
Zusammenfassung
Öffentliche Methoden |
---|
boolean | changeProfileAccessPermission ( ITestDevice primary, ITestDevice secondary, Sl4aBluetoothUtil.BluetoothProfile profile, Sl4aBluetoothUtil.BluetoothAccessLevel access) Ändern Sie die Zugriffsberechtigung für das Bluetooth-Profil des sekundären Geräts auf dem primären Gerät, damit das sekundäre Gerät auf das primäre Gerät im angegebenen Profil zugreifen kann |
boolean | connect ( ITestDevice primary, ITestDevice secondary, profiles) connect ( ITestDevice primary, ITestDevice secondary, profiles) Verbinden Sie das primäre Gerät über bestimmte Bluetooth-Profile mit dem sekundären Gerät |
boolean | disable ( ITestDevice device) Deaktivieren Sie Bluetooth auf dem Zielgerät |
boolean | disableBluetoothSnoopLog ( ITestDevice device) Deaktivieren Sie das Bluetooth-Snoop-Protokoll |
boolean | disconnect ( ITestDevice primary, ITestDevice secondary, profiles) disconnect ( ITestDevice primary, ITestDevice secondary, profiles) Trennen Sie das Primärgerät vom Sekundärgerät |
boolean | enable ( ITestDevice device) Aktivieren Sie Bluetooth auf dem Zielgerät |
boolean | enableBluetoothSnoopLog ( ITestDevice device) Aktivieren Sie das Bluetooth-Snoop-Protokoll |
String | getAddress ( ITestDevice device) Rufen Sie die Bluetooth-MAC-Adresse des Zielgeräts ab |
| getBondedDevices ( ITestDevice device) Rufen Sie die Bluetooth-MAC-Adressen der verbundenen (gepaarten) Geräte auf dem Zielgerät ab |
boolean | pair ( ITestDevice primary, ITestDevice secondary) Koppeln Sie das primäre Gerät mit dem sekundären Gerät |
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) Ändern Sie die Prioritätseinstellung bestimmter Profile auf dem primären Gerät in Richtung des sekundären Geräts |
void | startSl4a ( ITestDevice device, File sl4aApkFile) Starten Sie den SL4A-Client explizit mit dem angegebenen Gerät und der SL4A-Apk-Datei. |
void | stopSl4a () Stoppen Sie SL4A-Clients, die bereits geöffnet sind. |
boolean | unpairAll ( ITestDevice device) Entkoppeln Sie alle gekoppelten Geräte für das aktuelle Gerät |
Geschützte Methoden |
---|
void | finalize () Bereinigen Sie alle SL4A-Verbindungen |
Öffentliche Bauträger
Sl4aBluetoothUtil
public Sl4aBluetoothUtil ()
Öffentliche Methoden
changeProfileAccessPermission
public boolean changeProfileAccessPermission (ITestDevice primary,
ITestDevice secondary,
Sl4aBluetoothUtil.BluetoothProfile profile,
Sl4aBluetoothUtil.BluetoothAccessLevel access)
Ändern Sie die Zugriffsberechtigung für das Bluetooth-Profil des sekundären Geräts auf dem primären Gerät, damit das sekundäre Gerät auf das primäre Gerät im angegebenen Profil zugreifen kann
Parameter |
---|
primary | ITestDevice : Gerät zum Ändern der Berechtigung |
secondary | ITestDevice : Gerät, das auf das primäre Gerät im angegebenen Profil zugreift |
profile | Sl4aBluetoothUtil.BluetoothProfile : Bluetooth-Profil für den Zugriff |
access | Sl4aBluetoothUtil.BluetoothAccessLevel : Zugriffsebene, siehe BluetoothAccessLevel |
Kehrt zurück |
---|
boolean | true, wenn die Berechtigung erfolgreich geändert wurde |
verbinden
public boolean connect (ITestDevice primary,
ITestDevice secondary,
profiles)
Verbinden Sie das primäre Gerät über bestimmte Bluetooth-Profile mit dem sekundären Gerät
Parameter |
---|
primary | ITestDevice : Gerät, von dem aus eine Verbindung hergestellt werden soll |
secondary | ITestDevice : Gerät, mit dem eine Verbindung hergestellt werden soll |
profiles | : Für die Verbindung ist eine Reihe von Bluetooth-Profilen erforderlich |
Kehrt zurück |
---|
boolean | wahr, wenn die Verbindung erfolgreich ist |
deaktivieren
public boolean disable (ITestDevice device)
Deaktivieren Sie Bluetooth auf dem Zielgerät
Parameter |
---|
device | ITestDevice : Zielgerät |
Kehrt zurück |
---|
boolean | true, wenn Bluetooth erfolgreich deaktiviert wurde |
deaktivierenBluetoothSnoopLog
public boolean disableBluetoothSnoopLog (ITestDevice device)
Deaktivieren Sie das Bluetooth-Snoop-Protokoll
Parameter |
---|
device | ITestDevice : zum Deaktivieren des Snoop-Protokolls |
Kehrt zurück |
---|
boolean | wahr, wenn die Deaktivierung erfolgreich war |
trennen
public boolean disconnect (ITestDevice primary,
ITestDevice secondary,
profiles)
Trennen Sie das Primärgerät vom Sekundärgerät
Parameter |
---|
primary | ITestDevice : Gerät zum Durchführen des Trennvorgangs |
secondary | ITestDevice : Gerät, das getrennt werden soll |
profiles | : Bestimmter Satz von Bluetooth-Profilen, die getrennt werden müssen |
Kehrt zurück |
---|
boolean | wahr, wenn die Verbindung erfolgreich getrennt wurde |
aktivieren
public boolean enable (ITestDevice device)
Aktivieren Sie Bluetooth auf dem Zielgerät
Parameter |
---|
device | ITestDevice : Zielgerät |
Kehrt zurück |
---|
boolean | true, wenn Bluetooth erfolgreich aktiviert wurde |
Aktivieren Sie BluetoothSnoopLog
public boolean enableBluetoothSnoopLog (ITestDevice device)
Aktivieren Sie das Bluetooth-Snoop-Protokoll
Parameter |
---|
device | ITestDevice : um das Snoop-Protokoll zu aktivieren |
Kehrt zurück |
---|
boolean | true, wenn die Aktivierung erfolgreich war |
getAddress
public String getAddress (ITestDevice device)
Rufen Sie die Bluetooth-MAC-Adresse des Zielgeräts ab
Parameter |
---|
device | ITestDevice : Zielgerät |
Kehrt zurück |
---|
String | MAC-Adresszeichenfolge |
getBondedDevices
public getBondedDevices (ITestDevice device)
Rufen Sie die Bluetooth-MAC-Adressen der verbundenen (gepaarten) Geräte auf dem Zielgerät ab
Parameter |
---|
device | ITestDevice : Zielgerät |
Kehrt zurück |
---|
| Satz von Bluetooth-MAC-Adressen |
Paar
public boolean pair (ITestDevice primary,
ITestDevice secondary)
Koppeln Sie das primäre Gerät mit dem sekundären Gerät
Parameter |
---|
primary | ITestDevice : Gerät zum Koppeln |
secondary | ITestDevice : Gerät zum Koppeln |
Kehrt zurück |
---|
boolean | true, wenn die Kopplung erfolgreich war |
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)
Ändern Sie die Prioritätseinstellung bestimmter Profile auf dem primären Gerät in Richtung des sekundären Geräts
Parameter |
---|
primary | ITestDevice : Gerät, für das die Priorität festgelegt werden soll |
secondary | ITestDevice : Gerät, für das die Priorität festgelegt werden soll |
profiles | : Bluetooth-Profile zum Ändern der Prioritätseinstellung |
priority | Sl4aBluetoothUtil.BluetoothPriorityLevel : Prioritätsstufe |
Kehrt zurück |
---|
boolean | wahr, wenn die Priorität erfolgreich festgelegt wurde |
startSl4a
public void startSl4a (ITestDevice device,
File sl4aApkFile)
Starten Sie den SL4A-Client explizit mit dem angegebenen Gerät und der SL4A-Apk-Datei. Normalerweise ist diese Methode nicht erforderlich, da die SL4A-Verbindung immer vor dem eigentlichen Betrieb hergestellt wird.
Parameter |
---|
device | ITestDevice : das Gerät, das über SL4A verbunden werden soll |
sl4aApkFile | File : die optionale SL4A-Apk zur Installation und Verwendung. |
stopSl4a
public void stopSl4a ()
Stoppen Sie SL4A-Clients, die bereits geöffnet sind. Es bietet grundsätzlich eine Möglichkeit, Clients sofort zu bereinigen, nachdem sie nicht mehr verwendet werden
unpairAll
public boolean unpairAll (ITestDevice device)
Entkoppeln Sie alle gekoppelten Geräte für das aktuelle Gerät
Parameter |
---|
device | ITestDevice : Aktuelles Gerät zum Ausführen der Aktion |
Kehrt zurück |
---|
boolean | wahr, wenn die Kopplung erfolgreich aufgehoben wurde |
Geschützte Methoden
abschließen
protected void finalize ()
Bereinigen Sie alle SL4A-Verbindungen