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, profiles)

特定の Bluetooth プロファイルでメインデバイスをセカンダリ デバイスに接続する

boolean disable(ITestDevice device)

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

boolean disableBluetoothSnoopLog(ITestDevice device)

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

boolean disconnect(ITestDevice primary, ITestDevice secondary, profiles)

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

boolean enable(ITestDevice device)

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

boolean enableBluetoothSnoopLog(ITestDevice device)

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

String getAddress(ITestDevice device)

ターゲット デバイスの Bluetooth MAC アドレスを取得する

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, 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, 
                 profiles)

特定の Bluetooth プロファイルでメインデバイスをセカンダリ デバイスに接続する

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

secondary ITestDevice: 接続先のデバイス

profiles : 接続するには一連の 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, 
                 profiles)

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

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

secondary ITestDevice: 接続を解除するデバイス

profiles : 接続解除が必要な 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  getBondedDevices (ITestDevice device)

ターゲット デバイスで、結合済み(ペア設定済み)デバイスの Bluetooth MAC アドレスのセットを取得する

パラメータ
device ITestDevice: ターゲット デバイス

戻り値
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, 
                 profiles, 
                Sl4aBluetoothUtil.BluetoothPriorityLevel priority)

メインデバイスで特定のプロファイルの優先度設定をセカンダリ デバイスに変更する

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

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

profiles : 優先度の設定を変更する 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 接続をクリーンアップする