Package com.diozero.internal.spi
Class AbstractDevice
java.lang.Object
com.diozero.internal.spi.AbstractDevice
- All Implemented Interfaces:
DeviceInterface
,Closeable
,AutoCloseable
- Direct Known Subclasses:
AbstractInputDevice
,DefaultNativeSerialDevice
,DefaultNativeSpiDevice
,MCP23xxxDigitalOutputDevice
,NativeGpioOutputDevice
,NativeI2CDeviceJavaRaf
,NativeI2CDeviceSMBus
,OdroidC2SysFsPwmOutputDevice
,PiconZero.PiconZeroAnalogOutputDevice
,PiconZero.PiconZeroDigitalInputDevice
,PiconZero.PiconZeroDigitalOutputDevice
,PiconZero.PiconZeroPwmOutputDevice
,SoftwarePwmOutputDevice
,SysFsDigitalOutputDevice
,SysFsPwmOutputDevice
public abstract class AbstractDevice extends Object implements DeviceInterface
-
Constructor Summary
Constructors Constructor Description AbstractDevice(String key, DeviceFactoryInterface deviceFactory)
-
Method Summary
Modifier and Type Method Description void
close()
Close this deviceprotected abstract void
closeDevice()
protected DeviceFactoryInterface
getDeviceFactory()
String
getKey()
Get the unique device identifier for this deviceboolean
isOpen()
Check if this device is open or closed
-
Constructor Details
-
AbstractDevice
-
-
Method Details
-
getKey
Description copied from interface:DeviceInterface
Get the unique device identifier for this device- Specified by:
getKey
in interfaceDeviceInterface
- Returns:
- unique device identifier
-
isOpen
public boolean isOpen()Description copied from interface:DeviceInterface
Check if this device is open or closed- Specified by:
isOpen
in interfaceDeviceInterface
- Returns:
- true if this device is open
-
close
public final void close()Description copied from interface:DeviceInterface
Close this device- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceDeviceInterface
-
getDeviceFactory
-
closeDevice
- Throws:
RuntimeIOException
-