Class Keyence

All Implemented Interfaces:
Device, Scannable, Configurable, Findable, gda.observable.IObservable

public class Keyence extends ScannableBase
Provides Ethernet communications a Keyence Camera Controller Tested with a CV-3001P but should work with others as well. Triggering is done in software. If you require hardware (external) triggering, that would not be very hard to implement.
  • Constructor Details

    • Keyence

      public Keyence()
  • Method Details

    • configure

      public void configure() throws FactoryException
      Description copied from class: ConfigurableBase
      Default 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:
      configure in interface Configurable
      Overrides:
      configure in class ConfigurableBase
      Throws:
      FactoryException - if there is an error in configuration e.g. required variable not set or cannot connect to device
    • connect

      public void connect() throws DeviceException
      Set up initial connections to socket and wrap the stream in buffered reader and writer.
      Throws:
      DeviceException
    • reconfigure

      public void reconfigure() throws FactoryException
      Description copied from interface: Configurable
      Re-initialisation of values and states.

      Moved from Reconfigurable which has been deleted

      Specified by:
      reconfigure in interface Configurable
      Overrides:
      reconfigure in class ConfigurableBase
      Throws:
      FactoryException
    • reconnect

      public void reconnect() throws DeviceException
      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

      public void close() throws DeviceException
      Description copied from interface: Device
      Close and unconfigure the device.
      Specified by:
      close in interface Device
      Overrides:
      close in class DeviceBase
      Throws:
      DeviceException
    • isConnected

      public boolean isConnected()
      Returns the state of the socket connection
      Returns:
      true if connected
    • processCommand

      public String processCommand(String msg) throws DeviceException
      Send command to the server.
      Parameters:
      msg - an unterminated command
      Returns:
      the reply string.
      Throws:
      DeviceException
    • saveLastMeasurementImage

      public String saveLastMeasurementImage() throws IOException, DeviceException
      Returns:
      the filename
      Throws:
      IOException
      DeviceException
    • getLastMeasurementImage

      public BufferedImage getLastMeasurementImage() throws DeviceException, IOException
      Returns:
      the camera shot of the last measurement
      Throws:
      DeviceException
      IOException
    • saveScreenShot

      public void saveScreenShot(String fileName) throws IOException, DeviceException
      Throws:
      IOException
      DeviceException
    • saveScreenShot

      public String saveScreenShot() throws IOException, DeviceException
      Returns:
      the filename
      Throws:
      IOException
      DeviceException
    • getScreenShot

      public BufferedImage getScreenShot() throws DeviceException, IOException
      Returns:
      a screenshot
      Throws:
      DeviceException
      IOException
    • processImageRequest

      public Object[] processImageRequest(String msg, int expectedReplyItems) throws DeviceException
      Send command to the server.
      Parameters:
      msg - an unterminated command
      expectedReplyItems -
      Returns:
      the reply string.
      Throws:
      DeviceException
    • setHost

      public void setHost(String host)
      Set the keyence host
      Parameters:
      host -
    • getHost

      public String getHost()
      Returns:
      the keyence host name
    • setPort

      public void setPort(int port)
      Set the command port
      Parameters:
      port -
    • getPort

      public int getPort()
      Returns:
      the command port
    • setStartupCommands

      public void setStartupCommands(List<String> startupCommands)
      Parameters:
      startupCommands -
    • getStartupCommands

      public List<String> getStartupCommands()
      Returns:
      an array list of startup commands to be processed by da.server on startup
    • getPosition

      public double[] getPosition() throws DeviceException
      Description copied from class: ScannableBase
      Returns the current position of the Scannable. Called by ConcurentScan at the end of the point. Reads an internal (hardware) position from rawGetPosition, converts this to an external (user) position and returns it.
      Specified by:
      getPosition in interface Scannable
      Overrides:
      getPosition in class ScannableBase
      Returns:
      Current position with an element for each input and extra field. null if their are no fields.
      Throws:
      DeviceException
    • asynchronousMoveTo

      public void asynchronousMoveTo(Object position) throws DeviceException
      Description copied from class: ScannableBase
      Trigger a move/operation and return immediately. Implementations of this method should be non-blocking to allow concurrent motion; the isBusy method will be used to determine when the move has completed. Converts the external (user) position to an internal position and passes this to rawAsynchronousMoveTo.
      Specified by:
      asynchronousMoveTo in interface Scannable
      Overrides:
      asynchronousMoveTo in class ScannableBase
      Parameters:
      position - Position to move to should have an element for each input field.
      Throws:
      DeviceException
    • isBusy

      public boolean isBusy() throws DeviceException
      Description copied from interface: Scannable
      Check if the Scannable is moving/operating.
      Returns:
      true - if operation carried out by moveTo has not completed yet
      Throws:
      DeviceException
    • setInputNames

      public void setInputNames(String[] names)
      Description copied from interface: Scannable
      sets the array of names returned by getInputNames method of this scannable.
      Specified by:
      setInputNames in interface Scannable
      Overrides:
      setInputNames in class ScannableBase
      Parameters:
      names -