Sl4aBluetoothUtil

public class Sl4aBluetoothUtil
extends Object

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


מחלקת כלי עזר מספקת פעולות Bluetooth במכשיר אחד או בשני מכשירים באמצעות SL4A

סיכום

‫constructors ציבוריים

Sl4aBluetoothUtil()

‫methods ציבוריים

boolean changeProfileAccessPermission(ITestDevice primary, ITestDevice secondary, Sl4aBluetoothUtil.BluetoothProfile profile, Sl4aBluetoothUtil.BluetoothAccessLevel access)

שינוי הרשאת הגישה לפרופיל Bluetooth של המכשיר המשני במכשיר הראשי כדי שהמכשיר המשני יוכל לגשת למכשיר הראשי בפרופיל הנתון

boolean connect(ITestDevice primary, ITestDevice secondary, Set<Sl4aBluetoothUtil.BluetoothProfile> profiles)

חיבור המכשיר הראשי למכשיר המשני בפרופילי Bluetooth נתונים

boolean disable(ITestDevice device)

השבתת Bluetooth במכשיר היעד

boolean disableBluetoothSnoopLog(ITestDevice device)

השבתה של Bluetooth snoop log

boolean disconnect(ITestDevice primary, ITestDevice secondary, Set<Sl4aBluetoothUtil.BluetoothProfile> profiles)

ניתוק המכשיר הראשי מהמכשיר המשני

boolean enable(ITestDevice device)

הפעלת Bluetooth במכשיר היעד

boolean enableBluetoothSnoopLog(ITestDevice device)

הפעלת יומן Snoop של Bluetooth

String getAddress(ITestDevice device)

איך מוצאים את כתובת ה-MAC של מכשיר Bluetooth

Set<String> getBondedDevices(ITestDevice device)

קבלת קבוצה של כתובות MAC של Bluetooth של המכשירים המקושרים (המותאמים) במכשיר היעד

boolean pair(ITestDevice primary, ITestDevice secondary)

התאמה של המכשיר הראשי למכשיר המשני

void setBtConnectionTimeout(Duration timeout)
void setBtPairTimeout(Duration timeout)
boolean setProfilePriority(ITestDevice primary, ITestDevice secondary, Set<Sl4aBluetoothUtil.BluetoothProfile> profiles, Sl4aBluetoothUtil.BluetoothPriorityLevel priority)

שינוי הגדרת העדיפות של פרופילים נתונים במכשיר הראשי ביחס למכשיר המשני

void startSl4a(ITestDevice device, File sl4aApkFile)

מפעילים במפורש את לקוח SL4A עם המכשיר הנתון וקובץ ה-APK של SL4A.

void stopSl4a()

עוצרים לקוחות SL4A שכבר נפתחו.

boolean unpairAll(ITestDevice device)

ביטול ההתאמה של כל המכשירים שהותאמו למכשיר הנוכחי

שיטות מוגנות

void finalize()

מחיקת כל החיבורים של SL4A

‫constructors ציבוריים

Sl4aBluetoothUtil

public Sl4aBluetoothUtil ()

‫methods ציבוריים

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 אם ההרשאה שונתה בהצלחה

הקפצת הודעות שגיאה (throw)
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

חיבור

public boolean connect (ITestDevice primary, 
                ITestDevice secondary, 
                Set<Sl4aBluetoothUtil.BluetoothProfile> profiles)

חיבור המכשיר הראשי למכשיר המשני בפרופילי Bluetooth נתונים

פרמטרים
primary ITestDevice: המכשיר שממנו מתחברים

secondary ITestDevice: המכשיר שאליו רוצים להתחבר

profiles Set: נדרש חיבור של קבוצת פרופילים של Bluetooth

החזרות
boolean true אם החיבורים הצליחו

הקפצת הודעות שגיאה (throw)
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

השבתה

public boolean disable (ITestDevice device)

השבתת Bluetooth במכשיר היעד

פרמטרים
device ITestDevice: מכשיר היעד

החזרות
boolean ‫true אם ה-Bluetooth הושבת בהצלחה

הקפצת הודעות שגיאה (throw)
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

disableBluetoothSnoopLog

public boolean disableBluetoothSnoopLog (ITestDevice device)

השבתה של Bluetooth snoop log

פרמטרים
device ITestDevice: כדי להשבית את יומן הריגול

החזרות
boolean ‫true אם ההשבתה הצליחה

הקפצת הודעות שגיאה (throw)
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

ניתוק

public boolean disconnect (ITestDevice primary, 
                ITestDevice secondary, 
                Set<Sl4aBluetoothUtil.BluetoothProfile> profiles)

ניתוק המכשיר הראשי מהמכשיר המשני

פרמטרים
primary ITestDevice: המכשיר שעליו תתבצע פעולת הניתוק

secondary ITestDevice: המכשיר שרוצים לנתק

profiles Set: קבוצה נתונה של פרופילי Bluetooth שנדרש לנתק

החזרות
boolean true אם הניתוק הצליח

הקפצת הודעות שגיאה (throw)
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

הפעלה

public boolean enable (ITestDevice device)

הפעלת Bluetooth במכשיר היעד

פרמטרים
device ITestDevice: מכשיר היעד

החזרות
boolean ‫true אם ה-Bluetooth הופעל בהצלחה

הקפצת הודעות שגיאה (throw)
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

enableBluetoothSnoopLog

public boolean enableBluetoothSnoopLog (ITestDevice device)

הפעלת יומן Snoop של Bluetooth

פרמטרים
device ITestDevice: כדי להפעיל את יומן הריגול

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

הקפצת הודעות שגיאה (throw)
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getAddress

public String getAddress (ITestDevice device)

איך מוצאים את כתובת ה-MAC של מכשיר Bluetooth

פרמטרים
device ITestDevice: מכשיר היעד

החזרות
String מחרוזת של כתובת MAC

הקפצת הודעות שגיאה (throw)
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBondedDevices

public Set<String> getBondedDevices (ITestDevice device)

קבלת קבוצה של כתובות MAC של Bluetooth של המכשירים המקושרים (המותאמים) במכשיר היעד

פרמטרים
device ITestDevice: מכשיר היעד

החזרות
Set<String> קבוצה של כתובות MAC של Bluetooth

הקפצת הודעות שגיאה (throw)
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

התאם

public boolean pair (ITestDevice primary, 
                ITestDevice secondary)

התאמה של המכשיר הראשי למכשיר המשני

פרמטרים
primary ITestDevice: מכשיר שממנו מתבצעת ההתאמה

secondary ITestDevice: המכשיר שאליו רוצים להתאים

החזרות
boolean true אם ההתאמה בוצעה בהצלחה

הקפצת הודעות שגיאה (throw)
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, 
                Set<Sl4aBluetoothUtil.BluetoothProfile> profiles, 
                Sl4aBluetoothUtil.BluetoothPriorityLevel priority)

שינוי הגדרת העדיפות של פרופילים נתונים במכשיר הראשי ביחס למכשיר המשני

פרמטרים
primary ITestDevice: המכשיר שרוצים להגדיר לו עדיפות

secondary ITestDevice: המכשיר שרוצים להגדיר לו עדיפות

profiles Set: פרופילים של Bluetooth לשינוי הגדרת העדיפות

priority Sl4aBluetoothUtil.BluetoothPriorityLevel: רמת העדיפות

החזרות
boolean ‫true אם העדיפות הוגדרה בהצלחה

הקפצת הודעות שגיאה (throw)
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

startSl4a

public void startSl4a (ITestDevice device, 
                File sl4aApkFile)

מפעילים במפורש את לקוח SL4A עם המכשיר הנתון וקובץ ה-APK של SL4A. בדרך כלל לא צריך להשתמש בשיטה הזו, כי חיבור SL4A תמיד יתבצע לפני פעולות בפועל.

פרמטרים
device ITestDevice: המכשיר שאליו רוצים להתחבר באמצעות SL4A

sl4aApkFile File: קובץ ה-APK האופציונלי של SL4A להתקנה ולשימוש.

הקפצת הודעות שגיאה (throw)
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

stopSl4a

public void stopSl4a ()

עוצרים לקוחות SL4A שכבר נפתחו. הוא מספק דרך לנקות את הלקוחות מיד אחרי שהם כבר לא בשימוש.

unpairAll

public boolean unpairAll (ITestDevice device)

ביטול ההתאמה של כל המכשירים שהותאמו למכשיר הנוכחי

פרמטרים
device ITestDevice: המכשיר הנוכחי לביצוע הפעולה

החזרות
boolean true אם ביטול ההתאמה הצליח

הקפצת הודעות שגיאה (throw)
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

שיטות מוגנות

סיום

protected void finalize ()

מחיקת כל החיבורים של SL4A