The Windows version resource is compiled and can include the (generated)
version.h header file for the definition of the version macros. There is
no need to have it generated by autotools. Less generated files makes it
easier to use other build systems, like Visual Studio.
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.
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'.
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.
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.
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".
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.
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.
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.
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.
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.
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.
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.
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.
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>
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.
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.
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.
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.
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.
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.
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.
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.
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.