|
SunSPOT API V6.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.spot.resources.Resource
com.sun.spot.peripheral.Serial
public class Serial
Serial - provides read access to the serial/USB ports of an eSPOT
The rev8 eSPOT has 3 available usarts: usart0, usart1 & usart2.
The initial eSPOT only has one: usart0.
Note: usart is the same as usart0
Note that in the case where the URL is "serial://usart" it is possible to append parameters
to control the serial port settings. For example:
"serial://usart?baudrate=115200&databits=8&parity=even&stopbits=0"
Allowed values for parity are even, odd, mark and none.
| Constructor Summary | |
|---|---|
Serial()
|
|
Serial(int type)
|
|
| Method Summary | |
|---|---|
int |
available()
|
protected void |
cleanUpOldIsolates()
|
void |
close()
Close the connection. |
void |
closeInputStream()
|
void |
closeOutputStream()
|
protected boolean |
inUseByOtherIsolate()
Check if the serial line is in use by another running isolate. |
DataInputStream |
openDataInputStream()
Open and return a data input stream for a connection. |
DataOutputStream |
openDataOutputStream()
Open and return a data output stream for a connection. |
InputStream |
openInputStream()
Open and return an input stream for a connection. |
OutputStream |
openOutputStream()
Open and return an output stream for a connection. |
int |
read()
|
int |
read(byte[] b,
int off,
int len)
|
void |
setUSARTParams(int baudrate,
int databits,
String parity,
float stopbits)
Set one of the ARM9's USART line parameteres. |
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
| Methods inherited from class com.sun.spot.resources.Resource |
|---|
addTag, getTags, getTagValue, hasTag, removeTag |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.sun.spot.resources.IResource |
|---|
addTag, getTags, getTagValue, hasTag, removeTag |
| Constructor Detail |
|---|
public Serial()
public Serial(int type)
| Method Detail |
|---|
protected void cleanUpOldIsolates()
protected boolean inUseByOtherIsolate()
public void setUSARTParams(int baudrate,
int databits,
String parity,
float stopbits)
throws IOException
setUSARTParams in interface ISerialbaudrate - baud speed to set module todatabits - supported values are 5,6,7,8parity - supported options are none, odd, even, space & markstopbits - supported options are 1, 1.5 or 2
IOExceptionpublic void close()
Connection
When a connection has been closed, access to any of its methods
that involve an I/O operation will cause an IOException
to be thrown.
Closing an already closed connection has no effect. Streams
derived from the connection may be open when method is called.
Any open streams will cause the connection to be held open
until they themselves are closed. In this latter case access
to the open streams is permitted, but access to the connection
is not.
close in interface Connection
public InputStream openInputStream()
throws IOException
InputConnection
openInputStream in interface ISerialopenInputStream in interface InputConnectionIOException - If an I/O error occurs
public DataInputStream openDataInputStream()
throws IOException
InputConnection
openDataInputStream in interface InputConnectionIOException - If an I/O error occurs
public OutputStream openOutputStream()
throws IOException
OutputConnection
openOutputStream in interface ISerialopenOutputStream in interface OutputConnectionIOException - If an I/O error occurs
public DataOutputStream openDataOutputStream()
throws IOException
OutputConnection
openDataOutputStream in interface OutputConnectionIOException - If an I/O error occurs
public void closeInputStream()
throws IOException
closeInputStream in interface ISerialIOException
public void closeOutputStream()
throws IOException
closeOutputStream in interface ISerialIOException
public int read()
throws IOException
read in interface ISerialIOException
public int read(byte[] b,
int off,
int len)
throws IOException
read in interface ISerialIOException
public int available()
throws IOException
available in interface ISerialIOException
public void write(int b)
throws IOException
write in interface ISerialIOException
public void write(byte[] b,
int off,
int len)
throws IOException
write in interface ISerialIOException
|
SunSPOT API V6.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||