The handshake function is now called internally (even if it doesn't seem
to be required at all), and the version function can be called through
the public api. The format of the version data is changed too.
Trying to send the version command immediately after the initialization
of the data cable doesn't work very well. Adding a small delay before
sending the version commands turns out to be much more reliable.
When using the ringbuffer pointers to traverse the linked list, a full
ringbuffer appears as an empty one. This is probably a very rare
condition, but a very annoying one if you run into it it. Using byte
counts and the number of dives in the header avoids the problem.
In a ringbuffer implementation with only two begin/end pointers, it's
impossible to distinguish between an empty and a full ringbuffer. The
correct interpretation mode needs to be specified by the user.
Due to the internal memory buffering scheme of the Sensus Ultra, the
last page might contain a partial dive. Skipping this dive is more
apropriate than returning an error.
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.
We accept NULL pointers if the size is zero, but the C standard
library functions memcpy and memmove requires valid pointers, even if
the size is zero.
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.
The memory layout of the Mares Puck and Nemo devices is very similar,
which allows to share the parsing code between the backends.
The Mares Puck protocol allows for a more efficient implementation, by
reading only the data that we really need. But as an intermediate
solution, reusing the Nemo code is good enough.