Android蓝牙4.0API-类-BluetoothHealth
2016-04-28 16:46
465 查看
BluetoothHealth is a proxy object for controlling the Bluetooth Service via IPC.
How to connect to a health device which is acting in the source role.
Use
Create an
Pair with the remote device. This currently needs to be done manually from Bluetooth Settings
Connect to a health device using
will inform the application of channel state change.
Use the file descriptor描述符号 provided with a connected channel to read and write data to the health channel.
The received data needs to be interpreted using a health manager which implements the IEEE 11073-xxxxx specifications规格.
When done, close the health channel by calling
The remote Bluetooth device.config
The application configuration which has been registered using
int channelId) 断开device
The remote Bluetooth device.
config
The application configuration which has been registered using
The channel id associated关联 with the channel
获取设备列表List<BluetoothDevice> getConnectedDevices()
int getConnectionState(BluetoothDevice device)
List<BluetoothDevice> getDevicesMatchingConnectionStates(int[]
states)
states
Array of states. States can be one of
ParcelFileDescriptor getMainChannelFd(BluetoothDevice device, BluetoothHealthAppConfiguration config)
Get
the file descriptor描述符号 of the main channel associated关联的 with the remote device and application configuration.
boolean registerSinkAppConfiguration(String name,
int dataType, BluetoothHealthCallback callback)
boolean unregisterAppConfiguration(BluetoothHealthAppConfiguration config)
How to connect to a health device which is acting in the source role.
Use
getProfileProxy(Context, BluetoothProfile.ServiceListener, int)to get the BluetoothHealth proxy object.
Create an
BluetoothHealthcallback and call
registerSinkAppConfiguration(String, int, BluetoothHealthCallback)to register an application configuration
Pair with the remote device. This currently needs to be done manually from Bluetooth Settings
Connect to a health device using
connectChannelToSource(BluetoothDevice, BluetoothHealthAppConfiguration). Some devices will connect the channel automatically. The
BluetoothHealthcallback
will inform the application of channel state change.
Use the file descriptor描述符号 provided with a connected channel to read and write data to the health channel.
The received data needs to be interpreted using a health manager which implements the IEEE 11073-xxxxx specifications规格.
When done, close the health channel by calling
disconnectChannel(BluetoothDevice, BluetoothHealthAppConfiguration, int)and unregister the application configuration calling
unregisterAppConfiguration(BluetoothHealthAppConfiguration)公用方法boolean connectChannelToSource(BluetoothDevice device, BluetoothHealthAppConfiguration config)链接device
BluetoothDevice:
The remote Bluetooth device.config
BluetoothHealthAppConfiguration:
The application configuration which has been registered using
registerSinkAppConfiguration(String, int, BluetoothHealthCallback)boolean disconnectChannel(BluetoothDevice device, BluetoothHealthAppConfiguration config,
int channelId) 断开device
BluetoothDevice:
The remote Bluetooth device.
config
BluetoothHealthAppConfiguration:
The application configuration which has been registered using
registerSinkAppConfiguration(String, int, BluetoothHealthCallback)channelId
int:
The channel id associated关联 with the channel
获取设备列表List<BluetoothDevice> getConnectedDevices()
int getConnectionState(BluetoothDevice device)
List<BluetoothDevice> getDevicesMatchingConnectionStates(int[]
states)
states
int:
Array of states. States can be one of
STATE_CONNECTED,
STATE_CONNECTING,
STATE_DISCONNECTED,
STATE_DISCONNECTING,
ParcelFileDescriptor getMainChannelFd(BluetoothDevice device, BluetoothHealthAppConfiguration config)
Get
the file descriptor描述符号 of the main channel associated关联的 with the remote device and application configuration.
boolean registerSinkAppConfiguration(String name,
int dataType, BluetoothHealthCallback callback)
boolean unregisterAppConfiguration(BluetoothHealthAppConfiguration config)
BluetoothDevice: The remote Bluetooth device. |
相关文章推荐
- ant构建web项目build脚本
- iOS 代码实现获得应用的版本号(Version/Build)
- The current request is not a multipart request
- HDU-4192 Guess the Numbers 表达式求值
- Android消息机制:Looper,MessageQueue,Message与handler
- 引用.c 文件 Xcode出现 Could not build module 'Foundation'的错误
- Android Volley完全解析(三),定制自己的Request
- getRequestDispatcher()与sendRedirect()的区别
- UIView的放大动画
- bug日志(1):UIAlertView消失之后收起的键盘又弹出
- 5_7 丑数(UVa136)<priority_queue的使用>
- contentValues HashTable 的理解
- 使用百度的富文本编辑器UEditor遇到的问题总结
- UEFI模式下安装Windows 10、Ubuntu 16.04 LTS双系统教程
- hdoj--3530 Subsequence(单调队列)
- iOS开发~UITableView 在Plain下区头跟随移动
- 七周七种前端框架四:Vue.js 组件和组件通信
- qt GUI线程和其他线程的信号槽以及不同线程通信
- Frequency-tuned salient Region Detection
- addEventListener 第三个参数false true