Class GpioPropertyConfig

java.lang.Object
net.solarnetwork.domain.datum.DatumSamplePropertyConfig<V>
net.solarnetwork.domain.datum.NumberDatumSamplePropertyConfig<Integer>
net.solarnetwork.node.control.numato.usbgpio.GpioPropertyConfig

public class GpioPropertyConfig extends net.solarnetwork.domain.datum.NumberDatumSamplePropertyConfig<Integer>
Configuration for a single GPIO property to be control.

The DatumSamplePropertyConfig.getConfig() value represents the GPIO address to read from, starting from 0.

Version:
1.0
Author:
matt
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final GpioDirection
    The gpioDirection property default value.
    static final GpioType
    The gpioType property default value.

    Fields inherited from class net.solarnetwork.domain.datum.NumberDatumSamplePropertyConfig

    DEFAULT_DECIMAL_SCALE, DEFAULT_INTERCEPT, DEFAULT_PROPERTY_TYPE, DEFAULT_SLOPE
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the GPIO address to control.
    Get the control ID.
    Get the GPIO direction.
    int
    Get the GPIO direction code value.
    Get the GPIO type.
    int
    Get the GPIO type code value.
    static BitSet
    Create a new bit set suitable for using to configure the IO direction of all GPIO addresses based on a set of configurations.
    boolean
    Test if this instance has a valid configuration.
    of(String controlId, Integer address)
    Create a new configuration instance.
    void
    Set the GPIO address to control.
    void
    setControlId(String controlId)
    Set the control ID.
    void
    Set the GPIO direction.
    void
    Set the GPIO direction as a code value.
    void
    Set the GPIO type code value.
    void
    setGpioTypeCode(int code)
    Set the GPIO type as a code value.
    static List<net.solarnetwork.settings.SettingSpecifier>
    settings(String prefix)
    Get settings suitable for configuring an instance of this class.

    Methods inherited from class net.solarnetwork.domain.datum.NumberDatumSamplePropertyConfig

    applyTransformations, getDecimalScale, getIntercept, getSlope, getUnitIntercept, getUnitSlope, numberTransformSettings, setDecimalScale, setIntercept, setSlope, setUnitIntercept, setUnitSlope

    Methods inherited from class net.solarnetwork.domain.datum.DatumSamplePropertyConfig

    getConfig, getPropertyKey, getPropertyType, getPropertyTypeKey, setConfig, setPropertyKey, setPropertyType, setPropertyTypeKey, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • DEFAULT_GPIO_TYPE

      public static final GpioType DEFAULT_GPIO_TYPE
      The gpioType property default value.
    • DEFAULT_GPIO_DIRECTION

      public static final GpioDirection DEFAULT_GPIO_DIRECTION
      The gpioDirection property default value.
  • Constructor Details

    • GpioPropertyConfig

      public GpioPropertyConfig()
      Constructor.
  • Method Details

    • settings

      public static List<net.solarnetwork.settings.SettingSpecifier> settings(String prefix)
      Get settings suitable for configuring an instance of this class.
      Parameters:
      prefix - a setting key prefix to use
      Returns:
      the settings, never null
    • ioDirectionBitSet

      public static BitSet ioDirectionBitSet(GpioPropertyConfig[] configs)
      Create a new bit set suitable for using to configure the IO direction of all GPIO addresses based on a set of configurations.

      Only valid configurations are considered (those that return true from isValid().

      Parameters:
      configs - the configurations to generate the bit set from
      Returns:
      a bit set where
    • of

      public static GpioPropertyConfig of(String controlId, Integer address)
      Create a new configuration instance.
      Parameters:
      controlId - the control ID
      address - the GPIO address
      Returns:
      the configuration, never null
    • isValid

      public boolean isValid()
      Test if this instance has a valid configuration.

      This method simply verifies the minimum level of configuration is available for the control to be used.

      Returns:
      true if this configuration is valid for use
    • getControlId

      public String getControlId()
      Get the control ID.
      Returns:
      the control ID
    • setControlId

      public void setControlId(String controlId)
      Set the control ID.
      Parameters:
      controlId - the control ID to set
    • getAddress

      public Integer getAddress()
      Get the GPIO address to control.

      This is an alias for DatumSamplePropertyConfig.getConfig().

      Returns:
      the GPIO address
    • setAddress

      public void setAddress(Integer address)
      Set the GPIO address to control.

      This is an alias for DatumSamplePropertyConfig.setConfig(Object).

      Parameters:
      address - the GPIO address to set
    • getGpioType

      public GpioType getGpioType()
      Get the GPIO type.
      Returns:
      the type, never null
    • setGpioType

      public void setGpioType(GpioType gpioType)
      Set the GPIO type code value.
      Parameters:
      gpioType - the type; if null then DEFAULT_GPIO_TYPE will be set
    • getGpioTypeCode

      public int getGpioTypeCode()
      Get the GPIO type code value.
      Returns:
      the GPIO type code value
    • setGpioTypeCode

      public void setGpioTypeCode(int code)
      Set the GPIO type as a code value.
      Parameters:
      code - the code value to set; if not a valid GpioType code value the DEFAULT_GPIO_TYPE will be set
    • getGpioDirection

      public GpioDirection getGpioDirection()
      Get the GPIO direction.
      Returns:
      the direction, never null
    • setGpioDirection

      public void setGpioDirection(GpioDirection gpioDirection)
      Set the GPIO direction.
      Parameters:
      gpioDirection - the direction to set; if null then DEFAULT_GPIO_DIRECTION will be set
    • getGpioDirectionCode

      public int getGpioDirectionCode()
      Get the GPIO direction code value.
      Returns:
      the GPIO direction code value
    • setGpioDirectionCode

      public void setGpioDirectionCode(int code)
      Set the GPIO direction as a code value.
      Parameters:
      code - the code value to set; if not a valid GpioDirection code value the DEFAULT_GPIO_DIRECTION will be set