EXTRA_PACKET_RECEIPT_NOTIFICATIONS_VALUE

val EXTRA_PACKET_RECEIPT_NOTIFICATIONS_VALUE: String = "no.nordicsemi.android.dfu.extra.EXTRA_PRN_VALUE"

This property must contain a positive integer value, usually from range 1-200.

The default value is DEFAULT_PRN_VALUE. Setting it to 0 will disable the Packet Receipt Notification procedure. When sending a firmware using the DFU procedure the service will send this number of packets before waiting for a notification. Packet Receipt Notifications are used to synchronize the sender with receiver.

On Android, calling writeCharacteristic simply adds the packet to outgoing queue before returning the callback. Adding the next packet in the callback is much faster than the real transmission (also the speed depends on the device chip manufacturer) and the queue may reach its limit. When does, the transmission stops and Android Bluetooth hangs (see Note below). Using PRN procedure eliminates this problem as the notification is send when all packets were delivered the queue is empty.

Note: this bug has been fixed on Android 6.0 Marshmallow and now no notifications are required. The onCharacteristicWrite callback will be postponed until half of the queue is empty and upload will be resumed automatically. Disabling PRNs speeds up the upload process on those devices.

See also