藍牙工具

public class BluetoothUtils
extends Object

java.lang.Object
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)

從設備中刪除 snoop 日誌文件

static boolean disable ( ITestDevice device)

在給定設備上禁用藍牙

static boolean disableBtsnoopLogging ( ITestDevice device, File sl4aApkFile)

通過 sl4a 調用禁用 btsnoop 日誌記錄

static boolean disableBtsnoopLogging ( ITestDevice device)

通過 sl4a 調用禁用 btsnoop 日誌記錄

static boolean enable ( ITestDevice device)

在給定設備上啟用藍牙

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)

返回給定設備綁定的設備的藍牙 mac 地址

static String getBtSnoopLogFilePath ( ITestDevice device)

從 bt_stack.config 文件獲取 bt snoop 日誌文件路徑

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)

上傳 snoop 日誌文件以獲取測試結果

領域

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

公共構造函數

藍牙工具

public BluetoothUtils ()

公共方法

清理日誌文件

public static void cleanLogFile (ITestDevice device)

從設備中刪除 snoop 日誌文件

參數
device ITestDevice

投擲
DeviceNotAvailableException

禁用

public static boolean disable (ITestDevice device)

在給定設備上禁用藍牙

退貨
boolean如果禁用成功則為真,否則為假

投擲
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

禁用 BtsnoopLogging

public static boolean disableBtsnoopLogging (ITestDevice device, 
                File sl4aApkFile)

通過 sl4a 調用禁用 btsnoop 日誌記錄

參數
sl4aApkFile File : sl4a.apk文件位置,如果已經安裝則為null

退貨
boolean成功與否

投擲
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

禁用 BtsnoopLogging

public static boolean disableBtsnoopLogging (ITestDevice device)

通過 sl4a 調用禁用 btsnoop 日誌記錄

退貨
boolean成功與否

投擲
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

使能夠

public static boolean enable (ITestDevice device)

在給定設備上啟用藍牙

退貨
boolean如果啟用成功則為真,否則為假

投擲
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

獲取藍牙Mac

public static String getBluetoothMac (ITestDevice device)

檢索給定設備的 BT mac

退貨
String BT mac 或 null 如果沒有找到

投擲
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

獲取保稅設備

public static  getBondedDevices (ITestDevice device)

返回給定設備綁定的設備的藍牙 mac 地址

退貨
藍牙MAC地址

投擲
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBtSnoopLogFilePath

public static String getBtSnoopLogFilePath (ITestDevice device)

從 bt_stack.config 文件獲取 bt snoop 日誌文件路徑

退貨
String bt_snoop_log 的文件名,如果找不到則為 null

投擲
DeviceNotAvailableException

運行藍牙儀器

public static String runBluetoothInstrumentation (ITestDevice device, 
                String command)

執行BT檢測命令並返回輸出的便捷方法

參數
command String : 發送到 BT instrumentation 的命令字符串,目前支持: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

toggleBtsnoopLogging

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)

上傳 snoop 日誌文件以獲取測試結果

參數
listener ITestInvocationListener

device ITestDevice

type String

iteration int

投擲
DeviceNotAvailableException