Class 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
FieldsModifier and TypeFieldDescriptionstatic final GpioDirectionThegpioDirectionproperty default value.static final GpioTypeThegpioTypeproperty default value.Fields inherited from class net.solarnetwork.domain.datum.NumberDatumSamplePropertyConfig
DEFAULT_DECIMAL_SCALE, DEFAULT_INTERCEPT, DEFAULT_PROPERTY_TYPE, DEFAULT_SLOPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the GPIO address to control.Get the control ID.Get the GPIO direction.intGet the GPIO direction code value.Get the GPIO type.intGet the GPIO type code value.static BitSetioDirectionBitSet(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.booleanisValid()Test if this instance has a valid configuration.static GpioPropertyConfigCreate a new configuration instance.voidsetAddress(Integer address) Set the GPIO address to control.voidsetControlId(String controlId) Set the control ID.voidsetGpioDirection(GpioDirection gpioDirection) Set the GPIO direction.voidsetGpioDirectionCode(int code) Set the GPIO direction as a code value.voidsetGpioType(GpioType gpioType) Set the GPIO type code value.voidsetGpioTypeCode(int code) Set the GPIO type as a code value.static List<net.solarnetwork.settings.SettingSpecifier> 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, setUnitSlopeMethods inherited from class net.solarnetwork.domain.datum.DatumSamplePropertyConfig
getConfig, getPropertyKey, getPropertyType, getPropertyTypeKey, setConfig, setPropertyKey, setPropertyType, setPropertyTypeKey, toString
-
Field Details
-
DEFAULT_GPIO_TYPE
ThegpioTypeproperty default value. -
DEFAULT_GPIO_DIRECTION
ThegpioDirectionproperty default value.
-
-
Constructor Details
-
GpioPropertyConfig
public GpioPropertyConfig()Constructor.
-
-
Method Details
-
settings
Get settings suitable for configuring an instance of this class.- Parameters:
prefix- a setting key prefix to use- Returns:
- the settings, never null
-
ioDirectionBitSet
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
Create a new configuration instance.- Parameters:
controlId- the control IDaddress- 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
Get the control ID.- Returns:
- the control ID
-
setControlId
Set the control ID.- Parameters:
controlId- the control ID to set
-
getAddress
Get the GPIO address to control.This is an alias for
DatumSamplePropertyConfig.getConfig().- Returns:
- the GPIO address
-
setAddress
Set the GPIO address to control.This is an alias for
DatumSamplePropertyConfig.setConfig(Object).- Parameters:
address- the GPIO address to set
-
getGpioType
Get the GPIO type.- Returns:
- the type, never null
-
setGpioType
Set the GPIO type code value.- Parameters:
gpioType- the type; if null thenDEFAULT_GPIO_TYPEwill 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 validGpioTypecode value theDEFAULT_GPIO_TYPEwill be set
-
getGpioDirection
Get the GPIO direction.- Returns:
- the direction, never null
-
setGpioDirection
Set the GPIO direction.- Parameters:
gpioDirection- the direction to set; if null thenDEFAULT_GPIO_DIRECTIONwill 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 validGpioDirectioncode value theDEFAULT_GPIO_DIRECTIONwill be set
-