Class MockTopupScannable

All Implemented Interfaces:
AutoCloseable, IActivatable, IConnection, IBoundable<Number>, ILevel, INameable, IScanAttributeContainer, IScannable<Number>, ITerminatable, ITimeoutable, ITolerable<Number>, IPositionListenable

public class MockTopupScannable extends MockScannable implements IConnection
Designed to monitor topup (pretty badly, just conceptually). On a step divisible by ten, will force a wait until imaginary topup value is reached.
  • Constructor Details

    • MockTopupScannable

      public MockTopupScannable(String name, long period)
      Parameters:
      name -
      period - in ms that topup happens over e.g. 5000 for testing
  • Method Details

    • start

      public void start()
    • disconnect

      public void disconnect()
      Description copied from interface: IConnection
      Call to disconnect any resources which we no longer need. The resource may have timed out so it might not be connected, in that case it silently returns. Note, that the method IConnection.close(), inherited from AutoCloseable calls this method, which means that if an object of a class implementing IConnection is used with a try-with-resources block this method will be called automatically when exiting that block.
      Specified by:
      disconnect in interface IConnection
    • isConnected

      public boolean isConnected()
      Description copied from interface: IConnection
      Returns whether this connection is connected. This method returns true until disconnect is called, even if the connection is created lazily.
      Specified by:
      isConnected in interface IConnection
      Returns:
      true if connected, false otherwise
    • setPosition

      public Number setPosition(Number position) throws ScanningException
      Description copied from interface: IScannable
      Moves to the position required, blocking until it is complete. Similar to moveTo(...) in GDA8 Same as calling setPosition(value, null);
      Specified by:
      setPosition in interface IScannable<Number>
      Overrides:
      setPosition in class MockScannable
      Parameters:
      position -
      Returns:
      the new position attained by the device, if known. (Saves additional call to getPosition()) If not know the demand value is returned. NOTE if null is returned the system will call getPosition() again.
      Throws:
      ScanningException
    • setPosition

      public Number setPosition(Number position, IPosition loc) throws ScanningException
      Description copied from interface: IScannable
      Moves to the position required, blocking until it is complete. Similar to moveTo(...) in GDA8
      Specified by:
      setPosition in interface IScannable<Number>
      Overrides:
      setPosition in class MockScannable
      Parameters:
      position - that this scalar should take.
      loc - if within in a scan or null if not within a scan.
      Returns:
      the new position attained by the device, if known. (Saves additional call to getPosition()) If not know the demand value is returned. NOTE if null is returned the system will call getPosition() again.
      Throws:
      ScanningException
    • getPeriod

      public long getPeriod()
    • setPeriod

      public void setPeriod(long period)