|
direcs
2012-09-30
|
Class to read data from and write data to the serial port. More...
#include <direcsSerial.h>
Signals | |
| void | message (QString text) |
Public Member Functions | |
| int | closePort () |
| DirecsSerial () | |
| int | openPort (char *dev_name, int baudrate) |
| int | purgeRx () |
| int | readData (unsigned char *buf, int nChars, QString callingClassName="none") |
| int | writeData (unsigned char *c, QString callingClassName="none") |
| ~DirecsSerial () | |
Private Attributes | |
| QString | className |
| int | mDev_fd |
| this will contain the name of this class at runtime for debug messages | |
Class to read data from and write data to the serial port.
Definition at line 65 of file direcsSerial.h.
| DirecsSerial::DirecsSerial | ( | ) |
Definition at line 24 of file direcsSerial.cpp.
| DirecsSerial::~DirecsSerial | ( | ) |
Definition at line 33 of file direcsSerial.cpp.
| int DirecsSerial::closePort | ( | ) |
Closes the serial port.
Definition at line 299 of file direcsSerial.cpp.

|
signal |
Emits a info or error message to a slot. This slot can be used to display a text on a splash screen, log file, to print it to a console...

| int DirecsSerial::openPort | ( | char * | dev_name, |
| int | baudrate | ||
| ) |
Open a connection to the serial line.
The serial port settings (8,N,1) for the serial port are set in this method, too!
| dev_name | the name of the serial device, e.g. /dev/ttyUSB0 or /dev/ttyS0 |
| baudr | The baud rate can be B0, B300, B600, B1200, B2400, B4800, B9600, B19200, B38400, B57600, B115200 or B500000. |
Set *TERMIOS_P to indicate raw mode.
Definition at line 38 of file direcsSerial.cpp.


| int DirecsSerial::purgeRx | ( | ) |
Clears the read buffer.
Clears the read buffer. TCIFLUSH = Flush data received but not read.
Definition at line 199 of file direcsSerial.cpp.

| int DirecsSerial::readData | ( | unsigned char * | buf, |
| int | nChars, | ||
| QString | callingClassName = "none" |
||
| ) |
Reads data from the serial line
| *buf | Pointer to unsigned char buffer for the data to be read. |
| nChars | Number of bytes to be written (<= size of the buffer array). |
| callingClassName | may contain the name of the calling class. This is for debug messages only. |
Definition at line 228 of file direcsSerial.cpp.


| int DirecsSerial::writeData | ( | unsigned char * | c, |
| QString | callingClassName = "none" |
||
| ) |
Writes data to the serial line.
| *c | Pointer to unsiged char buffer to the data to be send over the serial line |
| callingClassName | may contain the name of the calling class. This is for debug messages only. |
Definition at line 209 of file direcsSerial.cpp.


|
private |
Definition at line 127 of file direcsSerial.h.
|
private |
this will contain the name of this class at runtime for debug messages
Definition at line 129 of file direcsSerial.h.