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.
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.