1139 Commits

Author SHA1 Message Date
Anton Lundin
138fd856bd Add deco model info strings to shearwater parser
This adds two strings describing the deco model information of the dive.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
v4.5.0
2015-10-14 05:52:53 -07:00
Dirk Hohndel
1ccf937aa3 Merge branch 'master' into Subsurface-branch 2015-10-13 19:23:32 -07:00
Giorgio Marzano
95bdea93cd Use the correct memory layout and packet size. 2015-10-05 15:11:34 +02:00
Dirk Hohndel
da0073c971 Merge branch 'master' into Subsurface-branch 2015-10-02 06:18:51 -04:00
Giorgio Marzano
cb06adef35 Add support for the Mares Smart Apnea.
The Mares Smart Apnea uses a different data format than the regular
Smart, because it records not only a summary of each freedive in the
session, but also a full depth profile.

Because both the regular Smart and the Smart Apnea have the same model
number (0x10), another way to distinguish the two variants is needed.
Therefore, the Smart Apnea gets a modified model number, with one of the
higher bit set. The actual type is detected from the contents of the
version packet.

The new Smart Apnea is also capable of recording multiple samples per
second (e.g. 2, 4 or 8). But since our smallest unit of time is one
second, we can't represent this, and the extra samples will get dropped
for now.
2015-09-30 08:19:59 +02:00
Jef Driesen
3fa606a8a2 Fix the gas switches for Galileo Trimix.
The Galileo Trimix supports up to 10 tanks and gas mixes. However, the
existing alarm based gas switch events have only 2 bits available, and
can support at most 4 gas mixes. Therefore, the trimix variant stores
another 4 bit value in the second alarm byte.

For the first three gas mixes (and possibly also the fourth), both alarm
bytes appear to be always set to the same value. For the higher mixes,
the value in the first alarm byte is always zero. This doesn't cause any
problems, because in the data stream the second alarm byte is stored
after the first one, and our final value is always the last one.

The non-trimix variant also has the second alarm byte, but the gas mix
bits appear to be always zero. In order to avoid taking this zero as the
final value, a separate table is used for the trimix variant.
2015-09-17 11:24:16 +02:00
Jef Driesen
52453f080d Add support for the tank field.
The air integrated uwatec aladin models do record the total consumption,
and not the begin/end pressure. Returning the total consumption as the
begin pressure, combined with a zero end pressure is strictly speaking
not correct, but it still provides useful information.
2015-09-11 22:41:46 +02:00
Jef Driesen
ddbcdeecbb Ignore disconnected O2 sensors.
Even if there are no O2 sensors connected (for example in auto or fixed
setpoint mode), the device records a ppO2 sample with all three values
set to zero. Such samples are now ignored, as if there was no ppO2
sample present.

Reported-by: Anton Lundin <glance@acc.umu.se>
2015-09-10 09:25:06 +02:00
Jef Driesen
c72bdfe4e4 Add support for logging I/O operations.
The Atomics Cobalt backend uses libusb directly, without going through
an internal I/O layer that support logging. Therefore the logging needs
to be done in the backend itself.
2015-09-07 22:51:44 +02:00
Claudiu Olteanu
8932b2a936 Fix dc_serial_native_open return check for Shearwater family
The dc_serial_native_open method doesn't return -1 on failures.
The failure errors can be DC_STATUS_INVALIDARGS, DC_STATUS_NOMEMORY,
DC_STATUS_IO.

Therefore we should check if the returned value is equal to
DC_STATUS_SUCCESS and pass it further.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-07 07:33:51 -07:00
Dirk Hohndel
9c7d1102d4 Fix compile errors on Mac
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-04 10:43:37 -07:00
Jef Driesen
55afe711f7 Fix the layout for the Oceanic Pro Plus 3.
The logbook ringbuffer starts at address 0x03E0 instead of 0x240. Since
none of the other models uses the same address, a completely new layout
structure is necessary.
2015-08-29 09:16:49 +02:00
Jef Driesen
3ff890b3e2 Improve the detection of unused tanks.
The begin/end pressure for unused tanks is normally zero. But I noticed
that in some cases both pressure values are stored as 0xFFFF. Since that
corresponds to a pressure of 511.99 bar, this is most likely some
special magic value, and not a valid pressure.

Tanks where either the begin or end pressure is 0xFFFF are now ignored
too.
2015-08-28 07:28:26 +02:00
Claudiu Olteanu
ad4bcffa23 Use custom set_timeout callback for Shearwater family
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
sync-point sync-point-clean
2015-08-26 10:48:47 -07:00
Claudiu Olteanu
f103553df1 Use the custom set_timeout callback for HW_OSTC 3 family
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:48:38 -07:00
Claudiu Olteanu
a6274a3a55 Add set_timeout callback for serial custom implementation
The new callback will be usefull when we will implement the support
for Windows. The implementation of native serial set_timeout method
uses a HANDLER on Windows and we will use the WinSock2 API which has
a socket descriptor.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:48:32 -07:00
Gaetan Bisson
adfff2d4a7 Add new functions to list of exported symbols
This is required in order to build those new public functions into the
shared library.

Signed-off-by: Gaetan Bisson <bisson@archlinux.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:48:25 -07:00
Linus Torvalds
f0e695b089 EON Steel: expose the gas switch cylinder in the "flags" field
This seems to be the simplest extension to the SAMPLE_EVENT_GASCHANGE2
format: the "value" remains the oddly encoded gas mix, but the "flags"
value (if non-zero) now contains the actual cylinder number we switch
to.

This will need a trivial patch to subsurface to take advantage of the
new data too.  But then we can actually distinguish between cylinders
that have the same gas mix.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:48:09 -07:00
Linus Torvalds
fe2448e34f Add EON Steel personal adjustment parsing
Suunto calls it "Conservatism" in the dump, but "Personal adjustment" in
at least some of the documentation. That's what we expose it as.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:48:00 -07:00
Linus Torvalds
7fd201a400 Add EON Steel dive mode and transmitter ID information
This adds the divemode name (Nitrox, Trimix, Gauge, or whatever custon
name) and the transmitter ID as extra string information when
downloading from the EON Steel.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:47:54 -07:00
Linus Torvalds
c39dda89bc Suunto EON Steel: populate various string data
The EON Steel saves the dive computer firmware versions etc per dive,
which is really nice for upgrades: old dives done with older firmware
still show the firmware at the time of the dive.  That, in turn, is nice
because we can use it for a reliable dive ID - dive time with serial
number etc.

This uses the new DC_FIELD_STRING model to feed the hw/sw information to
the application, since we need the parser to access it.  It also returns
battery state and deco model information.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:47:48 -07:00
Claudiu Olteanu
0c8886ce70 Implement custom open device method for SHEARWATER family
Create a custom open method for SHEARWATER family.
This method can be used to pass a reference to a dc_serial_t
structure. In this way the applications can implement their
own implementation for a serial communication and set their
callbacks for the basic serial functions.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:47:33 -07:00
Claudiu Olteanu
53ccc4f43b Use the dc_serial_t structure in SHEARWATER family
Use the new structure in the SHEARWATER family implementation.
This patch opens a native serial device and use it
for the serial communication.

Also the patch uses the set of callback functions saved in the
dc_serial_t structure.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:47:33 -07:00
Claudiu Olteanu
8c3e44aa0c Implement custom device open method
This method can be used by external applications to open a
device and to pass their custom implementation for the
serial communication.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:47:33 -07:00
Claudiu Olteanu
5dbaa7a053 Implement custom open method for HW OSTC 3 family
Create a custom open method for HW OSTC3 family.
This method can be used to pass a reference to a dc_serial_t
structure. In this way the applications can implement their
own implementation for a serial communication and set their
callbacks for the basic serial functions.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:47:33 -07:00
Claudiu Olteanu
69bd993233 Use the dc_serial_t structure in HW OSTC family 3
Open a native serial device and use it in the HW OSTC3
implementation.

This patch replaces the old serial structure with the
new one, which can be used for custom serial implementations.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:47:33 -07:00
Claudiu Olteanu
a50a1e0688 Create a generic way to represent any type of serial communication
Add a structure which holds references to basic operations
on a serial communication. This can be used to pass a set
of function pointer callbacks in order to create a custom
implementation for serial communication.

Add a generic structure to represent the needed information
for a serial communication.

Implement the initialization method where the user can
pass a set of function pointer callbacks and set some
custom data for the serial device.

Create open method for the native serial implementation.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:47:33 -07:00
Claudiu Olteanu
b9e3f40d59 Extend the transport enum descriptor for serial communication
Add a new transport type which can be used to identify
Bluetooth serial communication.

Signed-off-by Claudiu Oleanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:47:33 -07:00
Anton Lundin
f184b45e09 Correct firmware version string from OSTC's
The format string was incorrect, producing firmware numbers as 3.2
instead of 3.02 as is the current OSTC firmware version.

This was reported via hw's forum:
http://forum.heinrichsweikamp.com/read.php?2,14550,14552

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:47:33 -07:00
Dirk Hohndel
0ff1dd15f5 Predator: don't report PPO2 unless in CC mode
Sending this in OC mode is redundant and might confuse applications that
assume they only get PPO2 data in CC mode.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:47:33 -07:00
Dirk Hohndel
fb15ef18f6 Don't report errors if we can't set serial mode
That's just silly and breaks using the simulator.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:47:33 -07:00
Anton Lundin
3a17156be6 Add deco model info strings to hw parser
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:47:33 -07:00
Dirk Hohndel
1f24f67565 Make it easier to detect our branch of libdivecomputer
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:47:18 -07:00
Dirk Hohndel
5ecc65799c Mark a library built from our branch as such
This way it will be obvious when people report their libdivecomputer
version that they are using our branch

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:46:55 -07:00
Linus Torvalds
ddfdb6c306 Fix suunto serial numbers
libdivecomputer has already done the "byte to decimal" conversion.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:41:50 -07:00
Dirk Hohndel
b85f2333be Support serial number for Suuntu Vyper2 family of devices
We have the correct firmware in the devinfo, but that's the firmware the
dive computer is on NOW, not necessarily the firmware it was using when
recording the dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:41:43 -07:00
Dirk Hohndel
06426af656 Support firmware and serial number for Shearwater Petrel
This should work with the Predator as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:41:20 -07:00
Dirk Hohndel
f459155b54 Support serial number as DC_FIELD_STRING on atom2 backend
This has been verified with a few of the models, it needs much more
testing to make sure this is generally correct.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:40:35 -07:00
Dirk Hohndel
ebe6704747 Add support to return serial number to OSTC devices
This data isn't per dive, but it makes sense to return it here as a
string (we already return it as unsigned int in the devinfo event after
opening the device).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:40:09 -07:00
Dirk Hohndel
5f76249923 Pass the serial number from the devinfo to the OSTC parsers
This way we can analyze the data in the parser and return it to the
application.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:39:52 -07:00
Dirk Hohndel
0ddec2b50f Support FW Version on OSTC devices
And add battery voltage and desat for the Frog.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:39:45 -07:00
Dirk Hohndel
8f4038d4cd Add DC_FIELD_STRING support to OSTC parser
Just support a few of the most useful values. There are several more we
could and should add.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:39:36 -07:00
Dirk Hohndel
d90417da38 Add DC_FIELD_STRING support to Shearwater Petrel parser
Just support a few of the most useful values. There are several more we
could and should add.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:14:57 -07:00
Dirk Hohndel
f902f5882c Add DC_FIELD_STRING support to Atomics Aquatics Cobalt parser
Just support a few of the most useful values. There are several more we
could and should add.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:14:09 -07:00
Linus Torvalds
eac8e98ee7 parser: add DC_FIELD_STRING field type for parse-time information
This can be used to return almost arbitrary information to the dive log
application at dive parse time, by returning a number of strings (with a
descriptor) for dive state.

NOTE! The strings are supposed to be human-readable, so that the dive
log application can just show them unedited - and without understanding
them - to the user, together with the description.  So if your dive
computer supports returning a battery voltage, for example, you can
return it as a

  { "Voltage", "4.449V" }

descriptor/value string pair, and the application could then put these
string pairs together and show (somewhere) an informational line like
"Voltage: 4.449V" along with the other information you return.

Some dive log applications migth recognize particular descriptor strings
and use them specially to fill in other information (ie serial numbers,
weight and suit information etc), but in general the interface is very
much meant to be informational free-form for a human user.

So do *not* use this interface to encode things that are not human-
readable.  Serial numbers or version information that is meaningful to
humans are fine. But random encoded data structures are not.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 10:13:51 -07:00
Jef Driesen
5381714d08 Fix a bug in the tank id.
Due to a bitshift with the wrong number of bits, the tank id was always
zero for the Uwatec trimix firmware.
2015-08-20 09:08:56 +02:00
Jef Driesen
922d219bdc Add support for the tank field. 2015-08-10 13:10:44 +02:00
Jef Driesen
2fafcc7ae2 Disable all gas mixes in gauge/freedive mode. 2015-08-06 12:00:10 +02:00
Jef Driesen
04ffc894c9 Add support for ppO2 samples.
When the PPO2 sample was introduced, we didn't take into account the
fact that rebreathers usually support multiple O2 sensors. The HW OSTC
supports for example three sensors. In order to support multiple values,
without having to introduce a new data structure with an additional
sensor id field, we simply relax the assumption of allowing only one
DC_SAMPLE_PPO2 value per sample. Applications that are not prepared for
multiple values, will automatically use only one of them (probably the
last one).
2015-08-06 08:50:14 +02:00
Jef Driesen
a8f06c5c3c Add support for the new compact logbook headers.
With firmware version 1.84 (beta), a more compact logbook header is
introduced. Due to their smaller size (16 vs 256 bytes), the total
amount of data that needs to be transferred is much smaller (4K vs 64K).
Therefore, downloading these compact headers is roughly 16 times faster
then downloading the full headers.

For backwards compatibility with older firmware versions, there is an
automatic fallback to the full logbook headers.
2015-08-02 21:22:32 +02:00