OSVR-Core
Enumerations | Functions
GetSerialPortState.h File Reference

Header. More...

#include <string>

Go to the source code of this file.

Enumerations

enum  SerialPortState { SERIAL_INVALID, SERIAL_MISSING, SERIAL_BUSY, SERIAL_AVAILABLE }
 

Functions

SerialPortState getSerialPortState (std::string const &port)
 Returns an enum value indicating the apparent state of the port.
 
std::string normalizeSerialPort (std::string const &port)
 Normalizes the name of a serial port. More...
 
void verifySerialPort (std::string const &port, std::string const &origPort=std::string())
 Verifies the accessibility of a serial port and throws a std::exception unless it is available. More...
 
std::string normalizeAndVerifySerialPort (std::string const &port)
 Normalizes and verifies the accessibility of a serial port and throws a std::exception unless it is available. More...
 

Detailed Description

Header.

Date
2015
Author
Sensics, Inc. http://sensics.com/osvr

Enumeration Type Documentation

§ SerialPortState

Enumerator
SERIAL_INVALID 

Something's wrong with the port name you gave.

SERIAL_MISSING 

serial port requested is missing.

SERIAL_BUSY 

serial port requested is present, but busy (opened for exclusive use).

SERIAL_AVAILABLE 

serial port requested is available and not opened for exclusive use.

Function Documentation

§ normalizeAndVerifySerialPort()

std::string normalizeAndVerifySerialPort ( std::string const &  port)

Normalizes and verifies the accessibility of a serial port and throws a std::exception unless it is available.

On Windows, this takes care of prefixing \.\, for instance.

Parameters
portThe serial port name as supplied
Returns
the serial port name to use.

§ normalizeSerialPort()

std::string normalizeSerialPort ( std::string const &  port)

Normalizes the name of a serial port.

On Windows, this takes care of prefixing \.\, for instance.

Parameters
portThe serial port name as supplied
Returns
the serial port name to use.

§ verifySerialPort()

void verifySerialPort ( std::string const &  port,
std::string const &  origPort = std::string() 
)

Verifies the accessibility of a serial port and throws a std::exception unless it is available.

Parameters
portThe serial port name (already normalized)
origPortIf specified (and non-empty), the port name pre-normalization, for use in exceptions.

safety catch-all