Devices provide a c++ interface (usually on top of a lower level api such as posix) for input-output manipulation.

It's pretty hard to find a library that treats devices in anything but an ad-hoc way. There is no consistent interface. This attempts to bring that to the subset of devices that control systems use. It also allows hooking of streams to each and any of the devices. Also of interest, there are a few very theoretical approaches to writing c++ devices (sources, sinks, seekable, etc ..). The ecl's first version too was along these lines, but ultimately for control systems, being practical wins over syntactic correctness.

The devices here are kept as consistent and practical as possible without sacrificing speed.

Compiling & Linking

Include the following at the top of any translation unit:

   1 #include <ecl/devices.hpp>
   3 // Device Classes
   4 using ecl::OFile;
   5 using ecl::SharedFile;
   6 using ecl::Serial;
   7 using ecl::OConsole; // Also IConsole, EConsole, but dont use directly, use console streams instead.
   8 using ecl::String;   // Dont use directly, use StringStream instead.
   9 using ecl::SocketClient; // Simple and does ipv4 only.
  10 using ecl::SocketServer; // Simple and does ipv4 only.

If outside ros, you will also need to link against ecl_devices.



  • src/examples/serial_timeout.cpp : shows off the low latency timeout code [posix only].

These are in ecl_core_apps.

  • src/benchmarks/files.cpp

  • src/demos/socket_client.cpp

  • src/demos/socket_server.cpp

  • src/utils/hex.cpp : simple utility for reading/writing hex across the serial cable.

  • src/utils/serial.cpp : simple serial testing utility.

Wiki: ecl_devices (last edited 2012-01-19 23:29:44 by DanielStonier)