Rough merge of upstream libdivecomputer.
This is mainly about making the new iostream code upstream, although we
don't actually use it.
It abstracts out the the old serial and usbhid code, but we end up still
using our own 'custom_io' interface because the iostream code doesn't do
it right.
* jef/master:
Correctly determine git SHA if libdivecomputer is a git submodule
Don't accept a NULL pointer as parameter
Add support for semi-closed circuit diving
Detect dives with invalid profile data
Implement the serial communication functions as no-ops
Move the socket code to a common file
Add support for a custom I/O implementation
Port the USB HID code to the new I/O interface
Port the bluetooth code to the new I/O interface
Port the IrDA code to the new I/O interface
Port the serial code to the new I/O interface
Add a new abstract I/O interface
Post release version bump to 0.7.0
Add a new type to distinguish between closed circuit (CCR) and
semi-closed circuit (SCR) diving. Some dive computers from HW and
DiveSystem/Ratio support this.
Because the CCR/SCR abbreviations are more commonly used, let's take the
opportunity to also rename the existing DC_DIVEMODE_CC. To preserve
backwards compatibility, a macro is added to map the old name to the new
one.
Reported-by: Jan Mulder <jlmulder@xs4all.nl>
And remove the nasty and disgusting transmitter data handling code that
Dirk added to work around his misunderstanding of the parsing code.
This code now collects the various states of the transmitter batteries
throughout a dive and reports the most meaningful summary in the end. It
also rewrites the rest of the string handling code to be architecturally
cleaner.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This should be a STRING callback, but those come from the header and we
don't have the information until after we have parsed all the samples.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a rough merge of the upstream libdivecomputer changes.
I say "rough", because this disables the custom serial code as it
clashes very badly with Jef's new dc_serial_t abstraction.
Anton Lundin has patches on top of this to re-introduce the custom code
in a way that integrates better with the upstream libdivecomputer state.
* git://git.libdivecomputer.org/libdivecomputer: (42 commits)
Add support for the Sherwood Vision.
Fix the decoding of the maximum depth.
Improve the default layout detection.
Add a warning for unsupported devices.
Fix the temperature for the Tusa Zen Air.
Add support for the Aqualung i550T.
Use the new settings field for the salinity.
Fix the parsing of freedives.
Detect the gauge and freedive mode correctly.
Add the salinity field for the Aladin Tec.
Add support for the Scubapro Mantis 2.
Fix the decoding of the dive time.
Add support for the Scubapro Mantis.
Fix the Aeris 500AI serial number.
Add the serial number encoding to the layout.
Add salinity and timezone fields to Aladin Tec 2G
Add NDL and RBT for the ATOM31 and I450T
Add support for the new extended hardware descriptor.
Update the OSTC device descriptors.
Add a workaround for an OSTC4 firmware bug.
...
This way Subsurface can show different icons depending on what kind of
event we report.
This also fixes a bug where the begin/end marker was mistakenly added as
the value instead of as flag.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For applications supporting offline parsing (like libdivecomputer's own
dctool application), some device specific knowledge is still required in
order to map a particular model to the corresponding backend. The new
convenience function will take care of that internally.
The already existing dc_parser_new() function does the same, but
requires an open device handle, which makes it unsuitable for offline
parsing.
The event numbers are an indecipherable mess, and Suunto EON Steel has
notifications, events and warnings that just don't fit. Plus they
really come as strings from the EON Steel anyway.
So add a "SAMPLE_EVENT_STRING" type, and for that type the event has a
"const char *name" instead of the odd and meaningless flags/value pair.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Right now it only has an indication of whether the cylinder size is
imperial or metric, which is frankly quite useless.
Turn it into a bitmask instead, where we keep the imperial/metric data
for compatibility, but add another two bits that say that it's a CC
cylinder, and whether it's the oxygen or diluent cylinder.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The new gasmix sample contains the index of the active gas mix.
This new sample is intended as a replacement for the existing gas change
events (SAMPLE_EVENT_GASCHANGE and SAMPLE_EVENT_GASCHANGE2). To maintain
backwards compatibility, the legacy events are marked as deprecated but
not removed yet.
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>
There are two different ways to specify the volume of a tank. In the
metric system, the tank volume is specified as the water capacity, while
in the imperial system the tank volume is specified as the air capacity
at the surface (1 ATM) when the tank is filled at its working pressure.
To avoid mistakes, the tank volume is now always returned as the metric
volume. For imperial tanks, the tank volume is converted to the metric
representation.
Devices that only reports a single temperature in the header
will now be able to report it as well when they implement this.
Signed-off-by: Calle Gunnarsson <calle.gunnarsson@gmail.com>
This event is on when accumulating deco time. Once you reach the floor
deco time will start decreasing and the event will stop. Going below the
floor again will re-activate the event.
Signed-off-by: Michael Andreen <harv@ruin.nu>
The SAFETYSTOP is conceptually somewhere in between the NDL and the
DECOSTOP, so it makes sense to re-order the constants in the enum to
reflect this order.
Having these as events seems less useful since for many dive computers
there are data with every sample - so it makes much more sense to have
these as part of the sample.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
So far only OSTC and Shearwater Predator are supported. For the OSTC we
support CNS and setpoint changes in the samples (the current hardware
doesn't actually support ppO2 sensors and for the older hw that does I
don't have the correct encoding information).
For the Predator we support only the "average ppO2 during the sample".
The Predator also gives us a CNS value at the end of the dive - I don't
quite know yet how to deliver that back to the consumer. Possibly as CNS
value in the very last sample? That would at least be consistent.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- PO2 warnings (high and low both mapped to the same SAMPLE_EVENT_PO2
event)
- SPEED warning (which according to hw isn't emitted at this point)
- Deco stop violations (both deep and regular mapped to same
SAMPLE_EVENT_CEILING event)
- Deco ceiling and time (this is reported as a series of
SAMPLE_EVENT_DECOSTOP events with packed deco stop depth (in m) and
time (in seconds)
A SAMPLE_EVENT_NDL event (with an optional value indicating the non-stop
time remaining) indicates that the ceiling has been resolved
- Gas change (reported as SAMPLE_EVENT_GASCHANGE2, using another
unfortunate O2% / He% semantic that is used in the
SAMPLE_EVENT_GASCHANGE
This also covers the manual gas set event of the OSTC
- Manual Marker (reported as SAMPLE_EVENT_BOOKMARK)
The two new events (SAMPLE_EVENT_GASCHANGE2 and SAMPLE_EVENT_NDL are added
to the universal app as well.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The devinfo and clock event data is now cached internally at the device layer.
This allows the new dc_parser_new() convenience function to retrieve the event
data directly from the device handle, and applications don't have to deal with
the events anymore to create a parser.
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.
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.