789 Commits

Author SHA1 Message Date
Dirk Hohndel
10ae594b1f Add gas changes and violation events for Atomic Aquatics Cobalt
These are based on the documentation we have and have been tested and
verified against actual dive data (with the exception of the pO2 and
ascent speed violations).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-31 07:37:31 +01:00
Dirk Hohndel
1079bdc0b0 Fix gas handling for OSTC
Two issues:
- the OSTC counts its gases 1-based, not 0-based
- dives don't always start with the first gas. Simply create a gas change
event right after the first time sample that informs the application what
the first gas mix is

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-29 18:50:57 +01:00
Jef Driesen
0e0168f4d4 Log the date/time and version in the example applications. 2012-12-28 07:06:29 +01:00
Jef Driesen
f6df407699 Reverse the order of the include directories.
The version.h header file is generated by autoconf and therefore
located in the build directory and not the source directory. If
building out-of-tree, and a version.h header file is accidentally
present in the source tree, the wrong file will be picked up.

By reversing the order of the include directories, the build directory
is searched first, and the correct header file will be used.
2012-12-27 23:00:51 +01:00
Jef Driesen
e2a7d8bb45 Include the git commit SHA1 in the version number.
For bug reports it's very convenient to know the exact version. For
release builds, the standard version triplet (major.minor.micro) is
more than sufficient, but that's not the case for development builds.
Due to the post-release version increment, development builds already
have a version number that is distinct from previous releases, but
including the git commit SHA1 is even more accurate.

On Windows, the git commit SHA1 is also embedded in the version
resource.
2012-12-27 22:00:35 +01:00
Jef Driesen
56b7730773 Add a new vendor event.
The new vendor event provides a mechanism to deliver auxiliary data,
which is automatically retrieved during the data transfer, but not
accessible through the library interface otherwise. Possible examples
include handshake data and/or device identification data.

This event is mainly intended for diagnostic purposes, in combination
with the memory dumping support. Very few applications will actually
need it for anything else.
2012-12-27 12:10:45 +01:00
Jef Driesen
d0b7f2e584 Move the version string to the common device structure.
The version string can be shared by all three backends, which will make
it easier to use the version data directly from the common code.
2012-12-26 08:31:31 +01:00
Jef Driesen
633e8423dc Add a small delay before retrying a packet.
If the first attempt fails, that might indicate the device isn't ready
yet to service requests. In that case immediately retrying again isn't
the right solution. Adding a small delay seems to increase the success
rate, so it's a good idea anyway, regardless of the underlying reason.
2012-12-23 12:48:49 +01:00
Jef Driesen
14072ff8a6 Update the msvc project file. 2012-12-23 10:03:37 +01:00
Jef Driesen
b09b74783b Hardcode the maximum number of retries.
The application shouldn't have to deal with the maximum number of
retries. If the default value isn't good enough, that should be fixed
internally and not on the application side.
2012-12-23 09:55:37 +01:00
Jef Driesen
e9036674e0 Remove the obsolete timestamp functions.
These timestamp functions offer no real advantage and applications
should be using the device independent fingerprint feature instead.
2012-12-23 09:55:29 +01:00
Jef Driesen
f8ddf3306d Remove calls to the version functions from the examples.
These functions are already called internally, and there is no need to
call them explicitely in the example applications again.
2012-12-23 09:51:29 +01:00
Jef Driesen
45e9c08e92 Read the version info when opening the connection.
The d9 backend already reads the version info, to autodetect the
protocol variant. When doing the same in the vyper2 backend, we don't
have to read the version info again when downloading the dives.
2012-12-22 21:58:28 +01:00
Jef Driesen
fcc07a5f6d Add timestamps to the default log function.
Adding timestamps to the default logging function is very convenient to
investigate all kinds of timing related issues.
2012-12-22 21:55:16 +01:00
Jef Driesen
0ae6274939 Simplify the version matching logic.
The hardcoded version strings are now grouped into arrays, according to
their corresponding layout descriptor. The main advantage of using
arrays is that new versions strings can now easily be added, without
having to modify any code.
2012-12-22 21:25:52 +01:00
Jef Driesen
ccaa93a164 Merge branch 'release-0.2'
Integrate the bugfixes from the stable branch.
2012-12-22 21:07:25 +01:00
Jef Driesen
3d3c3f6039 Add support for the Mares Nemo Wide 2.
The Nemo Wide 2 uses the same communication protocol as the Icon HD,
except for two differences:

The Nemo Wide 2 requires a different baudrate and parity setting.
Unfortunately it doesn't seem possible to autodetect the correct
protocol variant at runtime. Attempting to proceed with incorrect
settings will render the device unresponsive and requires a battery
reset to recover.Therefore the model code needs to be provided as an
extra parameter, when opening the connection.

The Nemo Wide 2 also appears to have trouble downloading the entire
memory with a single request. Therefore the single large request is
split into many smaller ones. The offical Mares application uses 256
byte packets, and so do we. The Icon HD keeps using the large packets
because they are significant faster.

The extra model parameter breaks backwards compatibility!
2012-12-22 13:46:24 +01:00
Jef Driesen
74b91f2791 Add support for the Shearwater Petrel.
The Petrel is slightly different from the Predator because the device
reorders the internal ringbuffer before sending the data. The most
recent dive is always the first one, and there is no need to search for
it, like we have to do for the Predator.
2012-12-21 21:44:18 +01:00
Jef Driesen
a046071ad0 Fix a typo in the Sherwood Wisdom 3 model number. 2012-12-21 16:56:31 +01:00
Jef Driesen
113d2e4706 Fix a redefinition warning for the ERROR macro.
Apparantly, the windows wingdi.h header file already defines the
ERROR macro. By defining the NOGDI macro before including the
windows.h header file, we can prevent the wingdi.h file from being
included and thus avoid the warning. We don't need that header for
anything anyway.

Because the libusb header file includes the windows.h file
explicitly, it needs the same fix.
2012-12-13 20:02:08 +01:00
Jef Driesen
531e5cb748 Skip the size validation for unused divisors.
The recently introduced CNS support caused a regression for older
firmware versions. If a firmware doesn't support a certain sample
yet, the corresponding sample divisor and size are both equal to
zero (the default value for unused bytes). However, because the
size was always checked, regardless of whether the sample is
actually present or not, this zero size caused the parsing to fail.

To fix the regression, the size is now only checked when the
divisor indicates the sample is actually present.
2012-12-13 18:51:19 +01:00
Jef Driesen
f65f808b6c Add support for the Aeris A300 AI. 2012-12-12 20:05:00 +01:00
Jef Driesen
17efdaf1d8 Update the example application for the new sample types.
The example application is updated to support the new setpoint,
ppO2, CNS and decompression samples that have been introduced. The
NDL event is removed again.
2012-12-11 20:39:10 +01:00
Dirk Hohndel
3917ae15b9 Convert decostop / ndl to samples
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>
2012-12-11 20:38:08 +01:00
Dirk Hohndel
f2a656246d Add support for setpoint, ppO2 and CNS
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>
2012-12-10 21:23:48 +01:00
Jef Driesen
f5b5e41181 Reduce the amount of gaschange events.
Previously, gaschange events were emitted for every single sample.
With this change, the event is only emitted when the gas mix has
actually changed.
2012-12-06 20:08:22 +01:00
Jef Driesen
99fe2c693f Support both the OC and CC gas mixes.
The Shearwater Predator has two different sets of gas mixes for OC
(Open Circuit) and CC (Closed Circuit) mode. Since the dive mode can
be switched during the dive (e.g. in a bailout scenario), there is no
easy way to select one of both sets. With this change, both sets are
returned. It's not a perfect solution, but for CC dives it's already
an improvement.
2012-12-06 20:01:46 +01:00
Jef Driesen
500fb1e16b Add support for the Shearwater Predator. 2012-12-05 16:08:47 +01:00
Jef Driesen
e7d5afb1e4 Remove the version function for the Uwatec Smart.
The Uwatec Smart protocol supports reading individual settings. However
the version functions only reads those three values that we use
internally (model, serial number and device clock). That's a very
arbitrary subset and it would be much better to support reading
specific values. But that's something for later...
2012-12-05 16:07:32 +01:00
Jef Driesen
985323eefb Move the version function to the device specific api.
The version function requires device specific knowledge to use it (at
least the required buffer size), it is already called internally when
necessary, and only a few backends support it. Thus there is no good
reason to keep it in the high-level public api.
2012-12-05 16:07:32 +01:00
Jef Driesen
2a9e8c0023 Add some missing size macros.
These size macros are required to use the device specific functions
correctly and should therfore be exposed in the public api.
2012-12-05 16:07:32 +01:00
Jef Driesen
550e37d0b5 Remove the page, packet and memory size macros from the public api.
These macros are used internally and don't need to be exposed. In some
cases, the actual values are not even constant, but dependant on the
model and/or the firmware version.
2012-12-05 16:07:32 +01:00
Jef Driesen
43a518b1d2 Autodetect the three OSTC variants.
The exact OSTC variant can be detected by means of the serial number.
Each of the three variants is now assigned an artifical model number,
and included explicitly in the list of supported models.
2012-12-01 16:48:37 +01:00
Jef Driesen
3502ad39a6 Check the salinity byte for out of range values.
Apparently some older firmware versions don't support the salinity
setting. Because unused bytes are initialized with zero, the salinity
value will be reported as being zero.

To fix this unexpected value, the salinity factor is first checked for
valid values. If the value is out of range, a DC_STATUS_UNSUPPORTED
error is returned to indicate the absence of the value.
2012-12-01 16:48:14 +01:00
Jef Driesen
9c3af57038 Fix a regression in the depth calculation.
Apparently some older firmware versions don't support the salinity
setting. Because unused bytes are initialized with zero, the salinity
adjustment results in a division by zero, which converts all depth
values to infinity.

To fix this regression, the salinity factor is first checked for valid
values. If the value is out of range, no salinity adjustment is done,
and the previous behaviour is retained.
2012-12-01 14:24:33 +01:00
Jef Driesen
d3de4bf9bd Update the example application for the new fields.
Update the example application to support the new salinity and
atmosperic pressure fields. Because the new fields are not supported by
all backends, they are only included in the output when available.
2012-12-01 14:20:12 +01:00
Jef Driesen
3803e3c52d Add support for a second Sherwood Insight variant.
There appears to be two very different versions of the Sherwood Insight.
The old Insight needs the veo250 backend, while the newer Insight 2
needs the atom2 backend. Currently only the newer version was included
in the list of supported devices, and to increase the confusion it was
even named after the old version.

With this patch, the old version is added to the list, and the new
version is renamed to "Insight 2".
2012-11-30 09:33:39 +01:00
Jef Driesen
e4b66048a6 Add some documentation for the event values.
For the new packed 16bit event values, some minimal documentation is
required to interpret the value correctly.
2012-11-24 11:44:08 +01:00
Dirk Hohndel
1d360d3a1e This adds support for a subset of the events the OSTC provides.
- 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>
2012-11-24 11:43:59 +01:00
Dirk Hohndel
360a318334 Add support for salinity and atmospheric pressure
This adds a new type dc_salinity_t and associated enum dc_water_t.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-24 11:41:58 +01:00
Dirk Hohndel
ecb17c6fb6 Correct the OSTC depth calculation
This now uses the same formula as the OSTC uses internally which will get
the values reported by libdivecomputer to be consistent with what is
displayed on the OSTC.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-24 08:11:14 +01:00
Jef Driesen
328e929d4b Add support for a second Aeris Epic variant. 2012-11-17 14:33:54 +01:00
Jef Driesen
b3df32da9d Fix the parser for the Hollis DG03.
The date/time value and the sign bit of the sample temperature were
parsed incorrectly.
2012-11-17 14:30:31 +01:00
Jef Driesen
5f13759b6f Post release version bump to 0.2.1. 2012-11-14 09:28:17 +01:00
Jef Driesen
909679a48c Post release version bump to 0.3.0. 2012-09-21 22:47:22 +02:00
Jef Driesen
2ed54a204b Release version 0.2.0. v0.2.0 2012-09-21 22:46:30 +02:00
Jef Driesen
2511ebea3f Use the ifset macro to append the version suffix.
The version suffix is always defined. The correct condition for
appending the version suffix is whether it's defined as the empty
string or not.
2012-09-21 22:37:01 +02:00
Jef Driesen
743e434e5d Include the msvc project file in the tarballs. 2012-09-21 21:59:08 +02:00
Jef Driesen
af51b58a09 Use non-standard replacement functions for msvc. 2012-09-21 21:59:08 +02:00
Jef Driesen
14b28cb993 Add explicit casts for the msvc C++ compiler. 2012-09-21 21:59:08 +02:00