Package com.diozero.internal.provider
Class AbstractDeviceFactory
java.lang.Object
com.diozero.internal.provider.AbstractDeviceFactory
- All Implemented Interfaces:
DeviceFactoryInterface
,java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
BaseNativeDeviceFactory
,MCP23xxx
,McpAdc
,PCA9685
,PCF8574
,PCF8591
,PiconZero
public abstract class AbstractDeviceFactory extends java.lang.Object implements DeviceFactoryInterface
-
Field Summary
Fields Modifier and Type Field Description protected boolean
closed
protected DeviceStates
deviceStates
-
Constructor Summary
Constructors Constructor Description AbstractDeviceFactory(java.lang.String deviceFactoryPrefix)
-
Method Summary
Modifier and Type Method Description void
close()
java.lang.String
createI2CKey(int controller, int address)
java.lang.String
createPinKey(PinInfo pinInfo)
java.lang.String
createSpiKey(int controller, int chipSelect)
void
deviceClosed(DeviceInterface device)
void
deviceOpened(DeviceInterface device)
DeviceInterface
getDevice(java.lang.String key)
<T extends DeviceInterface>
TgetDevice(java.lang.String key, java.lang.Class<T> deviceClass)
boolean
isClosed()
boolean
isDeviceOpened(java.lang.String key)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.diozero.internal.provider.DeviceFactoryInterface
getBoardPinInfo, getName
-
Field Details
-
deviceStates
-
closed
protected boolean closed
-
-
Constructor Details
-
AbstractDeviceFactory
public AbstractDeviceFactory(java.lang.String deviceFactoryPrefix)
-
-
Method Details
-
createPinKey
- Specified by:
createPinKey
in interfaceDeviceFactoryInterface
-
createI2CKey
public final java.lang.String createI2CKey(int controller, int address)- Specified by:
createI2CKey
in interfaceDeviceFactoryInterface
-
createSpiKey
public final java.lang.String createSpiKey(int controller, int chipSelect)- Specified by:
createSpiKey
in interfaceDeviceFactoryInterface
-
close
public void close()- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceDeviceFactoryInterface
-
isClosed
public final boolean isClosed()- Specified by:
isClosed
in interfaceDeviceFactoryInterface
-
deviceOpened
- Specified by:
deviceOpened
in interfaceDeviceFactoryInterface
-
deviceClosed
- Specified by:
deviceClosed
in interfaceDeviceFactoryInterface
-
isDeviceOpened
public final boolean isDeviceOpened(java.lang.String key)- Specified by:
isDeviceOpened
in interfaceDeviceFactoryInterface
-
getDevice
- Specified by:
getDevice
in interfaceDeviceFactoryInterface
-
getDevice
public final <T extends DeviceInterface> T getDevice(java.lang.String key, java.lang.Class<T> deviceClass)- Specified by:
getDevice
in interfaceDeviceFactoryInterface
-