43 Commits

Author SHA1 Message Date
Jef Driesen
52cac91b18 Implement the temperature support for several devices.
The new temperature fields are now supported by devices from these
manufacturers:

 * Atomic Aquatics
 * Heinrichs Weikamp
 * Mares
 * Suunto
 * Uwatec
2014-11-07 21:58:49 +01:00
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
861b5652e0 Add support for parsing gas changes.
Parsing the gas switch events is somewhat complicated, because depending
on the actual model, they can be stored in different ways.

The table below lists the number of gas mixes (G), tanks (T) and alarm
bytes (A) supported by each model. Note that only the representative
model in each group is listed.

  Model         | G | T | A
  ==============|===|===|===
  Pro           | 1 | 0 | 1
  Com           | 1 | 1 | 1
  Tec           | 3 | 3 | 1
  Aladin Tec    | 1 | 0 | 2
  Aladin Tec 2G | 3 | 0 | 2
  Galileo       | 3 | 3 | 3

Models without support for multiple gasmixes only need to set the
initial gas mix correctly. Models with support for one or more tank
pressure sensors can link the gas switches to the tank switches. Models
with at least two alarm bytes can store a gas switch event in the second
alarm byte.

As can be observed from the table, some models can use several different
methods to store the gas switches. The current implementation supports
all of them. In the case of a conflict, the last used method always
takes precedence. That's simply due to the fact that each method just
sets the gasmix index, and only the final value is used. If this
approach turns out to produce wrong results, it can always be fixed
later.

The initial gasmix is always assumed to be the first configured gasmix.
2014-03-09 12:57:52 +01:00
Jef Driesen
68f97e907a Use only one byte for the oxygen percentage.
One byte is already more than sufficient to store an oxygen percentage.
Using two bytes doesn't cause any problems for some models, because the
upper byte is always zero, but for other models that's not the case.
Most likely this upper byte is used to store something else.
2014-03-09 12:57:52 +01:00
Jef Driesen
48661ce7a8 Fix the gasmix offset for the Aladin Tec 2G. 2014-03-09 12:57:52 +01:00
Jef Driesen
b9e8fdcb52 Use the same tables for the Uwatec Smart Tec and Z.
Internal, these two models use exactly the same data format. For those
features which are only available on one of the models, the
corresponding data fields are set to their unused values. For example,
the Smart Tec supports up to three gasmixes, while the Smart Z supports
only one gasmix. But although the Smart Z has storage reserved for up to
three gas mixes, only the first one is ever used.
2014-03-09 12:57:52 +01:00
Jef Driesen
3536086015 Check the buffer size before using the data.
For the Galileo Trimix, the header length isn't fixed. The actual length
depends on whether the dive has the trimix setting enabled or not.
Because at this point we're still trying to determine the length of the
header, it hasn't been checked yet and an extra check is necessary.
2014-03-09 12:57:52 +01:00
Jef Driesen
8da80ea0a2 Store the pointers to the tables in the device handle.
Because for selecting the correct header and sample tables (and
associated data) only the model number is necessary, they can easily be
stored inside the device handle. The main benefit is less duplicated
code.
2014-03-09 12:57:52 +01:00
Jef Driesen
56aa3b6669 Merge branch 'release-0.4'
Integrate the bugfixes from the stable branch.
2014-02-06 20:31:27 +01:00
Jef Driesen
c524986175 Add support for the Scubapro/Uwatec Meridian.
The Uwatec Meridian protocol is identical to the Uwatec Smart/Galileo
protocol, except for some additional framing around each data packet,
and the switch from IrDA to usb-serial communication. For parsing, the
data format appears to be identical to the Galileo data format.
2013-10-19 10:11:15 +02:00
Jef Driesen
6f7495dd3e Add support for a new Uwatec Aladin 2G variant.
This new variant has a different model number and has switched to the
Uwatec Galileo data format.
2013-09-19 08:56:40 +02:00
Jef Driesen
ee8b4e36ad Merge branch 'release-0.3'
Integrate the bugfixes from the stable branch.
2013-05-13 23:49:37 +02: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
276be51a65 Fix the decoding of negative temperatures.
Because temperatures can be negative, we should interpret the stored
value as a signed integer, even for the absolute values.
2013-03-17 08:45:33 +01:00
Jef Driesen
2f8ec75c7c Merge branch 'release-0.1'
Integrate the bugfixes from the stable branch.
2012-09-21 21:24:04 +02:00
Jef Driesen
ddf6fca65f Add support for the Uwatec Galileo Trimix. 2012-09-20 20:40:38 +02: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
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
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
2b77a52e89 Use symbolic constants for the model numbers. 2011-05-06 18:04:40 +02:00
Jef Driesen
6467f6353d Fixed a mistake in the type detection code. 2011-05-05 20:53:08 +02:00
Jef Driesen
643c04eca3 Implement the new field api for the Uwatec devices. 2011-01-13 22:14:53 +01:00
Jef Driesen
90e60fecee Add a new function to the public api to retrieve the dive metadata. 2011-01-13 22:14:53 +01:00
Jef Driesen
154f767a9c Convert assertions into error codes. 2011-01-08 23:40:15 +01:00
Jef Driesen
ec774d3426 Shorten the type detection code with bit manipulations. 2011-01-08 23:40:15 +01:00
Jef Driesen
911513c578 Use the correct number of alarm bytes for each model. 2010-07-29 13:39:52 +02:00
Jef Driesen
0f5b6028ef Copy missing sample values from the previous sample.
The Uwatec Smart stores a sample value only when it's diffent from the
previous value. While this compressed format does save some space on the
device, it is less practical for use in an application. The original
uncompressed data can easily be obtained by copying missing sample
values from the previous sample.

The implementation uses a two pass approach. In the first pass, all
sample values that are explicitly stored in the profile date are
collected. Any sample value that is not present, will automatically
retain the value from the previous sample. In the second pass, all
sample values are passed back to the application. The presence of an
absolute value is used to decide which sample types are present in the
data.
2010-07-29 13:36:43 +02:00
Jef Driesen
10377f969a Keep only a single type for both absolute and delta values. 2010-07-28 16:47:25 +02:00
Jef Driesen
441aad3a40 Add support for the Uwatec Aladin Tec 2G. 2010-05-19 20:01:44 +02:00
Jef Driesen
a8116a0aec Add datetime support to the parsers. 2010-02-02 15:04:46 +00:00
Jef Driesen
a4247b7505 Define the WARNING macro only once. 2009-08-06 14:15:52 +00:00
Jef Driesen
23ea0d5e18 Added some explicit casts to be able to build with a C++ compiler. 2008-12-04 15:09:54 +00:00
Jef Driesen
25d2f51870 Merge the Uwatec Smart and Galileo parsers. 2008-11-10 20:30:56 +00:00
Jef Driesen
03b7e3091e Prepare to merge the Uwatec Smart and Galileo parsers. 2008-11-10 20:30:40 +00:00
Jef Driesen
019b807e0f Port the changes from r179 to the Uwatec Smart parser. 2008-11-10 20:30:27 +00:00
Jef Driesen
53bb7778c7 Set the initial rbt value to 99.
Some models omit the absolute rbt value in the profile data.
2008-10-31 14:06:17 +00:00
Jef Driesen
a5cabb5550 Use only 1 byte for the alarms. 2008-10-31 14:05:31 +00:00
Jef Driesen
56c2893758 Ignore data bits that are stored in the last type byte for some samples. 2008-10-31 14:05:15 +00:00
Jef Driesen
52f7d01380 Added a parser for the Uwatec Smart. 2008-10-31 14:04:59 +00:00