android 蓝牙停止连接,Android蓝牙外设:由对等方终止连接(状态19)

开发了一个应用程序,它充当外围设备并与其他设备连接(仅限中央).

它在具有操作系统版本6.0的设备中运行良好,但在Nougat 7.0中遇到了一些问题.

我收集了一些日志,在开发者选项中启用“Bluetooth HCI snoop log”.

收集的日志:

W/bt_btm: btm_sec_disconnect : reason=19

W/bt_btif: btif_dm_generic_evt: event=33035

W/bt_btif: btif_dm_generic_evt: event=33035

W/bt_btm: btm_sec_send_hci_disconnect: handle:0x41, reason=0x13

W/bt_btif: btif_dm_generic_evt: event=33035

W/bt_btif: bta_gattc_conn_cback() - cif=3 connected=0 conn_id=3 reason=0x0016

W/bt_btif: bta_gattc_conn_cback() - cif=4 connected=0 conn_id=4 reason=0x0016

W/bt_btif: bta_gattc_conn_cback() - cif=5 connected=0 conn_id=5 reason=0x0016

W/bt_btif: bta_gattc_conn_cback() - cif=7 connected=0 conn_id=7 reason=0x0016

W/bt_btif: bta_dm_bl_change_cback : reason=22

W/bt_btif: bta_dm_bl_change_cback : reason=22

W/bt_btm: btm_sec_disconnected

W/bt_btif: conn.link_down.is_removed : 0

D/BtGatt.GattService: onClientConnected() serverIf: 6, connId=6, address=00:16:A4:13:1E:48, connected=false

W/bt_btif: btif_dm_upstreams_cback ev: BTA_DM_LINK_DOWN_EVT

W/bt_btif: BTA_DM_LINK_DOWN_EVT. Sending BT_ACL_STATE_DISCONNECTED

外围服务(代码):

private boolean addService() {

if (null == mGattServer) {

Logger.printLog(TAG, "mGattServer is null");

return false;

}

BluetoothGattService service = new BluetoothGattService(UUID_pService,

BluetoothGattService.SERVICE_TYPE_PRIMARY);

//Defined descriptor for CCC and CEP

final BluetoothGattDescriptor cccDescriptor = new BluetoothGattDescriptor(UUID.fromString("00002902-0000-1000-8000-00805f9b34fb"), BluetoothGattDescriptor.PERMISSION_READ_ENCRYPTED);

cccDescriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);

final BluetoothGattDescriptor cepDescriptor = new BluetoothGattDescriptor(UUID.fromString("00002900-0000-1000-8000-00805f9b34fb"),

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值