763 Commits

Author SHA1 Message Date
Jef Driesen
6ad8d61253 Fix the date/time for the Oceanic Geo 2.0. 2013-06-15 07:58:59 +02:00
Jef Driesen
d7c59dff58 Adjust the length based on the firmware version.
The OSTC 3 dataformat does contain the profile length twice: once in the
main 256 byte header, and again in the small profile header. However due
to a firmware bug, both values are not identical. The value in the main
header is wrong and 3 bytes larger than the value in the small profile
header. This bug was fixed in firmware version 0.93.

Unfortunately we rely on the length in the main header to calculate the
number of bytes to read when downloading the dive. The consequence is
that for all dives recorded with firmware 0.93 or later, the length is
calculated incorrectly, and the download fails. Luckily the firmware
version is stored in the main header too, and we can adjust the length
calculation accordingly.
2013-05-30 20:52:57 +02:00
Jef Driesen
890f5f0b5b Fix the temperature for the Aeris Atmos AI 2.
The temperature sign bit is reversed for this model.
2013-05-16 20:16:03 +02:00
Jef Driesen
d8bc4910b7 Post release version bump to 0.4.1. 2013-05-16 19:39:24 +02:00
Jef Driesen
bdd8e06786 Release version 0.4.0. v0.4.0 2013-05-13 23:50:52 +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
8cbfacc3ac Add a devinfo event.
The firmware version and serial number are stored in the final block
of each dive. That makes it very tricky to support the devinfo event
correctly. For an efficient implementation of the fingerprint feature,
the devinfo event should be emitted before downloading the manifests
or the dives. Fortunately it turns out it is actually possible to
retrieve the firmware version and serial number independently, using
the special identifier command.
2013-05-13 19:18:08 +02:00
Jef Driesen
2934c6a618 Shutdown the connection cleanly.
A shutdown command should be send to the device, before the connection
is actually closed. In the absence of this command, the device will
display an error, even if the data transfer itself was successful!
2013-05-13 19:16:46 +02:00
Jef Driesen
1a3c919a82 Fix temperature and tank pressure for the Tusa Element II.
The Tusa Element II is a non air integrated model, and the temperature
is stored at a different location.
2013-05-11 23:00:32 +02:00
Jef Driesen
1572a91f62 Add support for yet another Oceanic OC1 variant.
The only difference with the two other Oceanic OC1 variants is the new
model number. I have absolutely no idea what's the purpose of such a
silly change.
2013-05-11 07:16:25 +02:00
Jef Driesen
50fc64ac59 Limit the memory capacity to 256K.
The Mares Matrix, Puck Pro and Nemo Wide 2 have only 256K of memory,
which is 4 times less compared to the Icon HD. However for some unknown
reason, trying to download 1024K succeeds, and these devices just
repeat the same data 4 times. That's why we never noticed the
difference in memory capacity before.
2013-05-11 07:12:47 +02:00
Jef Driesen
c195404920 Add support for the Suunto DX.
The Suunto DX has support for 8 gas mixes (OC) and 3 diluents (CC).
Because it's still unknown how rebreather dives are stored, we simply
return all 11 gas mixes. For the rest, the DX data format is very
similar to that of the existing Suunto models, with only a few
different offsets here and there.
2013-05-11 07:00:51 +02:00
Jef Driesen
8f3eb48bfb Prevent an infinite loop.
When the number of parameters is zero, there are no sample values, and
the offset variable is never increased. The result is an infinite loop.
In practice this shouldn't happen because there should always be at
least one sample value (e.g. depth). But if a new data format is
available, which is not yet supported by the parser, we might be trying
to interpret the wrong byte.
2013-05-11 07:00:51 +02:00
Jef Driesen
ad0e187c0c Replace the hardcoded constants with a layout descriptor.
A side effect is that the mares_iconhd_extract_dives function now
requires a valid device handle. This shouldn't cause any real problems
because this function will likely become private some day.
2013-05-09 22:30:23 +02:00
Jef Driesen
51d6074bfe Use a new xml element for the gaschange events.
The new xml element makes the the gaschange events stand out more
against the other less important events. At the same time it also
demonstrates the decoding of the packed oxygen and helium percentages.
2013-05-09 21:09:52 +02:00
Jef Driesen
b5f3e30de4 Add a root element to the xml output.
Without the root element the output isn't valid xml. Although the
output is supposed to provide a human readable representation for
internal use only, and thus never really intended for processing by
third-party applications, it doesn't hurt to turn it into valid xml
either.
2013-05-09 21:09:52 +02:00
Jef Driesen
c550685bfc Update the msvc project file. 2013-05-09 21:07:01 +02:00
Jef Driesen
17d46813d8 Include the public header in the implementation file.
In the public header files, all symbols are marked extern C. When using
a C compiler, there is usually no problem if the header isn't included
in the C file. But the msvc build system uses the C++ compiler (due to
the use of some C99 features not supported by the msvc C compiler).
2013-05-09 21:06:03 +02:00
Jef Driesen
780440dffe Exclude device descriptors for unsupported devices.
Currently all device descriptors are included, regardless of whether
the device is actually supported by the library. If IrDA or USB support
is unavailable, a dummy backend is build which will always fail with
DC_STATUS_UNSUPPORTED. Thus there is no point in listing those devices
as being supported. Doing so will only confuse end-users.
2013-05-09 21:04:53 +02:00
Jef Driesen
5fdb1e9c82 Update the README with the new domain name. 2013-05-09 21:03:38 +02:00
Jef Driesen
b36ed311c5 Add support for the Heinrichs Weikamp OSTC3.
Although the communication protocol of the OSTC3 is nearly identical to
that of the Frog, the different size parameters make it hard to share
the code easily. On top of that, if we ever implement native bluetooth
communication support, we'll need a completely separate backend anyway.
Therefore the Frog backend is simply duplicated, with a few OSTC3
specific changes applied here and there.

The existing ostc parser is upgraded to support the new OSTC3 data
format.
2013-05-07 22:15:53 +02:00
Jef Driesen
86bdf0fbb4 Fix the gas change events for the Heinrichs Weikamp Frog.
The Frog stores the index of the initial gas mix at the same location
as the OSTC, but the gas mix percentages are at a different offset, and
the number of gas mixes is different too. Parsing all the gas mixes in
advance makes the code easier to read and more future proof.
2013-05-06 21:32:51 +02:00
Jef Driesen
c1893e9b0c Replace hardcoded constants with a layout descriptor.
With the layout descriptors, most hardcoded constants are now in a
central place, which will make it easier to add support for new data
format variants.
2013-05-05 08:39:21 +02:00
Jef Driesen
2203163a3a Move duplicated code to a common function. 2013-05-05 07:30:03 +02:00
Olivier Bussier
3ce237eee4 Fix the parsing of the gas mixes.
If the gas model flag is set to air, the individual gas mix definitions
are ignored, and a single mix with air is returned instead. For non-air
dives, only the gas mixes marked as active are returned.
2013-05-03 08:42:43 +02:00
Jef Driesen
c429947f25 Add a devinfo event containing the serial number. 2013-04-29 20:58:10 +02:00
Jef Driesen
9297e390a8 Flush the serial buffers after opening the port.
Sometimes there are garbage bytes present after opening the serial
port, which causes the communication to fail. Flushing the buffers
after a small delay is all it takes to get rid of those bytes.
2013-04-29 20:47:26 +02:00
Jef Driesen
20f813d5bc Fix a potential NULL pointer dereference. 2013-04-25 20:45:28 +02:00
Jef Driesen
f46e650a63 Add support for the Genesis React Pro White
The React Pro White appears to be a newer variant of the React Pro. For
the communication it uses the newer atom2 protocol, but the data format
remains (almost) the same as the older React Pro.
2013-04-25 20:43:56 +02:00
Jef Driesen
b185c1f62a Fix the temperature and year for the Genesis React Pro. 2013-04-23 21:42:06 +02:00
Jef Driesen
8a0efe2bfb Fix the sample rate for the Genesis React Pro.
This model doesn't support a 2 second sample rate. It appears the
possible sample rate values have been shifted by one to map the value
zero to a 15 second sample rate.

To avoid any trouble with possible out of range values, the index is
shifted in a circular way.
2013-04-23 21:42:06 +02:00
Jef Driesen
c7cc955b29 Use symbolic constants for the model numbers. 2013-04-23 21:42:06 +02:00
Jef Driesen
59b17858f4 Append the final block to each dive.
There are two good reasons for this change. First of all, it makes the
Predator data format more consistent with the Petrel data format, which
also has the final block appended to each dive. But even more important
is that we might actually need the information stored in the final block
someday.

The final block contains important information about the device, such as
the firmware and logbook version. Right now this information is simply
lost after the download. But if the data format ever changes to support
some new feature, we'll likely need that information to autodetect the
correct format.

Unfortunately this also changes the dive format in a non-backwards
compatible way. However, to minimize the inconvenience, the legacy
format (without the extra final block) remains supported in the parser.
2013-04-23 21:07:34 +02:00
Jef Driesen
7529ab8d5b Add additional descriptors for Uwatec devices. 2013-04-20 09:41:04 +02:00
Jef Driesen
2e5faae9da Avoid unnecessary large memory allocations.
Because the size of a dive isn't known in advance, we use the worst case
value of 0xFFFFFF (or nearly 16MB). However in practice, the real size
is many orders of magnitude smaller, even after the decompression.
Instead of pre-allocating a huge memory buffer, we now start with a much
smaller one, and increase when necessary.

For the predator and petrel manifests, where the size is known in
advance, we continue to pre-allocate the exact amount of memory as
before.
2013-04-19 21:31:28 +02:00
Jef Driesen
4b541d124f Add support for the native Shearwater Petrel protocol.
The Petrel (with updated firmware) supports an enhanced communication
protocol, which is more efficient and powerfull than the legacy Predator
compatibility mode. The new protocol uses data compression for faster
transfers and supports the ability to selectively download individual
dives. Last but not least, the new protocol isn't limited to the last
128kB of logbook data, but can access the full logbook capacity (16MB).
2013-04-19 21:31:28 +02:00
Jef Driesen
c4d3356b6e Add support for compressed data packets.
The new Petrel protocol uses a simple data compression scheme to reduce
the transfer times. The data is broken up into blocks of 32 bytes each.
Each block except the first is XOR'ed with the previous block, creating
large runs of zeros due to the similarity of the data. The zeros are
then run-length encoded (RLE) to save space.
2013-04-16 22:26:41 +02:00
Jef Driesen
6f3de69f0d Move the low-level communication to a common file.
This is done in preparation for the implementation of the new Petrel
protocol, which shares the low level communication with the existing
Predator protocol.
2013-04-16 22:26:41 +02:00
Jef Driesen
389933400f Replace hardcoded constants with parameters. 2013-04-16 21:39:19 +02:00
Jef Driesen
d4a8f2eb40 Add support for retrieving the transport type.
With the new interface, an application can easily retrieve the
underlying transport type from the device descriptors and present a
custom user interface element to the end-user for supplying transport
specific parameters. For example the serial port for devices using
serial communcication.

For devices using a usb-serial chipset or the bluetooth Serial Port
Profile (SPP/rfcomm), the transport type is DC_TRANSPORT_SERIAL, because
internally the serial emulation layer is used for the communication.
2013-04-16 20:54:25 +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
Dirk Hohndel
13950c0ca1 Fix time conversion for Shearwater computers
The time read from the Shearwater is already in localtime.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26 18:41:57 +01:00
Jef Driesen
a9b7edfde3 Add support for the Mares Nemo Steel and Titanium.
These two models are simply a variant of the normal Mares Nemo with a
different material on the outside.
2013-03-19 21:59:40 +01:00
Jef Driesen
4adac6f5c9 Add support for the Oceanic Pro Plus 3. 2013-03-19 07:48:36 +01: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
7323ba0f2d Re-order the decostop array to match the enum values.
The enum values have been re-ordered a while ago, but the array was not
updated to reflect those changes.
2013-03-10 20:57:19 +01:00
Jef Driesen
9fb5e1f566 Add support for the Aeris Atmos 2. 2013-03-03 23:45:27 +01:00
Cristian Ionescu-Idbohrn
63d0f41758 Add a gitignore file.
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
2013-02-28 22:37:47 +01:00
Jef Driesen
5bea3156fd Add support for the Aeris Elite. 2013-02-07 13:11:18 +01:00