lobot::Serial Class Reference

Serial communications API. More...

#include <Robots/LoBot/io/LoSerial.H>

List of all members.

Public Member Functions

 Serial (const ModelManager &, const std::string &device, int baud_rate)
 Initialization.
bool ready ()
 Check if the serial port has data available for reading.
int read (char buf[], int n)
void write (char buf[], int n)
 Send data to the serial port.
void read_full (char buf[], int n)
void eat (int n)
 Read and discard the specified number of bytes.
 ~Serial ()
 Clean-up.

Detailed Description

Serial communications API.

The robot's motors are controlled by a motor driver that is in turn controlled by a Propeller-based I/O board. This board connects to the Robolocust computer (the mini-ITX Debian box) over a USB port. The lobot::Serial class provides an API for interfacing with the Propeller using a serial port. It uses libserial for the serial communications if that library is available. Otherwise, it falls back to using INVT's support for serial communications.

Definition at line 85 of file LoSerial.H.


Constructor & Destructor Documentation

Serial::Serial ( const ModelManager ,
const std::string device,
int  baud_rate 
)

Initialization.

Definition at line 109 of file LoSerial.C.

Serial::~Serial ( void   ) 

Clean-up.

Definition at line 283 of file LoSerial.C.


Member Function Documentation

void Serial::eat ( int  n  ) 

Read and discard the specified number of bytes.

Definition at line 276 of file LoSerial.C.

References read_full().

int Serial::read ( char  buf[],
int  n 
)

Receive data from the serial port. Returns the number of bytes successfully read. Client should check that this is equal to the expected number.

Definition at line 133 of file LoSerial.C.

Referenced by read_full().

void Serial::read_full ( char  buf[],
int  n 
)

Read the specified number of bytes and don't return until they're all read in.

Definition at line 269 of file LoSerial.C.

References read().

Referenced by eat().

bool Serial::ready (  ) 

Check if the serial port has data available for reading.

Definition at line 127 of file LoSerial.C.

void Serial::write ( char  buf[],
int  n 
)

Send data to the serial port.

Definition at line 148 of file LoSerial.C.


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:30:39 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3