Sl4aBluetoothUtil

public class Sl4aBluetoothUtil
extends Object

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


ユーティリティ クラスは、SL4A を使用して 1 つまたは 2 つのデバイスで Bluetooth オペレーションを提供します。

概要

パブリック コンストラクタ

Sl4aBluetoothUtil()

パブリック メソッド

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

セカンダリ デバイスが指定されたプロファイルでプライマリ デバイスにアクセスできるように、プライマリ デバイスでセカンダリ デバイスの Bluetooth プロファイル アクセス権限を変更します。

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

指定された Bluetooth プロファイルでプライマリ デバイスをセカンダリ デバイスに接続します。

boolean disable(ITestDevice device)

対象デバイスの Bluetooth を無効にする

boolean disableBluetoothSnoopLog(ITestDevice device)

Bluetooth スヌープログを無効にする

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

メインデバイスとセカンダリ デバイスの接続を解除する

boolean enable(ITestDevice device)

対象デバイスで Bluetooth を有効にする

boolean enableBluetoothSnoopLog(ITestDevice device)

Bluetooth スヌープログを有効にする

String getAddress(ITestDevice device)

対象デバイスの Bluetooth MAC アドレスを取得する

Set<String> getBondedDevices(ITestDevice device)

対象デバイスでバインド(ペア設定)されたデバイスの Bluetooth MAC アドレスのセットを取得します。

boolean pair(ITestDevice primary, ITestDevice secondary)

プライマリ デバイスをセカンダリ デバイスとペア設定する

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

プライマリ デバイス上の指定されたプロファイルの優先度設定をセカンダリ デバイスに向けて変更します。

void startSl4a(ITestDevice device, File sl4aApkFile)

指定されたデバイスと SL4A apk ファイルで SL4A クライアントを明示的に起動します。

void stopSl4a()

すでに開いている SL4A クライアントを停止します。

boolean unpairAll(ITestDevice device)

現在のデバイスのペア設定されているすべてのデバイスのペア設定を解除します。

保護されたメソッド

void finalize()

すべての SL4A 接続をクリーンアップ

パブリック コンストラクタ

Sl4aBluetoothUtil

public Sl4aBluetoothUtil ()

パブリック メソッド

changeProfileAccessPermission

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

子デバイスが指定されたプロファイルで親デバイスにアクセスできるように、親デバイスで子デバイスの Bluetooth プロファイル アクセス権限を変更

パラメータ
primary ITestDevice: 権限を変更するデバイス

secondary ITestDevice: 指定されたプロファイルでプライマリ デバイスにアクセスするデバイス

profile Sl4aBluetoothUtil.BluetoothProfile: アクセスする Bluetooth プロファイル

access Sl4aBluetoothUtil.BluetoothAccessLevel: アクセスレベル。BluetoothAccessLevel を参照

戻り値
boolean 権限が正常に変更された場合は true

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

接続

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

指定された Bluetooth プロファイルでプライマリ デバイスをセカンダリ デバイスに接続する

パラメータ
primary ITestDevice: 接続元のデバイス

secondary ITestDevice: 接続するデバイス

profiles Set: 接続が必要な Bluetooth プロファイルのセット

戻り値
boolean 接続が成功した場合は true

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

無効にする

public boolean disable (ITestDevice device)

対象デバイスの Bluetooth を無効にする

パラメータ
device ITestDevice: 対象デバイス

戻り値
boolean Bluetooth が正常に無効になった場合は true

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

disableBluetoothSnoopLog

public boolean disableBluetoothSnoopLog (ITestDevice device)

Bluetooth スヌープログを無効にする

パラメータ
device ITestDevice: スヌープログを無効にする

戻り値
boolean 無効化に成功した場合は true

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

接続を解除

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

メインデバイスとセカンダリ デバイスの接続を解除する

パラメータ
primary ITestDevice: 切断オペレーションを実行するデバイス

secondary ITestDevice: 切断するデバイス

profiles Set: 切断が必要な Bluetooth プロファイルの指定されたセット

戻り値
boolean 正常に切断された場合は true

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

有効にする

public boolean enable (ITestDevice device)

対象デバイスで Bluetooth を有効にする

パラメータ
device ITestDevice: 対象デバイス

戻り値
boolean Bluetooth が正常に有効になった場合は true

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

enableBluetoothSnoopLog

public boolean enableBluetoothSnoopLog (ITestDevice device)

Bluetooth スヌープログを有効にする

パラメータ
device ITestDevice: スヌープログを有効にします

戻り値
boolean 有効にできた場合は true

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getAddress

public String getAddress (ITestDevice device)

対象デバイスの Bluetooth MAC アドレスを取得する

パラメータ
device ITestDevice: 対象デバイス

戻り値
String MAC アドレス文字列

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBondedDevices

public Set<String> getBondedDevices (ITestDevice device)

対象デバイスでバインド(ペア設定)されたデバイスの Bluetooth MAC アドレスのセットを取得する

パラメータ
device ITestDevice: 対象デバイス

戻り値
Set<String> Bluetooth MAC アドレスのセット

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

組み合わせて

public boolean pair (ITestDevice primary, 
                ITestDevice secondary)

メイン デバイスとセカンダリ デバイスをペア設定する

パラメータ
primary ITestDevice: ペアリング元のデバイス

secondary ITestDevice: ペアリングするデバイス

戻り値
boolean ペア設定が成功した場合は true

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

setBtConnectionTimeout

public void setBtConnectionTimeout (Duration timeout)

パラメータ
timeout Duration

setBtPairTimeout

public void setBtPairTimeout (Duration timeout)

パラメータ
timeout Duration

setProfilePriority

public boolean setProfilePriority (ITestDevice primary, 
                ITestDevice secondary, 
                Set<Sl4aBluetoothUtil.BluetoothProfile> profiles, 
                Sl4aBluetoothUtil.BluetoothPriorityLevel priority)

メインデバイス上の指定されたプロファイルの優先度設定をセカンダリ デバイスに向けて変更する

パラメータ
primary ITestDevice: 優先度を設定するデバイス

secondary ITestDevice: 優先度を設定するデバイス

profiles Set: 優先度設定を変更する Bluetooth プロファイル

priority Sl4aBluetoothUtil.BluetoothPriorityLevel: 優先度

戻り値
boolean 優先度を正常に設定した場合は true

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

startSl4a

public void startSl4a (ITestDevice device, 
                File sl4aApkFile)

指定されたデバイスと SL4A apk ファイルで SL4A クライアントを明示的に起動します。通常、このメソッドは必要ありません。SL4A 接続は常に実際のオペレーションの前に確立されるためです。

パラメータ
device ITestDevice: SL4A を使用して接続するデバイス

sl4aApkFile File: インストールして使用する SL4A APK(省略可)。

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

stopSl4a

public void stopSl4a ()

すでに開いている SL4A クライアントを停止します。基本的には、クライアントが使用されなくなった直後にクリーンアップする方法を提供します。

unpairAll

public boolean unpairAll (ITestDevice device)

現在のデバイスのペア設定されているすべてのデバイスのペア設定を解除

パラメータ
device ITestDevice: アクションを実行する現在のデバイス

戻り値
boolean ペア設定解除に成功した場合は true

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

保護されたメソッド

finalize

protected void finalize ()

すべての SL4A 接続をクリーンアップ