Elexis: Das führende OpenSource-Arztpraxisprogamm
im deutschsprachigen Raum
Java doc für Elexis version 2.1.7.dev vom 01.09.2013

ch.elexis.rs232
Class AbstractConnection

java.lang.Object
  extended by ch.elexis.rs232.AbstractConnection
All Implemented Interfaces:
PortEventListener, gnu.io.SerialPortEventListener, java.util.EventListener
Direct Known Subclasses:
AfinionConnection, CobasMiraConnection, ReflotronConnection, SysmexConnection

public abstract class AbstractConnection
extends java.lang.Object
implements PortEventListener


Nested Class Summary
static interface AbstractConnection.ComPortListener
           
 
Field Summary
protected  int checksumBytes
           
protected  long endTime
           
protected  int frameEnd
           
protected  int frameStart
           
protected  AbstractConnection.ComPortListener listener
           
protected  java.io.OutputStream os
           
protected  int overhang
           
protected  java.lang.StringBuilder sbFrame
           
protected  java.lang.StringBuilder sbLine
           
protected  int timeToWait
           
 
Fields inherited from interface ch.elexis.rs232.PortEventListener
CR, ETX, LF, NAK, STX, XOFF, XON
 
Constructor Summary
AbstractConnection(java.lang.String portName, java.lang.String port, java.lang.String settings, AbstractConnection.ComPortListener l)
           
 
Method Summary
 void awaitFrame(org.eclipse.swt.widgets.Shell shell, java.lang.String text, int start, int end, int following, int timeout, boolean background, boolean adjustEndTime)
          Wait for a frame of the device to be sent.
 void breakInterrupt(int state)
           
 void close()
           
 java.lang.String connect()
           
static java.lang.String[] getComPorts()
           
 byte getLineSeparator()
           
 int getState()
           
protected  void interruptWatchdog()
           
 boolean isOpen()
          Reports the open status of the port.
 boolean send(byte[] bytes)
           
 boolean send(java.lang.String data)
           
 void sendBreak()
          Send a one second break signal.
abstract  void serialEvent(int state, java.io.InputStream inputStream, gnu.io.SerialPortEvent e)
           
 void serialEvent(gnu.io.SerialPortEvent e)
          Handles SerialPortEvents.
 void setConnectionParameters(SerialParameters parameters)
          Sets the connection parameters to the setting in the parameters object.
 void setState(int state)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sbFrame

protected final java.lang.StringBuilder sbFrame

sbLine

protected final java.lang.StringBuilder sbLine

frameStart

protected int frameStart

frameEnd

protected int frameEnd

overhang

protected int overhang

checksumBytes

protected int checksumBytes

listener

protected final AbstractConnection.ComPortListener listener

endTime

protected long endTime

timeToWait

protected int timeToWait

os

protected java.io.OutputStream os
Constructor Detail

AbstractConnection

public AbstractConnection(java.lang.String portName,
                          java.lang.String port,
                          java.lang.String settings,
                          AbstractConnection.ComPortListener l)
Method Detail

connect

public java.lang.String connect()

setConnectionParameters

public void setConnectionParameters(SerialParameters parameters)
                             throws SerialConnectionException
Sets the connection parameters to the setting in the parameters object. If set fails return the parameters object to origional settings and throw exception.

Throws:
SerialConnectionException

awaitFrame

public void awaitFrame(org.eclipse.swt.widgets.Shell shell,
                       java.lang.String text,
                       int start,
                       int end,
                       int following,
                       int timeout,
                       boolean background,
                       boolean adjustEndTime)
Wait for a frame of the device to be sent. Ignores all input until a start byte is found. collects all bytes from that point until an end byte was received or the timeout happened.

Parameters:
start - character defining the start of a frame
end - character singalling end of frame
following - number of bytes after end to wait for (e.g. checksum)
timeout - number of seconds to wait for a frame to complete before givng up

serialEvent

public void serialEvent(gnu.io.SerialPortEvent e)
Handles SerialPortEvents. The two types of SerialPortEvents that this program is registered to listen for are DATA_AVAILABLE and BI. During DATA_AVAILABLE the port buffer is read until it is drained, when no more data is available and 30ms has passed the method returns. When a BI event occurs the words BREAK RECEIVED are written to the messageAreaIn.

Specified by:
serialEvent in interface gnu.io.SerialPortEventListener

serialEvent

public abstract void serialEvent(int state,
                                 java.io.InputStream inputStream,
                                 gnu.io.SerialPortEvent e)
                          throws java.io.IOException
Throws:
java.io.IOException

breakInterrupt

public void breakInterrupt(int state)

close

public void close()

isOpen

public boolean isOpen()
Reports the open status of the port.

Returns:
true if port is open, false if port is closed.

sendBreak

public void sendBreak()
Send a one second break signal.


send

public boolean send(java.lang.String data)

send

public boolean send(byte[] bytes)

getComPorts

public static java.lang.String[] getComPorts()

interruptWatchdog

protected void interruptWatchdog()

getLineSeparator

public byte getLineSeparator()

setState

public void setState(int state)

getState

public int getState()

Elexis: Das führende OpenSource-Arztpraxisprogamm
im deutschsprachigen Raum
Java doc für Elexis version 2.1.7.dev vom 01.09.2013