public class SerialService
extends java.lang.Object
The SerialService class provides serial IO services to the USerialAdapter class.
Modifier and Type | Method and Description |
---|---|
int |
available() |
boolean |
beginExclusive(boolean blocking)
Gets exclusive use of the 1-Wire to communicate with an iButton or
1-Wire Device.
|
static void |
CleanUpByThread(java.lang.Thread t)
Cleans up the resources used by the thread argument.
|
void |
closePort()
Close this serial port.
|
void |
endExclusive()
Relinquishes exclusive control of the 1-Wire Network.
|
void |
flush() |
int |
getBaudRate() |
java.lang.String |
getPortName() |
static java.util.Enumeration |
getSerialPortIdentifiers() |
static SerialService |
getSerialService(java.lang.String strComPort) |
boolean |
haveExclusive()
Check if this thread has exclusive control of the port.
|
boolean |
isDTR() |
boolean |
isPortOpen() |
boolean |
isRTS() |
void |
openPort() |
void |
openPort(SerialPortEventListener spel) |
int |
read() |
int |
read(byte[] buffer) |
int |
read(byte[] buffer,
int offset,
int length) |
int |
readWithTimeout(byte[] buffer,
int offset,
int length) |
char[] |
readWithTimeout(int length) |
void |
sendBreak(int duration)
Send a break on this serial port
|
void |
serialEvent(SerialPortEvent spe)
SerialPortEventListener method.
|
void |
setBaudRate(int baudRate) |
void |
setDTR(boolean newDTR) |
void |
setNotifyOnDataAvailable(boolean notify) |
void |
setRTS(boolean newRTS) |
void |
write(byte[] data) |
void |
write(byte[] data,
int offset,
int length) |
void |
write(char data) |
void |
write(char[] data) |
void |
write(char[] data,
int offset,
int length) |
void |
write(int data) |
void |
write(java.lang.String data) |
public static void CleanUpByThread(java.lang.Thread t)
thread
- that may have used a USerialAdapter
public static SerialService getSerialService(java.lang.String strComPort)
public void serialEvent(SerialPortEvent spe)
public void openPort() throws java.io.IOException
java.io.IOException
public void openPort(SerialPortEventListener spel) throws java.io.IOException
java.io.IOException
public void setNotifyOnDataAvailable(boolean notify)
public static java.util.Enumeration getSerialPortIdentifiers()
public java.lang.String getPortName()
public boolean isPortOpen()
public boolean isDTR()
public void setDTR(boolean newDTR)
public boolean isRTS()
public void setRTS(boolean newRTS)
public void sendBreak(int duration)
duration
- - break duration in mspublic int getBaudRate()
public void setBaudRate(int baudRate) throws java.io.IOException
java.io.IOException
public void closePort() throws java.io.IOException
java.io.IOException
- - if port is in use by another applicationpublic void flush() throws java.io.IOException
java.io.IOException
public boolean beginExclusive(boolean blocking)
blocking
- true
if want to block waiting
for an excluse access to the adaptertrue
if blocking was false and a
exclusive session with the adapter was aquiredpublic void endExclusive()
public boolean haveExclusive()
public int available() throws java.io.IOException
java.io.IOException
public int read() throws java.io.IOException
java.io.IOException
public int read(byte[] buffer) throws java.io.IOException
java.io.IOException
public int read(byte[] buffer, int offset, int length) throws java.io.IOException
java.io.IOException
public int readWithTimeout(byte[] buffer, int offset, int length) throws java.io.IOException
java.io.IOException
public char[] readWithTimeout(int length) throws java.io.IOException
java.io.IOException
public void write(int data) throws java.io.IOException
java.io.IOException
public void write(byte[] data, int offset, int length) throws java.io.IOException
java.io.IOException
public void write(byte[] data) throws java.io.IOException
java.io.IOException
public void write(java.lang.String data) throws java.io.IOException
java.io.IOException
public void write(char data) throws java.io.IOException
java.io.IOException
public void write(char[] data) throws java.io.IOException
java.io.IOException
public void write(char[] data, int offset, int length) throws java.io.IOException
java.io.IOException
Copyright © 1999-2012 Maxim Integrated Products. All Rights Reserved.