64 Commits

Author SHA1 Message Date
Florian Klink
fc008312b5 Remove trailing whitespaces
Most of them appear in the disclaimers, but some are in the code as
well.
2014-03-19 09:16:07 +01:00
Jef Driesen
6419e189a4 Add a single isinstance function per object type.
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.
2013-04-16 12:18:54 +02:00
Jef Driesen
007479fc92 Rename the backend structure to vtable.
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.
2013-04-16 12:18:53 +02:00
Jef Driesen
56b7730773 Add a new vendor event.
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.
2012-12-27 12:10:45 +01:00
Jef Driesen
b09b74783b Hardcode the maximum number of retries.
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.
2012-12-23 09:55:37 +01:00
Jef Driesen
e9036674e0 Remove the obsolete timestamp functions.
These timestamp functions offer no real advantage and applications
should be using the device independent fingerprint feature instead.
2012-12-23 09:55:29 +01:00
Jef Driesen
985323eefb Move the version function to the device specific api.
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.
2012-12-05 16:07:32 +01:00
Jef Driesen
550e37d0b5 Remove the page, packet and memory size macros from the 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.
2012-12-05 16:07:32 +01:00
Jef Driesen
cd31ff9dff Properly store the context pointer internally.
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.
2012-08-28 08:44:47 +02:00
Jef Driesen
38c7b022cd Integrate the context object in the serial code. 2012-08-27 23:08:38 +02:00
Jef Driesen
53e9d72a40 Integrate the context object in the library.
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.
2012-08-27 23:08:38 +02:00
Jef Driesen
3df5cb09d7 Require a serial handle for the sleep function. 2012-08-27 23:02:44 +02:00
Jef Driesen
c821d40144 Introduce a namespace prefix for the high-level public api.
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.
2012-06-21 21:42:37 +02:00
Jef Driesen
163d383332 Use a common backend type for the device and parser layers. 2012-06-21 21:42:37 +02:00
Jef Driesen
9136a52835 Use common status codes for the device and parser layers. 2012-06-21 21:42:34 +02:00
Jef Driesen
e65025b501 Separate private and public headers.
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.
2012-06-21 21:39:24 +02:00
Jef Driesen
887d744e6d Use a more consistent typedef in the serial and irda backends. 2010-10-04 23:08:39 +02:00
Jef Driesen
d4766904f5 Add progress events for writing the user data segment. 2010-10-04 23:08:27 +02:00
Jef Driesen
12a918bacc Improve the error recovery during the handshaking phase.
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.
2010-10-04 23:08:15 +02:00
Jef Driesen
4e5c9ad8a3 Remove all debugging code. 2010-05-06 06:21:59 +00:00
Jef Driesen
76db1e6f44 Locate the header marker correctly in a longer sequence of zero bytes.
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.
2010-04-26 08:09:22 +00:00
Jef Driesen
39b78aa2eb Allow the first page to be empty.
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.
2010-03-23 14:44:02 +00:00
Jef Driesen
f6d35fa2c2 Add cancellation support.
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.
2010-02-15 13:16:26 +00:00
Jef Driesen
4b590ba5e2 Pass the fingerprint data to the callback function. 2010-02-04 10:46:42 +00:00
Jef Driesen
fab15b19a7 Add a clock synchronization event. 2010-02-01 21:20:30 +00:00
Jef Driesen
b392a49045 Update the code to use the new datetime support. 2010-02-01 21:20:11 +00:00
Jef Driesen
0edeed162a Skip dives without a footer marker.
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.
2009-12-08 08:43:59 +00:00
Jef Driesen
7f983e29fe Rewrite the incremental parser function. 2009-12-03 12:43:29 +00:00
Jef Driesen
12d0a73abf Rewrite the code to use buffer objects internally. 2009-12-03 12:43:09 +00:00
Jef Driesen
a49d2c7b36 Changed the device_dump() function to use the new memory buffer class.
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.
2009-11-10 11:36:10 +00:00
Jef Driesen
a4247b7505 Define the WARNING macro only once. 2009-08-06 14:15:52 +00:00
Jef Driesen
16191c0f51 Use the new array_isequal() function instead of a local function. 2009-06-19 08:51:34 +00:00
Jef Driesen
be2a27c58b Remove the handshake function from the public api. 2009-04-14 21:37:39 +00:00
Jef Driesen
572dfa5184 Add a function to retrieve the stored handshake packet. 2009-04-14 21:37:04 +00:00
Jef Driesen
67363ea05c Store the handshake packet in the device handle. 2009-04-14 21:36:44 +00:00
Jef Driesen
aa7599929e Wake-up the device automatically.
The backend is now in full control of the handshake sequence and does
automatically wake-up the device at the appropriate time.
2009-04-14 21:36:28 +00:00
Jef Driesen
b7fcd5442c Use a single function for writing the device parameters. 2009-04-14 21:36:07 +00:00
Jef Driesen
c1745cc535 Merge the typedef with the struct declaration. 2009-04-06 07:26:16 +00:00
Jef Driesen
5cb754b01b Store the clock calibration values in the device handle. 2009-03-11 15:02:49 +00:00
Jef Driesen
ce705f8244 Use the new byte order functions everywhere. 2009-03-11 10:18:28 +00:00
Jef Driesen
ebfd5b4b1a Always use the timestamp stored in the device handle. 2009-03-11 08:48:29 +00:00
Jef Driesen
11dc4715a4 Add fingerprint support for the Reefnet Sensus Original, Pro and Ultra. 2009-02-23 13:03:52 +00:00
Jef Driesen
4368b94ff0 Added basic support for the fingerprint feature. 2009-02-23 13:03:20 +00:00
Jef Driesen
64e3f4b4bf Add a device info event for the Reefnet Sensus Original, Pro and Ultra. 2009-02-20 12:25:25 +00:00
Jef Driesen
3ce6a725a9 Port the Reefnet Sensus Original, Pro and Ultra to the new event code. 2009-02-20 12:11:38 +00:00
Jef Driesen
eb9efb47e1 Check the length of the provided buffer space before the data transfer. 2009-02-11 10:43:44 +00:00
Jef Driesen
b434fa344b Fixed some warnings related to shadow variables. 2009-01-06 21:44:25 +00:00
Jef Driesen
596af5a17b Add LGPL license headers. 2008-10-05 20:14:18 +00:00
Jef Driesen
276f45acd2 Allow the library to be compiled as C++ code.
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.
2008-09-03 10:16:35 +00:00
Jef Driesen
dfeea21c36 Add explicit casts to improve type safety. 2008-09-03 08:51:07 +00:00