Currently, each backend has it's own function to verify whether the
object vtable pointer is the expected one. All these functions can be
removed in favor of a single isintance function in the base class,
which takes the expected vtable pointer as a parameter.
Functions which are called through the vtable, don't need to verify the
vtable pointer, and those checks are removed.
The term "backend" can be confusing because it can refer to both the
virtual function table and the device/parser backends. The use of the
term "vtable" avoids this.
The new vendor event provides a mechanism to deliver auxiliary data,
which is automatically retrieved during the data transfer, but not
accessible through the library interface otherwise. Possible examples
include handshake data and/or device identification data.
This event is mainly intended for diagnostic purposes, in combination
with the memory dumping support. Very few applications will actually
need it for anything else.
The application shouldn't have to deal with the maximum number of
retries. If the default value isn't good enough, that should be fixed
internally and not on the application side.
The version function requires device specific knowledge to use it (at
least the required buffer size), it is already called internally when
necessary, and only a few backends support it. Thus there is no good
reason to keep it in the high-level public api.
These macros are used internally and don't need to be exposed. In some
cases, the actual values are not even constant, but dependant on the
model and/or the firmware version.
I forgot to update the device and parser initialization functions to
store the context pointer into the objects. As a result, the internal
context pointers were always NULL.
The public api is changed to require a context object for all
operations. Because other library objects store the context pointer
internally, only the constructor functions need an explicit context
object as a parameter.
Adding the "dc_" namespace prefix (which is of course an abbreviation
for libdivecomputer) should avoid conflicts with other libraries. For
the time being, only the high-level device and parser layers are
changed.
The public header files are moved to a new subdirectory, to separate
the definition of the public interface from the actual implementation.
Using an identical directory layout as the final installation has the
advantage that the example code can be build outside the project tree
without any modifications to the #include statements.
The handshaking is now automatically restarted whenever a non-fatal
error (such as a timeout or a protocol violation) is encountered.
Previously, only corrupt handshake packets where handled.
If the first few bytes of the timestamp are equal to zero, they were
incorrectly identified as part of the header marker. The correct header
marker is located a the start of this zero byte sequence, not the end.
When the Sensus Ultra reaches the end of a memory page while recording
data, the next page is erased to all 0xFF, and the current page cursor
is advanced. With this memory usage scheme, the last page will be empty
if the previous one was just filled.
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.
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.
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.
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.