This set of drivers for standard communication devices. This library offers a
generic communication device which can be used to create drivers for new
communication devices easily: it is only necessary to implement the low level,
operating system dependent functions, all the other features are already
implemented.
The main features of all communication devices are:
* Data is automatically received and stored into a data FIFO by an internal thread.
* An event is generated whenever there is new data into this FIFO. Read operations are non-blocking.
* An event is generated when an unexpected error happen.
* Only a few functions have to be implemented to generate a new driver.
The communication devices currently supported by this library include:
***serial port**: This drivers provides a simple and easy to use yet
complete interface to a standard computer serial port. This driver allows
the user to open any available serial port, configure it as needed and send
and receive data to and from it. Some USB devices can also use this driver
(those that appear as a virtual COM port).
***ftdi driver**: This driver is intended to be used to interface with
devices with any of the following FTDI chips:
- FT2232H
- FT4232H
- FT232R
- FT245R
- FT2232
- FT232B
- FT245B
- FT8U232AM
- FT8U245AM
This driver can also be used with USB devices that appear as virtual serial
ports in the host computer. In this case it is also possible to use the serial
port driver
***sockets**: This driver provide an implementation of server and client
TCP sockets in Linux. UDP connections are not yet supported. The server
side can handle as many connections as needed, providing notifications for
the following event for each of the connections:
- new connection
- disconnection
- reception of new data
Both the client and server can be used with other implementations of the POSIX sockets.
## Dependencies
This package requires of the following system libraries and packages
*[cmake](https://www.cmake.org"CMake's Homepage"), a cross-platform build system.
*[doxygen](http://www.doxygen.org"Doxygen's Homepage") and [graphviz](http://www.graphviz.org"Graphviz's Homepage") to generate the documentation.
* stdc++ and pthread libraries.
Under linux all of these utilities are available in ready-to-use packages.
Under MacOS most of the packages are available via [fink](http://www.finkproject.org/"Fink's Homepage")
This package also requires of the following IRI libraries:
*[iriutils](https://gitlab.iri.upc.edu/labrobotica/algorithms/iriutils"iriutils gitlab page"), a set of basic tools.
## Compilation and installation
Download this repository and create a build folder inside:
``` mkdir build ```
Inside the build folder execute the following commands:
``` cmake .. ```
The default build mode is DEBUG. That is, objects and executables include debug information.
The RELEASE build mode optimizes for speed. To build in this mode execute instead
``` cmake .. -DCMAKE_BUILD_TYPE=RELEASE ```
The release mode will be kept until next time cmake is executed.
``` make ```
In case no errors are reported, the generated libraries (if any) will be located at the
_lib_ folder and the executables (if any) will be located at the _bin_ folder.
In order to be able to use the library, it it necessary to copy it into the system.
To do that, execute
``` make install ```
as root and the shared libraries will be copied to */usr/local/lib/iridrivers* directory
and the header files will be copied to */usr/local/include/iridrivers* dierctory. At
this point, the library may be used by any user.
To remove the library from the system, exceute
``` make uninstall ```
as root, and all the associated files will be removed from the system.
To generate the documentation execute the following command:
``` make doc ```
## How to use it
To use this library in an other library or application, in the CMakeLists.txt file, first it is necessary to locate if the library has been installed or not using the following command
``` FIND_PACKAGE(<libraryname>) ```
In the case that the package is present, it is necessary to add the header files directory to the include directory path by using
Copyright (C) 2009-2018 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
Mantainer IRI labrobotics (labrobotica@iri.upc.edu)
This package is distributed in the hope that it will be useful, but without any warranty. It is provided "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the program is with you. should the program prove defective, the GMR group does not assume the cost of any necessary servicing, repair or correction.
In no event unless required by applicable law the author will be liable to you for damages, including any general, special, incidental or consequential damages arising out of the use or inability to use the program (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the program to operate with any other programs), even if the author has been advised of the possibility of such damages.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>