android-BluetoothProfile

BluetoothProfile

public interface BluetoothProfile 

android.bluetooth.BluetoothProfile


Public APIs for the Bluetooth Profiles.

Clients should call getProfileProxy(Context, BluetoothProfile.ServiceListener, int), to get the Profile Proxy. Each public profile implements this interface.

Summary


Nested classes

interface BluetoothProfile.ServiceListener

An interface for notifying BluetoothProfile IPC clients when they have been connected or disconnected to the service. 

Constants

int A2DP

A2DP profile.

String EXTRA_PREVIOUS_STATE

Extra for the connection state intents of the individual profiles.

String EXTRA_STATE

Extra for the connection state intents of the individual profiles.

int GATT

GATT

int GATT_SERVER

GATT_SERVER

int HEADSET

Headset and Handsfree profile

int HEALTH

Health Profile

int SAP

int STATE_CONNECTED

The profile is in connected state

int STATE_CONNECTING

The profile is in connecting state

int STATE_DISCONNECTED

The profile is in disconnected state

int STATE_DISCONNECTING

The profile is in disconnecting state

Public methods

abstractList<BluetoothDevice> getConnectedDevices()

Get connected devices for this specific profile.

abstract int getConnectionState(BluetoothDevice device)

Get the current connection state of the profile

Requires BLUETOOTH permission.

abstractList<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states)

Get a list of devices that match any of the given connection states.

Constants


A2DP

Added in  API level 11
int A2DP

A2DP profile.

Constant Value: 2 (0x00000002)

EXTRA_PREVIOUS_STATE

Added in  API level 11
String EXTRA_PREVIOUS_STATE

Extra for the connection state intents of the individual profiles. This extra represents the previous connection state of the profile of the Bluetooth device.

Constant Value: "android.bluetooth.profile.extra.PREVIOUS_STATE"

EXTRA_STATE

Added in  API level 11
String EXTRA_STATE

Extra for the connection state intents of the individual profiles. This extra represents the current connection state of the profile of the Bluetooth device.

Constant Value: "android.bluetooth.profile.extra.STATE"

GATT

Added in  API level 18
int GATT

GATT

Constant Value: 7 (0x00000007)

GATT_SERVER

Added in  API level 18
int GATT_SERVER

GATT_SERVER

Constant Value: 8 (0x00000008)

HEADSET

Added in  API level 11
int HEADSET

Headset and Handsfree profile

Constant Value: 1 (0x00000001)

HEALTH

Added in  API level 14
int HEALTH

Health Profile

Constant Value: 3 (0x00000003)

SAP

Added in  API level 23
int SAP

Constant Value: 10 (0x0000000a)

STATE_CONNECTED

Added in  API level 11
int STATE_CONNECTED

The profile is in connected state

Constant Value: 2 (0x00000002)

STATE_CONNECTING

Added in  API level 11
int STATE_CONNECTING

The profile is in connecting state

Constant Value: 1 (0x00000001)

STATE_DISCONNECTED

Added in  API level 11
int STATE_DISCONNECTED

The profile is in disconnected state

Constant Value: 0 (0x00000000)

STATE_DISCONNECTING

Added in  API level 11
int STATE_DISCONNECTING

The profile is in disconnecting state

Constant Value: 3 (0x00000003)

Public methods


getConnectedDevices

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

Get connected devices for this specific profile.

Return the set of devices which are in state STATE_CONNECTED

Requires BLUETOOTH permission.

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

getConnectionState

Added in  API level 11
int getConnectionState (BluetoothDevice device)

Get the current connection state of the profile

Requires BLUETOOTH permission.

Parameters
device BluetoothDevice: Remote bluetooth device.
Returns
int State of the profile connection. One of STATE_CONNECTEDSTATE_CONNECTINGSTATE_DISCONNECTEDSTATE_DISCONNECTING

getDevicesMatchingConnectionStates

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

Get a list of devices that match any of the given connection states.

If none of the devices match any of the given states, an empty list will be returned.

Requires BLUETOOTH permission.

Parameters
states int: Array of states. States can be one of STATE_CONNECTEDSTATE_CONNECTINGSTATE_DISCONNECTEDSTATE_DISCONNECTING,
Returns
List<BluetoothDevice> List of devices. The list will be empty on error.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值