Closed nichtgedacht closed 10 months ago
That macro only sets the size of the characteristic data buffer, not the data transmitted. The max size of a notification is determined by the MTU of the connection, so you would need to have a larger MTU on both devices.
MTU is reported as 256
NimBLEClient* pClient = NimBLEDevice::createClient(); ... Serial.printf("Got MTU: %d\n", pClient->getMTU());
Docu says: Set the default allocation size (bytes) for each attribute. If not specified when the constructor is called. This is also the size used when a remote characteristic or descriptor is constructed before a value is read/notifed. Increasing this will reduce reallocations but increase memory footprint. Default value is 20. Range: 1 : 512 (BLE_ATT_ATTR_MAX_LEN)
Why the length of data received from notifyCallback() is limited to 20 bytes?
I cannot reproduce this. The max size of a notification is always MTU-3 as per the BLE specifications. The initial size of the characteristic data buffer is all that macro defines as it says in the documentation you've pasted.
There is ether only 20 bytes in your data or there is an MTU issue.
Thank you. I'll ask the manufacturer of the device whether they send data in this small portions.
Setting CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH=100 does not work
Neither Setting in platformio.ini as:
build_flags = -D CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH=100
nor uncommenting in nimconfig.h as:
define CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH 100
Notification data are still coming in chunks of 20 bytes.