Class DefaultDeviceFactory
java.lang.Object
com.diozero.internal.spi.AbstractDeviceFactory
com.diozero.internal.spi.BaseNativeDeviceFactory
com.diozero.internal.provider.builtin.DefaultDeviceFactory
- All Implemented Interfaces:
AnalogInputDeviceFactoryInterface
,AnalogOutputDeviceFactoryInterface
,DeviceFactoryInterface
,GpioDeviceFactoryInterface
,I2CDeviceFactoryInterface
,NativeDeviceFactoryInterface
,PwmOutputDeviceFactoryInterface
,SerialDeviceFactoryInterface
,SpiDeviceFactoryInterface
,Closeable
,AutoCloseable
public class DefaultDeviceFactory extends BaseNativeDeviceFactory
-
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 DefaultDeviceFactory()
-
Method Summary
Methods inherited from class com.diozero.internal.spi.BaseNativeDeviceFactory
close, getBoardInfo, getBoardPinInfo, getVRef, lookupBoardInfo, registerDeviceFactory
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
provisionAnalogInputDevice
Methods inherited from interface com.diozero.internal.spi.AnalogOutputDeviceFactoryInterface
provisionAnalogOutputDevice
Methods inherited from interface com.diozero.internal.spi.DeviceFactoryInterface
createI2CKey, createPinKey, createSerialKey, createSpiKey, deviceClosed, deviceOpened, getDevice, isClosed, isDeviceOpened, reopen
Methods inherited from interface com.diozero.internal.spi.GpioDeviceFactoryInterface
provisionDigitalInputDevice, provisionDigitalInputOutputDevice, provisionDigitalOutputDevice
Methods inherited from interface com.diozero.internal.spi.I2CDeviceFactoryInterface
provisionI2CDevice
Methods inherited from interface com.diozero.internal.spi.PwmOutputDeviceFactoryInterface
provisionPwmOutputDevice
Methods inherited from interface com.diozero.internal.spi.SerialDeviceFactoryInterface
provisionSerialDevice
Methods inherited from interface com.diozero.internal.spi.SpiDeviceFactoryInterface
getSpiBufferSize, provisionSpiDevice
-
Constructor Details
-
DefaultDeviceFactory
public DefaultDeviceFactory()
-
-
Method Details
-
start
public void start()Description copied from interface:DeviceFactoryInterface
Lifecycle method to start this device factory -
shutdown
public void shutdown()- Specified by:
shutdown
in classBaseNativeDeviceFactory
-
getName
Description copied from interface:DeviceFactoryInterface
Get the name of this device factory- Returns:
- the name of this device factory
-
getBoardPwmFrequency
public int getBoardPwmFrequency() -
setBoardPwmFrequency
public void setBoardPwmFrequency(int pwmFrequency) -
createDigitalInputDevice
public GpioDigitalInputDeviceInterface createDigitalInputDevice(String key, PinInfo pinInfo, GpioPullUpDown pud, GpioEventTrigger trigger) throws RuntimeIOException- Throws:
RuntimeIOException
-
createDigitalOutputDevice
public GpioDigitalOutputDeviceInterface createDigitalOutputDevice(String key, PinInfo pinInfo, boolean initialValue) throws RuntimeIOException- Throws:
RuntimeIOException
-
createDigitalInputOutputDevice
public GpioDigitalInputOutputDeviceInterface createDigitalInputOutputDevice(String key, PinInfo pinInfo, DeviceMode mode) throws RuntimeIOException- Throws:
RuntimeIOException
-
createPwmOutputDevice
public PwmOutputDeviceInterface createPwmOutputDevice(String key, PinInfo pinInfo, int pwmFrequency, float initialValue) throws RuntimeIOException- Throws:
RuntimeIOException
-
createAnalogInputDevice
public AnalogInputDeviceInterface createAnalogInputDevice(String key, PinInfo pinInfo) throws RuntimeIOException- Throws:
RuntimeIOException
-
createAnalogOutputDevice
public AnalogOutputDeviceInterface createAnalogOutputDevice(String key, PinInfo pinInfo, float initialValue) throws RuntimeIOException- Throws:
RuntimeIOException
-
createSpiDevice
public SpiDeviceInterface createSpiDevice(String key, int controller, int chipSelect, int frequency, SpiClockMode spiClockMode, boolean lsbFirst) throws RuntimeIOException- Throws:
RuntimeIOException
-
createI2CDevice
public I2CDeviceInterface createI2CDevice(String key, int controller, int address, I2CConstants.AddressSize addressSize) throws RuntimeIOException- Throws:
RuntimeIOException
-
createSerialDevice
public SerialDeviceInterface createSerialDevice(String key, String deviceFile, int baud, SerialConstants.DataBits dataBits, SerialConstants.StopBits stopBits, SerialConstants.Parity parity, boolean readBlocking, int minReadChars, int readTimeoutMillis) throws RuntimeIOException- Throws:
RuntimeIOException
-