Android BLE:服务中发现的特征列表不完整

zed*_*zed 5 android bluetooth-lowenergy gatt

尝试从 GATT 服务读取特征时,与我从 iOS 设备或制造商指南获得的列表相比,该列表不完整。

我正在阅读的特征如下:

private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
        @Override
        public void onConnectionStateChange(BluetoothGatt gatt, int status,
                                            int newState) {
            if (newState == BluetoothProfile.STATE_CONNECTED) {
                mConnectionState = STATE_CONNECTED;
                mBluetoothGatt = gatt;
                if (shouldStartWriting && writeCharacteristicsQueue.peek() != null) {
                    mBluetoothGatt.writeCharacteristic(writeCharacteristicsQueue.poll());
                } else {
                    EventBus.getDefault().post(new BTGattStatusEvent(BTGattStatusEvent.Status.CONNECTED));
                    Log.i(TAG, "Attempting to start service discovery:" +
                            gatt.discoverServices());
                }

            } else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
                mConnectionState = STATE_DISCONNECTED;
                mBluetoothGatt = null;
                EventBus.getDefault().post(new BTGattDisconnectedEvent());
            }
        }

        @Override
        // New services discovered
        public void onServicesDiscovered(BluetoothGatt gatt, int status) {
            EventBus.getDefault().post(new BTGattStatusEvent(BTGattStatusEvent.Status.DISCOVERED));

            if (status == BluetoothGatt.GATT_SUCCESS) {
                for (BluetoothGattService service : gatt.getServices()) {
                    LOGD(TAG, "Found Service " + service.getUuid().toString());
                    discoverCharacteristics(service);
                }
                gatt.readCharacteristic(readCharacteristicsQueue.poll());
            } else {
                Log.w(TAG, "onServicesDiscovered received: " + status);
            }
        }

    @Override
    // Result of a characteristic read operation
    public void onCharacteristicRead(BluetoothGatt gatt,
                                     BluetoothGattCharacteristic characteristic,
                                     int status) {
        if (status == BluetoothGatt.GATT_SUCCESS) {
            parseCharacteristic(characteristic);
            LOGD(TAG, String.format("%s | %s ", characteristic.getUuid(), characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT16, 0)));//(BluetoothGattCharacteristic.FORMAT_UINT16));

            if (readCharacteristicsQueue.peek() != null) {
                gatt.readCharacteristic(readCharacteristicsQueue.poll());
            } else {
                EventBus.getDefault().post(new BTGattStatusEvent(BTGattStatusEvent.Status.DONE_DISCOVERING));
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

private void discoverCharacteristics(BluetoothGattService service) {
    for (BluetoothGattCharacteristic gattCharacteristic : service.getCharacteristics()) {
        LOGD(TAG, "Discovered UUID: " + gattCharacteristic.getUuid());
        readCharacteristicsQueue.add(gattCharacteristic);
    }

}
Run Code Online (Sandbox Code Playgroud)

我也尝试使用 来获取此特征getCharacteristic,但我收到了一个空值。

发现的特征是:

Discovered UUID: 0000fff1-0000-1000-8000-00805f9b34fb
Discovered UUID: 0000fff2-0000-1000-8000-00805f9b34fb
Discovered UUID: 0000fff3-0000-1000-8000-00805f9b34fb
Discovered UUID: 0000fff4-0000-1000-8000-00805f9b34fb
Discovered UUID: 0000fff5-0000-1000-8000-00805f9b34fb
Run Code Online (Sandbox Code Playgroud)

然而,在 iOS 上,根据制造商的说法,还应该有一个 0000fff7。

为什么这个特性没有被读取?

更新:这里什么也没发生。Android 的 BLE 扫描应用程序都无法发现它。