Package com.diozero.internal.spi
Class BaseNativeDeviceFactory
- java.lang.Object
-
- com.diozero.internal.spi.AbstractDeviceFactory
-
- com.diozero.internal.spi.BaseNativeDeviceFactory
-
- All Implemented Interfaces:
AnalogInputDeviceFactoryInterface
,AnalogOutputDeviceFactoryInterface
,DeviceFactoryInterface
,GpioDeviceFactoryInterface
,I2CDeviceFactoryInterface
,NativeDeviceFactoryInterface
,PwmOutputDeviceFactoryInterface
,SerialDeviceFactoryInterface
,SpiDeviceFactoryInterface
,AutoCloseable
- Direct Known Subclasses:
DefaultDeviceFactory
public abstract class BaseNativeDeviceFactory extends AbstractDeviceFactory implements NativeDeviceFactoryInterface
Helper class for instantiating different devices via the configured provider. To set the provider edit META-INF/services/com.diozero.spi.provider.NativeDeviceFactoryInterface While the ServiceLoader supports multiple service providers, only the first entry in this file is used
-
-
Field Summary
-
Fields inherited from class com.diozero.internal.spi.AbstractDeviceFactory
closed, deviceStates
-
Fields inherited from interface com.diozero.internal.spi.I2CDeviceFactoryInterface
I2C_PREFIX
-
Fields inherited from interface com.diozero.internal.spi.SerialDeviceFactoryInterface
SERIAL_PREFIX
-
Fields inherited from interface com.diozero.internal.spi.SpiDeviceFactoryInterface
DEFAULT_SPI_BUFFER_SIZE, SPI_PREFIX
-
-
Constructor Summary
Constructors Constructor Description BaseNativeDeviceFactory()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
Close this device factory including all devices that have been provisioned by it.BoardInfo
getBoardInfo()
BoardPinInfo
getBoardPinInfo()
Get information about pins that can be provisioned by this device factory.float
getVRef()
protected BoardInfo
lookupBoardInfo()
void
registerDeviceFactory(DeviceFactoryInterface deviceFactory)
abstract void
shutdown()
-
Methods inherited from class com.diozero.internal.spi.AbstractDeviceFactory
createI2CKey, createPinKey, createSerialKey, createSpiKey, deviceClosed, deviceOpened, getDevice, isClosed, isDeviceOpened, reopen
-
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.spi.AnalogInputDeviceFactoryInterface
createAnalogInputDevice, provisionAnalogInputDevice
-
Methods inherited from interface com.diozero.internal.spi.AnalogOutputDeviceFactoryInterface
createAnalogOutputDevice, provisionAnalogOutputDevice
-
Methods inherited from interface com.diozero.internal.spi.DeviceFactoryInterface
createI2CKey, createPinKey, createSerialKey, createSpiKey, deviceClosed, deviceOpened, getDevice, getName, isClosed, isDeviceOpened, reopen, start
-
Methods inherited from interface com.diozero.internal.spi.GpioDeviceFactoryInterface
createDigitalInputDevice, createDigitalInputOutputDevice, createDigitalOutputDevice, provisionDigitalInputDevice, provisionDigitalInputOutputDevice, provisionDigitalOutputDevice
-
Methods inherited from interface com.diozero.internal.spi.I2CDeviceFactoryInterface
createI2CDevice, provisionI2CDevice
-
Methods inherited from interface com.diozero.internal.spi.PwmOutputDeviceFactoryInterface
createPwmOutputDevice, getBoardPwmFrequency, provisionPwmOutputDevice, setBoardPwmFrequency
-
Methods inherited from interface com.diozero.internal.spi.SerialDeviceFactoryInterface
createSerialDevice, provisionSerialDevice
-
Methods inherited from interface com.diozero.internal.spi.SpiDeviceFactoryInterface
createSpiDevice, getSpiBufferSize, provisionSpiDevice
-
-
-
-
Method Detail
-
lookupBoardInfo
protected BoardInfo lookupBoardInfo()
-
getBoardInfo
public final BoardInfo getBoardInfo()
- Specified by:
getBoardInfo
in interfaceNativeDeviceFactoryInterface
-
getBoardPinInfo
public BoardPinInfo getBoardPinInfo()
Description copied from interface:DeviceFactoryInterface
Get information about pins that can be provisioned by this device factory.- Specified by:
getBoardPinInfo
in interfaceDeviceFactoryInterface
- Returns:
- board pin info instance for this device factory
-
getVRef
public float getVRef()
- Specified by:
getVRef
in interfaceAnalogInputDeviceFactoryInterface
-
registerDeviceFactory
public final void registerDeviceFactory(DeviceFactoryInterface deviceFactory)
- Specified by:
registerDeviceFactory
in interfaceNativeDeviceFactoryInterface
-
close
public final void close()
Description copied from interface:DeviceFactoryInterface
Close this device factory including all devices that have been provisioned by it.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceDeviceFactoryInterface
- Overrides:
close
in classAbstractDeviceFactory
-
shutdown
public abstract void shutdown()
-
-