ngscopeclient v0.2.2
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
UART Class Reference

Wrapper class for a serial port. More...

#include <UART.h>

Collaboration diagram for UART:
Collaboration graph
[legend]

Public Member Functions

 UART ()
 Constructor.
 
 UART (const std::string &devfile, int baud)
 Connects to a serial port.
 
bool Connect (const std::string &devfile, int baud, bool dtrEnable=false, unsigned int txUs=1000 *50, unsigned int rxUs=1000 *500)
 
bool SetTimeouts (unsigned int txUs=1000 *50, unsigned int rxUs=1000 *500)
 
void Close ()
 Disconnects from the serial port.
 
virtual ~UART ()
 Destructor.
 
bool Read (unsigned char *data, int len)
 
bool Write (const unsigned char *data, int len)
 
void FlushRxBuffer ()
 
FILE_DESCRIPTOR GetHandle ()
 
bool IsValid () const
 

Static Public Member Functions

static std::vector< UartDescriptorEnumerateUarts ()
 

Protected Attributes

bool m_networked
 
FILE_DESCRIPTOR m_fd
 
Socket m_socket
 

Detailed Description

Wrapper class for a serial port.

Constructor & Destructor Documentation

◆ UART()

UART::UART ( const std::string &  devfile,
int  baud 
)

Connects to a serial port.

Exceptions
JtagExceptionon failure
Parameters
devfileThe device file
baudBaud rate to use (in bits per second)

Member Function Documentation

◆ Connect()

bool UART::Connect ( const std::string &  devfile,
int  baud,
bool  dtrEnable = false,
unsigned int  txUs = 1000*50,
unsigned int  rxUs = 1000*500 
)
@brief Connects to a serial port

@throw JtagException on failure

@param devfile      The device file
@param baud         Baud rate to use (in bits per second)
@param dtrEnable    True if DTR line should be enabled (needed by some devices like the NanoVNA to communicate)
@param txUs         Transmit timeout in microseconds (default 50,000 = 50 milliseconds)
@param rxUs         Recieve timeout in microseconds (default 500,000 = 500 milliseconds)

TODO timeouts only implemented for WIN32

◆ SetTimeouts()

bool UART::SetTimeouts ( unsigned int  txUs = 1000*50,
unsigned int  rxUs = 1000*500 
)
@brief Sets timeouts on a UART that is open

@param txUs         Transmit timeout in microseconds (default 50,000 = 50 milliseconds)
@param rxUs         Recieve timeout in microseconds (default 500,000 = 500 milliseconds)

TODO timeouts only implemented for WIN32


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