BluetoothUtils

public class BluetoothUtils
extends Object

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


פונקציות עזר להפעלת BluetoothInstrumentation במכשיר

קוד BluetoothInstrumentation בצד המכשיר נמצא ב-AOSP בכתובת: frameworks/base/core/tests/bluetoothtests

סיכום

ערכים קבועים

String BTSNOOP_API

String BTSNOOP_CMD

String BTSNOOP_DISABLE_CMD

String BTSNOOP_ENABLE_CMD

String GOLD_BTSNOOP_LOG_PATH

String O_BUILD

Constructors ציבוריים

BluetoothUtils()

‫methods ציבוריים

static void cleanLogFile(ITestDevice device)

מחיקת קובץ יומן של חטטנות מהמכשיר

static boolean disable(ITestDevice device)

השבתה של Bluetooth במכשיר הנתון

static boolean disableBtsnoopLogging(ITestDevice device, File sl4aApkFile)

השבתת הרישום ביומן של btsnoop באמצעות קריאה ל-sl4a

static boolean disableBtsnoopLogging(ITestDevice device)

השבתת רישום ביומן של btsnoop באמצעות קריאה ל-sl4a

static boolean enable(ITestDevice device)

הפעלת Bluetooth במכשיר הנתון

static boolean enableBtsnoopLogging(ITestDevice device, File sl4aApkFile)

הפעלת רישום ביומן של btsnoop באמצעות קריאה ל-sl4a

static boolean enableBtsnoopLogging(ITestDevice device)

הפעלת רישום ביומן של btsnoop באמצעות קריאה ל-sl4a

static String getBluetoothMac(ITestDevice device)

מאחזר את כתובת ה-MAC של ה-BT של המכשיר הנתון

static getBondedDevices(ITestDevice device)

מחזירה את כתובות ה-MAC של מכשירי Bluetooth שהמכשיר הנתון משויך אליהם

static String getBtSnoopLogFilePath(ITestDevice device)

קבלת הנתיב של קובץ היומן של bt snoop מקובץ bt_stack.config

static String runBluetoothInstrumentation(ITestDevice device, String command)

שיטה נוחה להפעלת פקודת BT instrumentation ולהחזרת פלט

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

מנסה שוב לבטל את ההתאמה של Bluetooth עם השהיה לינארית לפני ניסיון חוזר

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

העלאת קובץ יומן מעקב לתוצאות הבדיקה

ערכים קבועים

BTSNOOP_API

public static final String BTSNOOP_API

ערך קבוע: "bluetoothConfigHciSnoopLog"

BTSNOOP_CMD

public static final String BTSNOOP_CMD

ערך קבוע: ‎"setprop persist.bluetooth.btsnoopenable "‎

BTSNOOP_DISABLE_CMD

public static final String BTSNOOP_DISABLE_CMD

ערך קבוע: ‎"setprop persist.bluetooth.btsnoopenable false"‎

BTSNOOP_ENABLE_CMD

public static final String BTSNOOP_ENABLE_CMD

ערך קבוע: ‎"setprop persist.bluetooth.btsnoopenable true"‎

GOLD_BTSNOOP_LOG_PATH

public static final String GOLD_BTSNOOP_LOG_PATH

ערך קבוע: "/data/misc/bluetooth/logs/btsnoop_hci.log"

O_BUILD

public static final String O_BUILD

ערך קבוע: ‫"O"

Constructors ציבוריים

BluetoothUtils

public BluetoothUtils ()

‫methods ציבוריים

cleanLogFile

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

disableBtsnoopLogging

public static boolean disableBtsnoopLogging (ITestDevice device, 
                File sl4aApkFile)

השבתת הרישום ביומן של btsnoop באמצעות קריאה ל-sl4a

פרמטרים
sl4aApkFile File: המיקום של הקובץ sl4a.apk, הערך null אם הוא הותקן

החזרות
boolean האם הפעולה הצליחה או לא

זריקות
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

disableBtsnoopLogging

public static boolean disableBtsnoopLogging (ITestDevice device)

השבתת הרישום ביומן של btsnoop באמצעות קריאה ל-sl4a

החזרות
boolean האם הפעולה הצליחה או לא

זריקות
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

הפעלה

public static boolean enable (ITestDevice device)

הפעלת Bluetooth במכשיר הנתון

החזרות
boolean הערך True אם ההפעלה הצליחה, אחרת הערך False

זריקות
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

enableBtsnoopLogging

public static boolean enableBtsnoopLogging (ITestDevice device, 
                File sl4aApkFile)

הפעלת רישום ביומן של btsnoop באמצעות קריאה ל-sl4a

פרמטרים
sl4aApkFile File: המיקום של הקובץ sl4a.apk, הערך null אם הוא הותקן

החזרות
boolean האם הפעולה הצליחה או לא

זריקות
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

enableBtsnoopLogging

public static boolean enableBtsnoopLogging (ITestDevice device)

הפעלת רישום ביומן של btsnoop באמצעות קריאה ל-sl4a

החזרות
boolean האם הפעולה הצליחה או לא

זריקות
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBluetoothMac

public static String getBluetoothMac (ITestDevice device)

מאחזר את כתובת ה-MAC של ה-BT של המכשיר הנתון

החזרות
String כתובת ה-MAC של ה-BT או null אם לא נמצאה כתובת

זריקות
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBondedDevices

public static  getBondedDevices (ITestDevice device)

מחזירה את כתובות ה-MAC של מכשירי Bluetooth שהמכשיר הנתון משויך אליהם

החזרות
כתובות MAC של Bluetooth

זריקות
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBtSnoopLogFilePath

public static String getBtSnoopLogFilePath (ITestDevice device)

קבלת הנתיב של קובץ היומן של bt snoop מקובץ bt_stack.config

החזרות
String שם הקובץ של bt_snoop_log או null אם הוא לא נמצא

זריקות
DeviceNotAvailableException

runBluetoothInstrumentation

public static String runBluetoothInstrumentation (ITestDevice device, 
                String command)

שיטה נוחה להפעלת פקודת BT instrumentation ולהחזרת פלט

פרמטרים
command String: מחרוזת פקודה שנשלחת אל מכשור BT, שנתמכות כרגע: enable, disable, unpairAll, getName, getAddress, getBondedDevices; refer to AOSP source for more details

החזרות
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

unpairWithRetry

public static boolean unpairWithRetry (ITestDevice device)

מנסה שוב לבטל את ההתאמה של Bluetooth עם השהיה לינארית לפני ניסיון חוזר

החזרות
boolean

זריקות
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

uploadLogFiles

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

העלאת קובץ יומן מעקב לתוצאות הבדיקה

פרמטרים
listener ITestInvocationListener

device ITestDevice

type String

iteration int

זריקות
DeviceNotAvailableException