1

我在获取特征描述符时遇到问题,它总是返回 null。我的代码有一大块:

public static final String CHARACTERISTIC_UPDATE_NOTIFICATION_DESCRIPTOR_UUID = "00000001-0000-1000-8000-00805f9b34fb";
public final static UUID tmp_uuid_1 = UUID.fromString(CHARACTERISTIC_UPDATE_NOTIFICATION_DESCRIPTOR_UUID);

...

BluetoothGattDescriptor descriptor = gattCharacteristic.getDescriptor(tmp_uuid_1);
descriptor.setValue(true ? BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE : new byte[]{0x00, 0x00});

我在带有 Android 5.1 的 Nexus 6 和带有 OS 2.0(如 Android 4.3)的诺基亚 X2 DS 上尝试了这个,并且有类似的错误。

等待答案)感谢您的关注!

4

1 回答 1

3

通知描述符的 uuid 是“00002902-0000-1000-8000-00805f9b34fb”,而不是代码中的“00000001-0000-1000-8000-00805f9b34fb”。

于 2015-06-03T04:46:45.673 回答