OSVR-Core
Functions
GetSerialPortState.cpp File Reference

Implementation. More...

#include "GetSerialPortState.h"
#include <osvr/Util/MacroToolsC.h>
#include <osvr/Util/Finally.h>
#include <stdexcept>

Functions

SerialPortState getSerialPortStateImpl (std::string const &port)
 
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)
 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

Implementation.

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

Function Documentation

§ getSerialPortStateImpl()

SerialPortState getSerialPortStateImpl ( std::string const &  port)
inline
Todo:
just assuming it's available on platforms where we don't know how to check.

§ 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