|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object processing.serial.Serial
public class Serial
Field Summary | |
---|---|
int |
databits
|
java.io.InputStream |
input
|
java.io.OutputStream |
output
|
int |
parity
|
gnu.io.SerialPort |
port
|
int |
rate
|
int |
stopbits
|
Constructor Summary | |
---|---|
Serial(PApplet parent)
|
|
Serial(PApplet parent,
int irate)
|
|
Serial(PApplet parent,
java.lang.String iname)
|
|
Serial(PApplet parent,
java.lang.String iname,
int irate)
|
|
Serial(PApplet parent,
java.lang.String iname,
int irate,
char iparity,
int idatabits,
float istopbits)
|
Method Summary | |
---|---|
int |
available()
Returns the number of bytes that have been read from serial and are waiting to be dealt with by the user. |
void |
buffer(int count)
Set number of bytes to buffer before calling serialEvent() in the host applet. |
void |
bufferUntil(int what)
Set a specific byte to buffer until before calling serialEvent() in the host applet. |
void |
clear()
Ignore all the bytes read so far and empty the buffer. |
void |
dispose()
Used by PApplet to shut things down. |
static void |
errorMessage(java.lang.String where,
java.lang.Throwable e)
General error reporting, all corraled here just in case I think of something slightly more intelligent to do. |
int |
last()
Same as read() but returns the very last value received and clears the buffer. |
char |
lastChar()
Just like last() and readChar(). |
static java.lang.String[] |
list()
If this just hangs and never completes on Windows, it may be because the DLL doesn't have its exec bit set. |
int |
read()
Returns a number between 0 and 255 for the next byte that's waiting in the buffer. |
byte[] |
readBytes()
Return a byte array of anything that's in the serial buffer. |
int |
readBytes(byte[] outgoing)
Grab whatever is in the serial buffer, and stuff it into a byte buffer passed in by the user. |
byte[] |
readBytesUntil(int interesting)
Reads from the serial port into a buffer of bytes up to and including a particular character. |
int |
readBytesUntil(int interesting,
byte[] outgoing)
Reads from the serial port into a buffer of bytes until a particular character. |
char |
readChar()
Returns the next byte in the buffer as a char. |
java.lang.String |
readString()
Return whatever has been read from the serial port so far as a String. |
java.lang.String |
readStringUntil(int interesting)
Combination of readBytesUntil and readString. |
void |
serialEvent(gnu.io.SerialPortEvent serialEvent)
|
void |
setDTR(boolean state)
Set the DTR line. |
void |
setProperties(java.util.Properties props)
|
void |
stop()
Stop talking to serial and shut things down. |
void |
write(byte[] bytes)
|
void |
write(int what)
This will handle both ints, bytes and chars transparently. |
void |
write(java.lang.String what)
Write a String to the output. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public gnu.io.SerialPort port
public int rate
public int parity
public int databits
public int stopbits
public java.io.InputStream input
public java.io.OutputStream output
Constructor Detail |
---|
public Serial(PApplet parent)
public Serial(PApplet parent, int irate)
public Serial(PApplet parent, java.lang.String iname, int irate)
public Serial(PApplet parent, java.lang.String iname)
public Serial(PApplet parent, java.lang.String iname, int irate, char iparity, int idatabits, float istopbits)
Method Detail |
---|
public void setProperties(java.util.Properties props)
public void stop()
Basically just a user-accessible version of dispose(). For now, it just calls dispose(), but dispose shouldn't be called from applets, because in some libraries, dispose() blows shit up if it's called by a user who doesn't know what they're doing.
public void dispose()
public void setDTR(boolean state)
public void serialEvent(gnu.io.SerialPortEvent serialEvent)
serialEvent
in interface gnu.io.SerialPortEventListener
public void buffer(int count)
public void bufferUntil(int what)
public int available()
public void clear()
public int read()
public int last()
public char readChar()
public char lastChar()
public byte[] readBytes()
public int readBytes(byte[] outgoing)
public byte[] readBytesUntil(int interesting)
public int readBytesUntil(int interesting, byte[] outgoing)
public java.lang.String readString()
public java.lang.String readStringUntil(int interesting)
public void write(int what)
public void write(byte[] bytes)
public void write(java.lang.String what)
public static java.lang.String[] list()
public static void errorMessage(java.lang.String where, java.lang.Throwable e)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |