mercredi 8 février 2017

Bluetooth LE listen to multiple characteristic notifications

Vote count: 0

I'm using BLE application on an Android phone communicating with a custom BLE sensor board. There are two characteristics provided by the board, acceleration and ecg. On the phone side, I'd like to receive the notifications of two characteristics from the sensor board. My code to set notifications:

mGatt.setCharacteristicNotification(ecgChar, true);
            BluetoothGattDescriptor descriptor = ecgChar.getDescriptor(
                    UUID.fromString("00002902-0000-1000-8000-00805f9b34fb"));
            descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
            mGatt.writeDescriptor(descriptor);
            mGatt.setCharacteristicNotification(accelChar, true);
            descriptor = ecgChar.getDescriptor(
                    UUID.fromString("00002902-0000-1000-8000-00805f9b34fb"));
            descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
            mGatt.writeDescriptor(descriptor);

However, I can only receive notifications for the first characteristics. When I only register notification for one characteristic, it worked well. The sampling frequency is 100Hz for both ECG and acceleration. So how can I receive notifications from both characteristics? Thanks.

asked 1 min ago

Let's block ads! (Why?)



Bluetooth LE listen to multiple characteristic notifications

Aucun commentaire:

Enregistrer un commentaire