android-BluetoothManager
2016-07-19 11:33
323 查看
BluetoothManager
public final class BluetoothManager
extends Object
java.lang.Object | |
↳ | android.bluetooth.BluetoothManager |
BluetoothAdapterand to
conduct overall Bluetooth Management.
高级管理者用于获得BluetoothAdapter的实例并进行整体蓝牙管理
Use
getSystemService(java.lang.String)with
BLUETOOTH_SERVICEto
create an
BluetoothManager, then call
getAdapter()to
obtain the
BluetoothAdapter.
使用getSystemService(String)创建一个BluetoothManager BLUETOOTH_SERVICE,然后调用getAdapter()来获得theBluetoothAdapter。
Alternately, you can just call the static helper
getDefaultAdapter().
或者,你可以调用静态辅助getDefaultAdapter()。
Developer Guides
For more information about using BLUETOOTH, read the Bluetooth developerguide.
See also:
getSystemService(Class)
getDefaultAdapter()
Summary
| |
---|---|
BluetoothAdapter | getAdapter() Get the default BLUETOOTH Adapter for this device. 这个设备的默认蓝牙适配器。 |
List<BluetoothDevice> | getConnectedDevices(int profile) Get connected devices for the specified profile. 获得指定的配置文件的连接设备。 |
int | getConnectionState(BluetoothDevice device, int profile) Get the current connection state of the profile to the remote device. 获取当前状态概要文件的远程设备的连接。 |
List<BluetoothDevice> | getDevicesMatchingConnectionStates(int profile, int[] states) Get a list of devices that match any of the given connection states. 得到的设备列表匹配任何给定的连接状态。 |
BluetoothGattServer | openGattServer(Context context, BluetoothGattServerCallback callback) Open a GATT Server The callback is used to deliver results to Caller, such as connection status as well as the results of any other GATT server operations. 打开一个GATT 服务器回调用于向调用者提供的结果,如连接状态以及任何其他GATT 服务器操作的结果。 |
|
---|
From class java.lang.Object |
Public methods
getAdapter
Added in API level 18BluetoothAdapter getAdapter ()
Get the default BLUETOOTH Adapter for this device.
Returns | |
---|---|
BluetoothAdapter | the default BLUETOOTH Adapter |
getConnectedDevices
Added in API level 18List<BluetoothDevice> getConnectedDevices (int profile)
Get connected devices for the specified profile.
Return the set of devices which are in state
STATE_CONNECTED 返回设备的设置在STATE_CONNECTED状态
This is not specific to any application configuration but represents the connection state of Bluetooth for this profile. This can be used by applications like status bar which would just like to know the state of
Bluetooth.
这不是特定于任何应用程序配置,但这个概要文件代表了蓝牙的连接状态。这可以通过应用程序状态栏,想知道蓝牙的状态。
Requires
BLUETOOTHpermission.
Parameters | |
---|---|
profile | int: GATT or GATT_SERVER |
Returns | |
---|---|
List<BluetoothDevice> | List of devices. The list will be empty on error. |
getConnectionState
Added in API level 18int getConnectionState (BluetoothDevice device, int profile)
Get the current connection state of the profile to the remote device.
获取当前状态概要文件的远程设备的连接。
This is not specific to any application configuration but represents the connection state of the local Bluetooth adapter for certain profile. This can be used by applications like status bar which would just like
to know the state of Bluetooth.
这不是特定于任何应用程序配置但代表本地蓝牙适配器连接状态的某些配置文件。这可以通过应用程序状态栏,想知道蓝牙的状态。
Requires
BLUETOOTHpermission.
Parameters | |
---|---|
device | BluetoothDevice: Remote bluetooth device. |
profile | int: GATT or GATT_SERVER |
Returns | |
---|---|
int | State of the profile connection. One of STATE_CONNECTED, STATE_CONNECTING, STATE_DISCONNECTED, STATE_DISCONNECTING |
getDevicesMatchingConnectionStates
Added in API level 18List<BluetoothDevice> getDevicesMatchingConnectionStates (int profile, 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.
This is not specific to any application configuration but represents the connection state of the local Bluetooth adapter for this profile. This can be used by applications like status bar which would just like to
know the state of the local adapter.
Requires
BLUETOOTHpermission.
Parameters | |
---|---|
profile | int: GATT or GATT_SERVER |
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. |
openGattServer
Added in API level 18BluetoothGattServer openGattServer (Context context, BluetoothGattServerCallback callback)
Open a GATT Server The callback is used to deliver results to Caller, such as connection status as well as the results of any other GATT server operations. The method returns a BluetoothGattServer instance. You
can use BluetoothGattServer to conduct GATT server operations.
Parameters | |
---|---|
context | Context: App context |
callback | BluetoothGattServerCallback: GATT server callback handler that will receive asynchronous callbacks. |
Returns | |
---|---|
BluetoothGattServer | BluetoothGattServer instance |
相关文章推荐
- Xcode buildsettings 设置相关的问题
- Android studio value 2 (DexIndexOverflowException,OutOfMemoryError,NoClassDefFoundError错误)
- iOS 设置UITextField的输入限制
- 并发队列ConcurrentLinkedQueue和阻塞队列LinkedBlockingQueue用法
- iOS 自定义UITableViewCell的分割线
- dfs常见的配置文件中的value与description
- java.io.NotSerializableException: com.jshb.fengyun.wms.ui.secsystem.model.User$PlatsBean
- JDBC中execute、executeQuery和executeUpdate的小结
- android-BluetoothDevice
- UIButton实现左文字右图片
- iOS开发从入门到精通--开关按钮UISwitch控件
- Android studio value 2 (com.android.dex.DexException:资源重复引用或者加载问题)
- iOS开发runtime给工程所有UITextfield属性赋初值
- [转]java.sql.SQLException: Incorrect string value: '\xF0\x9F\x98\x8E' for column 'nick' at row 1
- 基于java容器注解说明---@Value和@ImportResource
- servlet request getHeader(“x-forwarded-for”) 获取真实IP
- [SQL优化工具]Quest.Central.For.Databases——SQL Tuning for SQL Server
- EL表达式从request和session中取值
- android中requestFocus
- android-UUID