OSVR Framework (Internal Development Docs)  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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

Definition in file GetSerialPortState.h.

Enumeration Type Documentation

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.

Definition at line 37 of file GetSerialPortState.h.

Function Documentation

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.

Definition at line 79 of file GetSerialPortState.cpp.

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

Definition at line 94 of file GetSerialPortState.cpp.

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.

Definition at line 116 of file GetSerialPortState.cpp.