Package com.diozero.internal.spi
Class AbstractDevice
java.lang.Object
com.diozero.internal.spi.AbstractDevice
- All Implemented Interfaces:
DeviceInterface
,InternalDeviceInterface
,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 InternalDeviceInterface
-
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:InternalDeviceInterface
Get the unique device identifier for this device- Specified by:
getKey
in interfaceInternalDeviceInterface
- Returns:
- unique device identifier
-
isOpen
public boolean isOpen()Description copied from interface:InternalDeviceInterface
Check if this device is open or closed- Specified by:
isOpen
in interfaceInternalDeviceInterface
- 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 interfaceDeviceInterface
-
getDeviceFactory
-
closeDevice
- Throws:
RuntimeIOException
-