Class Device

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable
    Direct Known Subclasses:
    BaseRegulatedMotor, BaseSensor, BasicMotor, DeviceIdentifier

    public class Device
    extends java.lang.Object
    implements java.io.Closeable
    Base class for sensor drivers. Provides mechanism to release resources when closed
    Author:
    andy
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.ArrayList<java.io.Closeable> closeList  
    • Constructor Summary

      Constructors 
      Constructor Description
      Device()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close the sensor.
      protected void releaseOnClose​(java.io.Closeable res)
      Add the specified resource to the list of objects that will be closed when the sensor is closed.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • closeList

        protected java.util.ArrayList<java.io.Closeable> closeList
    • Constructor Detail

      • Device

        public Device()
    • Method Detail

      • releaseOnClose

        protected void releaseOnClose​(java.io.Closeable res)
        Add the specified resource to the list of objects that will be closed when the sensor is closed.
        Parameters:
        res -
      • close

        public void close()
        Close the sensor. Close associated resources.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable