接口说明
| 
 接口名  | 
 功能描述  | 
|---|---|
| 
 getDeviceAddr()  | 
 获取远端蓝牙设备地址。  | 
| 
 getDeviceClass()  | 
 获取远端蓝牙设备类型。  | 
| 
 getDeviceName()  | 
 获取远端蓝牙设备名称。  | 
| 
 getPairState()  | 
 获取远端设备配对状态。  | 
| 
 startPair()  | 
 向远端设备发起配对。  | 
开发步骤
- 调用BluetoothHost的getDefaultHost(Context context)接口,获取BluetoothHost实例,管理本机蓝牙操作。
 - 调用enableBt()接口,打开蓝牙。
 - 调用startBtDiscovery(),扫描设备。
 - 调用startPair(),发起配对。
 
调用getDeviceAddr(),获取远端蓝牙设备地址。
// 获取蓝牙本机管理对象
BluetoothHost bluetoothHost = BluetoothHost.getDefaultHost(context);
// 调用打开接口
bluetoothHost.enableBt();
// 调用扫描接口
bluetoothHost.startBtDiscovery();
// 设置界面会显示出扫描结果列表,点击蓝牙设备去配对
BluetoothRemoteDevice device = bluetoothHost.getRemoteDev(TEST_ADDRESS);
device.startPair();
// 调用接口获取远端蓝牙设备地址
String deviceAddr = device.getDeviceAddr();