Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,35 @@
## Fixes
* Log accessory names instead of futures. [#150](https://github.com/hap-java/HAP-Java/issues/150)
* Fix rotation speed data type (BREAKING API CHANGE). According to HAP specification it must be float
* Close JsonWriters [#149](https://github.com/hap-java/HAP-Java/issues/149)
* Fix UUID of HAP Version characteristic
* Add Mute characteristic to Doorbell service

## New
* New characteristics:
* Identifier
* Input Device Type
* Input Source Type
* Configured Name
* Current Visibility State
* Target Visibility State
* Sleep Discovery Mode
* Active Identifier
* Closed Captions
* Current Media State
* Target Media State
* Picture Mode
* Power Mode
* Remote Key
* Volume Control Type
* Volume Selector
* AirPlay Enable

* New services
* Input Source
* Television
* Television Speaker
* Smart Speaker

# HAP-Java 2.0.0
* major refactoring to support optional characteristics
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Include HAP-Java in your project using maven:
<dependency>
<groupId>io.github.hap-java</groupId>
<artifactId>hap</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>2.0.1-SNAPSHOT</version>
</dependency>
```

Expand All @@ -28,7 +28,7 @@ read the [Javadoc](https://hap-java.github.io/HAP-Java/apidocs/index.html)
Supported HomeKit Accessories
=========

Current implementation fully supports 38 HomeKit accessory/services.
Current implementation fully supports 42 HomeKit accessory/services.

| HomeKit Accessory & Service type | Supported by Java-HAP |
|--------------------|--------------------|
Expand All @@ -52,6 +52,7 @@ Current implementation fully supports 38 HomeKit accessory/services.
| Heater Cooler | :white_check_mark: |
| Humidifier Dehumidifier | :white_check_mark: |
| Humidity Sensor | :white_check_mark: |
| Input Source | :white_check_mark: |
| Irrigation System | :white_check_mark: |
| Leak Sensor | :white_check_mark: |
| Light Bulb | :white_check_mark: |
Expand All @@ -66,12 +67,15 @@ Current implementation fully supports 38 HomeKit accessory/services.
| Service Label | :white_check_mark: |
| Siri | :x: |
| Slat | :white_check_mark: |
| Smart Speaker | :white_check_mark: |
| Smoke Sensor | :white_check_mark: |
| Speaker | :white_check_mark: |
| Stateless Programmable Switch | :white_check_mark: |
| Switch | :white_check_mark: |
| Target Control | :x: |
| Target Control Management | :x: |
| Television | :white_check_mark: |
| Television Speaker | :white_check_mark: |
| Temperature Sensor | :white_check_mark: |
| Thermostat | :white_check_mark: |
| Valve | :white_check_mark: |
Expand Down
104 changes: 104 additions & 0 deletions src/main/java/io/github/hapjava/accessories/InputSourceAccessory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
package io.github.hapjava.accessories;

import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
import io.github.hapjava.characteristics.impl.common.IsConfiguredEnum;
import io.github.hapjava.characteristics.impl.inputsource.CurrentVisibilityStateEnum;
import io.github.hapjava.characteristics.impl.inputsource.InputSourceTypeEnum;
import io.github.hapjava.services.Service;
import io.github.hapjava.services.impl.InputSourceService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;

/** Input Source accessory. */
public interface InputSourceAccessory extends HomekitAccessory {

/**
* Retrieves configured name of input source.
*
* @return configured name of input source
*/
CompletableFuture<String> getConfiguredName();

/**
* Sets the configured name.
*
* @param name configured name
* @return a future that completes when the change is made
* @throws Exception when the change cannot be made
*/
CompletableFuture<Void> setConfiguredName(String name) throws Exception;

/**
* Subscribes to changes in configured name.
*
* @param callback the function to call when the configured name changes.
*/
void subscribeConfiguredName(HomekitCharacteristicChangeCallback callback);

/** Unsubscribes from changes in the configured name. */
void unsubscribeConfiguredName();

/**
* Retrieves the flag whether input source is configured.
*
* @return a future that will contain the flag .
*/
CompletableFuture<IsConfiguredEnum> isConfigured();
/**
* set the flag whether input source is configured.
*
* @param state is configured state
* @return a future that completes when the change is made
*/
CompletableFuture<Void> setIsConfigured(IsConfiguredEnum state);

/**
* Subscribes to changes in isConfigured.
*
* @param callback the function to call when the state changes.
*/
void subscribeIsConfigured(HomekitCharacteristicChangeCallback callback);

/** Unsubscribes from changes in isConfigured. */
void unsubscribeIsConfigured();

/**
* Retrieves the input source type.
*
* @return a future that will contain the input source type.
*/
CompletableFuture<InputSourceTypeEnum> getInputSourceType();

/**
* Subscribes to changes in input source type.
*
* @param callback the function to call when the type changes.
*/
void subscribeInputSourceType(HomekitCharacteristicChangeCallback callback);

/** Unsubscribes from changes in the input source type. */
void unsubscribeInputSourceType();

/**
* Retrieves the current visibility state.
*
* @return a future that will contain the current visibility state.
*/
CompletableFuture<CurrentVisibilityStateEnum> getCurrentVisibilityState();

/**
* Subscribes to changes in current visibility state.
*
* @param callback the function to call when the state changes.
*/
void subscribeCurrentVisibilityState(HomekitCharacteristicChangeCallback callback);

/** Unsubscribes from changes in the current visibility state. */
void unsubscribeCurrentVisibilityState();

@Override
default Collection<Service> getServices() {
return Collections.singleton(new InputSourceService(this));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package io.github.hapjava.accessories;

import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
import io.github.hapjava.characteristics.impl.television.CurrentMediaStateEnum;
import io.github.hapjava.characteristics.impl.television.TargetMediaStateEnum;
import io.github.hapjava.services.Service;
import io.github.hapjava.services.impl.SmartSpeakerService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;

/** Smart Speaker accessory. */
public interface SmartSpeakerAccessory extends HomekitAccessory {

/**
* Retrieves the current media state (see {@link
* io.github.hapjava.characteristics.impl.television.CurrentMediaStateEnum} for supported values).
*
* @return a future that will contain the current media state
*/
CompletableFuture<CurrentMediaStateEnum> getCurrentMediaState();

/**
* Subscribes to changes in the current media state.
*
* @param callback the function to call when the current media state changes.
*/
void subscribeCurrentMediaState(HomekitCharacteristicChangeCallback callback);

/** Unsubscribes from changes in the current media state. */
void unsubscribeCurrentMediaState();

/**
* Retrieves the target media state (see {@link TargetMediaStateEnum} for supported values).
*
* @return a future that will contain the target media state
*/
CompletableFuture<TargetMediaStateEnum> getTargetMediaState();

/**
* Set the target media state (see {@link TargetMediaStateEnum} for supported values).
*
* @param targetMediaState target media state
* @return a future that completes when the change is made
*/
CompletableFuture<Void> setTargetMediaState(TargetMediaStateEnum targetMediaState);

/**
* Subscribes to changes in the target media state.
*
* @param callback the function to call when the target media state changes.
*/
void subscribeTargetMediaState(HomekitCharacteristicChangeCallback callback);

/** Unsubscribes from changes in the target media state. */
void unsubscribeTargetMediaState();

@Override
default Collection<Service> getServices() {
return Collections.singleton(new SmartSpeakerService(this));
}
}
123 changes: 123 additions & 0 deletions src/main/java/io/github/hapjava/accessories/TelevisionAccessory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
package io.github.hapjava.accessories;

import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
import io.github.hapjava.characteristics.impl.television.RemoteKeyEnum;
import io.github.hapjava.characteristics.impl.television.SleepDiscoveryModeEnum;
import io.github.hapjava.services.Service;
import io.github.hapjava.services.impl.TelevisionService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;

/** Television accessory. */
public interface TelevisionAccessory extends HomekitAccessory {

/**
* Retrieves the current active state of the TV.
*
* @return a future that will contain the state
*/
CompletableFuture<Boolean> isActive();

/**
* Sets the active state of the TV
*
* @param state the state to set
* @return a future that completes when the change is made
* @throws Exception when the change cannot be made
*/
CompletableFuture<Void> setActive(boolean state) throws Exception;

/**
* Subscribes to changes in the active state of the TV .
*
* @param callback the function to call when the active state changes.
*/
void subscribeActive(HomekitCharacteristicChangeCallback callback);

/** Unsubscribes from changes in the active state of the TV. */
void unsubscribeActive();

/**
* Retrieves the active identifier
*
* @return a future that will contain the active identifier.
*/
CompletableFuture<Integer> getActiveIdentifier();

/**
* Sets the active identifier
*
* @param identifier the active identifier
* @return a future that completes when the active identifier is changed
* @throws Exception when the active identifier cannot be set
*/
CompletableFuture<Void> setActiveIdentifier(Integer identifier) throws Exception;

/**
* Subscribes to changes in the active identifier.
*
* @param callback the function to call when the active identifier changes.
*/
void subscribeActiveIdentifier(HomekitCharacteristicChangeCallback callback);

/** Unsubscribes from changes in the active identifier. */
void unsubscribeActiveIdentifier();

/**
* Retrieves configured name.
*
* @return configured name
*/
CompletableFuture<String> getConfiguredName();

/**
* Sets the configured name
*
* @param name configured name
* @return a future that completes when the change is made
* @throws Exception when the change cannot be made
*/
CompletableFuture<Void> setConfiguredName(String name) throws Exception;

/**
* Subscribes to changes in configured name.
*
* @param callback the function to call when the configureed name changes.
*/
void subscribeConfiguredName(HomekitCharacteristicChangeCallback callback);

/** Unsubscribes from changes in the configured name state. */
void unsubscribeConfiguredName();

/**
* Sends the remote key.
*
* @param key remote key
* @return a future that completes when the change is made
* @throws Exception when the change cannot be made
*/
CompletableFuture<Void> setRemoteKey(RemoteKeyEnum key) throws Exception;

/**
* Retrieves the sleep discovery mode.
*
* @return a future that will contain the sleep discovery mode .
*/
CompletableFuture<SleepDiscoveryModeEnum> getSleepDiscoveryMode();

/**
* Subscribes to changes in sleep discovery mode.
*
* @param callback the function to call when the sleep discovery mode changes.
*/
void subscribeSleepDiscoveryMode(HomekitCharacteristicChangeCallback callback);

/** Unsubscribes from changes in the sleep discovery mode. */
void unsubscribeSleepDiscoveryMode();

@Override
default Collection<Service> getServices() {
return Collections.singleton(new TelevisionService(this));
}
}
Loading