Class FloatCharacteristic
- java.lang.Object
- 
- io.github.hapjava.characteristics.impl.base.BaseCharacteristic<java.lang.Double>
- 
- io.github.hapjava.characteristics.impl.base.FloatCharacteristic
 
 
- 
- All Implemented Interfaces:
- Characteristic,- EventableCharacteristic
 - Direct Known Subclasses:
- CarbonDioxideLevelCharacteristic,- CarbonDioxidePeakLevelCharacteristic,- CarbonMonoxideLevelCharacteristic,- CarbonMonoxidePeakLevelCharacteristic,- CoolingThresholdTemperatureCharacteristic,- CurrentAmbientLightLevelCharacteristic,- CurrentRelativeHumidityCharacteristic,- CurrentTemperatureCharacteristic,- FilterLifeLevelCharacteristic,- HeatingThresholdTemperatureCharacteristic,- HueCharacteristic,- HumidityDehumidifierThresholdCharacteristic,- HumidityHumidifierThresholdCharacteristic,- NitrogenDioxideDensityCharacteristic,- OzoneDensityCharacteristic,- PM10DensityCharacteristic,- PM25DensityCharacteristic,- RotationSpeedCharacteristic,- SaturationCharacteristic,- SulphurDioxideDensityCharacteristic,- TargetRelativeHumidityCharacteristic,- TargetTemperatureCharacteristic,- VOCDensityCharacteristic,- WaterLavelCharacteristic
 
 public abstract class FloatCharacteristic extends BaseCharacteristic<java.lang.Double> A characteristic that provides a Float value type.- Author:
- Andy Lintner
 
- 
- 
Constructor SummaryConstructors Constructor Description FloatCharacteristic(java.lang.String type, java.lang.String description, double minValue, double maxValue, double minStep, java.lang.String unit, java.util.Optional<java.util.function.Supplier<java.util.concurrent.CompletableFuture<java.lang.Double>>> getter, java.util.Optional<ExceptionalConsumer<java.lang.Double>> setter, java.util.Optional<java.util.function.Consumer<HomekitCharacteristicChangeCallback>> subscriber, java.util.Optional<java.lang.Runnable> unsubscriber)Default constructor
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Doubleconvert(javax.json.JsonValue jsonValue)Converts from the JSON value to a Java object of the type Tjava.lang.DoublegetDefault()Supplies a default value for the characteristic to send to connected clients when the real value.doublegetMaxValue()doublegetMinStep()doublegetMinValue()java.util.concurrent.CompletableFuture<java.lang.Double>getValue()Retrieves the current value of the characteristic.protected java.util.concurrent.CompletableFuture<javax.json.JsonObjectBuilder>makeBuilder(int iid)Creates the JSON serialized form of the accessory for use over the HomeKit Accessory Protocol.voidsetValue(java.lang.Double value)Update the characteristic value using a new value supplied by the connected client.- 
Methods inherited from class io.github.hapjava.characteristics.impl.base.BaseCharacteristicgetType, setJsonValue, setValue, subscribe, supplyValue, toJson, unsubscribe
 
- 
 
- 
- 
- 
Constructor Detail- 
FloatCharacteristicpublic FloatCharacteristic(java.lang.String type, java.lang.String description, double minValue, double maxValue, double minStep, java.lang.String unit, java.util.Optional<java.util.function.Supplier<java.util.concurrent.CompletableFuture<java.lang.Double>>> getter, java.util.Optional<ExceptionalConsumer<java.lang.Double>> setter, java.util.Optional<java.util.function.Consumer<HomekitCharacteristicChangeCallback>> subscriber, java.util.Optional<java.lang.Runnable> unsubscriber)Default constructor- Parameters:
- type- a string containing a UUID that indicates the type of characteristic. Apple defines a set of these, however implementors can create their own as well.
- description- a description of the characteristic to be passed to the consuming device.
- minValue- the minimum supported value.
- maxValue- the maximum supported value
- minStep- the smallest supported step. Values will be rounded to a multiple of this.
- unit- a description of the unit this characteristic supports.
- getter- getter to retrieve the value
- setter- setter to set value
- subscriber- subscriber to subscribe to changes
- unsubscriber- unsubscriber to unsubscribe from chnages
 
 
- 
 - 
Method Detail- 
makeBuilderprotected java.util.concurrent.CompletableFuture<javax.json.JsonObjectBuilder> makeBuilder(int iid) Creates the JSON serialized form of the accessory for use over the HomeKit Accessory Protocol.- Overrides:
- makeBuilderin class- BaseCharacteristic<java.lang.Double>
- Parameters:
- iid- the static id of the accessory.
- Returns:
- a future that will complete with the JSON builder for the object.
 
 - 
convertprotected java.lang.Double convert(javax.json.JsonValue jsonValue) Converts from the JSON value to a Java object of the type T- Specified by:
- convertin class- BaseCharacteristic<java.lang.Double>
- Parameters:
- jsonValue- the JSON value to convert from.
- Returns:
- the converted Java object.
 
 - 
getValuepublic final java.util.concurrent.CompletableFuture<java.lang.Double> getValue() Retrieves the current value of the characteristic.. Calls the getDoubleValue method and applies rounding to the minStep supplied in the constructor.- Specified by:
- getValuein class- BaseCharacteristic<java.lang.Double>
- Returns:
- a future that will complete with the current value.
 
 - 
setValuepublic void setValue(java.lang.Double value) throws java.lang.ExceptionDescription copied from class:BaseCharacteristicUpdate the characteristic value using a new value supplied by the connected client.- Specified by:
- setValuein class- BaseCharacteristic<java.lang.Double>
- Parameters:
- value- the new value to set.
- Throws:
- java.lang.Exception- if the value cannot be set.
 
 - 
getDefaultpublic java.lang.Double getDefault() Supplies a default value for the characteristic to send to connected clients when the real value. cannot be retrieved.- Specified by:
- getDefaultin class- BaseCharacteristic<java.lang.Double>
- Returns:
- a sensible default value.
 
 - 
getMinValuepublic double getMinValue() 
 - 
getMaxValuepublic double getMaxValue() 
 - 
getMinSteppublic double getMinStep() 
 
- 
 
-