Android扫描指定类型ble,java – Android BLE:识别特征类型?

我正在用BLE开发一个

Android应用程序.该应用的要求是用各种输入更新特定硬件中的电压变化.所以我在这个应用程序中启用了BLE通知API.这将在最近的硬件电压的一段时间内通知应用程序.

履行

mBluetoothGatt.setCharacteristicNotification(characteristic, enabled);

BluetoothGattDescriptor des = characteristic.getDescriptors();

des.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);

//Set the value of the descriptor to enable notification

mBluetoothGatt.writeDescriptor(des);

我在Gatt CallBack方法的通知值中收到通知

@Override

public void onCharacteristicChanged(BluetoothGatt Gatt, BluetoothGattCharacteristic characteristic) {

Log.w(TAG, "**ACTION_DATA_AVAILABLE**" + characteristic.getUuid());

//Indication or notification was received

broadcastUpdate(BLEConstants.ACTION_DATA_AVAILABLE, characteristic);

//Go broadcast an intent with the characteristic data

}

但我的问题是,我在相同的Gatt回调方法中也得到了正常的响应.我想在UI中以特定方式更新通知.所以我需要分开正常的响应和通知.有没有办法做同样的事情?或者任何识别特定消息的选项来自通知?

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值