Sl4aBluetoothUtil

public class Sl4aBluetoothUtil
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.Sl4aBluetoothUtil


Eine Hilfsklasse bietet Bluetooth-Vorgänge auf einem oder zwei Geräten mit SL4A.

Zusammenfassung

Öffentliche Konstruktoren

Sl4aBluetoothUtil()

Öffentliche Methoden

boolean changeProfileAccessPermission(ITestDevice primary, ITestDevice secondary, Sl4aBluetoothUtil.BluetoothProfile profile, Sl4aBluetoothUtil.BluetoothAccessLevel access)

Ändern Sie die Berechtigung für den Bluetooth-Profilzugriff des sekundären Geräts auf dem primären Gerät, damit das sekundäre Gerät auf das primäre Gerät über das angegebene Profil zugreifen kann.

boolean connect(ITestDevice primary, ITestDevice secondary, Set<Sl4aBluetoothUtil.BluetoothProfile> profiles)

Primäres Gerät über die angegebenen Bluetooth-Profile mit dem sekundären Gerät verbinden

boolean disable(ITestDevice device)

Bluetooth auf dem Zielgerät deaktivieren

boolean disableBluetoothSnoopLog(ITestDevice device)

Bluetooth-Snoop-Protokoll deaktivieren

boolean disconnect(ITestDevice primary, ITestDevice secondary, Set<Sl4aBluetoothUtil.BluetoothProfile> profiles)

Hauptgerät vom Zweitgerät trennen

boolean enable(ITestDevice device)

Bluetooth auf dem Zielgerät aktivieren

boolean enableBluetoothSnoopLog(ITestDevice device)

Bluetooth-Snoop-Protokoll aktivieren

String getAddress(ITestDevice device)

Bluetooth-MAC-Adresse des Zielgeräts ermitteln

Set<String> getBondedDevices(ITestDevice device)

Eine Reihe von Bluetooth-MAC-Adressen der gebundenen (gekoppelten) Geräte auf dem Zielgerät abrufen

boolean pair(ITestDevice primary, ITestDevice secondary)

Primäres Gerät mit sekundärem Gerät koppeln

void setBtConnectionTimeout(Duration timeout)
void setBtPairTimeout(Duration timeout)
boolean setProfilePriority(ITestDevice primary, ITestDevice secondary, Set<Sl4aBluetoothUtil.BluetoothProfile> profiles, Sl4aBluetoothUtil.BluetoothPriorityLevel priority)

Prioritätseinstellung der angegebenen Profile auf dem primären Gerät im Vergleich zum sekundären Gerät ändern

void startSl4a(ITestDevice device, File sl4aApkFile)

Starten Sie den SL4A-Client explizit mit dem angegebenen Gerät und der SL4A-APK-Datei.

void stopSl4a()

Beenden Sie SL4A-Clients, die bereits geöffnet sind.

boolean unpairAll(ITestDevice device)

Entkoppeln aller gekoppelten Geräte für das aktuelle Gerät

Geschützte Methoden

void finalize()

Alle SL4A-Verbindungen bereinigen

Öffentliche Konstruktoren

Sl4aBluetoothUtil

public Sl4aBluetoothUtil ()

Öffentliche Methoden

changeProfileAccessPermission

public boolean changeProfileAccessPermission (ITestDevice primary, 
                ITestDevice secondary, 
                Sl4aBluetoothUtil.BluetoothProfile profile, 
                Sl4aBluetoothUtil.BluetoothAccessLevel access)

Ändern Sie die Berechtigung für den Bluetooth-Profilzugriff des sekundären Geräts auf dem primären Gerät, damit das sekundäre Gerät auf das primäre Gerät über das angegebene Profil zugreifen kann.

Parameter
primary ITestDevice: Gerät, für das die Berechtigung geändert werden soll

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)

Gibt Folgendes zurück:
boolean „true“, wenn die Berechtigung erfolgreich geändert wurde

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

verbinden

public boolean connect (ITestDevice primary, 
                ITestDevice secondary, 
                Set<Sl4aBluetoothUtil.BluetoothProfile> profiles)

Primäres Gerät über die angegebenen Bluetooth-Profile mit dem sekundären Gerät verbinden

Parameter
primary ITestDevice: Gerät, von dem aus die Verbindung hergestellt werden soll

secondary ITestDevice: Gerät, mit dem eine Verbindung hergestellt werden soll

profiles Set: Es muss eine Reihe von Bluetooth-Profilen verbunden sein.

Gibt Folgendes zurück:
boolean „true“, wenn die Verbindung erfolgreich ist

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

deaktivieren

public boolean disable (ITestDevice device)

Bluetooth auf dem Zielgerät deaktivieren

Parameter
device ITestDevice: Zielgerät

Gibt Folgendes zurück:
boolean „true“, wenn Bluetooth erfolgreich deaktiviert wurde

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

disableBluetoothSnoopLog

public boolean disableBluetoothSnoopLog (ITestDevice device)

Bluetooth-Snoop-Protokoll deaktivieren

Parameter
device ITestDevice: Snoop-Log deaktivieren

Gibt Folgendes zurück:
boolean „true“, wenn die Deaktivierung erfolgreich war

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

Verknüpfung aufheben

public boolean disconnect (ITestDevice primary, 
                ITestDevice secondary, 
                Set<Sl4aBluetoothUtil.BluetoothProfile> profiles)

Hauptgerät vom Zweitgerät trennen

Parameter
primary ITestDevice: Gerät zum Trennen der Verbindung

secondary ITestDevice: Gerät, das getrennt werden soll

profiles Set: Die angegebenen Bluetooth-Profile müssen getrennt werden.

Gibt Folgendes zurück:
boolean „true“, wenn die Verbindung erfolgreich getrennt wurde

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

aktivieren

public boolean enable (ITestDevice device)

Bluetooth auf dem Zielgerät aktivieren

Parameter
device ITestDevice: Zielgerät

Gibt Folgendes zurück:
boolean „true“, wenn Bluetooth erfolgreich aktiviert wurde

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

enableBluetoothSnoopLog

public boolean enableBluetoothSnoopLog (ITestDevice device)

Bluetooth-Snoop-Protokoll aktivieren

Parameter
device ITestDevice: Aktiviert das Snoop-Log.

Gibt Folgendes zurück:
boolean „true“, wenn die Aktivierung erfolgreich war

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

getAddress

public String getAddress (ITestDevice device)

Bluetooth-MAC-Adresse des Zielgeräts ermitteln

Parameter
device ITestDevice: Zielgerät

Gibt Folgendes zurück:
String MAC-Adressstring

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

getBondedDevices

public Set<String> getBondedDevices (ITestDevice device)

Eine Reihe von Bluetooth-MAC-Adressen der gebundenen (gekoppelten) Geräte auf dem Zielgerät abrufen

Parameter
device ITestDevice: Zielgerät

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

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

Koppeln

public boolean pair (ITestDevice primary, 
                ITestDevice secondary)

Primäres Gerät mit sekundärem Gerät koppeln

Parameter
primary ITestDevice: Gerät, von dem aus die Kopplung erfolgen soll

secondary ITestDevice: Gerät, mit dem gekoppelt werden soll

Gibt Folgendes zurück:
boolean „true“, wenn die Kopplung erfolgreich ist

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

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, 
                Set<Sl4aBluetoothUtil.BluetoothProfile> profiles, 
                Sl4aBluetoothUtil.BluetoothPriorityLevel priority)

Prioritätseinstellung der angegebenen Profile auf dem primären Gerät im Vergleich zum sekundären Gerät ändern

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 Set: Bluetooth-Profile, für die die Prioritätseinstellung geändert werden soll

priority Sl4aBluetoothUtil.BluetoothPriorityLevel: Prioritätsstufe

Gibt Folgendes zurück:
boolean „true“, wenn die Priorität erfolgreich festgelegt wurde

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

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 den eigentlichen Vorgängen hergestellt wird.

Parameter
device ITestDevice: Das Gerät, das über SL4A verbunden werden soll

sl4aApkFile File: Die optionale SL4A-APK-Datei, die installiert und verwendet werden soll.

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

stopSl4a

public void stopSl4a ()

Beenden Sie SL4A-Clients, die bereits geöffnet sind. So können Clients sofort bereinigt werden, wenn sie nicht mehr verwendet werden.

unpairAll

public boolean unpairAll (ITestDevice device)

Entkoppeln aller gekoppelten Geräte für das aktuelle Gerät

Parameter
device ITestDevice: Aktuelles Gerät, auf dem die Aktion ausgeführt werden soll

Gibt Folgendes zurück:
boolean „true“, wenn die Entkopplung erfolgreich war

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

Geschützte Methoden

finalize

protected void finalize ()

Alle SL4A-Verbindungen bereinigen