Package io.github.hapjava.accessories
Interface DoorAccessory
-
- All Superinterfaces:
HomekitAccessory
public interface DoorAccessory extends HomekitAccessory
A motorized door with current and target position.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.Integer>
getCurrentPosition()
Retrieves the current position of the doorjava.util.concurrent.CompletableFuture<PositionStateEnum>
getPositionState()
Retrieves the position state of the doordefault java.util.Collection<Service>
getServices()
The collection of Services this accessory supports.java.util.concurrent.CompletableFuture<java.lang.Integer>
getTargetPosition()
Retrieves the target position of the doorjava.util.concurrent.CompletableFuture<java.lang.Void>
setTargetPosition(java.lang.Integer position)
Sets the targeted state of the door.void
subscribeCurrentPosition(HomekitCharacteristicChangeCallback callback)
Subscribes to changes in the door's current positionvoid
subscribePositionState(HomekitCharacteristicChangeCallback callback)
Subscribes to changes in the door's position statevoid
subscribeTargetPosition(HomekitCharacteristicChangeCallback callback)
Subscribes to changes in the door's target positionvoid
unsubscribeCurrentPosition()
Unsubscribes from changes in the door's current positionvoid
unsubscribePositionState()
Unsubscribes from changes in the door's statevoid
unsubscribeTargetPosition()
Unsubscribes from changes in the door's target position-
Methods inherited from interface io.github.hapjava.accessories.HomekitAccessory
getFirmwareRevision, getId, getManufacturer, getModel, getName, getPrimaryService, getSerialNumber, identify
-
-
-
-
Method Detail
-
getPositionState
java.util.concurrent.CompletableFuture<PositionStateEnum> getPositionState()
Retrieves the position state of the door- Returns:
- a future which will contain the door's position state
-
getCurrentPosition
java.util.concurrent.CompletableFuture<java.lang.Integer> getCurrentPosition()
Retrieves the current position of the door- Returns:
- a future which will contain the door's current position
-
getTargetPosition
java.util.concurrent.CompletableFuture<java.lang.Integer> getTargetPosition()
Retrieves the target position of the door- Returns:
- a future which will contain the door's target position
-
setTargetPosition
java.util.concurrent.CompletableFuture<java.lang.Void> setTargetPosition(java.lang.Integer position) throws java.lang.Exception
Sets the targeted state of the door.- Parameters:
position
- the targeted position- Returns:
- a future that completes when the change is made
- Throws:
java.lang.Exception
- when the change cannot be made
-
subscribePositionState
void subscribePositionState(HomekitCharacteristicChangeCallback callback)
Subscribes to changes in the door's position state- Parameters:
callback
- the function to call when the state changes
-
subscribeCurrentPosition
void subscribeCurrentPosition(HomekitCharacteristicChangeCallback callback)
Subscribes to changes in the door's current position- Parameters:
callback
- the function to call when the current position changes
-
subscribeTargetPosition
void subscribeTargetPosition(HomekitCharacteristicChangeCallback callback)
Subscribes to changes in the door's target position- Parameters:
callback
- the function to call when the target position changes
-
unsubscribePositionState
void unsubscribePositionState()
Unsubscribes from changes in the door's state
-
unsubscribeCurrentPosition
void unsubscribeCurrentPosition()
Unsubscribes from changes in the door's current position
-
unsubscribeTargetPosition
void unsubscribeTargetPosition()
Unsubscribes from changes in the door's target position
-
getServices
default java.util.Collection<Service> getServices()
Description copied from interface:HomekitAccessory
The collection of Services this accessory supports. Services are the primary way to interact with the accessory via HomeKit. Besides the Services offered here, the accessory will automatically include the required information service.This method will only be useful if you're implementing your own accessory type. For the standard accessories, use the default implementation provided by the interfaces in
io.github.hapjava.accessories
.- Specified by:
getServices
in interfaceHomekitAccessory
- Returns:
- the collection of services.
-
-