When trying to read the last memory page from an Oceanic Atom 2, the
device does not respond. Strangely, other compatible devices are not
affected by this problem.
The Geo 2 appears to respond with a single NAK byte instead of three.
The issue is fixed by expecting only a single byte, and flushing the
serial line to discard all other bytes (if there are any).
To be able to cancel an operation, an application should register a
callback function that returns a non-zero value whenever the active
operaton should be cancelled. A backend can invoke this callback function
to query the application for a pending cancellation request.
A helper function is added to simplify implementing the devic_dump()
function on top of the device_read() function, and enable progress
events automatically.
Using a resizable memory buffer allows to allocate the right amount of
memory inside the backend, avoiding having to know the required buffer
size in advance.
The logbook ringbuffer is now considered empty if any of the pointers is
outside the valid ringbuffer area. Compared to checking only against a
special empty value, this approach makes the code more robust against
invalid pointers.
Introducing a common base class allows to share more code between the
backends. Sharing the fingerprint data eliminates the need to pass it
with a function parameter.
Logbook entries are now downloaded one by one, until a previously
downloaded entry is identified. This approach reduces the amount of data
that needs to be transfered in the typical case, where only a few new
dives are available on the device.
Moved the initialization of the backend pointers to the beginning of the
source file. Without the need for a tentative definition, the library
can be compiled with a C++ compiler.
When necessary, an output parameter is added to provide the size
information. Status codes are strictly reserved for providing status
information only.
The first byte of a packet seems to be an ACK/NAK byte, rather than a
real packet header. The implementation of the transfer function is
changed to match this observation.