Package gda.device.serial
Class SerialController
java.lang.Object
gda.factory.ConfigurableBase
gda.factory.FindableConfigurableBase
gda.device.DeviceBase
gda.device.serial.SerialController
- All Implemented Interfaces:
Device,Configurable,Findable,gda.observable.IObservable
A Distributed Controller class for Serial devices
-
Field Summary
Fields inherited from class gda.device.DeviceBase
DEFAULT_PROTECTION_LEVEL_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close and unconfigure the device.voidDefault implementation for classes that do not have to do any specific configuration.
Classes that do their own configuration should *not* call this superclass function, as it may cause the object to appear configured before it really is.intintgetReply()intintvoidsendCommand(String command) Send a command to the serial portvoidsetBaudRate(int i) voidsetByteSize(int i) voidsetCommandTerminator(String terminator) voidsetErrorChars(String chars) voidsetFlowControl(String str) voidvoidsetReplyTerminator(String terminator) voidsetSerialDeviceName(String name) voidsetSerialTimeout(int t) voidsetStopBits(int i) 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
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
isConfigured, reconfigure
-
Constructor Details
-
SerialController
public SerialController()
-
-
Method Details
-
configure
Description copied from class:ConfigurableBaseDefault implementation for classes that do not have to do any specific configuration.
Classes that do their own configuration should *not* call this superclass function, as it may cause the object to appear configured before it really is.- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classConfigurableBase- Throws:
FactoryException- if there is an error in configuration e.g. required variable not set or cannot connect to device
-
getByteSize
public int getByteSize()- Returns:
- the no. data bits
-
setByteSize
public void setByteSize(int i) - Parameters:
i- int number of data bits
-
getBaudRate
public int getBaudRate()- Returns:
- int value of bits/second
-
setBaudRate
public void setBaudRate(int i) - Parameters:
i- int value of bits/second
-
getCommandTerminator
- Returns:
- the String command terminator
-
setCommandTerminator
- Parameters:
terminator- the String command terminator
-
getErrorChars
- Returns:
- String errorChars
-
setErrorChars
- Parameters:
chars- String error Chars
-
getFlowControl
- Returns:
- String flow control
-
setFlowControl
- Parameters:
str- String flow control
-
getParity
- Returns:
- String parity
-
setParity
- Parameters:
str- String parity
-
getReplyTerminator
- Returns:
- String reply Terminator
-
setReplyTerminator
- Parameters:
terminator- String reply Terminator
-
getSerialDeviceName
- Returns:
- String Serial Device Name
-
setSerialDeviceName
- Parameters:
name- String Serial Device Name
-
getSerialTimeout
public int getSerialTimeout()- Returns:
- int serial timeout
-
setSerialTimeout
public void setSerialTimeout(int t) - Parameters:
t- int serial timeout
-
getStopBits
public int getStopBits()- Returns:
- int stop bits
-
setStopBits
public void setStopBits(int i) - Parameters:
i- int stop bits
-
close
public void close()Description copied from interface:DeviceClose and unconfigure the device.- Specified by:
closein interfaceDevice- Overrides:
closein classDeviceBase
-
sendCommand
Send a command to the serial port- Parameters:
command- String serial device command- Throws:
DeviceException
-
getReply
- Returns:
- reply
- Throws:
DeviceException
-