Class AbstractDeviceFactory

    • Field Detail

      • closed

        protected boolean closed
    • Constructor Detail

      • AbstractDeviceFactory

        public AbstractDeviceFactory​(String deviceFactoryPrefix)
    • Method Detail

      • isDeviceOpened

        public final boolean isDeviceOpened​(String key)
        Description copied from interface: DeviceFactoryInterface
        Check if the device with the given unique key is opened
        Specified by:
        isDeviceOpened in interface DeviceFactoryInterface
        Parameters:
        key - the unique key of the device
        Returns:
        true if the device is opened
      • createPinKey

        public final String createPinKey​(PinInfo pinInfo)
        Description copied from interface: DeviceFactoryInterface
        diozero internal method to generate a unique key for the specified pin. Used for maintaining the state of devices provisioned by this device factory.
        Specified by:
        createPinKey in interface DeviceFactoryInterface
        Parameters:
        pinInfo - the pin to create the key for
        Returns:
        a key that is unique to this pin
      • createI2CKey

        public final String createI2CKey​(int controller,
                                         int address)
        Description copied from interface: DeviceFactoryInterface
        diozero internal method to generate a unique key for the I2C device at the specified address attached to the specified I2C bus controller.
        Specified by:
        createI2CKey in interface DeviceFactoryInterface
        Parameters:
        controller - the I2C bus controller number
        address - the I2C device address
        Returns:
        a unique I2C key
      • createSpiKey

        public final String createSpiKey​(int controller,
                                         int chipSelect)
        Description copied from interface: DeviceFactoryInterface
        diozero internal method to generate a unique key for the SPI device attached to the specified SPI controller and chip select.
        Specified by:
        createSpiKey in interface DeviceFactoryInterface
        Parameters:
        controller - the SPI controller number
        chipSelect - the SPI chip select number
        Returns:
        a unique SPI key
      • createSerialKey

        public final String createSerialKey​(String deviceFile)
        Description copied from interface: DeviceFactoryInterface
        diozero internal method to generate a unique key for the specified serial device.
        Specified by:
        createSerialKey in interface DeviceFactoryInterface
        Parameters:
        deviceFile - the serial device filename
        Returns:
        a unique serial key