Package lejos.hardware
Class Device
- java.lang.Object
-
- lejos.hardware.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.CloseableBase 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 voidclose()Close the sensor.protected voidreleaseOnClose(java.io.Closeable res)Add the specified resource to the list of objects that will be closed when the sensor is closed.
-
-
-
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:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
-