1214 Commits

Author SHA1 Message Date
Jef Driesen
c8b2d89354 Set the default model number.
When the device family is provided without an explicit model number, we
simply choose the first available model. But since new models are being
added all the time, this default model is not guaranteed to remain the
same. That's not desirable because it can alter the behaviour of the
application.

The introduction of the Aeris 500AI is an example of this problem. The
default model in the vtpro family used to be the Oceanic Versa Pro. But
because the Aeris 500AI has a lower model number, it automatically
became the new default model. Since both use a different protocol
variant (MOD vs INTR) they are not interchangable.

The default model is now hardcoded. The best option is of course to
provide the model number explicitly!
2016-07-11 21:49:16 +02:00
Jef Driesen
335539f179 Merge branch 'aeris500ai' 2016-07-11 21:48:58 +02:00
Jef Driesen
92f84b5945 Refactor the oceanic download function.
The large and complex oceanic_common_device_foreach() function is
refactored into two independent helper functions. One for reading the
entries in the logbook ringbuffer, and another for reading the profile
data.
2016-07-11 21:47:29 +02:00
Jef Driesen
aaa7fbe08d Add support for the Aeris 500AI.
The Aeris 500AI is quite different from the other vtpro compatible
models. First, it uses the INTR protocol variant. Next, it doesn't
appear to have a logbook ringbuffer. Instead it supports a new read
logbook index command (0x52) that returns the logbook entries. This
requires a custom implementation of the logbook function.
2016-07-11 21:47:29 +02:00
Jef Driesen
9c251b6814 Ignore samples with all 0xFF bytes. 2016-07-11 21:47:29 +02:00
Jef Driesen
5824254cf5 Add support for the INTR protocol variant.
There are two variants of the vtpro communication protocol: the existing
MOD variant and the new INTR variant. The main difference is in the
initialization sequence, with two completely different response packets:

   MOD--OK_V2.00
   INTR-OK_V1.11

The INTR variant does not appear to return useful information in the
version packet.
2016-07-11 21:47:29 +02:00
Jef Driesen
b41ecd0c15 Add a parameter with the model number. 2016-07-11 21:47:29 +02:00
Jef Driesen
9bae07551f Allow custom logbook and profile functions.
By adding the logbook and profile functions to the vtable, a dive
computer backend can now easily replace the default implementation with
a custom one, without having to duplicate the common code.
2016-07-11 21:47:29 +02:00
Jef Driesen
4ba92e24ef Fix a crash when no dives are present.
To guard applications from divisions by zero, the progress event code
asserts the maximum value should always be non-zero. The eonsteel does
trigger this assert when there are no dives present.
2016-07-11 13:14:15 +02:00
Jef Driesen
1e22760f91 Fix the memory layout for the Aqualung i300.
The profile ringbuffer ends at 0xFE00 instead of 0x10000.
2016-06-23 08:48:45 +02:00
Jef Driesen
47037286a2 Fix the sample rate for the Aqualung i450t. 2016-06-13 15:17:58 +02:00
Jef Driesen
375fe2f6a7 Fix the nitrox gas mix parsing.
Mares Darwin compatible devices support a nitrox mode. The nitrogen
percentage should only be taken into account when the dive mode is set
to nitrox, because the last used value remains in place for air dives.
2016-06-03 08:19:42 +02:00
Jef Driesen
cb3b372b5b Add support for the dive mode field. 2016-06-03 08:13:55 +02:00
Jef Driesen
73a06407b8 Fix the length of the Vyper Novo gas change event.
Just like the Suunto DX, the Vyper Novo uses 5 bytes for the 0x06 gas
change event.
2016-06-02 08:27:24 +02:00
Jef Driesen
8f776cc55e Add support for the Aqualung i300. 2016-05-16 09:06:57 +02:00
Jef Driesen
d1aa9478a4 Merge branch 'refactor' 2016-05-10 20:22:07 +02:00
Jef Driesen
f8417037c6 Convert operating system errors.
Errors reported by system calls are now converted to the corresponding
libdivecomputer status code. This results in a more descriptive and
meaningfull return value.
2016-05-10 11:52:32 +02:00
Jef Driesen
4fd0118d4e Add support for 1.5 stopbits. 2016-05-10 11:35:03 +02:00
Jef Driesen
72bd82f0a3 Add support for space and mark parity. 2016-05-10 11:35:03 +02:00
Jef Driesen
84563c6303 Refactor the internal serial and IrDA api.
The low level serial and IrDA functions are modified to:

 - Use the libdivecomputer namespace prefix.

 - Return a more detailed status code instead of the zero on success and
   negative on error return value. This will allow to return more
   fine-grained error codes.

 - The read and write functions have an additional output parameter to
   return the actual number of bytes transferred. Since these functions
   are not atomic, some data might still be transferred successfully if
   an error occurs.

The dive computer backends are updated to use the new api.
2016-05-10 11:34:57 +02:00
Jef Driesen
dbba7f3272 Fix the date for the Sherwood Insight 2. 2016-04-27 16:20:04 +02:00
Jef Driesen
33f5206f79 Add support for the Beuchat Mundial 2 and 3.
These two models use the same memory layout and data format as the
Oceanic F10.

Reported-By: Nick Shore <support@mac-dive.com>
2016-04-27 09:09:06 +02:00
Jef Driesen
3978dea153 Merge branch 'eonsteel' 2016-04-26 21:04:32 +02:00
Jef Driesen
d40cdb4755 Add the devinfo event.
The devinfo event with the device serial number is required for the
fingerprint feature. Without this event, applications won't be able to
load (or save) the correct fingerprint. All necessary information is
already available in the initial handshake packet.
2016-04-26 10:59:02 +02:00
Jef Driesen
76c52b582a Add support for the fingerprint feature. 2016-04-26 10:56:52 +02:00
Jef Driesen
ce82829284 Fix a memory leak.
A new buffer is allocated for each dive, but only the last one is freed.
Since the code is already prepared to simply re-use the same buffer,
there is no need to allocate those extra buffers.
2016-04-26 10:56:48 +02:00
Jef Driesen
0899486378 Add support for the new DX data format.
Just like the D4i and D6i, the new header is a few bytes larger. The
correct variant can again be detected by means of the logbook id tag at
the start of the header.
2016-04-19 09:02:52 +02:00
Jef Driesen
018c27d7b3 Add support for the Aqualung i450T. 2016-03-31 13:26:34 +02:00
Jef Driesen
f3fb2391f9 Add support for the Cressi Newton.
The Cressi Newton appears to be compatible with the Leonardo and Giotto.
2016-03-29 16:34:59 +02:00
Jef Driesen
469717a2a1 Add support for imperial units in the xml output.
Libdivecomputer always uses metric units internally. But when reverse
engineering a device that stores everything using imperial units, it's
very convenient to be able to switch the output to imperial units too.
2016-03-29 16:34:27 +02:00
Jef Driesen
8ab3fb0542 Always close the xml tags.
The dive and sample xml tags were not closed properly if an error
occurred during parsing.
2016-03-27 22:02:52 +02:00
Jef Driesen
c8b166dadb Get the gas mixes from the sample data.
The Shearwater devices support adding, removing or editing gas mixes
during the dive. The pre-defined gas mixes available in the opening and
closing block are only a snapshot of the configuration at the start and
at the end of the dive. Thus by editing the gas mixes during the dive
it's possible to switch to a gas mix that is not present in the opening
(or even the closing block). The parser doesn't support that.

To avoid this problem, we now collect the available gas mixes from the
sample data. As a side effect we only return those gas mixes that are
effectively used during the dive.
2016-03-23 10:50:21 +01:00
Jef Driesen
c964fa5ad9 Cache the dive mode internally.
This simply moves the code to the get the dive mode from its own
function into the existing caching function.
2016-03-23 10:50:21 +01:00
Jef Driesen
0bb3f7ebd1 Add support for the Shearwater Perdix. 2016-03-23 10:48:59 +01:00
John Van Ostrand
9a4e2b75a5 Add support for the Cochran Commander and EMC. 2016-03-22 20:09:45 +01:00
Jef Driesen
280f1871f0 Add support for the Uwatec Aladin Sport.
The Aladin Sport appears to be compatible with the Aladin 2G.
2016-03-17 08:22:39 +01:00
Jef Driesen
50ba063a46 Add support for the Suunto Zoop/Vyper Novo.
The Zoop Novo and Vyper Novo are compatible with respectively the D4i
and D6i.
2016-03-11 10:36:05 +01:00
Jef Driesen
63dcee9eaa The new D6i data format support 3 gas mixes. 2016-03-11 10:35:46 +01:00
Jef Driesen
2e64d47dff Add support for the new D4i and D6i data format.
One of the newer D4i and D6i firmware versions (for example v1.5.9),
introduces a new variant of the data format. The new dive header is 8
bytes larger. The correct variant can be detected by means of the
logbook id tag at the start of the header.
2016-03-09 14:14:10 +01:00
Jef Driesen
42e234a0f9 Merge branch 'ostc4' 2016-03-07 13:10:48 +01:00
Jef Driesen
dbd604abb0 Add support for the HW OSTC 4.
Except for the firmware update and a few other minor differences, the
new OSTC4 is backwards compatible with the OSTC3.
2016-03-01 21:26:43 +01:00
Jef Driesen
f0c442751d Read and cache the hardware descriptor.
By reading the hardware descriptor immediately after entering download
or service mode, we can identify the specific model and adapt to minor
differences in the communication protocol.
2016-03-01 21:26:43 +01:00
Jef Driesen
6ce83347f0 Pass an array to the checksum function. 2016-03-01 21:26:43 +01:00
Jef Driesen
90cf480c25 Fix the OSTC3 missing initial gas mix detection.
For the OSTC3 compatible devices, a missing initial gas mix (e.g. no gas
marked as the first gas) leaves the initial gas mix index at its default
value of zero. This is different from the OSTC2 compatible devices,
where a missing initial gas is stored as the value 0xFF.

By initializing the index with the value 0xFF, the existing detection
works for both variants.
2016-02-26 08:25:55 +01:00
Jef Driesen
5629bdd87a Merge branch 'dctool' 2016-02-26 08:25:05 +01:00
Jef Driesen
83e54d84a2 Add support for the parse command. 2016-02-26 08:24:11 +01:00
Jef Driesen
e8b9e88171 Integrate the new output formats.
The existing output code is removed and replaced with the new XML and
RAW output formats. The desired output format can be selected with a new
command-line option. The XML format remains the default output format.
2016-02-26 08:24:11 +01:00
Jef Driesen
5d9ddafc41 Add support for the raw output format.
The RAW output format exports each dive to a raw (binary) file. To
output multiple files, the filename is interpreted as a template and
should contain one or more placeholders.
2016-02-26 08:23:55 +01:00
Jef Driesen
e35f0a3ff4 Add support for the xml output format.
The XML output format exports all dives to a single xml file.
2016-02-26 08:23:45 +01:00
Jef Driesen
195702046c Add a new abstract output interface.
The new output interface provides the necessary infrastructure to add
support for multiple output formats. Due to the abstract interface, each
new format will require only minimal changes in the application itself.
2016-02-26 07:55:40 +01:00