52 Commits

Author SHA1 Message Date
Jef Driesen
9307acbe4a Migrate to Visual Studio 2013 (or newer)
Starting with msvc 2013, the C compiler has much better C99 support. The
previous workaround to compile everything as C++ code is no longer
needed.

Some additional changes:

 - Add a 64bit build
 - Enable _CRT_SECURE_NO_WARNINGS to silence warnings
2021-07-02 17:29:27 +02:00
Jef Driesen
6ef72ab420 Add support for the Sporasub SP2
The Sporasub SP2 uses a very simple communication protocol and memory
layout, but with some unusual aspects:

Dives are artifically limited to a maximum of 6000 samples.

Unlike all other dive computers, the dives are not stored in some kind
of ringbuffer structure. Once the memory is full, no new dives can be
recorded. The existing dives need to be erased first, and the dive
computer will start recording again at te start of the memory area. The
Sporasub application has an "Auto-clear watch memory after data
transfer" feature for this purpose.

I didn't implement a more efficient download algorithm because
downloading a full memory dumps takes less than 10 seconds.
2021-04-15 16:47:59 +02:00
Jef Driesen
752a064bb3 Use a common sleep implementation
Implement a common sleep function to eliminate some conditional
compilation in the rest of the code.
2021-03-24 17:17:57 +01:00
Jef Driesen
c84bbd93a3 Add an I/O implementation for USB communication
The USB communication is now also implemented as an I/O stream
transport. Unlike most I/O devices, USB communication supports multiple
interfaces and endpoints. This requires some some special care:

In the general case, autodetection isn't really possible without
additional knowledge. Hence the need for the filter parameters to pass
this kind of information.

The implementation assumes two bulk endpoints for the standard
read/write interface. Communication with the control endpoint is
supported through the new DC_IOCTL_USB_CONTROL_{READ,WRITE} ioctl's.
2020-08-11 15:16:36 +02:00
Jef Driesen
71a149d776 Add support for Liquivision dive computers 2020-07-09 17:02:32 +02:00
David Carron
8d35ee6978 Add support for the McLean Extreme 2020-06-08 13:45:43 +02:00
Jef Driesen
e363e5b1fd Add support for the Cressi Goa and Cartesio 2019-01-14 21:14:30 +01:00
Jef Driesen
472e9e984c Add support for the Tecdiving DiveComputer.eu 2018-06-22 23:24:30 +02:00
Jef Driesen
8aef4a49a0 Unify the Uwatec Smart, Meridian and G2 backends
The Uwatec Smart, Meridian and G2 backends are almost identical, except
for the low-level packet sending and receiving code. With the new I/O
layer, those three backends can easily be unified in a single backend.

The Meridian and G2 are completely removed, only the family types are
kept for backwards compatibility.
2018-06-22 23:13:44 +02:00
Jef Driesen
44eba5515c Move the I/O implementations to the public api
The I/O implementations need to be exposed in the public api, otherwise
applications won't be able to use them!
2018-04-03 21:44:08 +02:00
Jef Driesen
a8adb16c0d Add a high resolution timer module
The new timer module provides an cross-platform interface for a high
resolution monotonic clock. The timestamps are always relative to the
creation of the timer and their unit is one microseconds.

The timers can be used for logging, measuring elapsed time and
implementing timeouts.
2018-03-05 08:44:14 +01:00
Jef Driesen
823303980e Move the socket code to a common file
A large part of the irda and bluetooth code is the Windows and BSD
socket code. Moving this code to a common file reduces code duplication.
2017-11-26 23:00:33 +01:00
Jef Driesen
283eaa1ca6 Add support for a custom I/O implementation
Wih the custom I/O implementation, an application can use its own
low-level I/O layer instead of using one of the built-in ones. The
application only needs to provide a set of callback functions, and
libdivecomputer will wrap them into a I/O stream.
2017-11-26 10:40:34 +01:00
Jef Driesen
3ca27995e1 Add a new abstract I/O interface
The purpose of the new I/O interface is to provide a common interface
for all existing I/O implementations (serial, IrDA, bluetooth and USB
HID). With a common interface the dive computer backends can more easily
use different I/O implementations at runtime, without needing
significant code changes. For example bluetooth enabled devices can
easily switch between native bluetooth communication and serial port
emulation mode.

The new interface is modelled after the existing serial communication
api. Implementations where some of those functions are meaningless (e.g.
IrDA, bluetooth and USB), can just leave those functions unimplemented
(causing the call to fail with DC_STATUS_UNSUPPORTED), or implement it
as a no-op (always return DC_STATUS_SUCCESS).
2017-11-25 10:26:49 +01:00
Jef Driesen
52e03944c0 Move platform specific macros to a common header file 2017-09-28 22:02:53 +02:00
Jef Driesen
4aac63ea00 Update the msvc project file 2017-08-19 22:32:48 +02:00
Jef Driesen
3c7bd525bb Add support for native bluetooth communication
For the time being, the bluetooth communication code is of very limited
use. It's not used anywhere in the library, and as an internal api it's
also not available to applications. It serves mainly as a reference
implementation for future use.

The implementation supports Windows and Linux.
2017-06-02 12:11:39 +02:00
Jef Driesen
404cea7417 Move the dummy IrDA implementation
The dummy IrDA implementation is integrated in the main file. The
appropriate implementation is selected using conditional compilation
based on the features detect by the autotools build system.
2017-06-02 12:11:39 +02:00
Jef Driesen
d1a06e784c Remove deprecated functions from the public api
The vendor_product_parser_create() and vendor_product_device_open()
functions should be called indirectly, through the generic
dc_device_open() and dc_parser_new() functions. And the
vendor_product_extract_dives() functions are internal functions that
should never have been part of the public api in the first place.
2017-04-18 08:41:10 +02:00
Jef Driesen
3f82a553bd Add a common ringbuffer reading algorithm
Reading a ringbuffer backwards in order to process the most recent data
first, is a very common operation. Nearly every dive computer backend
has its own implementation. Thus with a common implementation, the
amount of code duplication and complexity in the dive computer backends
can be greatly reduced.

The common algorithm is implemented as a simple ringbuffer stream, which
takes care of all the technical details like the ringbuffer boundaries,
alignment to the page size, using the optimal packet size and caching
the remaining data.
2017-02-16 20:34:09 +01:00
Jef Driesen
995cfd4bbd Update the msvc project file. 2016-09-28 14:50:56 +02:00
John Van Ostrand
9a4e2b75a5 Add support for the Cochran Commander and EMC. 2016-03-22 20:09:45 +01:00
Jef Driesen
f1c0249053 Simplify the error handling in the close function.
When the close function returns, all resources should be freed,
regardless of whether an error has occured or not. The error code is
purely informative.

However, in order to return the first error code, which is usually the
most interesting one, the current implementation is unnecessary
complicated. If an error occurs, there is no need to exit immediately.
Simply store the error code unless there is already a previous one, and
then continue.
2016-01-05 20:40:21 +01:00
Jef Driesen
98bd0d2d21 Update the msvc project file. 2015-07-03 22:37:13 +02:00
Anton Lundin
52bc5ab7a0 Import Tiny AES128
This imports Tiny AES128 from https://github.com/kokke/tiny-AES128-C for
use in the decoding of OSTC3 firmwares.

This aes-code is released into the public domain.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2014-12-21 14:52:12 +01:00
Jef Driesen
598377ec44 Add support for the Citizen Hyper Aqualand. 2014-11-30 15:30:16 +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
3f7af8c349 Add support for the Dive Rite NiTek Q. 2014-02-06 09:42:06 +01:00
Jef Driesen
13db9dc8c0 Update the msvc project file. 2014-01-22 20:09:14 +01:00
Jef Driesen
c550685bfc Update the msvc project file. 2013-05-09 21:07:01 +02:00
Jef Driesen
0b20855d56 Add support for the Cressi Leonardo.
This is only a preliminary version. There is certainly some room for
improvement, but the basic functionality is already in place. That
should be sufficient for daily use, and possibles issues can always be
fixed when discovered.
2013-02-04 17:20:23 +01:00
Jef Driesen
14072ff8a6 Update the msvc project file. 2012-12-23 10:03:37 +01:00
Jef Driesen
8b4d216131 Update the msvc project file. 2012-09-21 21:59:08 +02:00
Jef Driesen
de1bdd456c Add a version resource on Windows. 2010-03-09 15:18:45 +00:00
Jef Driesen
b295f71536 Add a dummy backend for systems without IrDA support. 2010-02-18 09:26:32 +00:00
Jef Driesen
54410dab8d Add a datetime module. 2010-02-01 21:19:55 +00:00
Jef Driesen
098b229bc6 Rename the Suunto Spyder parser as the Eon parser.
Both devices have an almost identical data format. Renaming the parser
backend makes it more consistent with the corresponding device backend.
2010-02-01 13:34:52 +00:00
Jef Driesen
bb08248bd9 Add a parser for the Oceanic VT Pro. 2009-12-28 10:30:53 +00:00
Jef Driesen
778ae70d2e Add a parser for the Oceanic Veo 250. 2009-12-28 10:30:36 +00:00
Jef Driesen
5fa943d685 Added the initial implementation for the Cressi Edy. 2009-11-17 11:02:26 +00:00
Jef Driesen
7e6a57bd1c Added the initial implementation for the Heinrichs Weikamp OSTC. 2009-11-12 08:18:16 +00:00
Jef Driesen
69727bf855 Update the msvc project file. 2009-11-10 11:35:39 +00:00
Jef Driesen
bf0dd700c1 Add a parser for the Oceanic Atom 2. 2009-10-15 09:14:33 +00:00
Jef Driesen
50174fa55b Update the msvc project file. 2009-10-11 13:53:41 +00:00
Jef Driesen
872f5a594d Add a common base class.
The transfer protocol of the Suunto Vyper 2 and D9 devices is very
similar, which allows to share most of the transfer code between the
backends.
2009-08-06 09:52:50 +00:00
Jef Driesen
6132ae2550 Share the parsing code between the backends.
The memory layout of all Oceanic devices is very similar, which allows
to share the parsing code between the different backends. Differences in
the layout are passed by means of a new layout descriptor structure.
Memory buffers are now allocated dynamically to support devices with
different amounts of memory.
2009-05-04 09:03:04 +00:00
Jef Driesen
135c903792 Updated the msvc project file. 2009-04-14 21:46:46 +00:00
Jef Driesen
fe78347584 Added a parser for the Reefnet Sensus Original. 2009-02-05 09:59:35 +00:00
Jef Driesen
873eccd2b8 Updated the msvc project file. 2009-01-21 14:12:19 +00:00
Jef Driesen
9a61ecf493 Updated the msvc project file. Patch by Eric Bourque. 2009-01-02 21:34:54 +00:00