i'm losing my mind with this issue.
The fact is, one android device which is advertising a string value: "78d89537-4309-4728-87f6-3ab2bbe231d8" (36 bytes). I'm using a characteristic defined as
anonIdCharacteristic = new BluetoothGattCharacteristic(TippeeBluetoothManager.UUID_READ_CHARACTERISTIC,
BluetoothGattCharacteristic.PROPERTY_READ | BluetoothGattCharacteristic.PROPERTY_BROADCAST,
BluetoothGattCharacteristic.PERMISSION_READ );
anonIdCharacteristic.setValue(idToAdvertise);
as you can see i'm advertising in "READ" mode, not notify.
When another android device connect and try to read the characteristic, the onCharacteristicRead method is called but the value passed is wrong. More specifically is:
"78d89537-4309-4728-87f678d89537-4309-4728-87f678d89537-4309-4728-87f6..." (600 bytes)
which is part of the value expected, but repeated.
If i put myself on debug "server side" is see that the number of bytes sent are correct. On debug "client side" the byte are 600
What am i doing wrong ?
Thanks in advance
---- EDIT ---
i found some more information.
onCharacteristicReadRequest is called repeatedly with crescent offset that is causing the "dirty" buffer now i'm responding this way:
if (BluetoothManager.UUID_READ_CHARACTERISTIC.equals(characteristic.getUuid())) { mGattServer.sendResponse(device, requestId, BluetoothGatt.GATT_SUCCESS, offset, getStoredValue()); return; }
using offset values. Not working yet but it's something.
I wonder what is telling the app how long is response..