Package gda.device.detector
Class DAServer
java.lang.Object
gda.factory.ConfigurableBase
gda.factory.FindableConfigurableBase
gda.device.DeviceBase
gda.device.detector.DAServer
- All Implemented Interfaces:
Device,Configurable,Findable,gda.observable.IObservable
- Direct Known Subclasses:
DummyDAServer
Provides Ethernet communications with OS9/Linux DAServer
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleFields 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.voidconnect()double[]getBinaryData(String message, int ndata) Get binary data from the server and transform to doubleprotected ByteBuffergetBinaryDataBuffer(String command, int ndata) Object[]Get data from the server.intfloat[]getFloatBinaryData(String message, int ndata) Get binary data from the server as floatgetHost()int[]getIntBinaryData(String message, int ndata) Get binary data from the server and transform to int[] (32bit)long[]getLongBinaryData(String message, int ndata) Get binary data from the server and transform to long (64bit) *intgetPort()longbooleanReturns the state of the socket connectionvoidRe-initialisation of values and states.voidTidy existing socket streams and try to connect them again within the thread.sendCommand(String msg) sendCommand(String msg, int timeout) Send command to the server and specify a timeout on this commandsendCommand(String msg, Boolean multiline) Send command to the server.voidsetDataPort(int dataPort) Set the data port on which da.server can make socket connection back to this.voidSet the host on which da.server is runningvoidsetPort(int port) Set the port on which da.server is listeningvoidsetReplyTimeOut(long replyTimeOut) voidsetStartupCommands(ArrayList<String> startupCommands) voidtest()test methodMethods 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, 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
-
Field Details
-
CLOCKRATE
public static final double CLOCKRATE- See Also:
-
startupCommands
-
-
Constructor Details
-
DAServer
public DAServer()
-
-
Method Details
-
setHost
Set the host on which da.server is running- Parameters:
host-
-
getHost
- Returns:
- the host name on which da.server is running
-
setPort
public void setPort(int port) Set the port on which da.server is listening- Parameters:
port-
-
getPort
public int getPort()- Returns:
- the port on which da.server is listening
-
setDataPort
public void setDataPort(int dataPort) Set the data port on which da.server can make socket connection back to this.- Parameters:
dataPort-
-
getDataPort
public int getDataPort()- Returns:
- Get the data port on which da.server can make socket connection back to this.
-
setStartupCommands
- Parameters:
startupCommands-
-
getStartupCommands
- Returns:
- an array list of startup commands to be processed by da.server on startup
-
getReplyTimeOut
public long getReplyTimeOut()- Returns:
- Returns the replyTimeOut.
-
setReplyTimeOut
public void setReplyTimeOut(long replyTimeOut) - Parameters:
replyTimeOut- Set the replyTimeOut in msec. This is the time before we give up on da.Server
-
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
-
reconfigure
Description copied from interface:ConfigurableRe-initialisation of values and states.Moved from Reconfigurable which has been deleted
- Specified by:
reconfigurein interfaceConfigurable- Overrides:
reconfigurein classConfigurableBase- Throws:
FactoryException
-
connect
public void connect() -
reconnect
Tidy existing socket streams and try to connect them again within the thread. This method is synchronized as both the main thread and run thread use this method.- Throws:
DeviceException
-
close
Close and unconfigure the device. tidy up all streams before ending program- Specified by:
closein interfaceDevice- Overrides:
closein classDeviceBase- Throws:
DeviceException- See Also:
-
isConnected
public boolean isConnected()Returns the state of the socket connection- Returns:
- true if connected
-
sendCommand
Send command to the server and specify a timeout on this command- Parameters:
msg- an unterminated commandtimeout- value in milliseconds- Returns:
- the reply which may be integer or string.
- Throws:
DeviceException
-
sendCommand
- Throws:
DeviceException
-
sendCommand
Send command to the server.- Parameters:
msg- an unterminated command- Returns:
- the reply which may be integer or string.
- Throws:
DeviceException
-
getData
Get data from the server.- Parameters:
msg- an unterminated command- Returns:
- returns data as an array of string objects.
- Throws:
Exception
-
getBinaryDataBuffer
- Throws:
Exception
-
getBinaryData
Get binary data from the server and transform to double- Parameters:
message- an unterminated commandndata- number of data values to fetch.- Returns:
- returns data as an array.
- Throws:
Exception
-
getFloatBinaryData
Get binary data from the server as float- Parameters:
message- an unterminated commandndata- number of data values to fetch.- Returns:
- returns data as an array.
- Throws:
Exception
-
getLongBinaryData
Get binary data from the server and transform to long (64bit) *- Parameters:
message- an unterminated commandndata- number of data values to fetch.- Returns:
- returns data as an array.
- Throws:
Exception
-
getIntBinaryData
Get binary data from the server and transform to int[] (32bit)- Parameters:
message- an unterminated commandndata- number of data values to fetch.- Returns:
- returns data as an array.
- Throws:
Exception
-
test
test method- Throws:
Exception
-