public class SerialPortControl
extends java.lang.Object
implements gnu.io.SerialPortEventListener
Klasse zum Senden und Empfangen von TC57-Telegrammen via serieller Schnittstelle.
Modifier and Type | Field and Description |
---|---|
private long |
_byteTransmitDurationMicros |
private boolean |
_checkDsr |
private static Debug |
_debug |
private boolean |
_flushAfterSend |
private java.io.InputStream |
_in |
private boolean |
_initialized |
private int |
_interCharacterTimeout |
private long |
_lastReadTime |
private long |
_lastSendTime |
private java.io.OutputStream |
_out |
private boolean |
_overrunError |
private boolean |
_parityError |
private int |
_pendingInput |
private boolean |
_pendingOutput |
private gnu.io.SerialPort |
_port |
private java.lang.String |
_portName |
private PropertyConsultant |
_propertyConsultant |
private byte[] |
_receiveBuffer |
private int |
_receivedCount |
private boolean |
_receiving |
private boolean |
_rtsOnSend |
private int |
_rtsPostSendDelay |
private int |
_rtsPreSendDelay |
private int |
_tap |
private boolean |
_waitForCts |
private boolean |
_waitForDcdDown |
private boolean |
_waitWhilePendingOutput |
private static java.lang.Object |
OPEN_ACCESS_LOCK |
Constructor and Description |
---|
SerialPortControl() |
Modifier and Type | Method and Description |
---|---|
(package private) static java.lang.String |
getEventTypeName(int eventType) |
private void |
prepareReceive() |
byte[] |
query(int waitTimeSinceLastReceive,
byte[] sendBytes,
int receiveTimeout) |
byte[] |
readBytes(long timeout) |
private byte[] |
readPacket(int timeout) |
private byte[] |
receivePacket(java.nio.ByteBuffer buffer,
int timeout) |
private void |
sendPacket(int waitTimeSinceLastReceive,
byte[] packet) |
void |
serialEvent(gnu.io.SerialPortEvent serialPortEvent) |
void |
shutdown() |
void |
start(PropertyQueryInterface propertyQueryInterface,
java.lang.String applicationName) |
private static final Debug _debug
private static final java.lang.Object OPEN_ACCESS_LOCK
private PropertyConsultant _propertyConsultant
private gnu.io.SerialPort _port
private java.io.OutputStream _out
private java.io.InputStream _in
private boolean _rtsOnSend
private int _rtsPreSendDelay
private int _rtsPostSendDelay
private int _tap
private int _interCharacterTimeout
private boolean _waitForCts
private boolean _waitForDcdDown
private boolean _pendingOutput
private boolean _checkDsr
private long _lastSendTime
private int _pendingInput
private boolean _receiving
private long _lastReadTime
private boolean _parityError
private boolean _overrunError
private int _receivedCount
private byte[] _receiveBuffer
private boolean _flushAfterSend
private long _byteTransmitDurationMicros
private java.lang.String _portName
private boolean _initialized
private boolean _waitWhilePendingOutput
public void start(PropertyQueryInterface propertyQueryInterface, java.lang.String applicationName) throws java.lang.Exception
java.lang.Exception
public void shutdown()
static java.lang.String getEventTypeName(int eventType)
private void sendPacket(int waitTimeSinceLastReceive, byte[] packet) throws java.lang.InterruptedException, java.io.IOException
java.lang.InterruptedException
java.io.IOException
private void prepareReceive() throws java.io.IOException
java.io.IOException
private byte[] receivePacket(java.nio.ByteBuffer buffer, int timeout) throws java.lang.InterruptedException
java.lang.InterruptedException
public void serialEvent(gnu.io.SerialPortEvent serialPortEvent)
serialEvent
in interface gnu.io.SerialPortEventListener
public byte[] query(int waitTimeSinceLastReceive, byte[] sendBytes, int receiveTimeout) throws java.lang.InterruptedException, java.io.IOException
java.lang.InterruptedException
java.io.IOException
private byte[] readPacket(int timeout) throws java.lang.InterruptedException, java.io.IOException
java.lang.InterruptedException
java.io.IOException
public byte[] readBytes(long timeout) throws java.lang.InterruptedException
java.lang.InterruptedException