Sl4aBluetoothUtil

public class Sl4aBluetoothUtil
extends Object

java.lang.オブジェクト
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) connect ( ITestDevice primary, ITestDevice secondary, profiles)

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

boolean disable ( ITestDevice device)

ターゲットデバイスのBluetoothを無効にする

boolean disableBluetoothSnoopLog ( ITestDevice device)

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

boolean disconnect ( ITestDevice primary, ITestDevice secondary, profiles) 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) 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 ()

パブリックメソッド

変更プロファイルアクセス許可

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

BluetoothSnoopLogを無効にする

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

BluetoothSnoopLogを有効にする

public boolean enableBluetoothSnoopLog (ITestDevice device)

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

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

戻り値
boolean正常に有効化された場合は true

投げる
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

アドレスを取得する

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

ストップSl4a

public void stopSl4a ()

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

すべてのペアリングを解除する

public boolean unpairAll (ITestDevice device)

現在のデバイスのペアリングされているすべてのデバイスのペアリングを解除します

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

戻り値
booleanペアリングが正常に解除された場合は true

投げる
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

保護されたメソッド

完成させる

protected void finalize ()

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