63 Commits

Author SHA1 Message Date
Jef Driesen
094a225363 Detect the posix unistd.h header file
The getopt function is defined in the unistd.h header file. This header
file is only available on posix compatible systems. For example, on
Windows it's not available when building without mingw.
2022-12-21 14:55:12 +01:00
Jef Driesen
913a65fde6 Allow to specify the hidapi library variant
On Linux, the hidapi library is usually available in two variants:
hidapi-libusb and hidapi-hidraw. By default, the autotools build system
won't be able to detect those variants (due to the difference in the
name) and will automatically fallback to the libusb implementation
instead.

If for some reason the hidapi library should be used, the preferred
hidapi variant can now be specified during configuation with a
parameter:

  ./configure --with-hidapi=hidapi-libusb|hidapi-hidraw

The default value for the parameter remains 'hidapi'.
2022-11-25 13:25:23 +01:00
Jef Driesen
14fd0296d4 Post release version bump to 0.8.0 2021-05-07 21:22:36 +02:00
Jef Driesen
47cbed5355 Release version 0.7.0 2021-05-07 21:22:36 +02:00
Jef Driesen
a4d771956a Fix the clang compiler flag detection
The clang compiler accepts *any* compiler flags, and just reports
an annoying warning instead:

  warning: unknown warning option '-Wsomething' [-Wunknown-warning-option]

Use -Werror=unknown-warning-option to change this warning into an error,
and detect the unsupported flag. Since this is a clang specific option,
it can't be used unconditionally with other compilers. The option is
also only used for checking the compiler flags, and not for compiling
the code.
2021-03-11 16:41:53 +01:00
Jef Driesen
6b576da5ef Show a summary after configuration 2021-03-07 21:24:15 +01:00
Jef Driesen
6bb13a564f Extend the OS detection to non Windows platforms
At the moment, only the Windows platform needs some special handling,
but this can easily be extended to detect and handle other platforms as
well.
2021-03-07 21:23:44 +01:00
Jef Driesen
ad297c1cc9 Strip the source directory from file names
Use the GCC 8 -fmacro-prefix-map option to strip the source directory
and change the __FILE__ macro into a relative path.
2019-12-21 20:57:06 +01: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
931d1857ce Disable some Windows specific compiler warnings
The -Wno-pedantic-ms-format option is only needed for the MinGW target.
But for some reason, the AX_APPEND_COMPILE_FLAGS macro enables the
option for all other GCC targets too. But during compilation GCC outputs
the warning "unrecognized command line option".
2018-01-30 21:21:21 +01:00
Jef Driesen
b75095cefa Post release version bump to 0.7.0 2017-11-24 23:48:55 +01:00
Jef Driesen
1195abc2f4 Release version 0.6.0 2017-11-24 23:47:58 +01:00
Jef Driesen
91f5b34ae5 Enable some useful compiler warnings by default
Because some of those compiler warnings are GCC specific, they should
only be enabled if the compiler actually supports them. This is take
care of with some macros from the autoconf-archive.

To avoid breaking the build on systems that don't have those macros
installed (e.g. Mac OS X), they are included in the project.
2017-11-24 23:45:11 +01:00
Jef Driesen
cbaebc777d Generate html documentation from the manpages 2017-11-23 10:33:31 +01:00
Jef Driesen
f708eadcfd Make the initialization thread-safe
Perform the initialization inside a critical section.

Unfortunately Windows critical sections, which are the simplest
synchronization mechanism available on Windows, do not support static
initialization. A call to InitializeCriticalSection is required.
Therefore a simple spinlock, with an implementation based on atomic
operations, is used as a workaround.
2017-10-09 14:35:36 +02:00
Jef Driesen
156f54302d Add basic timezone support
Allthough most dive computers always use local time and don't support
timezones at all, there are a few exceptions. There are two different
sources of timezone information:

 - Some of the newer Uwatec/Scubapro devices use UTC internally and also
   support a timezone setting. This UTC offset is currently taken into
   account to obtain the dive date/time, but the UTC offset itself is
   lost.

 - Uwatec/Scubapro and Reefnet devices rely on the clock of the host
   system to synchronize the internal device clock and calculate the
   dive date/time. The consequence is that the resulting date/time is
   always in the timezone of the host system.

In order to preserve this timezone information, the dc_datetime_t
structure is extended with a new "timezone" field, containing the UTC
offset in seconds. Devices without timezone support will set the field
to the special value DC_TIMEZONE_NONE.

The dc_datetime_localtime() and dc_datetime_gmtime() functions will
automatically populate the new field with respectively the local
timezone offset and zero. The dc_datetime_mktime() function will take
into account the new timezone field for the conversion to UTC. The
special value DC_TIMEZONE_NONE is interpreted as zero.
2017-08-18 23:26:45 +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
Kristaps Dzonsons
77b0cebb35 Document the public api with man pages 2017-01-07 13:41:07 +01:00
Ryan McLean
39aa859d19 Add doxygen documentation to the build system 2016-11-22 20:25:50 +01:00
Jef Driesen
8aa8bbebd5 Post release version bump to 0.6.0. 2016-09-30 21:20:06 +02:00
Jef Driesen
ba0e7224b0 Release version 0.5.0. 2016-09-30 21:17:08 +02:00
Jef Driesen
ed2a7c91fe Use the hidapi library on Mac OS X.
On Mac OS X, libusb doesn't work for USB HID devices. We can use the
hidapi library instead. Although the hidapi library supports Linux and
Windows too, we keep using libusb there to avoid the extra dependency.
2016-09-19 15:04:48 +02:00
Jef Driesen
f30e048afc Add a configure option to build without libusb. 2016-09-19 08:48:04 +02:00
Jef Driesen
67a3697a4d Disable the getopt argument permutation on BSD systems.
On BSD based operating systems (which includes Mac OS X), the getopt()
function is posix compliant and thus the option processing stops when
the first non-option is found. But the getopt_long() function permutes
the argument vector, just like the GNU implementation.

Using a leading '+' character in the option string disables the
permutation again.
2016-01-30 23:00:17 +01:00
Jef Driesen
5add68b2d5 Use the optreset variable on BSD systems.
On BSD based operating systems the optreset variable should be used to
reset the internal getopt state. Setting optind to zero is a GNU
extension.
2016-01-30 23:00:17 +01:00
Jef Driesen
b5503e53fd Add a more modular example application.
The universal application works well, but is quite difficult to extend
with more functionality. Therefore a new and more modular application is
needed. The new dctool application will support multiple sub-commands,
to carry out specific actions. Extending the application will be as easy
as adding new commands.
2016-01-04 19:50:51 +01:00
Venkatesh Shukla
33710423ac Add an option to disable the example applications.
The example applications may not always be needed. An option to disable
them might be useful.

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
2014-07-02 16:26:39 +02:00
Jef Driesen
3c8ea2c33c Post release version bump to 0.5.0. 2013-05-13 23:54:14 +02:00
Jef Driesen
bdd8e06786 Release version 0.4.0. 2013-05-13 23:50:52 +02:00
Jef Driesen
780440dffe Exclude device descriptors for unsupported devices.
Currently all device descriptors are included, regardless of whether
the device is actually supported by the library. If IrDA or USB support
is unavailable, a dummy backend is build which will always fail with
DC_STATUS_UNSUPPORTED. Thus there is no point in listing those devices
as being supported. Doing so will only confuse end-users.
2013-05-09 21:04:53 +02:00
Jef Driesen
653a3409d7 Post release version bump to 0.4.0. 2013-02-06 13:53:33 +01:00
Jef Driesen
82fadd89bf Release version 0.3.0. 2013-02-06 13:52:03 +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
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. 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
fab606b00a Add an option to enable support for pseudo terminals.
Pseudo terminals are very convenient for testing purposes, but they are
not fully compatible with real serial (or even usb-serial) hardware.
With the new option, some workarounds can be enabled to hide the
differences and increase compatibility. Although these workarounds
shouldn't cause any problems in production builds, the advise is to
disable this feature.

A few ioctl's are not supported for pseudo terminals. They fail with
EINVAL (Linux) or ENOTTY (Mac OS X). Since these specific error codes
should not occur under normal conditions, they are simply ignored when
pseudo terminal support is enabled.

The TIOCEXCL ioctl (exclusive access) is also problematic. The TIOCEXCL
setting is shared between the master and slave side of the pty. When the
setting is applied on the slave side, it persists for as long as the
master side remains open. The result is that re-opening the slave side
will fail with EBUSY, unless the process has root priviliges. Since this
is very inconvenient, the TIOCEXCL setting is not used when pseudo
terminal support is enabled.
2012-08-28 23:30:43 +02:00
Jef Driesen
b1b30f068c Add an option to disable the logging.
With the new option, the library can be compiled with the entire
logging infrastructure disabled. The public api remains unchanged, but
the internal logging functions will have no effect anymore.

In practice the overhead of the logging functions should be quite
small, and disabling the logging at runtime might be more convenient.
Especially because troubleshooting will become much harder without any
logging.
2012-08-27 23:08:38 +02:00
Jef Driesen
3311960795 Add a convenience function for logging system errors.
The new convenience function provides a centralized and threadsafe
function for logging system errors. The previous functions are
deprecated and will be removed after the transition to the new context
based logging.
2012-08-27 23:02:44 +02:00
Jef Driesen
2095a2d10e Merge branch 'release-0.1'
Integrate the bugfixes from the stable branch.
2012-08-27 22:58:52 +02:00
Grischa Toedt
2f4a9abf88 Fix a build error with automake 1.12 or newer.
Since automake 1.12, the warnings in the category 'extra-portability'
are now enabled by '-Wall'. Because of this change, linking libtool
archives requires the new AM_PROG_AR macro.
2012-07-07 22:54:42 +02:00
Jef Driesen
e65025b501 Separate private and public headers.
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.
2012-06-21 21:39:24 +02:00
Jef Driesen
fa54a55a89 Add a version suffix.
For development snapshots, a 'devel' suffix is added to distinguish from
the final release. If necessary, the suffix can also be used for 'alpha'
and 'beta' releases.
2012-06-19 21:27:46 +02:00
Jef Driesen
53b4a1c225 Post release version bump to 0.1.1 2012-06-03 22:13:38 +02:00
Jef Driesen
bb87198622 Add a version suffix.
For development snapshots, a 'devel' suffix is added to distinguish from
the final release. If necessary, the suffix can also be used for 'alpha'
and 'beta' releases.
2012-04-27 23:56:20 +02:00
Jef Driesen
631f2d4a3d Post release version bump to 0.2.0 2012-04-27 23:50:41 +02:00
Jef Driesen
c3ea5a16e4 Release version 0.1.0 2012-04-27 23:33:57 +02:00
Jef Driesen
eda03255a8 Add the libusb dependency to the pkg-config file.
When linking dynamically, the shared library contains a reference to all
external dependencies, and the linker can easily resolve them. However
when linking statically, all external dependencies have to be specified
explicitly. This rule also applies to dependencies that are not exposed
through the public api.

The pkg-config Requires.private field is used to support both static and
dynamic linking correctly.
2011-10-23 00:03:58 +02:00
Jef Driesen
088ea6d054 Add support for non standard baudrates. 2011-08-12 22:47:07 +02:00