83 Commits

Author SHA1 Message Date
Anton Lundin
20d268acdb Remove last traces of our old custom serial code
This is just to make future merges easier.

There were nothing left of Claudiu's code in those files, so thats why i
removed the copyright lines.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-18 07:13:13 -07:00
Anton Lundin
94e7a77d01 Re-implement custom serial in a new way
This re-implements the custom serial concept in a new way. This way
doesn't touch any of the backend code, it just introduces a optional
redirection layer in the existing serial backends.

This implementation supports more serial operations to, so we can
support more backends this way.

Hooking into the existing serial backends might look ugly but its
probably the best way to make sure this patch conflicts as little as
possible with upstream.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-09-17 14:09:37 -07:00
Anton Lundin
7e086f697d Remove the old custom serial code
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-09-17 14:09:37 -07:00
Linus Torvalds
f9db4ca97c Merge git://git.libdivecomputer.org/libdivecomputer into Subsurface-branch
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.
  ...
2016-09-17 14:08:32 -07:00
Jef Driesen
2829f7ebf9 Add an ostc3 specific function with the model number.
To be able to pass the OSTC 3 model number to the parser, and preserve
backwards compatibility, we need a new function. The new function should
also be used for the Frog, by passing zero as the model number.

Using the hw_ostc_parser_create() function with the hwos parameter set
to one, is now deprecated but will remain supported for backwards
compatibility.
2016-07-23 23:14:13 +02:00
Jef Driesen
29caab0673 Rename the frog parameter and field to hwos.
The frog parameter and field are not only used for the Frog, but also
for all hwOS based models. Therefore, using the more generic hwos as the
name is more meaningful.
2016-07-23 23:11:30 +02:00
Linus Torvalds
406dbf3dae Add severity indication to the event flags for the Suunto EON Steel
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>
2016-07-23 17:07:38 +09:00
Jef Driesen
ad2257569c Add a new dc_parser_new2 convenience function.
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.
2016-07-22 21:14:33 +02:00
Linus Torvalds
79e2e3b0b5 Add 'string' event type
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>
2016-07-21 19:58:29 +09:00
Linus Torvalds
2e26ae4708 Make the tank "type" field more useful
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>
2016-07-21 19:58:29 +09:00
Jef Driesen
b41ecd0c15 Add a parameter with the model number. 2016-07-11 21:47:29 +02:00
John Van Ostrand
af30fbb3f8 Add support for the Cochran Commander and EMC. 2016-03-23 14:47:09 -07:00
John Van Ostrand
9a4e2b75a5 Add support for the Cochran Commander and EMC. 2016-03-22 20:09:45 +01:00
Dirk Hohndel
7c33c633fb Merge branch 'master' into Subsurface-branch
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-27 22:17:36 +01:00
Jef Driesen
06e0de6712 Add a new sample with the active gas mix.
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.
2015-12-21 14:03:39 +01:00
Jef Driesen
5c6c4cccc7 Add support for the DiveSystem iX3M series.
The protocol of the iX3M series is almost identical to the protocol of
the iDive series. The main difference is that the command bytes and the
size of the response packets have been changed. In order to be able to
communicate with the correct set of commands, the user needs to supply
the correct number now. To maintain backwards compatibility, a new
variant of the open function is added.
2015-12-14 12:23:31 +01: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
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
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
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
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
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
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
Anton Lundin
ab92043dc3 Remove removed function from public header
reefnet_sensusultra_device_set_maxretries was killed off back in v0.3,
but was still lying around in the public header.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2015-06-26 09:59:24 +02:00
Jef Driesen
3b264d9cfd Add support for the new hardware descriptor.
The latest firmware v1.75 introduced a new hardware descriptor byte to
identify the different models based on their hardware features. This new
hardware descriptor is now used as the libdivecomputer model number. For
older firmware versions, which do not support the descriptor yet, there
is an automatic fallback to the previous method based on the serial
number.
2015-03-06 21:45:02 +01:00
Jef Driesen
4dfca21a2b Pass the model number to the open function.
This change will be necessary for the Oceanic VTX, because it uses a
higher baudrate.

To maintain backwards compatibility, the existing function remains
unchanged and a new function is introduced instead.
2015-02-19 13:47:25 +01:00
Jef Driesen
87e6940572 Add support for the DiveSystem iDive and Orca. 2014-12-29 10:09:34 +01:00
Anton Lundin
02d8c0f04a Firmware upgrade for OSTC3
This connects the bits and implements firmware upgrade for the OSTC3.

This code is inspired by JeanDo ostc-companion.

Reviewed-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2014-12-21 15:02:08 +01:00
Jef Driesen
598377ec44 Add support for the Citizen Hyper Aqualand. 2014-11-30 15:30:16 +01:00
Jef Driesen
686500d51b Follow the libdivecomputer naming conventions.
All entry point functions (e.g. public functions or functions called
through the vtable) use the backend name as the prefix. The same applies
to the main device and parser structures.
2014-11-24 11:37:24 +01:00
Linus Torvalds
5c967f3382 Suunto EON Steel: support downloading of core dive profile data
Basic Suunto EON Steel downloading copied from my test application.
This parses all the core dive data, including sample data (time, depth,
cylinder pressure, deco information etc).

The deco information returns ceiling and TTS rather than ceiling and
"time at ceiling", because that's what the dive computer has, and I
don't see any other way to return the information.

We don't report any events yet, though.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-11-24 11:37:23 +01:00
Jef Driesen
b2bc231cb4 Convert imperial tank volume to the metric system.
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.
2014-11-13 13:13:07 +01:00
Jef Driesen
651123de53 Add support for parsing the dive mode. 2014-11-07 22:04:16 +01:00
Jef Driesen
11cafbaf5f Implement tank support for the Atomic Cobalt. 2014-11-07 22:00:07 +01:00
Jef Driesen
8f9878a1c0 Add support for parsing tank data in the dive header. 2014-11-07 22:00:07 +01:00
Jef Driesen
693a452250 Extend temperature with surface, min and max values. 2014-11-07 21:58:49 +01:00
Calle Gunnarsson
cdbc0cd9bd Added support for parsing temperature in the dive header
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>
2014-11-07 21:58:49 +01:00
Florian Klink
fc008312b5 Remove trailing whitespaces
Most of them appear in the disclaimers, but some are in the code as
well.
2014-03-19 09:16:07 +01:00
Jef Driesen
56e2dec726 Add support for configuring the OSTC3 settings.
Starting with firmware v1.23, the OSTC3 settings can be configured
through the USB interface. There are new commands for reading, writing
and restoring the settings to their default values.
2014-03-04 20:10:43 +01:00
Jef Driesen
56aa3b6669 Merge branch 'release-0.4'
Integrate the bugfixes from the stable branch.
2014-02-06 20:31:27 +01:00
Jef Driesen
3f7af8c349 Add support for the Dive Rite NiTek Q. 2014-02-06 09:42:06 +01:00
Jef Driesen
c524986175 Add support for the Scubapro/Uwatec Meridian.
The Uwatec Meridian protocol is identical to the Uwatec Smart/Galileo
protocol, except for some additional framing around each data packet,
and the switch from IrDA to usb-serial communication. For parsing, the
data format appears to be identical to the Galileo data format.
2013-10-19 10:11:15 +02:00
Jef Driesen
14286e8236 Add support for updating the HW OSTC firmware.
Only the bootloader V2 protocol is supported for now.
2013-08-22 09:15:55 +02:00
Michael Andreen
5f8da384e6 Identify event 0x07 on Suunto d9-style computers as Below Floor.
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>
2013-08-05 23:02:19 +02:00