유틸리티 클래스는 SL4A를 사용하여 하나 또는 두 개의 장치에서 Bluetooth 작업을 제공합니다.
중첩 클래스 |
---|
enum | Sl4aBluetoothUtil.BluetoothAccessLevel 기반으로하는 블루투스 장치 액세스 레벨 열거 BluetoothDevice.java |
enum | Sl4aBluetoothUtil.BluetoothConnectionState 을 기반으로 블루투스 연결 상태에 대한 enum BluetoothProfile.java |
enum | Sl4aBluetoothUtil.BluetoothPriorityLevel 기반으로 블루투스 프로파일 우선 순위 레벨에 대한 enum BluetoothProfile.java |
enum | Sl4aBluetoothUtil.BluetoothProfile 을 기반으로 블루투스 프로파일에 대한 enum BluetoothProfile.java |
공개 메서드 |
---|
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) 대상 장치에서 블루투스 비활성화 |
boolean | disableBluetoothSnoopLog (ITestDevice device) 블루투스 스눕 로그 비활성화 |
boolean | disconnect (ITestDevice primary, ITestDevice secondary, profiles) disconnect (ITestDevice primary, ITestDevice secondary, profiles) 보조 장치에서 기본 장치 연결 해제 |
boolean | enable (ITestDevice device) 대상 장치에서 블루투스 활성화 |
boolean | enableBluetoothSnoopLog (ITestDevice device) 블루투스 스눕 로그 활성화 |
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) 현재 장치에 대해 페어링된 모든 장치 페어링 해제 |
공개 생성자
Sl4aBluetoothUtil
public Sl4aBluetoothUtil ()
공개 메서드
변경 프로필 액세스 권한
public boolean changeProfileAccessPermission (ITestDevice primary,
ITestDevice secondary,
Sl4aBluetoothUtil.BluetoothProfile profile,
Sl4aBluetoothUtil.BluetoothAccessLevel access)
보조 장치가 주어진 프로필의 기본 장치에 액세스할 수 있도록 기본 장치에서 보조 장치의 Bluetooth 프로필 액세스 권한을 변경합니다.
매개변수 |
---|
primary | ITestDevice : 변경 허가에 장치 |
secondary | ITestDevice 주어진 프로파일 기본 장치를 액세스 장치 |
profile | Sl4aBluetoothUtil.BluetoothProfile : 액세스 블루투스 프로필 |
access | Sl4aBluetoothUtil.BluetoothAccessLevel : 액세스 수준을 참조 BluetoothAccessLevel |
보고 |
---|
boolean | 권한이 성공적으로 변경되면 true |
던지다 |
---|
DeviceNotAvailableException | |
연결하다
public boolean connect (ITestDevice primary,
ITestDevice secondary,
profiles)
주어진 Bluetooth 프로필에서 기본 장치를 보조 장치에 연결
매개변수 |
---|
primary | ITestDevice : 장치에서 연결 |
secondary | ITestDevice : 장치에 연결 |
profiles | : 연결하려면 일련의 Bluetooth 프로필이 필요합니다. |
던지다 |
---|
DeviceNotAvailableException | |
장애를 입히다
public boolean disable (ITestDevice device)
대상 장치에서 블루투스 비활성화
매개변수 |
---|
device | ITestDevice : 대상 기기 |
보고 |
---|
boolean | 블루투스가 성공적으로 비활성화되면 true |
던지다 |
---|
DeviceNotAvailableException | |
비활성화BluetoothSnoopLog
public boolean disableBluetoothSnoopLog (ITestDevice device)
블루투스 스눕 로그 비활성화
매개변수 |
---|
device | ITestDevice : 비활성화 스눕 로그 |
보고 |
---|
boolean | 성공적으로 비활성화되면 true |
던지다 |
---|
DeviceNotAvailableException | |
연결을 끊다
public boolean disconnect (ITestDevice primary,
ITestDevice secondary,
profiles)
보조 장치에서 기본 장치 연결 해제
매개변수 |
---|
primary | ITestDevice : 장치가 연결 해제 작업을 수행 할 |
secondary | ITestDevice : 장치를 연결합니다 |
profiles | : 연결을 해제해야 하는 주어진 블루투스 프로파일 세트 |
보고 |
---|
boolean | 성공적으로 연결 해제된 경우 true |
던지다 |
---|
DeviceNotAvailableException | |
~ 할 수있게하다
public boolean enable (ITestDevice device)
대상 장치에서 블루투스 활성화
매개변수 |
---|
device | ITestDevice : 대상 기기 |
보고 |
---|
boolean | 블루투스가 성공적으로 활성화되면 true |
던지다 |
---|
DeviceNotAvailableException | |
enableBluetoothSnoopLog
public boolean enableBluetoothSnoopLog (ITestDevice device)
블루투스 스눕 로그 활성화
매개변수 |
---|
device | ITestDevice : 스눕 로그를 활성화하려면 |
보고 |
---|
boolean | 성공적으로 활성화되면 true |
던지다 |
---|
DeviceNotAvailableException | |
주소 가져오기
public String getAddress (ITestDevice device)
대상 장치의 Bluetooth MAC 주소 가져오기
매개변수 |
---|
device | ITestDevice : 대상 기기 |
던지다 |
---|
DeviceNotAvailableException | |
getBonded 장치
public getBondedDevices (ITestDevice device)
대상 장치에 연결된(페어링된) 장치의 Bluetooth MAC 주소 세트 가져오기
매개변수 |
---|
device | ITestDevice : 대상 기기 |
던지다 |
---|
DeviceNotAvailableException | |
쌍
public boolean pair (ITestDevice primary,
ITestDevice secondary)
기본 장치를 보조 장치에 페어링
매개변수 |
---|
primary | ITestDevice : 장치에서 페어링 |
secondary | ITestDevice : 쌍 장치 |
보고 |
---|
boolean | 페어링이 성공하면 true |
던지다 |
---|
DeviceNotAvailableException | |
setBtConnectionTimeout
public void setBtConnectionTimeout (Duration timeout)
setBtPairTimeout
public void setBtPairTimeout (Duration timeout)
setProfilePriority
public boolean setProfilePriority (ITestDevice primary,
ITestDevice secondary,
profiles,
Sl4aBluetoothUtil.BluetoothPriorityLevel priority)
기본 장치에서 지정된 프로필의 우선 순위 설정을 보조 장치로 변경
매개변수 |
---|
primary | ITestDevice :에 설정된 우선 순위 장치 |
secondary | ITestDevice : 대한 우선 순위 설정에 장치 |
profiles | : 우선순위 설정을 변경하기 위한 블루투스 프로파일 |
priority | Sl4aBluetoothUtil.BluetoothPriorityLevel : 우선 순위의 수준 |
보고 |
---|
boolean | 우선 순위가 성공적으로 설정된 경우 true |
던지다 |
---|
DeviceNotAvailableException | |
시작 Sl4a
public void startSl4a (ITestDevice device,
File sl4aApkFile)
지정된 장치 및 SL4A apk 파일로 SL4A 클라이언트를 명시적으로 시작합니다. 일반적으로 SL4A 연결은 실제 작업 전에 항상 설정되기 때문에 이 방법은 필요하지 않습니다.
매개변수 |
---|
device | ITestDevice : 장치는 SL4A를 사용하여 접속되는 |
sl4aApkFile | File : 설치하고 사용하는 옵션 SL4A의 APK. |
던지다 |
---|
DeviceNotAvailableException | |
stopSl4a
public void stopSl4a ()
이미 열려 있는 SL4A 클라이언트를 중지합니다. 기본적으로 더 이상 사용되지 않는 클라이언트를 즉시 정리하는 방법을 제공합니다.
모두 해제
public boolean unpairAll (ITestDevice device)
현재 장치에 대해 페어링된 모든 장치 페어링 해제
매개변수 |
---|
device | ITestDevice : 현재 장치는 작업을 수행 할 수 |
보고 |
---|
boolean | 성공적으로 페어링 해제되면 true |
던지다 |
---|
DeviceNotAvailableException | |
보호된 방법
마무리하다
protected void finalize ()
모든 SL4A 연결 정리
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2021-10-04 UTC.
[]
[]