MD.FAISAL KABIR
MD.FAISAL KABIR

Reputation: 181

What could be causing the Android app to stop receiving responses from the BLE device after increasing the data packet size from 4-5 bits to 140 bits?

I am using "BluetoothGatt" for BLE communication.

Previously:

The Android app received BLE responses for short BLE commands (4-5 bits) by splitting the response in the "onCharacteristicChanged" method and calling the method multiple times. This approach worked well with short data. I was taking those split response strings and combining them into a single string to use.

Current Situation:

I am now attempting to send larger data packets (around 140 bits) to the device. However, the app no longer receives any response from the device after increasing the data size.

I tried to increase the MTU size using the method "requestMtu(140)" before running the new command, but the "onMtuChanged" callback method always returns MTU as "96". What could be causing this issue, and how can we resolve it?

BluetoothGattService myService = gatt.getService(UUID.fromString("service_uuid"));
            BluetoothGattCharacteristic myChar = myService.getCharacteristic(UUID.fromString("notification_uuid"));
            for (BluetoothGattDescriptor myDescriptor : myChar.getDescriptors()) {
                boolean result21 = myDescriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
                Log.e("TAG", "descriptor.setValue(BluetoothGattDescriptor Result2: " + result21);
                mBluetoothGatt.writeDescriptor(myDescriptor);
            }

Upvotes: 1

Views: 56

Answers (0)

Related Questions