Bluetoothユーティリティ

public class BluetoothUtils
extends Object

java.lang.オブジェクト
com.android.tradefed.util.BluetoothUtils


デバイス上で BluetoothInstrumentation を呼び出すためのユーティリティ関数

デバイス側の BluetoothInstrumentation コードは、AOSP のframeworks/base/core/tests/bluetoothtestsにあります。

まとめ

田畑

public static final String BTSNOOP_API

public static final String BTSNOOP_CMD

public static final String BTSNOOP_DISABLE_CMD

public static final String BTSNOOP_ENABLE_CMD

public static final String GOLD_BTSNOOP_LOG_PATH

public static final String O_BUILD

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

BluetoothUtils ()

パブリックメソッド

static void cleanLogFile ( ITestDevice device)

スヌープログファイルをデバイスから削除します

static boolean disable ( ITestDevice device)

指定されたデバイスの Bluetooth を無効にします

static boolean disableBtsnoopLogging ( ITestDevice device, File sl4aApkFile)

sl4a 呼び出しによる btsnoop ロギングを無効にする

static boolean disableBtsnoopLogging ( ITestDevice device)

sl4a 呼び出しによる btsnoop ロギングを無効にする

static boolean enable ( ITestDevice device)

指定されたデバイスで Bluetooth を有効にします

static boolean enableBtsnoopLogging ( ITestDevice device, File sl4aApkFile)

sl4a 呼び出しによる btsnoop ロギングを有効にする

static boolean enableBtsnoopLogging ( ITestDevice device)

sl4a 呼び出しによる btsnoop ロギングを有効にする

static String getBluetoothMac ( ITestDevice device)

指定されたデバイスの BT mac を取得します

static getBondedDevices ( ITestDevice device)

指定されたデバイスがボンディングしているデバイスの Bluetooth MAC アドレスを返します。

static String getBtSnoopLogFilePath ( ITestDevice device)

bt_stack.config ファイルから bt スヌープ ログ ファイルのパスを取得します

static String runBluetoothInstrumentation ( ITestDevice device, String command)

BT インストルメンテーション コマンドを実行して出力を返す便利なメソッド

static boolean runBluetoothInstrumentationWithRetry ( ITestDevice device, String command)
static boolean toggleBtsnoopLogging ( Sl4aClient client, boolean onOff)
static boolean unpairWithRetry ( ITestDevice device)

線形バックオフを使用して BT ペアリングのクリアを再試行します

static void uploadLogFiles ( ITestInvocationListener listener, ITestDevice device, String type, int iteration)

テスト結果のスヌープ ログ ファイルをアップロードする

田畑

BTSNOOP_API

public static final String BTSNOOP_API

BTSNOOP_CMD

public static final String BTSNOOP_CMD

BTSNOOP_DISABLE_CMD

public static final String BTSNOOP_DISABLE_CMD

BTSNOOP_ENABLE_CMD

public static final String BTSNOOP_ENABLE_CMD

GOLD_BTSNOOP_LOG_PATH

public static final String GOLD_BTSNOOP_LOG_PATH

O_BUILD

public static final String O_BUILD

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

Bluetoothユーティリティ

public BluetoothUtils ()

パブリックメソッド

クリーンログファイル

public static void cleanLogFile (ITestDevice device)

スヌープログファイルをデバイスから削除します

パラメーター
device ITestDevice

投げる
DeviceNotAvailableException

無効にする

public static boolean disable (ITestDevice device)

指定されたデバイスの Bluetooth を無効にします

戻り値
boolean無効化が成功した場合は true、それ以外の場合は false

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

Btsnoopロギングを無効にする

public static boolean disableBtsnoopLogging (ITestDevice device, 
                File sl4aApkFile)

sl4a 呼び出しによる btsnoop ロギングを無効にする

パラメーター
sl4aApkFile File : sl4a.apk ファイルの場所、インストールされている場合は null

戻り値
boolean成功か否か

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

Btsnoopロギングを無効にする

public static boolean disableBtsnoopLogging (ITestDevice device)

sl4a 呼び出しによる btsnoop ロギングを無効にする

戻り値
boolean成功か否か

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

有効にする

public static boolean enable (ITestDevice device)

指定されたデバイスで Bluetooth を有効にします

戻り値
boolean有効化が成功した場合は true、それ以外の場合は false

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

BtsnoopLogging を有効にする

public static boolean enableBtsnoopLogging (ITestDevice device, 
                File sl4aApkFile)

sl4a 呼び出しによる btsnoop ロギングを有効にする

パラメーター
sl4aApkFile File : sl4a.apk ファイルの場所、インストールされている場合は null

戻り値
boolean成功か否か

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

BtsnoopLogging を有効にする

public static boolean enableBtsnoopLogging (ITestDevice device)

sl4a 呼び出しによる btsnoop ロギングを有効にする

戻り値
boolean成功か否か

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

getBluetoothMac

public static String getBluetoothMac (ITestDevice device)

指定されたデバイスの BT mac を取得します

戻り値
String BT mac または見つからない場合は null

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

getBondedDevices

public static  getBondedDevices (ITestDevice device)

指定されたデバイスがボンディングしているデバイスの Bluetooth MAC アドレスを返します。

戻り値
Bluetooth MAC アドレス

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

getBtSnoopLogFilePath

public static String getBtSnoopLogFilePath (ITestDevice device)

bt_stack.config ファイルから bt スヌープ ログ ファイルのパスを取得します

戻り値
String bt_snoop_log のファイル名、または見つからない場合は null

投げる
DeviceNotAvailableException

runBluetooth計測器

public static String runBluetoothInstrumentation (ITestDevice device, 
                String command)

BT インストルメンテーション コマンドを実行して出力を返す便利なメソッド

パラメーター
command String : BT インスツルメンテーションに送信されるコマンド文字列。現在サポートされているのは、enable、disable、unpairAll、getName、getAddress、getBondedDevices です。詳細については、AOSP ソースを参照してください。

戻り値
String BluetoothInstrumentation の出力

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

runBluetoothInstrumentationWithRetry

public static boolean runBluetoothInstrumentationWithRetry (ITestDevice device, 
                String command)

パラメーター
device ITestDevice

command String

戻り値
boolean

投げる
DeviceNotAvailableException

トグルBtsnoopロギング

public static boolean toggleBtsnoopLogging (Sl4aClient client, 
                boolean onOff)

パラメーター
client Sl4aClient

onOff boolean

戻り値
boolean

投げる
DeviceNotAvailableException

再試行でペアリングを解除する

public static boolean unpairWithRetry (ITestDevice device)

線形バックオフを使用して BT ペアリングのクリアを再試行します

戻り値
boolean

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

アップロードログファイル

public static void uploadLogFiles (ITestInvocationListener listener, 
                ITestDevice device, 
                String type, 
                int iteration)

テスト結果のスヌープ ログ ファイルをアップロードする

パラメーター
listener ITestInvocationListener

device ITestDevice

type String

iteration int

投げる
DeviceNotAvailableException