Repository navigation
Expand file tree
/
Copy pathSetDurationCharacteristic.java
More file actions
45 lines (41 loc) · 1.62 KB
/
Copy pathSetDurationCharacteristic.java
File metadata and controls
45 lines (41 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package io.github.hapjava.characteristics.impl.valve;
import io.github.hapjava.characteristics.EventableCharacteristic;
import io.github.hapjava.characteristics.ExceptionalConsumer;
import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
import io.github.hapjava.characteristics.impl.base.IntegerCharacteristic;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import java.util.function.Supplier;
/** This characteristic describes the duration, how long an accessory should be set to "InUse". */
public class SetDurationCharacteristic extends IntegerCharacteristic
implements EventableCharacteristic {
public static final int DEFAULT_MIN_VALUE = 0;
public static final int DEFAULT_MAX_VALUE = 3600;
public SetDurationCharacteristic(
int minValue,
int maxValue,
Supplier<CompletableFuture<Integer>> getter,
ExceptionalConsumer<Integer> setter,
Consumer<HomekitCharacteristicChangeCallback> subscriber,
Runnable unsubscriber) {
super(
"000000D3-0000-1000-8000-0026BB765291",
"uint32",
"set duration",
minValue,
maxValue,
"s",
Optional.of(getter),
Optional.of(setter),
Optional.of(subscriber),
Optional.of(unsubscriber));
}
public SetDurationCharacteristic(
Supplier<CompletableFuture<Integer>> getter,
ExceptionalConsumer<Integer> setter,
Consumer<HomekitCharacteristicChangeCallback> subscriber,
Runnable unsubscriber) {
this(DEFAULT_MIN_VALUE, DEFAULT_MAX_VALUE, getter, setter, subscriber, unsubscriber);
}
}