The Linux implementation is very straighforward and just a lightweight wrapper around the select function. But the Windows implementation is much more complex, because the Windows event notification mechanism behaves very different: The WaitCommEvent function does not support a timeout and is always a blocking call. The only way to implement a timeout is to use asynchronous I/O (or overlapped I/O as it's called in the Windows API), to run the operation in the background. This requires some additional book keeping to keep track of the pending background operation. The event mechanism is also edge triggered instead of level triggered, and reading the event with the WaitCommEvent function clears the pending event. Therefore, the state of the input buffer needs to be checked with the ClearCommError function before and after the WaitCommEvent call. The check before is necessary in case the event is already cleared by a previous WaitCommEvent call, while there is still data present in the input buffer. In this case, WaitCommEvent should not be called at all, because it would wait until more data arrives. The check afterwards is necessary in case WaitCommEvent reports a pending event, while the data in the input buffer has already been consumed. In this case, the current event must be ignored and WaitCommEvent needs to be called again, to wait for the next event.
Overview ======== Libdivecomputer is a cross-platform and open source library for communication with dive computers from various manufacturers. The official web site is: http://www.libdivecomputer.org/ The sourceforge project page is: http://sourceforge.net/projects/libdivecomputer/ Installation ============ On UNIX-like systems (including Linux, Mac OS X, MinGW), use the autotools based build system. Run the following commands from the top directory (containing this file) to configure, build and install the library and utilities: $ ./configure $ make $ make install If you downloaded the libdivecomputer source code directly from the git source code repository, then you need to create the configure script as the first step: $ autoreconf --install To uninstall libdivecomputer again, run: $ make uninstall Support ======= Please send bug reports, feedback or questions to the mailing list: http://libdivecomputer.org/cgi-bin/mailman/listinfo/devel or contact me directly: jef@libdivecomputer.org License ======= Libdivecomputer is free software, released under the terms of the GNU Lesser General Public License (LGPL). You can find a copy of the license in the file COPYING.
Description
Languages
C
98.3%
M4
1.2%
Makefile
0.5%