This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Android 5.01 (Nexus 4) multiple packets per connection interval

Dear community,

I would like to know how to send as much data as possilbe from a Nexus 4 to an NRF51822 based device. For that I think I need to send multiple packets per connection interval.

What I did:

I searched the interwebs and also this community. ;) and found this: devzone.nordicsemi.com/.../

I set the connection interval to: connection interval 7.5..15

In the Sniffer I see that the devices agree to about 10 ms which is fine: Sniffer shows interval

To send Data I use a queue and the onCharacteristicsWrite callback to pump data in 20 byte chunks to the device:

public void writeCharacteristicBulk()
{
    BluetoothGattService service = mBluetoothGatt.getService(UUID.fromString("xxx"));
    BluetoothGattCharacteristic bluetoothGattCharacteristicA = service.getCharacteristic(UUID.fromString("xxx"));
    byte[] value;
    boolean status;

    bluetoothGattCharacteristicA.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE);
     value = mDataToTransfer.poll();
    if(value!=null) {
        bluetoothGattCharacteristicA.setValue(value);
        status = mBluetoothGatt.writeCharacteristic(bluetoothGattCharacteristicA);
        Log.d(TAG, "write " + bluetoothGattCharacteristicA.getUuid() + " status " + status);
    }
}

and later ...

 @Override
        public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
            writeCharacteristicBulk();
        }

But when I send large amounts of data (96 packets of 20 byte) I only see one per interval in the sniffer: Sniffer image of one package at a time

So the question is: Is it possible to send more than that? Or is the throughput calculation of the above mentioned question only valid for android receiving data?

Thanks and have a great weekend Matthias

Related