|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecttuwien.auto.calimero.serial.LibraryAdapter
public abstract class LibraryAdapter
Adapter to access a serial communication port using some serial I/O library.
Subtypes of this class implementing the access to a specific library have to declare a
public constructor expecting a String and an int argument:
Ctor(String portID, int baudrate)
Invoking this constructor will open the serial port according the supplied arguments.
After closing a library adapter, method behavior is undefined.
| Field Summary | |
|---|---|
protected static LogService |
logger
The same logger as used for the FT1.2 connection. |
| Constructor Summary | |
|---|---|
protected |
LibraryAdapter()
Creates a new library adapter. |
| Method Summary | |
|---|---|
abstract void |
close()
Closes an open serial port. |
int |
getBaudRate()
Returns the currently used baud rate. |
abstract java.io.InputStream |
getInputStream()
Returns the input stream for the opened serial communication port. |
abstract java.io.OutputStream |
getOutputStream()
Returns the output stream for the opened serial communication port. |
protected java.lang.Object |
invoke(java.lang.Object obj,
java.lang.String method,
java.lang.Object[] args)
Invokes method name on object obj with arguments
args. |
void |
setBaudRate(int baudrate)
Sets a new baud rate for this connection. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final LogService logger
| Constructor Detail |
|---|
protected LibraryAdapter()
| Method Detail |
|---|
public abstract void close()
throws java.io.IOException
java.io.IOException - on error during closepublic int getBaudRate()
public abstract java.io.InputStream getInputStream()
Subsequent invocations might return the same or a new stream object.
public abstract java.io.OutputStream getOutputStream()
Subsequent invocations might return the same or a new stream object.
protected java.lang.Object invoke(java.lang.Object obj,
java.lang.String method,
java.lang.Object[] args)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException
method name on object obj with arguments
args.
Arguments wrapped in an object of type Integer are replaced with the primitive int type when looking up the method name.
obj - object on which to invoke the methodmethod - method nameargs - list of arguments
java.lang.NoSuchMethodException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetExceptionClass.getMethod(String, Class[]),
Method.invoke(Object, Object[])public void setBaudRate(int baudrate)
baudrate - requested baud rate [Bit/s], 0 < baud rate
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||