gpt4 book ai didi

java - 如何找到CLIENT_CHARACTERISTIC_CONFIG?

转载 作者:行者123 更新时间:2023-12-01 17:53:28 25 4
gpt4 key购买 nike

我需要 CLIENT_CHARACTERISTIC_CONFIG UUID 来激活我的应用程序中的通知。在 Google 示例应用程序中,它们是预定义的:

public static String HEART_RATE_MEASUREMENT = "00002a37-0000-1000-8000-00805f9b34fb";
public static String CLIENT_CHARACTERISTIC_CONFIG = "00002902-0000-1000-8000-00805f9b34fb";

我所拥有的是:

  • BidirectionalService : b9e875c0-1cfa-11e6-b797-0002a5d5c51b
  • Rx : 0c68d100-266f-11e6-b388-0002a5d5c51b
  • Tx : 1ed9e2c0-266f-11e6-850b-0002a5d5c51b

如何获取 UUID:

mBluetoothGatt.setCharacteristicNotification(characteristic, enabled);
BluetoothGattDescriptor descriptor = characteristic.getDescriptor(UUID.fromString(needed UUID here));
descriptor.setValue(enabled?BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE : new byte[]{0x00, 0x00});
mBluetoothGatt.writeDescriptor(descriptor);

最佳答案

客户端特征配置的 UUID 为 0x2902,或者长格式的“00002902-0000-1000-8000-00805f9b34fb”(已在您的应用中定义)。

顺便说一句,您可以找到所有支持的描述符及其 UUID,如 Nick Unucheck 的回答所示:

https://stackoverflow.com/a/34181034/5185968

关于java - 如何找到CLIENT_CHARACTERISTIC_CONFIG?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47475431/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com