transferInitPacket
Sends the legacy DFU init packet using the SDK 7+ extended-init flow:
START_DFU [APP]→ device prepares.Image sizes
[0u32, 0u32, appSize_u32]on the Packet characteristic.INIT_PARAMS_START→ init bytes on Packet →INIT_PARAMS_COMPLETE.
The legacy init packet for an APP image is typically 14 bytes (SDK 7) or 32 bytes (SDK 11 with signature). Any .dat significantly larger than that almost certainly belongs to a Secure DFU build that has been mis-packaged for a legacy bootloader — we surface that with a helpful error rather than letting the device reject it.
The init packet is bracketed by START/COMPLETE, but the upload itself is intermixed with image sizes. To match Nordic's library, the initPacket argument here is the legacy init bytes; the firmware transferFirmware method needs to be called next to provide the actual image (and the size we include here must match its length).
Because transferInitPacket is called before transferFirmware, we don't yet know the firmware size when sending image sizes. To keep the DfuUploadTransport contract clean we instead send image sizes lazily inside transferFirmware's START phase. This method only writes START_DFU + brackets the init packet. Any outstanding image-size write happens at the start of transferFirmware.