|
| 1 | +package io.github.hapjava.accessories; |
| 2 | + |
| 3 | +import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback; |
| 4 | +import io.github.hapjava.characteristics.impl.slat.CurrentSlatStateEnum; |
| 5 | +import io.github.hapjava.characteristics.impl.slat.SlatTypeEnum; |
| 6 | +import io.github.hapjava.services.Service; |
| 7 | +import io.github.hapjava.services.impl.SlatService; |
| 8 | +import java.util.Collection; |
| 9 | +import java.util.Collections; |
| 10 | +import java.util.concurrent.CompletableFuture; |
| 11 | + |
| 12 | +/** |
| 13 | + * A slat which tilts on a vertical or a horizontal axis. |
| 14 | + * |
| 15 | + * @author Eugen Freiter |
| 16 | + */ |
| 17 | +public interface SlatAccessory extends HomekitAccessory { |
| 18 | + |
| 19 | + /** |
| 20 | + * Retrieves the current state of the slat |
| 21 | + * |
| 22 | + * @return a future that will contain the state |
| 23 | + */ |
| 24 | + CompletableFuture<CurrentSlatStateEnum> getSlatState(); |
| 25 | + |
| 26 | + /** |
| 27 | + * Subscribes to changes in the state of the slat. |
| 28 | + * |
| 29 | + * @param callback the function to call when the state changes. |
| 30 | + */ |
| 31 | + void subscribeSlatState(HomekitCharacteristicChangeCallback callback); |
| 32 | + |
| 33 | + /** Unsubscribes from changes in the state of the slat. */ |
| 34 | + void unsubscribeSlatState(); |
| 35 | + |
| 36 | + /** |
| 37 | + * Retrieves the slat type. |
| 38 | + * |
| 39 | + * @return a future that will slat type. |
| 40 | + */ |
| 41 | + CompletableFuture<SlatTypeEnum> getSlatType(); |
| 42 | + |
| 43 | + @Override |
| 44 | + default Collection<Service> getServices() { |
| 45 | + return Collections.singleton(new SlatService(this)); |
| 46 | + } |
| 47 | +} |
0 commit comments