|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object kaos.robots.util.gps.SerialComm
public class SerialComm
Field Summary | |
---|---|
java.io.BufferedReader |
_bufferedReader
|
java.io.InputStream |
_inputStream
|
protected Logger |
_logger
|
Constructor Summary | |
---|---|
SerialComm()
This constructor assumes common default settings. |
|
SerialComm(int comPort)
|
|
SerialComm(int comPort,
int speed,
int databits,
int stopbits,
java.lang.String parity)
|
Method Summary | |
---|---|
boolean |
getDTR()
Returns the value of the DTR line |
boolean |
getRTS()
Returns the value of the RTS line |
boolean |
matchSubstring(java.lang.String input)
Retrieves the next line of input from the stream, delimited by either a line feed or carriage return, and compares it to the provided input string to see if the two strings begin in the same manner. |
protected void |
printDebugString(java.lang.String msg,
int loggerDisplayLevel)
|
byte[] |
receiveBlob(int numbytes)
Read a continuous block or 'blob' of bytes from the input stream. |
java.lang.String |
receiveLine()
Retrieves the next line of input from the stream, delimited by either a line feed or carriage return. |
void |
send(byte b)
Send the argument character on the output stream, and indicate end of input with a carriage return. |
void |
send(java.lang.String buffer)
Send the argument string on the output stream. |
void |
sendLine(java.lang.String buffer)
Send the argument string on the output stream, and indicate end of input with a carriage return. |
void |
setDTR(boolean setting)
Sets the DTR line on or off |
void |
setFlowControl(java.lang.String flowControl)
Set the flow control mode on the port. |
void |
setRTS(boolean setting)
Sets the RTS line on or off |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Logger _logger
public java.io.InputStream _inputStream
public java.io.BufferedReader _bufferedReader
Constructor Detail |
---|
public SerialComm() throws java.lang.Exception
java.lang.Exception
public SerialComm(int comPort) throws java.lang.Exception
comPort
- -- integer indicator of preferred Serial Com Port - a
'1' would indicate:
COM1 on Windows/DOS system,
/dev/ttyS0 on Linux,
/dev/ttya on Sun,
etc.
Currently coded to expect two com ports, 1 and 2.
java.lang.Exception
public SerialComm(int comPort, int speed, int databits, int stopbits, java.lang.String parity) throws java.lang.Exception, PortInUseException, java.io.IOException, UnsupportedCommOperationException
comPort
- integer indicator of preferred Serial Com Port - a '1'
would indicate
COM1 on Windows/DOS system,
/dev/ttyS0 on Linux,
/dev/ttya on Sun,
etc.
Currently coded to expect two com ports, 1 and 2.speed
- baudrate - needs to be a speed that COM port and app can
handle - i.e., one of 2400, 4800, 9600, 19200, 38400, 57600, etc.databits
- actual number of databits - needs to be one of 5, 6 ,7 or 8.stopbits
- actual number of stopbits - needs to be one of 1, 2 or 15 (i.e., 1.5).parity
- needs to be one of none, even, odd, mark or space.
java.lang.Exception
PortInUseException
java.io.IOException
UnsupportedCommOperationException
Method Detail |
---|
public void setFlowControl(java.lang.String flowControl)
flowControl
- string determines which type of flowcontrol to set on port.public void setRTS(boolean setting)
setting
- passing in true turns on RTS whereas false turns off RTSpublic boolean getRTS()
public void setDTR(boolean setting)
setting
- passing in true turns on DTR whereas false turns off DTRpublic boolean getDTR()
public void send(byte b)
buffer
- string to place onto output stream.public void send(java.lang.String buffer)
buffer
- string to place onto output stream.public void sendLine(java.lang.String buffer)
buffer
- string to place onto output stream.public java.lang.String receiveLine()
public boolean matchSubstring(java.lang.String input)
input
- string that is to be compared with string read in from line.
public byte[] receiveBlob(int numbytes)
integer
- number of bytes expected to comprise the blob to be read from inout stream
protected void printDebugString(java.lang.String msg, int loggerDisplayLevel)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |