PlusLib
2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
|
Class for reading and writing data through the serial (RS-232) port. More...
#include <src/PlusDataCollection/PlusSerialLine.h>
Public Types | |
typedef unsigned char | BYTE |
typedef unsigned long | DWORD |
typedef int | HANDLE |
typedef unsigned int | UINT |
Public Member Functions | |
DWORD | ClearError () |
void | Close () |
PlusStatus | GetCTS (bool &onOff) |
PlusStatus | GetDSR (bool &onOff) |
int | GetMaxReplyTime () const |
unsigned int | GetNumberOfBytesAvailableForReading () const |
GetStdStringMacro (PortName) | |
bool | IsHandleAlive () const |
bool | Open () |
int | Read (BYTE *data, int maxNumberOfBytesToRead) |
bool | Read (BYTE &data) |
SerialLine () | |
PlusStatus | SetDTR (bool onOff) |
void | SetMaxReplyTime (int maxreply) |
PlusStatus | SetRTS (bool onOff) |
void | SetSerialPortSpeed (DWORD speed) |
SetStdStringMacro (PortName) | |
int | Write (const BYTE *data, int numberOfBytesToWrite) |
bool | Write (const BYTE data) |
virtual | ~SerialLine () |
Class for reading and writing data through the serial (RS-232) port.
The class currently only works on Windows. If serial communication is needed on other platforms then sample code can be found in src\Utilities\ndicapi\ndicapi_serial.* or at https://github.com/wjwwood/serial.
Definition at line 29 of file PlusSerialLine.h.
typedef unsigned char SerialLine::BYTE |
Definition at line 34 of file PlusSerialLine.h.
typedef unsigned long SerialLine::DWORD |
Definition at line 32 of file PlusSerialLine.h.
typedef int SerialLine::HANDLE |
Definition at line 39 of file PlusSerialLine.h.
typedef unsigned int SerialLine::UINT |
Definition at line 33 of file PlusSerialLine.h.
SerialLine::SerialLine | ( | ) |
Definition at line 11 of file PlusSerialLine.cxx.
|
virtual |
Definition at line 20 of file PlusSerialLine.cxx.
SerialLine::DWORD SerialLine::ClearError | ( | ) |
Clears the device's error flag to enable additional input and output (I/O) operations
Definition at line 188 of file PlusSerialLine.cxx.
void SerialLine::Close | ( | ) |
Close serial port
Definition at line 29 of file PlusSerialLine.cxx.
PlusStatus SerialLine::GetCTS | ( | bool & | onOff | ) |
Gets status of CTS (clear-to-send) line.
Definition at line 303 of file PlusSerialLine.cxx.
PlusStatus SerialLine::GetDSR | ( | bool & | onOff | ) |
Gets status of DTR (data-set-ready) line.
Definition at line 286 of file PlusSerialLine.cxx.
int SerialLine::GetMaxReplyTime | ( | ) | const |
Get the serial port max reply time
Definition at line 214 of file PlusSerialLine.cxx.
unsigned int SerialLine::GetNumberOfBytesAvailableForReading | ( | ) | const |
Check the handle alive status
Definition at line 226 of file PlusSerialLine.cxx.
SerialLine::GetStdStringMacro | ( | PortName | ) |
Get the serial port name
bool SerialLine::IsHandleAlive | ( | ) | const |
Check the handle alive status
Definition at line 220 of file PlusSerialLine.cxx.
bool SerialLine::Open | ( | ) |
Open serial port
Definition at line 41 of file PlusSerialLine.cxx.
Read data from the serial port. Returns the number of writes actually read.
Definition at line 144 of file PlusSerialLine.cxx.
bool SerialLine::Read | ( | BYTE & | data | ) |
Read a single byte from the serial port. Returns true if successful.
Definition at line 182 of file PlusSerialLine.cxx.
PlusStatus SerialLine::SetDTR | ( | bool | onOff | ) |
Sends the DTR (data-terminal-ready) signal.
Definition at line 240 of file PlusSerialLine.cxx.
void SerialLine::SetMaxReplyTime | ( | int | maxreply | ) |
Set the serial port max reply time
Definition at line 208 of file PlusSerialLine.cxx.
PlusStatus SerialLine::SetRTS | ( | bool | onOff | ) |
Sends the RTS (request-to-send) signal.
Definition at line 263 of file PlusSerialLine.cxx.
void SerialLine::SetSerialPortSpeed | ( | DWORD | speed | ) |
Set the serial port speed
Definition at line 202 of file PlusSerialLine.cxx.
SerialLine::SetStdStringMacro | ( | PortName | ) |
Set the serial port name e.g. COM1
Write data to the serial port. Returns the number of writes actually written.
Definition at line 100 of file PlusSerialLine.cxx.
bool SerialLine::Write | ( | const BYTE | data | ) |
Write a single byte to the serial port. Returns true if successful.
Definition at line 138 of file PlusSerialLine.cxx.