I'm trying to create data transmission between a custom BLE peripheral and Android communication library implemented with RxAndroidBle (1.4.1). I have it working with the default MTU (23 bytes) so that Android transmits only 20 bytes at the time. The communication works with MTU of 23, but we'd really like faster communication.
Our device supports DLE and requests a larger MTU of 158 bytes at the start of the communication and gets it with practically all mobiles. That done, the device starts sending data up-to 155 bytes at the time. Because of this the device->mobile communication is reasonably fast and it works fine. However on the Android side the RxAndroidBle's getMtu() call always returns 23 (even if library and test application have been built with minsdk = 21, running on Android 7.1.1). I tried to add call to RxBleConnection.requestMtu(512) after establishing the connection, but that results no callbacks and the getMtu() still returns 23.
I tried it with just brutally calling setMaxBatchSize(155) on createNewLongWriteBuilder and seeing what happens. Result was faster communication without any issues! (I confirmed on device logs that we really were getting >20 bytes at the time) However, to avoid unpleasant surprises if a device doesn't support large MTU's I'd really like to have the library use an actual MTU value, not a "big guess".
So, What is the actual way of getting current MTU in RxAndroidBle? Is there a bug that prevents it from working or something?