nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches

◆ dfu_multi_image_write()

int dfu_multi_image_write ( size_t offset,
const uint8_t * chunk,
size_t chunk_size )

#include <include/dfu/dfu_multi_image.h>

Write subsequent DFU Multi Image package chunk.

Called to consume a subsequent chunk of the DFU Multi Image package. The initial bytes of the package contain a header that allows the library to learn offsets of particular images within the entire package. After the header is parsed, the registered image writers are used to store the image data.

The package chunks must be provided in order.

When an image for which no writer has been registered is found in the package, the library may decide to skip ahead the image. For that reason, a user of the function must provide the offset argument to validate the chunk's position against the current write position and potentially drop the bytes that are not needed anymore.

A user shall NOT write any more chunks after any write results in a failure.

Parameters
[in]offsetOffset of the chunk within the entire package.
[in]chunkPointer to the chunk's data.
[in]chunk_sizeSize of the chunk.
Return values
-ESPIPEIf offset is bigger than expected which may indicate a data gap or writing more data than declared in the package header.
Returns
negative On other failure.
0 On success.