vrpn  07.33
Virtual Reality Peripheral Network
vrpn_Serial.h File Reference

vrpn_Serial: Pulls all the serial port routines into one file to make porting to new operating systems easier. More...

#include "vrpn_Configure.h"
#include <stddef.h>
Include dependency graph for vrpn_Serial.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  vrpn_SER_PARITY {
  vrpn_SER_PARITY_NONE, vrpn_SER_PARITY_ODD, vrpn_SER_PARITY_EVEN, vrpn_SER_PARITY_MARK,
  vrpn_SER_PARITY_SPACE
}
 

Functions

VRPN_API int vrpn_open_commport (const char *portname, long baud, int charsize=8, vrpn_SER_PARITY parity=vrpn_SER_PARITY_NONE, bool rts_flow=false)
 Open a serial port, given its name and baud rate. More...
 
VRPN_API int vrpn_close_commport (int comm)
 
VRPN_API int vrpn_flush_input_buffer (int comm)
 Throw out any characters within the input buffer. More...
 
VRPN_API int vrpn_flush_output_buffer (int comm)
 Throw out any characters (do not send) within the output buffer. More...
 
VRPN_API int vrpn_drain_output_buffer (int comm)
 Wait until all of the characters in the output buffer are sent, then return. More...
 
VRPN_API int vrpn_write_characters (int comm, const unsigned char *buffer, size_t bytes)
 Write the buffer to the serial port. More...
 
VRPN_API int vrpn_write_slowly (int comm, const unsigned char *buffer, size_t bytes, int millisec_delay)
 
RTS Hardware Flow Control

Set and clear functions for the RTS ("ready to send") hardware flow- control bit. These are used on a port that is already open. Some devices (like the Ascension Flock of Birds) use this to reset the device. Return 0 on success, nonzero on error.

VRPN_API int vrpn_set_rts (int comm)
 
VRPN_API int vrpn_clear_rts (int comm)
 
Read routines

Read up the the requested count of characters from the input buffer, return with less if less (or none) are there. Return the number of characters read, or -1 if there is an error. The second of these will keep looking until the timeout period expires before returning (NULL pointer will cause it to block indefinitely).

VRPN_API int vrpn_read_available_characters (int comm, unsigned char *buffer, size_t count)
 
VRPN_API int vrpn_read_available_characters (int comm, unsigned char *buffer, size_t count, struct timeval *timeout)
 Read until either you get the answer, you get an error, or timeout. More...
 

Detailed Description

vrpn_Serial: Pulls all the serial port routines into one file to make porting to new operating systems easier.

Author
Russ Taylor, 1998

Definition in file vrpn_Serial.h.

Enumeration Type Documentation

◆ vrpn_SER_PARITY

Enumerator
vrpn_SER_PARITY_NONE 
vrpn_SER_PARITY_ODD 
vrpn_SER_PARITY_EVEN 
vrpn_SER_PARITY_MARK 
vrpn_SER_PARITY_SPACE 

Definition at line 15 of file vrpn_Serial.h.

Function Documentation

◆ vrpn_clear_rts()

◆ vrpn_close_commport()

◆ vrpn_drain_output_buffer()

◆ vrpn_flush_input_buffer()

◆ vrpn_flush_output_buffer()

VRPN_API int vrpn_flush_output_buffer ( int  comm)

Throw out any characters (do not send) within the output buffer.

Returns
0 on success, tc err codes (whatever those are) on error.

Definition at line 462 of file vrpn_Serial.C.

Referenced by vrpn_SerialPort::flush_output_buffer(), vrpn_ADBox::mainloop(), vrpn_Tracker_Crossbow::reset(), vrpn_Poser_Tek4662::reset(), vrpn_Tracker_NDI_Polaris::sendCommand(), vrpn_Tracker_Flock::~vrpn_Tracker_Flock(), and vrpn_Tracker_Flock_Parallel_Slave::~vrpn_Tracker_Flock_Parallel_Slave().

◆ vrpn_open_commport()

VRPN_API int vrpn_open_commport ( const char *  portname,
long  baud,
int  charsize = 8,
vrpn_SER_PARITY  parity = vrpn_SER_PARITY_NONE,
bool  rts_flow = false 
)

◆ vrpn_read_available_characters() [1/2]

VRPN_API int vrpn_read_available_characters ( int  comm,
unsigned char *  buffer,
size_t  count 
)

Definition at line 512 of file vrpn_Serial.C.

Referenced by vrpn_Tracker_Flock::checkError(), vrpn_Tracker_3Space::get_report(), vrpn_Joystick::get_report(), vrpn_Tracker_3DMouse::get_report(), vrpn_Zaber::get_report(), vrpn_Nikon_Controls::get_report(), vrpn_raw_SGIBox::get_report(), vrpn_Radamec_SPI::get_report(), vrpn_5dt16::get_report(), vrpn_Tracker_Crossbow::get_report(), vrpn_CerealBox::get_report(), vrpn_GlobalHapticsOrb::get_report(), vrpn_Magellan::get_report(), vrpn_Spaceball::get_report(), vrpn_Tracker_Dyna::get_report(), vrpn_Tng3::get_report(), vrpn_Tracker_GPS::get_report(), vrpn_ImmersionBox::get_report(), vrpn_Tracker_Flock::get_report(), vrpn_5dt::get_report(), vrpn_BiosciencesTools::get_report(), vrpn_Tracker_Isotrak::get_report(), vrpn_Tracker_Liberty::get_report(), vrpn_Tracker_Fastrak::get_report(), vrpn_IDEA::get_report(), vrpn_inertiamouse::get_report(), vrpn_Tracker_Flock::getMeasurementRate(), vrpn_Wanda::mainloop(), vrpn_VPJoystick::mainloop(), vrpn_ADBox::mainloop(), vrpn_IDEA::move_until_done_or_error(), vrpn_Tracker_Crossbow::ping(), vrpn_Button_SerialMouse::read(), vrpn_Button_PinchGlove::read(), vrpn_SerialPort::read_available_characters(), vrpn_Tracker_NDI_Polaris::readResponse(), vrpn_Tracker_Crossbow::recalibrate(), vrpn_YEI_3Space_Sensor_Wireless::receive_LED_values_response(), vrpn_Button_PinchGlove::report_no_timestamp(), vrpn_Tracker_3Space::reset(), vrpn_Magellan::reset(), vrpn_Joystick::reset(), vrpn_Tracker_3DMouse::reset(), vrpn_Zaber::reset(), vrpn_Nikon_Controls::reset(), vrpn_Tracker_Crossbow::reset(), vrpn_5dt16::reset(), vrpn_CerealBox::reset(), vrpn_Poser_Tek4662::reset(), vrpn_5dt::reset(), vrpn_Tracker_Flock::reset(), vrpn_Tracker_Liberty::reset(), vrpn_Tracker_Isotrak::reset(), vrpn_Tracker_Fastrak::reset(), vrpn_IDEA::reset(), vrpn_Poser_Tek4662::run(), vrpn_5dt::syncing(), and vrpn_read_available_characters().

◆ vrpn_read_available_characters() [2/2]

VRPN_API int vrpn_read_available_characters ( int  comm,
unsigned char *  buffer,
size_t  count,
struct timeval *  timeout 
)

Read until either you get the answer, you get an error, or timeout.

Definition at line 592 of file vrpn_Serial.C.

References time_add, time_greater, vrpn_gettimeofday, and vrpn_read_available_characters().

Here is the call graph for this function:

◆ vrpn_set_rts()

◆ vrpn_write_characters()

VRPN_API int vrpn_write_characters ( int  comm,
const unsigned char *  buffer,
size_t  bytes 
)

Write the buffer to the serial port.

Definition at line 643 of file vrpn_Serial.C.

Referenced by vrpn_Tracker_Flock::checkError(), vrpn_Tracker_3DMouse::get_report(), vrpn_Tracker_Crossbow::get_report(), vrpn_CerealBox::get_report(), vrpn_Tracker_Flock::getMeasurementRate(), vrpn_Nikon_Controls::mainloop(), vrpn_ADBox::mainloop(), vrpn_Tracker_Crossbow::ping(), vrpn_Tracker_Crossbow::recalibrate(), vrpn_Button_PinchGlove::report_no_timestamp(), vrpn_BiosciencesTools::request_temperature(), vrpn_Tracker_3Space::reset(), vrpn_Joystick::reset(), vrpn_Tracker_3DMouse::reset(), vrpn_Nikon_Controls::reset(), vrpn_Tracker_Crossbow::reset(), vrpn_CerealBox::reset(), vrpn_GlobalHapticsOrb::reset(), vrpn_Poser_Tek4662::reset(), vrpn_Tracker_Dyna::reset(), vrpn_Tracker_Flock::reset(), vrpn_Tracker_Liberty::reset(), vrpn_Tracker_Isotrak::reset(), vrpn_Tracker_Fastrak::reset(), vrpn_Tracker_Flock_Parallel_Slave::reset(), vrpn_Poser_Tek4662::run(), vrpn_YEI_3Space_Sensor::send_ascii_command(), vrpn_YEI_3Space_Sensor::send_binary_command(), vrpn_Zaber::send_command(), vrpn_Radamec_SPI::send_command(), vrpn_5dt::send_command(), vrpn_IDEA::send_command(), vrpn_Tracker_NDI_Polaris::sendCommand(), vrpn_Nikon_Controls::set_channel(), vrpn_BiosciencesTools::set_control_status(), vrpn_Tracker_3DMouse::set_filtering_count(), vrpn_BiosciencesTools::set_reference_temperature(), vrpn_Tracker_Isotrak::set_sensor_output_format(), vrpn_Tracker_Liberty::set_sensor_output_format(), vrpn_Tracker_Fastrak::set_sensor_output_format(), vrpn_write_slowly(), vrpn_SerialPort::write(), vrpn_Tracker_Flock::~vrpn_Tracker_Flock(), and vrpn_Tracker_Flock_Parallel_Slave::~vrpn_Tracker_Flock_Parallel_Slave().

◆ vrpn_write_slowly()

VRPN_API int vrpn_write_slowly ( int  comm,
const unsigned char *  buffer,
size_t  bytes,
int  millisec_delay 
)

Definition at line 670 of file vrpn_Serial.C.

References vrpn_SleepMsecs(), and vrpn_write_characters().

Referenced by vrpn_Magellan::reset(), vrpn_Spaceball::reset(), vrpn_raw_SGIBox::reset(), and vrpn_raw_SGIBox::send_light_command().

Here is the call graph for this function: