|
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
com.sun.spot.sensorboard.peripheral.EDemoSerial
public class EDemoSerial
EDemoSerial - provides access to the serial port of the eDemoboard.
It is possible to append parameters to control the serial port settings.
For example:
"edemoserial://usart?baudrate=115200&databits=8&parity=even&stopbits=0"
Allowed values for parity are even, odd, mark and none.
| Constructor Summary | |
|---|---|
EDemoSerial()
|
|
| Method Summary | |
|---|---|
int |
available()
|
void |
close()
Close the connection. |
long |
getTimeout()
Get the timeout for receiving information on this connection |
int |
read()
|
int |
read(byte[] b,
int off,
int len)
|
void |
setTimeout(long timeout)
Set the timeout for receiving information on this connection |
void |
setUSARTParams(int baudrate,
int databits,
String parity,
float stopbits)
Set the eDemo's USART line parameteres. |
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
| Methods inherited from class com.sun.spot.peripheral.Serial |
|---|
cleanUpOldIsolates, closeInputStream, closeOutputStream, inUseByOtherIsolate, openDataInputStream, openDataOutputStream, openInputStream, openOutputStream |
| 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 EDemoSerial()
| Method Detail |
|---|
public void setUSARTParams(int baudrate,
int databits,
String parity,
float stopbits)
throws IOException
setUSARTParams in interface ISerialsetUSARTParams in class Serialbaudrate - baud speed to set module todatabits - supported values are 5,6,7,8parity - supported options are none, odd & evenstopbits - supported options are 1 or 2
IOExceptionpublic void setTimeout(long timeout)
setTimeout in interface ITimeoutableConnectiontimeout - Timeout period in milliseconds. Set this to 0 to turn off
timeouts (infinite wait), or to > 0 to wait that long
for data before throwing a TimeoutException.public long getTimeout()
getTimeout in interface ITimeoutableConnection
public int read()
throws IOException
read in interface ISerialread in class SerialIOException
public int read(byte[] b,
int off,
int len)
throws IOException
read in interface ISerialread in class SerialIOException
public int available()
throws IOException
available in interface ISerialavailable in class SerialIOException
public void write(int b)
throws IOException
write in interface ISerialwrite in class SerialIOException
public void write(byte[] b,
int off,
int len)
throws IOException
write in interface ISerialwrite in class SerialIOExceptionpublic 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 Connectionclose in class Serial
|
SunSPOT API V6.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||