Package com.diozero.internal.spi
Interface SerialDeviceFactoryInterface
- All Superinterfaces:
AutoCloseable
,DeviceFactoryInterface
- All Known Subinterfaces:
NativeDeviceFactoryInterface
- All Known Implementing Classes:
BaseNativeDeviceFactory
,DefaultDeviceFactory
public interface SerialDeviceFactoryInterface extends DeviceFactoryInterface
-
Field Summary
Fields Modifier and Type Field Description static String
SERIAL_PREFIX
-
Method Summary
Modifier and Type Method Description InternalSerialDeviceInterface
createSerialDevice(String key, String deviceFilename, int baud, SerialConstants.DataBits dataBits, SerialConstants.StopBits stopBits, SerialConstants.Parity parity, boolean readBlocking, int minReadChars, int readTimeoutMillis)
static String
createSerialKey(String keyPrefix, String deviceFilename)
default InternalSerialDeviceInterface
provisionSerialDevice(String deviceFilename, int baud, SerialConstants.DataBits dataBits, SerialConstants.StopBits stopBits, SerialConstants.Parity parity, boolean readBlocking, int minReadChars, int readTimeoutMillis)
Provision a serial device.Methods inherited from interface com.diozero.internal.spi.DeviceFactoryInterface
close, createI2CKey, createPinKey, createSerialKey, createSpiKey, deviceClosed, deviceOpened, getBoardPinInfo, getDevice, getName, isClosed, isDeviceOpened, reopen, start
-
Field Details
-
SERIAL_PREFIX
- See Also:
- Constant Field Values
-
-
Method Details
-
provisionSerialDevice
default InternalSerialDeviceInterface provisionSerialDevice(String deviceFilename, int baud, SerialConstants.DataBits dataBits, SerialConstants.StopBits stopBits, SerialConstants.Parity parity, boolean readBlocking, int minReadChars, int readTimeoutMillis) throws RuntimeIOExceptionProvision a serial device.- Parameters:
deviceFilename
- The O/S name of the device, e.g. "/dev/ttyUSB0"baud
- Baud ratedataBits
- Number of data bitsstopBits
- Number of stop bitsparity
- Parity optionreadBlocking
- Do read operations block?minReadChars
- The minimum number of characters to readreadTimeoutMillis
- How long a read operation waits for data before timing out. 0 == no timeout- Returns:
- Serial device instance
- Throws:
RuntimeIOException
- if an error occurs
-
createSerialDevice
InternalSerialDeviceInterface createSerialDevice(String key, String deviceFilename, int baud, SerialConstants.DataBits dataBits, SerialConstants.StopBits stopBits, SerialConstants.Parity parity, boolean readBlocking, int minReadChars, int readTimeoutMillis) throws RuntimeIOException- Throws:
RuntimeIOException
-
createSerialKey
-