Closed GoogleCodeExporter closed 9 years ago
This is probably possible using the stream mechanism currently in place.
http://koti.kapsi.fi/~jpa/nanopb/docs/concepts.html#streams
If your flash memory supports random-access, you can just implement your own
pb_istream_t callback and fill the buffer there. The buffer passed to stream
callbacks is either a 1-10 byte buffer allocated on stack or a buffer contained
in the destination structure itself.
If your flash memory is a SD card or other medium where it's more efficient to
read larger blocks, I suggest the following:
1) Have your own stream callback and have it keep a block-sized buffer.
2) When stream callback is called:
2a) If block buffer is empty, read a new block.
2b) Copy data from block buffer to destination buffer.
2c) If enough data has been read, return. Otherwise repeat from 2a.
Original comment by Petteri.Aimonen
on 2 Feb 2013 at 9:05
I'm closing this as from my perspective the current support for stream
callbacks is sufficient.
If you have more information, don't hesitate to comment or re-open.
Original comment by Petteri.Aimonen
on 7 Feb 2013 at 3:28
Original issue reported on code.google.com by
ScottALyons
on 2 Feb 2013 at 8:30