conexus logo

Conexus::Serial Class Reference
[Conexus I/O Endpoints]

This class encapsulates a raw serial port. More...

#include <serial.h>

Inheritance diagram for Conexus::Serial:
Inheritance graph
[legend]

List of all members.

Classes

struct  Device
 Convenience struct to hold both the name and path of an enumerated device. More...

Public Types

typedef ConexusPointer< Serialpointer
typedef std::vector< DeviceDevices
 Convenience typedef for devices returned by enumeration.

Public Member Functions

 CONEXUS_ENDPOINT_GENERIC_CREATE ()
virtual ~Serial ()
virtual void open (const std::string &device, ReadWrite rwmode=READ_WRITE_UNCHANGED) throw ( open_exception )
 Opens the named serial port device in the specified mode.
virtual void open () throw ( open_exception )
 Will attempt to open the serial port if a device has been specified.
virtual uint32_t rw_mode ()
virtual std::string device ()
 Will return the string representing the device associated with this serial object.
virtual void set_device (const std::string &device, ReadWrite rwmode=READ_WRITE_UNCHANGED) throw ( open_exception )
 Sets the string representing the device associated with this serial object.
virtual sigc::signal< void > & signal_device_changed ()

Static Public Member Functions

static Serial::pointer create (const std::string &device=std::string(), ReadWrite rwmode=READ_WRITE)
static Devices enumerate_devices (bool include_virtuals=false)
 Uses udev to look for all devices in the tty subsystem.

Protected Member Functions

 Serial (const std::string &device=std::string(), ReadWrite rwmode=READ_WRITE)

Protected Attributes

std::string m_device
ReadWrite m_rwmode
sigc::signal< void > m_signal_device_changed

Detailed Description

This class encapsulates a raw serial port.

It is likely that it will be extended one level deeper in the inheritance hierarchy and replaced by an ancestor that provides file I/O to be used with traditional files and with Unix named pipes.

Author:
Rick L Vinyard Jr

Member Typedef Documentation

typedef std::vector<Device> Conexus::Serial::Devices

Convenience typedef for devices returned by enumeration.

typedef ConexusPointer<Serial> Conexus::Serial::pointer

Reimplemented from Conexus::FileDescriptor.

Reimplemented in Conexus::TTY.


Constructor & Destructor Documentation

Conexus::Serial::Serial ( const std::string &  device = std::string(),
ReadWrite  rwmode = READ_WRITE 
) [protected]

References m_rwmode, Conexus::READ_WRITE_UNCHANGED, and set_device().

Referenced by create().

Conexus::Serial::~Serial (  )  [virtual]

Member Function Documentation

Conexus::Serial::CONEXUS_ENDPOINT_GENERIC_CREATE (  ) 

Reimplemented in Conexus::TTY.

Serial::pointer Conexus::Serial::create ( const std::string &  device = std::string(),
ReadWrite  rwmode = READ_WRITE 
) [static]

Reimplemented in Conexus::TTY.

References Serial().

std::string Conexus::Serial::device (  )  [virtual]

Will return the string representing the device associated with this serial object.

Implements Conexus::SerialInterface.

References m_device.

Referenced by enumerate_devices().

Serial::Devices Conexus::Serial::enumerate_devices ( bool  include_virtuals = false  )  [static]

Uses udev to look for all devices in the tty subsystem.

If

Parameters:
include_virtuals is false any devices with "/virtual/" or "/platform/" anywhere in their udev system pathname will be excluded from the returned device set.

References device(), and Conexus::Object::name().

Referenced by Conexus::Gtk::SerialComboBox::load_from_enumerated_serials().

void Conexus::Serial::open (  )  throw ( open_exception ) [virtual]

Will attempt to open the serial port if a device has been specified.

Otherwise an exception will be thrown.

Implements Conexus::SerialInterface.

Reimplemented in Conexus::TTY.

References m_device.

Referenced by Conexus::TTY::open().

void Conexus::Serial::open ( const std::string &  device,
ReadWrite  rwmode = READ_WRITE_UNCHANGED 
) throw ( open_exception ) [virtual]

Opens the named serial port device in the specified mode.

Implements Conexus::SerialInterface.

Reimplemented in Conexus::TTY.

References Conexus::ENDPOINT_CLOSED, Conexus::READ, Conexus::READ_WRITE, Conexus::READ_WRITE_UNCHANGED, and Conexus::WRITE.

uint32_t Conexus::Serial::rw_mode (  )  [virtual]

Implements Conexus::SerialInterface.

References m_rwmode.

void Conexus::Serial::set_device ( const std::string &  device,
ReadWrite  rwmode = READ_WRITE_UNCHANGED 
) throw ( open_exception ) [virtual]

Sets the string representing the device associated with this serial object.

If the serial device is currently open and d is not equal to the current device, the current device will be closed.

Also, if auto_open is set, the new device will be immediately opened.

Additionally, this method checks whether the parameter d is the same as the current device, and parameter mode is the same as the current mode. If both are equal, the device will not be closed and reopened unless force=true.

Implements Conexus::SerialInterface.

References Conexus::READ_WRITE_UNCHANGED.

Referenced by Serial().

sigc::signal< void > & Conexus::Serial::signal_device_changed (  )  [virtual]

Member Data Documentation

std::string Conexus::Serial::m_device [protected]

Referenced by device(), and open().

Referenced by rw_mode(), and Serial().

sigc::signal<void> Conexus::Serial::m_signal_device_changed [protected]

Referenced by signal_device_changed().


The documentation for this class was generated from the following files:

Generated on Mon Mar 8 15:35:48 2010 for conexus by doxygen 1.6.1