Map27
 All Classes Functions Variables Enumerations Enumerator Pages
Public Member Functions | List of all members
Map27UnixPort Class Reference

Access RS232 port on Unix/Linux. More...

#include <Map27/UnixPort.h>

Inheritance diagram for Map27UnixPort:
Map27Port

Public Member Functions

 Map27UnixPort ()
 
void setDevice (const char *device)
 
const char * device ()
 
virtual bool open ()
 
virtual bool close ()
 
virtual void send (uint8_t ch)
 
virtual bool canRead ()
 
virtual uint8_t read ()
 
- Public Member Functions inherited from Map27Port
 Map27Port ()
 Constructor.
 
virtual bool configure (uint32_t baud=9600)
 

Additional Inherited Members

- Protected Attributes inherited from Map27Port
uint32_t _baud
 The currently configured baud rate.
 

Detailed Description

Access RS232 port on Unix/Linux.

This is a concrete implementation of Map27Port for use on Unix/Linux platforms. It is automatically selected by Port.cpp at compile time, so you should only need to link with Port.o.

You should specify the underlying device to use with setDevice(), which defaults to '/dev/ttyUSB0'.

Examples:
test2.cpp, and test3.cpp.

Constructor & Destructor Documentation

Map27UnixPort::Map27UnixPort ( )

Constructor The default device is '/dev/ttyUSB0'.

Member Function Documentation

bool Map27UnixPort::canRead ( )
virtual

Test whether readable input characters are waiting

Returns
true if one or more octets are waiting to be read from the underlying device

Reimplemented from Map27Port.

bool Map27UnixPort::close ( )
virtual

Close the underlying physical device if it is currently open

Reimplemented from Map27Port.

const char * Map27UnixPort::device ( )

Get the currently configured device

Returns
The currently configured RS232 device name
bool Map27UnixPort::open ( )
virtual

Open the underlying physical device Sets the baud rate to the configured rate and to 8N1

Reimplemented from Map27Port.

uint8_t Map27UnixPort::read ( )
virtual

Reads a single octet from the underlying device

Returns
The next octet to be read. Undefined if canRead() is not true.

Reimplemented from Map27Port.

void Map27UnixPort::send ( uint8_t  ch)
virtual

Sends a single octet to the underlying physical device

Parameters
[in]chThe character to send. Blocks until the character is queued by the operating system
[in]chThe octet to send

Reimplemented from Map27Port.

void Map27UnixPort::setDevice ( const char *  device)

Sets the name of the underlying RS232 device to open. Defaults to '/dev/ttyUSB0'.

Parameters
[in]deviceASCII name of the UNix device of the RS232 port to open
Examples:
test2.cpp, and test3.cpp.

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