Most visited

Recently visited

Added in API level 11

BluetoothProfile

public interface BluetoothProfile

android.bluetooth.BluetoothProfile
Known Indirect Subclasses


蓝牙配置文件的公共API。

客户应该致电getProfileProxy(Context, BluetoothProfile.ServiceListener, int) ,以获取Profile Proxy。 每个公共配置文件实现此接口。

Summary

Nested classes

interface BluetoothProfile.ServiceListener

用于在BluetoothProfile IPC客户端连接或断开服务时通知其的接口。

Constants

int A2DP

A2DP配置文件。

String EXTRA_PREVIOUS_STATE

额外用于各个配置文件的连接状态意图。

String EXTRA_STATE

额外用于各个配置文件的连接状态意图。

int GATT

GATT

int GATT_SERVER

GATT_SERVER

int HEADSET

耳机和免提配置文件

int HEALTH

健康档案

int SAP

int STATE_CONNECTED

该配置文件处于连接状态

int STATE_CONNECTING

该配置文件处于连接状态

int STATE_DISCONNECTED

配置文件处于断开状态

int STATE_DISCONNECTING

配置文件处于断开状态

Public methods

abstract List<BluetoothDevice> getConnectedDevices()

获取此特定配置文件的连接设备。

abstract int getConnectionState(BluetoothDevice device)

获取配置文件的当前连接状态

需要 BLUETOOTH权限。

abstract List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states)

获取匹配任何给定连接状态的设备列表。

Constants

A2DP

Added in API level 11
int A2DP

A2DP配置文件。

常量值:2(0x00000002)

EXTRA_PREVIOUS_STATE

Added in API level 11
String EXTRA_PREVIOUS_STATE

额外用于各个配置文件的连接状态意图。 这额外表示蓝牙设备配置文件的先前连接状态。

常量值:“android.bluetooth.profile.extra.PREVIOUS_STATE”

EXTRA_STATE

Added in API level 11
String EXTRA_STATE

额外用于各个配置文件的连接状态意图。 这额外代表了蓝牙设备配置文件的当前连接状态。

常量值:“android.bluetooth.profile.extra.STATE”

GATT

Added in API level 18
int GATT

GATT

常量值:7(0x00000007)

GATT_SERVER

Added in API level 18
int GATT_SERVER

GATT_SERVER

常量值:8(0x00000008)

HEADSET

Added in API level 11
int HEADSET

耳机和免提配置文件

常数值:1(0x00000001)

HEALTH

Added in API level 14
int HEALTH

健康档案

常量值:3(0x00000003)

SAP

Added in API level 23
int SAP

常量值:10(0x0000000a)

STATE_CONNECTED

Added in API level 11
int STATE_CONNECTED

该配置文件处于连接状态

常量值:2(0x00000002)

STATE_CONNECTING

Added in API level 11
int STATE_CONNECTING

该配置文件处于连接状态

常数值:1(0x00000001)

STATE_DISCONNECTED

Added in API level 11
int STATE_DISCONNECTED

配置文件处于断开状态

常量值:0(0x00000000)

STATE_DISCONNECTING

Added in API level 11
int STATE_DISCONNECTING

配置文件处于断开状态

常量值:3(0x00000003)

Public methods

getConnectedDevices

Added in API level 11
List<BluetoothDevice> getConnectedDevices ()

获取此特定配置文件的连接设备。

返回处于状态 STATE_CONNECTED的一组设备

需要 BLUETOOTH权限。

Returns
List<BluetoothDevice> List of devices. The list will be empty on error.

getConnectionState

Added in API level 11
int getConnectionState (BluetoothDevice device)

获取配置文件的当前连接状态

需要 BLUETOOTH权限。

Parameters
device BluetoothDevice: Remote bluetooth device.
Returns
int State of the profile connection. One of STATE_CONNECTED, STATE_CONNECTING, STATE_DISCONNECTED, STATE_DISCONNECTING

getDevicesMatchingConnectionStates

Added in API level 11
List<BluetoothDevice> getDevicesMatchingConnectionStates (int[] states)

获取匹配任何给定连接状态的设备列表。

如果没有任何设备匹配任何给定的状态,则会返回空列表。

需要 BLUETOOTH权限。

Parameters
states int: Array of states. States can be one of STATE_CONNECTED, STATE_CONNECTING, STATE_DISCONNECTED, STATE_DISCONNECTING,
Returns
List<BluetoothDevice> List of devices. The list will be empty on error.

Hooray!