4
* 2003-February-17 Jason Rohrer
7
* 2003-April-4 Jason Rohrer
8
* Added function for dumping the read buffer.
13
#ifndef SERIAL_PORT_INCLUDED
14
#define SERIAL_PORT_INCLUDED
21
* Note: Implementation for the functions defined here is provided
22
* separately for each platform (in the mac/ linux/ and win32/
25
* @author Jason Rohrer
35
static const int PARITY_NONE = 0;
36
static const int PARITY_EVEN = 1;
37
static const int PARITY_ODD = 2;
42
* Constructs a serial port.
44
* @param inBaud the baud rate.
45
* @param inParity the parity, one of SerialPort:: PARITY_NONE,
46
* PARITY_EVEN, or PARITY_ODD.
47
* @param inDataBits the number of data bits, 5, 6, 7, or 8.
48
* @param inStopBits the number of stop bits, 1 or 2.
50
SerialPort( int inBaud, int inParity, int inDataBits, int inStopBits );
59
* Sends a line of text through this serial port.
61
* @param inLine the \0-terminated line of text to send.
62
* Should not contain newline characters.
63
* Must be destroyed by caller if non-const.
65
* @return 1 if the line was sent successfully,
66
* or -1 for a port error.
68
int sendLine( char *inLine );
73
* Receives a line of text from this serial port.
75
* @return the read line as a \0-terminated string with end of
76
* line characters included, or NULL for a port error.
77
* Must be destroyed by caller if non-NULL.
84
* Discards all characters in the receive buffer, including
87
* Can be used to recover from buffer overflow problems.
89
void dumpReceiveBuffer();
98
* Used for platform-specific implementations.
100
void *mNativeObjectPointer;