blob: 11ea4c18ef4976f1d0ace06364a5627d5df5fb2b [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
Serial
</TITLE>
<META NAME="keywords" CONTENT="processing.serial.Serial class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="Serial";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html?processing/serial/Serial.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="Serial.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
processing.serial</FONT>
<BR>
Class Serial</H2>
<PRE>
java.lang.Object
<IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>processing.serial.Serial</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD>gnu.io.SerialPortEventListener, java.util.EventListener</DD>
</DL>
<HR>
<DL>
<DT><PRE>public class <B>Serial</B><DT>extends java.lang.Object<DT>implements gnu.io.SerialPortEventListener</DL>
</PRE>
<P>
<HR>
<P>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#databits">databits</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.io.InputStream</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#input">input</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.io.OutputStream</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#output">output</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#parity">parity</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;gnu.io.SerialPort</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#port">port</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#rate">rate</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#stopbits">stopbits</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#Serial(processing.core.PApplet)">Serial</A></B>(<A HREF="../../processing/core/PApplet.html" title="class in processing.core">PApplet</A>&nbsp;parent)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#Serial(processing.core.PApplet, int)">Serial</A></B>(<A HREF="../../processing/core/PApplet.html" title="class in processing.core">PApplet</A>&nbsp;parent,
int&nbsp;irate)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#Serial(processing.core.PApplet, java.lang.String)">Serial</A></B>(<A HREF="../../processing/core/PApplet.html" title="class in processing.core">PApplet</A>&nbsp;parent,
java.lang.String&nbsp;iname)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#Serial(processing.core.PApplet, java.lang.String, int)">Serial</A></B>(<A HREF="../../processing/core/PApplet.html" title="class in processing.core">PApplet</A>&nbsp;parent,
java.lang.String&nbsp;iname,
int&nbsp;irate)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#Serial(processing.core.PApplet, java.lang.String, int, char, int, float)">Serial</A></B>(<A HREF="../../processing/core/PApplet.html" title="class in processing.core">PApplet</A>&nbsp;parent,
java.lang.String&nbsp;iname,
int&nbsp;irate,
char&nbsp;iparity,
int&nbsp;idatabits,
float&nbsp;istopbits)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#available()">available</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the number of bytes that have been read from serial
and are waiting to be dealt with by the user.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#buffer(int)">buffer</A></B>(int&nbsp;count)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set number of bytes to buffer before calling serialEvent()
in the host applet.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#bufferUntil(int)">bufferUntil</A></B>(int&nbsp;what)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set a specific byte to buffer until before calling
serialEvent() in the host applet.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#clear()">clear</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ignore all the bytes read so far and empty the buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#dispose()">dispose</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Used by PApplet to shut things down.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#errorMessage(java.lang.String, java.lang.Throwable)">errorMessage</A></B>(java.lang.String&nbsp;where,
java.lang.Throwable&nbsp;e)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;General error reporting, all corraled here just in case
I think of something slightly more intelligent to do.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#last()">last</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Same as read() but returns the very last value received
and clears the buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;char</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#lastChar()">lastChar</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Just like last() and readChar().</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#list()">list</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If this just hangs and never completes on Windows,
it may be because the DLL doesn't have its exec bit set.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#read()">read</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a number between 0 and 255 for the next byte that's
waiting in the buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#readBytes()">readBytes</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Return a byte array of anything that's in the serial buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#readBytes(byte[])">readBytes</A></B>(byte[]&nbsp;outgoing)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Grab whatever is in the serial buffer, and stuff it into a
byte buffer passed in by the user.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#readBytesUntil(int)">readBytesUntil</A></B>(int&nbsp;interesting)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads from the serial port into a buffer of bytes up to and
including a particular character.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#readBytesUntil(int, byte[])">readBytesUntil</A></B>(int&nbsp;interesting,
byte[]&nbsp;outgoing)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads from the serial port into a buffer of bytes until a
particular character.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;char</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#readChar()">readChar</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the next byte in the buffer as a char.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#readString()">readString</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Return whatever has been read from the serial port so far
as a String.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#readStringUntil(int)">readStringUntil</A></B>(int&nbsp;interesting)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Combination of readBytesUntil and readString.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#serialEvent(gnu.io.SerialPortEvent)">serialEvent</A></B>(gnu.io.SerialPortEvent&nbsp;serialEvent)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#setDTR(boolean)">setDTR</A></B>(boolean&nbsp;state)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the DTR line.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#setProperties(java.util.Properties)">setProperties</A></B>(java.util.Properties&nbsp;props)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#stop()">stop</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Stop talking to serial and shut things down.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#write(byte[])">write</A></B>(byte[]&nbsp;bytes)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#write(int)">write</A></B>(int&nbsp;what)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This will handle both ints, bytes and chars transparently.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../processing/serial/Serial.html#write(java.lang.String)">write</A></B>(java.lang.String&nbsp;what)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Write a String to the output.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="port"><!-- --></A><H3>
port</H3>
<PRE>
public gnu.io.SerialPort <B>port</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="rate"><!-- --></A><H3>
rate</H3>
<PRE>
public int <B>rate</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="parity"><!-- --></A><H3>
parity</H3>
<PRE>
public int <B>parity</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="databits"><!-- --></A><H3>
databits</H3>
<PRE>
public int <B>databits</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="stopbits"><!-- --></A><H3>
stopbits</H3>
<PRE>
public int <B>stopbits</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="input"><!-- --></A><H3>
input</H3>
<PRE>
public java.io.InputStream <B>input</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="output"><!-- --></A><H3>
output</H3>
<PRE>
public java.io.OutputStream <B>output</B></PRE>
<DL>
<DL>
</DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="Serial(processing.core.PApplet)"><!-- --></A><H3>
Serial</H3>
<PRE>
public <B>Serial</B>(<A HREF="../../processing/core/PApplet.html" title="class in processing.core">PApplet</A>&nbsp;parent)</PRE>
<DL>
</DL>
<HR>
<A NAME="Serial(processing.core.PApplet, int)"><!-- --></A><H3>
Serial</H3>
<PRE>
public <B>Serial</B>(<A HREF="../../processing/core/PApplet.html" title="class in processing.core">PApplet</A>&nbsp;parent,
int&nbsp;irate)</PRE>
<DL>
</DL>
<HR>
<A NAME="Serial(processing.core.PApplet, java.lang.String, int)"><!-- --></A><H3>
Serial</H3>
<PRE>
public <B>Serial</B>(<A HREF="../../processing/core/PApplet.html" title="class in processing.core">PApplet</A>&nbsp;parent,
java.lang.String&nbsp;iname,
int&nbsp;irate)</PRE>
<DL>
</DL>
<HR>
<A NAME="Serial(processing.core.PApplet, java.lang.String)"><!-- --></A><H3>
Serial</H3>
<PRE>
public <B>Serial</B>(<A HREF="../../processing/core/PApplet.html" title="class in processing.core">PApplet</A>&nbsp;parent,
java.lang.String&nbsp;iname)</PRE>
<DL>
</DL>
<HR>
<A NAME="Serial(processing.core.PApplet, java.lang.String, int, char, int, float)"><!-- --></A><H3>
Serial</H3>
<PRE>
public <B>Serial</B>(<A HREF="../../processing/core/PApplet.html" title="class in processing.core">PApplet</A>&nbsp;parent,
java.lang.String&nbsp;iname,
int&nbsp;irate,
char&nbsp;iparity,
int&nbsp;idatabits,
float&nbsp;istopbits)</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="setProperties(java.util.Properties)"><!-- --></A><H3>
setProperties</H3>
<PRE>
public void <B>setProperties</B>(java.util.Properties&nbsp;props)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="stop()"><!-- --></A><H3>
stop</H3>
<PRE>
public void <B>stop</B>()</PRE>
<DL>
<DD>Stop talking to serial and shut things down.
<P>
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.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="dispose()"><!-- --></A><H3>
dispose</H3>
<PRE>
public void <B>dispose</B>()</PRE>
<DL>
<DD>Used by PApplet to shut things down.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setDTR(boolean)"><!-- --></A><H3>
setDTR</H3>
<PRE>
public void <B>setDTR</B>(boolean&nbsp;state)</PRE>
<DL>
<DD>Set the DTR line. Addition from Tom Hulbert.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="serialEvent(gnu.io.SerialPortEvent)"><!-- --></A><H3>
serialEvent</H3>
<PRE>
public void <B>serialEvent</B>(gnu.io.SerialPortEvent&nbsp;serialEvent)</PRE>
<DL>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE>serialEvent</CODE> in interface <CODE>gnu.io.SerialPortEventListener</CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="buffer(int)"><!-- --></A><H3>
buffer</H3>
<PRE>
public void <B>buffer</B>(int&nbsp;count)</PRE>
<DL>
<DD>Set number of bytes to buffer before calling serialEvent()
in the host applet.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="bufferUntil(int)"><!-- --></A><H3>
bufferUntil</H3>
<PRE>
public void <B>bufferUntil</B>(int&nbsp;what)</PRE>
<DL>
<DD>Set a specific byte to buffer until before calling
serialEvent() in the host applet.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="available()"><!-- --></A><H3>
available</H3>
<PRE>
public int <B>available</B>()</PRE>
<DL>
<DD>Returns the number of bytes that have been read from serial
and are waiting to be dealt with by the user.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="clear()"><!-- --></A><H3>
clear</H3>
<PRE>
public void <B>clear</B>()</PRE>
<DL>
<DD>Ignore all the bytes read so far and empty the buffer.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="read()"><!-- --></A><H3>
read</H3>
<PRE>
public int <B>read</B>()</PRE>
<DL>
<DD>Returns a number between 0 and 255 for the next byte that's
waiting in the buffer.
Returns -1 if there was no byte (although the user should
first check available() to see if things are ready to avoid this)
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="last()"><!-- --></A><H3>
last</H3>
<PRE>
public int <B>last</B>()</PRE>
<DL>
<DD>Same as read() but returns the very last value received
and clears the buffer. Useful when you just want the most
recent value sent over the port.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="readChar()"><!-- --></A><H3>
readChar</H3>
<PRE>
public char <B>readChar</B>()</PRE>
<DL>
<DD>Returns the next byte in the buffer as a char.
Returns -1, or 0xffff, if nothing is there.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="lastChar()"><!-- --></A><H3>
lastChar</H3>
<PRE>
public char <B>lastChar</B>()</PRE>
<DL>
<DD>Just like last() and readChar().
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="readBytes()"><!-- --></A><H3>
readBytes</H3>
<PRE>
public byte[] <B>readBytes</B>()</PRE>
<DL>
<DD>Return a byte array of anything that's in the serial buffer.
Not particularly memory/speed efficient, because it creates
a byte array on each read, but it's easier to use than
readBytes(byte b[]) (see below).
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="readBytes(byte[])"><!-- --></A><H3>
readBytes</H3>
<PRE>
public int <B>readBytes</B>(byte[]&nbsp;outgoing)</PRE>
<DL>
<DD>Grab whatever is in the serial buffer, and stuff it into a
byte buffer passed in by the user. This is more memory/time
efficient than readBytes() returning a byte[] array.
Returns an int for how many bytes were read. If more bytes
are available than can fit into the byte array, only those
that will fit are read.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="readBytesUntil(int)"><!-- --></A><H3>
readBytesUntil</H3>
<PRE>
public byte[] <B>readBytesUntil</B>(int&nbsp;interesting)</PRE>
<DL>
<DD>Reads from the serial port into a buffer of bytes up to and
including a particular character. If the character isn't in
the serial buffer, then 'null' is returned.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="readBytesUntil(int, byte[])"><!-- --></A><H3>
readBytesUntil</H3>
<PRE>
public int <B>readBytesUntil</B>(int&nbsp;interesting,
byte[]&nbsp;outgoing)</PRE>
<DL>
<DD>Reads from the serial port into a buffer of bytes until a
particular character. If the character isn't in the serial
buffer, then 'null' is returned.
If outgoing[] is not big enough, then -1 is returned,
and an error message is printed on the console.
If nothing is in the buffer, zero is returned.
If 'interesting' byte is not in the buffer, then 0 is returned.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="readString()"><!-- --></A><H3>
readString</H3>
<PRE>
public java.lang.String <B>readString</B>()</PRE>
<DL>
<DD>Return whatever has been read from the serial port so far
as a String. It assumes that the incoming characters are ASCII.
If you want to move Unicode data, you can first convert the
String to a byte stream in the representation of your choice
(i.e. UTF8 or two-byte Unicode data), and send it as a byte array.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="readStringUntil(int)"><!-- --></A><H3>
readStringUntil</H3>
<PRE>
public java.lang.String <B>readStringUntil</B>(int&nbsp;interesting)</PRE>
<DL>
<DD>Combination of readBytesUntil and readString. See caveats in
each function. Returns null if it still hasn't found what
you're looking for.
If you want to move Unicode data, you can first convert the
String to a byte stream in the representation of your choice
(i.e. UTF8 or two-byte Unicode data), and send it as a byte array.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="write(int)"><!-- --></A><H3>
write</H3>
<PRE>
public void <B>write</B>(int&nbsp;what)</PRE>
<DL>
<DD>This will handle both ints, bytes and chars transparently.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="write(byte[])"><!-- --></A><H3>
write</H3>
<PRE>
public void <B>write</B>(byte[]&nbsp;bytes)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="write(java.lang.String)"><!-- --></A><H3>
write</H3>
<PRE>
public void <B>write</B>(java.lang.String&nbsp;what)</PRE>
<DL>
<DD>Write a String to the output. Note that this doesn't account
for Unicode (two bytes per char), nor will it send UTF8
characters.. It assumes that you mean to send a byte buffer
(most often the case for networking and serial i/o) and
will only use the bottom 8 bits of each char in the string.
(Meaning that internally it uses String.getBytes)
If you want to move Unicode data, you can first convert the
String to a byte stream in the representation of your choice
(i.e. UTF8 or two-byte Unicode data), and send it as a byte array.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="list()"><!-- --></A><H3>
list</H3>
<PRE>
public static java.lang.String[] <B>list</B>()</PRE>
<DL>
<DD>If this just hangs and never completes on Windows,
it may be because the DLL doesn't have its exec bit set.
Why the hell that'd be the case, who knows.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="errorMessage(java.lang.String, java.lang.Throwable)"><!-- --></A><H3>
errorMessage</H3>
<PRE>
public static void <B>errorMessage</B>(java.lang.String&nbsp;where,
java.lang.Throwable&nbsp;e)</PRE>
<DL>
<DD>General error reporting, all corraled here just in case
I think of something slightly more intelligent to do.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html?processing/serial/Serial.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="Serial.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>