API
MagAOX::tty::usbDevice Struct Reference

A USB device as a TTY device. More...

#include <usbDevice.hpp>

Inheritance diagram for MagAOX::tty::usbDevice:
Inheritance graph
Collaboration diagram for MagAOX::tty::usbDevice:
Collaboration graph

Public Member Functions

int setupConfig (mx::app::appConfigurator &config)
 Setup an application configurator for the USB section. More...
 
int loadConfig (mx::app::appConfigurator &config)
 Load the USB section from an application configurator. More...
 
int getDeviceName ()
 Get the device name from udev using the vendor, product, and serial number. More...
 
int connect ()
 Connect to the device. More...
 

Public Attributes

std::string m_idVendor
 The vendor id 4-digit code. More...
 
std::string m_idProduct
 The product id 4-digit code. More...
 
std::string m_serial
 The serial number. More...
 
speed_t m_baudRate {0}
 The baud rate specification. More...
 
std::string m_deviceName
 The device path name, e.g. /dev/ttyUSB0. More...
 
int m_fileDescrip {0}
 The file descriptor. More...
 

Detailed Description

A USB device as a TTY device.

Definition at line 32 of file usbDevice.hpp.

Member Function Documentation

◆ connect()

int MagAOX::tty::usbDevice::connect ( )

Connect to the device.

Closes the device file descriptor if open, then calls ttyOpenRaw.

Returns
TTY_E_NOERROR on success.
TTY_E_TCGETATTR on a error from tcgetattr.
TTY_E_TCSETATTR on an error from tcsetattr.
TTY_E_SETISPEED on a cfsetispeed error.
TTY_E_SETOSPEED on a cfsetospeed error.

Definition at line 108 of file usbDevice.cpp.

Referenced by MagAOX::app::filterWheelCtrl::appLogic(), MagAOX::app::flipperCtrl::appLogic(), MagAOX::app::koolanceCtrl::appLogic(), MagAOX::app::pi335Ctrl::appLogic(), MagAOX::app::smc100ccCtrl::appLogic(), and MagAOX::app::rhusbMon::connect().

◆ getDeviceName()

int MagAOX::tty::usbDevice::getDeviceName ( )

◆ loadConfig()

int MagAOX::tty::usbDevice::loadConfig ( mx::app::appConfigurator &  config)

Load the USB section from an application configurator.

If config does not contain a baud rate, m_baudRate is unchanged. If m_baudRate is 0 at the end of this method, an error is returned. Set m_baudRate prior to calling to avoid this error.

Returns
0 on success
-1 on error (nothing implemented yet)
Parameters
[in]configan application configuration from which to load values

Definition at line 34 of file usbDevice.cpp.

Referenced by MagAOX::app::filterWheelCtrl::loadConfig(), MagAOX::app::smc100ccCtrl::loadConfig(), MagAOX::app::zaberLowLevel::loadConfig(), MagAOX::app::flipperCtrl::loadConfigImpl(), MagAOX::app::koolanceCtrl::loadConfigImpl(), MagAOX::app::pi335Ctrl::loadConfigImpl(), and MagAOX::app::rhusbMon::loadConfigImpl().

◆ setupConfig()

int MagAOX::tty::usbDevice::setupConfig ( mx::app::appConfigurator &  config)

Setup an application configurator for the USB section.

Returns
0 on success.
-1 on error (nothing implemented yet)
Parameters
[in]configan application configuration to setup

Definition at line 24 of file usbDevice.cpp.

Referenced by MagAOX::app::filterWheelCtrl::setupConfig(), MagAOX::app::flipperCtrl::setupConfig(), MagAOX::app::koolanceCtrl::setupConfig(), MagAOX::app::pi335Ctrl::setupConfig(), MagAOX::app::rhusbMon::setupConfig(), MagAOX::app::smc100ccCtrl::setupConfig(), and MagAOX::app::zaberLowLevel::setupConfig().

Member Data Documentation

◆ m_baudRate

◆ m_deviceName

◆ m_fileDescrip

int MagAOX::tty::usbDevice::m_fileDescrip {0}

◆ m_idProduct

◆ m_idVendor

◆ m_serial


The documentation for this struct was generated from the following files: