Package gda.device.serial
Class DummySerialDevice
java.lang.Object
gda.factory.ConfigurableBase
gda.factory.FindableConfigurableBase
gda.device.DeviceBase
gda.device.serial.SerialBase
gda.device.serial.DummySerialDevice
- All Implemented Interfaces:
CharReadableDev,CharWriteableDev,Device,Serial,Configurable,Findable,gda.observable.IObservable,ActionListener,KeyListener,EventListener
Allows you to pretend to be a serial device
-
Field Summary
Fields inherited from class gda.device.DeviceBase
DEFAULT_PROTECTION_LEVEL_PROPERTYFields inherited from interface gda.device.Serial
BAUDRATE_0, BAUDRATE_110, BAUDRATE_115200, BAUDRATE_1200, BAUDRATE_128000, BAUDRATE_134, BAUDRATE_14400, BAUDRATE_150, BAUDRATE_1800, BAUDRATE_19200, BAUDRATE_200, BAUDRATE_2000, BAUDRATE_2400, BAUDRATE_256000, BAUDRATE_300, BAUDRATE_3600, BAUDRATE_38400, BAUDRATE_4800, BAUDRATE_50, BAUDRATE_56000, BAUDRATE_57600, BAUDRATE_600, BAUDRATE_7200, BAUDRATE_75, BAUDRATE_9600, BYTESIZE_5, BYTESIZE_6, BYTESIZE_7, BYTESIZE_8, FLOWCONTROL_NONE, FLOWCONTROL_RTSCTS, FLOWCONTROL_XONXOFF, PARITY_EVEN, PARITY_MARK, PARITY_NONE, PARITY_ODD, PARITY_SPACE, STOPBITS_1, STOPBITS_1_5, STOPBITS_2 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidclose()Close and unconfigure the device.voidflush()Flushes any unread characters from the device.intGets the timeout value for single character readsvoidvoidvoidcharreadChar()Reads a character from the device.voidsetBaudRate(int baudRate) Sets the baud rate to the required valuevoidsetByteSize(int byteSize) Sets the number of data bits to the required valuevoidsetFlowControl(String flowControl) Sets the flow controlvoidSets the parity to the required valuevoidsetReadTimeout(int time) Sets the maximum length of time to wait for a character to become available to read.voidsetStopBits(int stopBits) Sets the number of stop bits to the required valuevoidwriteChar(char c) Writes a character to the device.Methods inherited from class gda.device.DeviceBase
addIObserver, deleteIObserver, deleteIObservers, getAttribute, getName, getProtectionLevel, isBeingObserved, isConfigureAtStartup, notifyIObservers, setAttribute, setConfigureAtStartup, setName, setProtectionLevelMethods inherited from class gda.factory.ConfigurableBase
configure, isConfigured, reconfigure, setConfiguredMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface gda.factory.Configurable
configure, isConfigureAtStartup, isConfigured, reconfigureMethods inherited from interface gda.device.Device
getAttribute, getProtectionLevel, setAttribute, setProtectionLevelMethods inherited from interface gda.observable.IObservable
addIObserver, deleteIObserver, deleteIObservers
-
Constructor Details
-
DummySerialDevice
public DummySerialDevice()Constructor
-
-
Method Details
-
setBaudRate
Description copied from interface:SerialSets the baud rate to the required value- Specified by:
setBaudRatein interfaceSerial- Parameters:
baudRate- number of bits/second- Throws:
DeviceException
-
setByteSize
Description copied from interface:SerialSets the number of data bits to the required value- Specified by:
setByteSizein interfaceSerial- Parameters:
byteSize- number of data bits- Throws:
DeviceException
-
setParity
Description copied from interface:SerialSets the parity to the required value- Specified by:
setParityin interfaceSerial- Parameters:
parity- type of parity- Throws:
DeviceException
-
setStopBits
Description copied from interface:SerialSets the number of stop bits to the required value- Specified by:
setStopBitsin interfaceSerial- Parameters:
stopBits- number of stop bits- Throws:
DeviceException
-
setFlowControl
Description copied from interface:SerialSets the flow control- Specified by:
setFlowControlin interfaceSerial- Parameters:
flowControl-- Throws:
DeviceException
-
getReadTimeout
Description copied from interface:SerialGets the timeout value for single character reads- Specified by:
getReadTimeoutin interfaceSerial- Returns:
- the timeout in milliseconds
- Throws:
DeviceException
-
close
public void close()Description copied from interface:DeviceClose and unconfigure the device. -
setReadTimeout
Description copied from interface:CharReadableDevSets the maximum length of time to wait for a character to become available to read.- Specified by:
setReadTimeoutin interfaceCharReadableDev- Parameters:
time- the length of time in milliseconds.- Throws:
DeviceException
-
readChar
Description copied from interface:CharReadableDevReads a character from the device.- Specified by:
readCharin interfaceCharReadableDev- Returns:
- the character read
- Throws:
DeviceException
-
flush
Description copied from interface:CharReadableDevFlushes any unread characters from the device.- Specified by:
flushin interfaceCharReadableDev- Throws:
DeviceException
-
writeChar
Description copied from interface:CharWriteableDevWrites a character to the device.- Specified by:
writeCharin interfaceCharWriteableDev- Parameters:
c- The character to write- Throws:
DeviceException
-
actionPerformed
- Specified by:
actionPerformedin interfaceActionListener
-
keyPressed
- Specified by:
keyPressedin interfaceKeyListener
-
keyReleased
- Specified by:
keyReleasedin interfaceKeyListener
-
keyTyped
- Specified by:
keyTypedin interfaceKeyListener
-