低功耗蓝牙:gattCharacteristic.getDescriptor() returns 空

Bluetooth Low Energy: gattCharacteristic.getDescriptor() returns null

我在获取特征的描述符时遇到问题,它总是 returns 为空。 我的代码有一小段:

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 的 Nokia X2 DS 上试过这个,比如 Android 4.3,并且有类似的错误。

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

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