getServices();
+ /**
+ * Returns a serial number to display in iOS.
+ *
+ * @return the serial number, or null.
+ */
+ String getSerialNumber();
+
+ /**
+ * Returns a model name to display in iOS.
+ *
+ * @return the model name, or null.
+ */
+ String getModel();
+
+ /**
+ * Returns a manufacturer to display in iOS.
+ *
+ * @return the manufacturer, or null.
+ */
+ String getManufacturer();
+
+ /**
+ * 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 {@link
+ * com.beowulfe.hap.accessories}.
+ *
+ * @return the collection of services.
+ */
+ Collection getServices();
}
diff --git a/src/main/java/com/beowulfe/hap/HomekitAuthInfo.java b/src/main/java/com/beowulfe/hap/HomekitAuthInfo.java
index 0b91897e9..d43a57fc4 100644
--- a/src/main/java/com/beowulfe/hap/HomekitAuthInfo.java
+++ b/src/main/java/com/beowulfe/hap/HomekitAuthInfo.java
@@ -3,79 +3,86 @@
import java.math.BigInteger;
/**
- * Authentication info that must be provided when constructing a new {@link HomekitServer}. You will need to implement
- * this interface yourself to provide the necessary callbacks to a persistent storage mechanism. All values provided
- * must be constant across invocations or the accessories will require re-pairing within iOS.
+ * Authentication info that must be provided when constructing a new {@link HomekitServer}. You will
+ * need to implement this interface yourself to provide the necessary callbacks to a persistent
+ * storage mechanism. All values provided must be constant across invocations or the accessories
+ * will require re-pairing within iOS.
*
* @author Andy Lintner
*/
public interface HomekitAuthInfo {
- /**
- * A pin code used for pairing the device. This pin will be required within iOS in order to complete pairing. The numbers
- * cannot be sequential and should not have a repeating pattern.
- *
- * @return the pin code, in the form ###-##-###
- */
- String getPin();
-
- /**
- * A unique MAC address to be advertised with the Homekit information. This does not have to be the MAC address of the
- * network interface. You can generate this using {@link HomekitServer#generateMac()}.
- *
- * @return the unique MAC address.
- */
- String getMac();
+ /**
+ * A pin code used for pairing the device. This pin will be required within iOS in order to
+ * complete pairing. The numbers cannot be sequential and should not have a repeating pattern.
+ *
+ * @return the pin code, in the form ###-##-###
+ */
+ String getPin();
- /**
- * The Salt that will be used when hashing the pin code to send to the client. You should generate this using
- * {@link HomekitServer#generateSalt()}.
- *
- * @return the Salt.
- */
- BigInteger getSalt();
+ /**
+ * A unique MAC address to be advertised with the Homekit information. This does not have to be
+ * the MAC address of the network interface. You can generate this using {@link
+ * HomekitServer#generateMac()}.
+ *
+ * @return the unique MAC address.
+ */
+ String getMac();
- /**
- * The private key used by the server during pairing and message encryption. You should generate this using
- * {@link HomekitServer#generateKey()}
- *
- * @return the private key.
- */
- byte[] getPrivateKey();
-
- /**
- * Called during the pairing process, you should store the user and public key in a manner that the public key can later
- * be retrieved using {@link #getUserPublicKey(String)}. This must be stored in a persistent store as pairing will
- * need to be reset if the information is lost.
- *
- * @param username the iOS device's username. The value will not be meaningful to anything but iOS.
- * @param publicKey the iOS device's public key.
- */
- void createUser(String username, byte[] publicKey);
-
- /**
- * Called when an iOS device needs to remove an existing pairing. Subsequent calls to {@link #getUserPublicKey(String)} for this
- * username return null.
- *
- * @param username the username to delete from the persistent store.
- */
- void removeUser(String username);
+ /**
+ * The Salt that will be used when hashing the pin code to send to the client. You should generate
+ * this using {@link HomekitServer#generateSalt()}.
+ *
+ * @return the Salt.
+ */
+ BigInteger getSalt();
- /**
- * Called when an already paired iOS device is re-connecting. The public key returned by this method will be compared
- * with the signature of the pair verification request to validate the device.
- *
- * @param username the username of the iOS device to retrieve the public key for.
- * @return the previously stored public key for this user.
- */
- byte[] getUserPublicKey(String username);
-
- /**
- * Called to check if a user has been created. The homekit accessory advertises whether the accessory has already been paired.
- * At this time, it's unclear whether multiple users can be created, however it is known that advertising as unpaired
- * will break in iOS 9. The default value has been provided to maintain API compatibility for implementations targeting iOS 8.
- *
- * @return whether a user has been created and stored
- */
- default boolean hasUser() { return false; };
+ /**
+ * The private key used by the server during pairing and message encryption. You should generate
+ * this using {@link HomekitServer#generateKey()}
+ *
+ * @return the private key.
+ */
+ byte[] getPrivateKey();
+
+ /**
+ * Called during the pairing process, you should store the user and public key in a manner that
+ * the public key can later be retrieved using {@link #getUserPublicKey(String)}. This must be
+ * stored in a persistent store as pairing will need to be reset if the information is lost.
+ *
+ * @param username the iOS device's username. The value will not be meaningful to anything but
+ * iOS.
+ * @param publicKey the iOS device's public key.
+ */
+ void createUser(String username, byte[] publicKey);
+
+ /**
+ * Called when an iOS device needs to remove an existing pairing. Subsequent calls to {@link
+ * #getUserPublicKey(String)} for this username return null.
+ *
+ * @param username the username to delete from the persistent store.
+ */
+ void removeUser(String username);
+
+ /**
+ * Called when an already paired iOS device is re-connecting. The public key returned by this
+ * method will be compared with the signature of the pair verification request to validate the
+ * device.
+ *
+ * @param username the username of the iOS device to retrieve the public key for.
+ * @return the previously stored public key for this user.
+ */
+ byte[] getUserPublicKey(String username);
+
+ /**
+ * Called to check if a user has been created. The homekit accessory advertises whether the
+ * accessory has already been paired. At this time, it's unclear whether multiple users can be
+ * created, however it is known that advertising as unpaired will break in iOS 9. The default
+ * value has been provided to maintain API compatibility for implementations targeting iOS 8.
+ *
+ * @return whether a user has been created and stored
+ */
+ default boolean hasUser() {
+ return false;
+ };
}
diff --git a/src/main/java/com/beowulfe/hap/HomekitCharacteristicChangeCallback.java b/src/main/java/com/beowulfe/hap/HomekitCharacteristicChangeCallback.java
index a02e88100..fbc160251 100644
--- a/src/main/java/com/beowulfe/hap/HomekitCharacteristicChangeCallback.java
+++ b/src/main/java/com/beowulfe/hap/HomekitCharacteristicChangeCallback.java
@@ -3,18 +3,20 @@
import com.beowulfe.hap.characteristics.EventableCharacteristic;
/**
- * A callback interface for notifying subscribers that a characteristic value has changed.
- *
- * {@link EventableCharacteristic}s can be subscribed to, and in doing so, are supplied an instance of this class. Implementors
- * should call the {@link #changed()} method on the passed object when a subscribed characteristic changes.
+ * A callback interface for notifying subscribers that a characteristic value has changed.
+ *
+ * {@link EventableCharacteristic}s can be subscribed to, and in doing so, are supplied an
+ * instance of this class. Implementors should call the {@link #changed()} method on the passed
+ * object when a subscribed characteristic changes.
*
* @author Andy Lintner
*/
@FunctionalInterface
public interface HomekitCharacteristicChangeCallback {
- /**
- * Call when the value of the characteristic that was subscribed to when this object was passed changes.
- */
- void changed();
+ /**
+ * Call when the value of the characteristic that was subscribed to when this object was passed
+ * changes.
+ */
+ void changed();
}
diff --git a/src/main/java/com/beowulfe/hap/HomekitRoot.java b/src/main/java/com/beowulfe/hap/HomekitRoot.java
index b9d954d0d..0d0ba6462 100644
--- a/src/main/java/com/beowulfe/hap/HomekitRoot.java
+++ b/src/main/java/com/beowulfe/hap/HomekitRoot.java
@@ -6,160 +6,170 @@
import com.beowulfe.hap.impl.connections.HomekitClientConnectionFactoryImpl;
import com.beowulfe.hap.impl.connections.SubscriptionManager;
import com.beowulfe.hap.impl.jmdns.JmdnsHomekitAdvertiser;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.io.IOException;
import java.net.InetAddress;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
- * Provides advertising and handling for Homekit accessories. This class handles the advertising of Homekit accessories and
- * contains one or more accessories. When implementing a bridge accessory, you will interact with this class directly. Instantiate
- * it via {@link HomekitServer#createBridge(HomekitAuthInfo, String, String, String, String)}. For single accessories, this is composed
- * by {@link HomekitStandaloneAccessoryServer}.
+ * Provides advertising and handling for Homekit accessories. This class handles the advertising of
+ * Homekit accessories and contains one or more accessories. When implementing a bridge accessory,
+ * you will interact with this class directly. Instantiate it via {@link
+ * HomekitServer#createBridge(HomekitAuthInfo, String, String, String, String)}. For single
+ * accessories, this is composed by {@link HomekitStandaloneAccessoryServer}.
*
* @author Andy Lintner
*/
public class HomekitRoot {
-
- private final static Logger logger = LoggerFactory.getLogger(HomekitRoot.class);
-
- private final JmdnsHomekitAdvertiser advertiser;
- private final HomekitWebHandler webHandler;
- private final HomekitAuthInfo authInfo;
- private final String label;
- private final HomekitRegistry registry;
- private final SubscriptionManager subscriptions = new SubscriptionManager();
- private boolean started = false;
- private int configurationIndex = 1;
- HomekitRoot(String label, HomekitWebHandler webHandler, InetAddress localhost,
- HomekitAuthInfo authInfo) throws IOException {
- this(label, webHandler, authInfo, new JmdnsHomekitAdvertiser(localhost));
- }
-
- HomekitRoot(String label, HomekitWebHandler webHandler, HomekitAuthInfo authInfo,
- JmdnsHomekitAdvertiser advertiser) throws IOException {
- this.advertiser = advertiser;
- this.webHandler = webHandler;
- this.authInfo = authInfo;
- this.label = label;
- this.registry = new HomekitRegistry(label);
- }
-
- /**
- * Add an accessory to be handled and advertised by this root. Any existing Homekit connections will be terminated to allow
- * the clients to reconnect and see the updated accessory list. When using this for a bridge, the ID of the accessory must be
- * greater than 1, as that ID is reserved for the Bridge itself.
- *
- * @param accessory to advertise and handle.
- */
- public void addAccessory(HomekitAccessory accessory) {
- if (accessory.getId() <= 1 && !(accessory instanceof Bridge)) {
- throw new IndexOutOfBoundsException("The ID of an accessory used in a bridge must be greater than 1");
- }
- addAccessorySkipRangeCheck(accessory);
- }
-
- /**
- * Skips the range check. Used by {@link HomekitStandaloneAccessoryServer} as well as {@link #addAccessory(HomekitAccessory)};
- *
- * @param accessory to advertise and handle.
- */
- void addAccessorySkipRangeCheck(HomekitAccessory accessory) {
- this.registry.add(accessory);
- logger.info("Added accessory " + accessory.getLabel());
- if (started) {
- registry.reset();
- webHandler.resetConnections();
- }
- }
-
- /**
- * Removes an accessory from being handled or advertised by this root. Any existing Homekit connections will be terminated to allow
- * the clients to reconnect and see the updated accessory list.
- *
- * @param accessory accessory to cease advertising and handling
- */
- public void removeAccessory(HomekitAccessory accessory) {
- this.registry.remove(accessory);
- logger.info("Removed accessory " + accessory.getLabel());
- if (started) {
- registry.reset();
- webHandler.resetConnections();
- }
- }
-
- /**
- * Starts advertising and handling the previously added Homekit accessories. You should try to call this after you have used the
- * {@link #addAccessory(HomekitAccessory)} method to add all the initial accessories you plan on advertising, as any later additions
- * will cause the Homekit clients to reconnect.
- */
- public void start() {
- started = true;
- registry.reset();
- webHandler.start(new HomekitClientConnectionFactoryImpl(authInfo,
- registry, subscriptions, advertiser)).thenAccept(port -> {
- try {
- refreshAuthInfo();
- advertiser.advertise(label, authInfo.getMac(), port, configurationIndex);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- });
- }
-
- /**
- * Stops advertising and handling the Homekit accessories.
- */
- public void stop() {
- advertiser.stop();
- webHandler.stop();
- started = false;
- }
-
- /**
- * Refreshes auth info after it has been changed outside this library
- *
- * @throws IOException if there is an error in the underlying protocol, such as a TCP error
- */
- public void refreshAuthInfo() throws IOException {
- advertiser.setDiscoverable(!authInfo.hasUser());
- }
-
- /**
- * By default, most homekit requests require that the client be paired. Allowing unauthenticated requests
- * can be useful for debugging, but should not be used in production.
- *
- * @param allow whether to allow unauthenticated requests
- */
- public void allowUnauthenticatedRequests(boolean allow) {
- registry.setAllowUnauthenticatedRequests(allow);
- }
-
-
- /**
- * By default, the bridge advertises itself at revision 1. If you make changes to the accessories you're
- * including in the bridge after your first call to {@link start()}, you should increment this number. The
- * behavior of the client if the configuration index were to decrement is undefined, so this implementation will
- * not manage the configuration index by automatically incrementing - preserving this state across invocations should
- * be handled externally.
- *
- * @param revision an integer, greater than or equal to one, indicating the revision of the accessory information
- * @throws IOException if there is an error in the underlying protocol, such as a TCP error
- */
- public void setConfigurationIndex(int revision) throws IOException {
- if (revision < 1) {
- throw new IllegalArgumentException("revision must be greater than or equal to 1");
- }
- this.configurationIndex = revision;
- if (this.started) {
- advertiser.setConfigurationIndex(revision);
- }
- }
-
- HomekitRegistry getRegistry() {
- return registry;
- }
+ private static final Logger logger = LoggerFactory.getLogger(HomekitRoot.class);
+
+ private final JmdnsHomekitAdvertiser advertiser;
+ private final HomekitWebHandler webHandler;
+ private final HomekitAuthInfo authInfo;
+ private final String label;
+ private final HomekitRegistry registry;
+ private final SubscriptionManager subscriptions = new SubscriptionManager();
+ private boolean started = false;
+ private int configurationIndex = 1;
+
+ HomekitRoot(
+ String label, HomekitWebHandler webHandler, InetAddress localhost, HomekitAuthInfo authInfo)
+ throws IOException {
+ this(label, webHandler, authInfo, new JmdnsHomekitAdvertiser(localhost));
+ }
+
+ HomekitRoot(
+ String label,
+ HomekitWebHandler webHandler,
+ HomekitAuthInfo authInfo,
+ JmdnsHomekitAdvertiser advertiser)
+ throws IOException {
+ this.advertiser = advertiser;
+ this.webHandler = webHandler;
+ this.authInfo = authInfo;
+ this.label = label;
+ this.registry = new HomekitRegistry(label);
+ }
+
+ /**
+ * Add an accessory to be handled and advertised by this root. Any existing Homekit connections
+ * will be terminated to allow the clients to reconnect and see the updated accessory list. When
+ * using this for a bridge, the ID of the accessory must be greater than 1, as that ID is reserved
+ * for the Bridge itself.
+ *
+ * @param accessory to advertise and handle.
+ */
+ public void addAccessory(HomekitAccessory accessory) {
+ if (accessory.getId() <= 1 && !(accessory instanceof Bridge)) {
+ throw new IndexOutOfBoundsException(
+ "The ID of an accessory used in a bridge must be greater than 1");
+ }
+ addAccessorySkipRangeCheck(accessory);
+ }
+
+ /**
+ * Skips the range check. Used by {@link HomekitStandaloneAccessoryServer} as well as {@link
+ * #addAccessory(HomekitAccessory)};
+ *
+ * @param accessory to advertise and handle.
+ */
+ void addAccessorySkipRangeCheck(HomekitAccessory accessory) {
+ this.registry.add(accessory);
+ logger.info("Added accessory " + accessory.getLabel());
+ if (started) {
+ registry.reset();
+ webHandler.resetConnections();
+ }
+ }
+
+ /**
+ * Removes an accessory from being handled or advertised by this root. Any existing Homekit
+ * connections will be terminated to allow the clients to reconnect and see the updated accessory
+ * list.
+ *
+ * @param accessory accessory to cease advertising and handling
+ */
+ public void removeAccessory(HomekitAccessory accessory) {
+ this.registry.remove(accessory);
+ logger.info("Removed accessory " + accessory.getLabel());
+ if (started) {
+ registry.reset();
+ webHandler.resetConnections();
+ }
+ }
+
+ /**
+ * Starts advertising and handling the previously added Homekit accessories. You should try to
+ * call this after you have used the {@link #addAccessory(HomekitAccessory)} method to add all the
+ * initial accessories you plan on advertising, as any later additions will cause the Homekit
+ * clients to reconnect.
+ */
+ public void start() {
+ started = true;
+ registry.reset();
+ webHandler
+ .start(
+ new HomekitClientConnectionFactoryImpl(authInfo, registry, subscriptions, advertiser))
+ .thenAccept(
+ port -> {
+ try {
+ refreshAuthInfo();
+ advertiser.advertise(label, authInfo.getMac(), port, configurationIndex);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+ }
+
+ /** Stops advertising and handling the Homekit accessories. */
+ public void stop() {
+ advertiser.stop();
+ webHandler.stop();
+ started = false;
+ }
+
+ /**
+ * Refreshes auth info after it has been changed outside this library
+ *
+ * @throws IOException if there is an error in the underlying protocol, such as a TCP error
+ */
+ public void refreshAuthInfo() throws IOException {
+ advertiser.setDiscoverable(!authInfo.hasUser());
+ }
+
+ /**
+ * By default, most homekit requests require that the client be paired. Allowing unauthenticated
+ * requests can be useful for debugging, but should not be used in production.
+ *
+ * @param allow whether to allow unauthenticated requests
+ */
+ public void allowUnauthenticatedRequests(boolean allow) {
+ registry.setAllowUnauthenticatedRequests(allow);
+ }
+
+ /**
+ * By default, the bridge advertises itself at revision 1. If you make changes to the accessories
+ * you're including in the bridge after your first call to {@link start()}, you should increment
+ * this number. The behavior of the client if the configuration index were to decrement is
+ * undefined, so this implementation will not manage the configuration index by automatically
+ * incrementing - preserving this state across invocations should be handled externally.
+ *
+ * @param revision an integer, greater than or equal to one, indicating the revision of the
+ * accessory information
+ * @throws IOException if there is an error in the underlying protocol, such as a TCP error
+ */
+ public void setConfigurationIndex(int revision) throws IOException {
+ if (revision < 1) {
+ throw new IllegalArgumentException("revision must be greater than or equal to 1");
+ }
+ this.configurationIndex = revision;
+ if (this.started) {
+ advertiser.setConfigurationIndex(revision);
+ }
+ }
+ HomekitRegistry getRegistry() {
+ return registry;
+ }
}
diff --git a/src/main/java/com/beowulfe/hap/HomekitServer.java b/src/main/java/com/beowulfe/hap/HomekitServer.java
index 8653ab043..47e7afb2a 100644
--- a/src/main/java/com/beowulfe/hap/HomekitServer.java
+++ b/src/main/java/com/beowulfe/hap/HomekitServer.java
@@ -1,143 +1,152 @@
package com.beowulfe.hap;
+import com.beowulfe.hap.impl.HomekitBridge;
+import com.beowulfe.hap.impl.HomekitUtils;
+import com.beowulfe.hap.impl.http.impl.HomekitHttpServer;
import java.io.IOException;
import java.math.BigInteger;
import java.net.InetAddress;
import java.security.InvalidAlgorithmParameterException;
-import com.beowulfe.hap.impl.HomekitBridge;
-import com.beowulfe.hap.impl.HomekitUtils;
-import com.beowulfe.hap.impl.http.impl.HomekitHttpServer;
-
/**
- * The main entry point for hap-java. Creating an instance of this class will listen for Homekit connections
- * on the supplied port. Only a single root accessory can be added for each unique instance and port, however,
- * that accessory may be a {@link #createBridge(HomekitAuthInfo, String, String, String, String) bridge accessory}
- * containing child accessories.
- *
- * The {@link HomekitAuthInfo HomekitAuthInfo} argument when creating accessories should be an implementation supplied
- * by your application. Several of the values needed for your implementation are provided by this class, specifically
- * {@link #generateKey() generateKey}, {@link #generateMac() generateMac}, and {@link #generateSalt()}. It is important
- * that you provide these same values on each start of your application or Homekit will fail to recognize your device as
- * being the same.
- *
+ * The main entry point for hap-java. Creating an instance of this class will listen for Homekit
+ * connections on the supplied port. Only a single root accessory can be added for each unique
+ * instance and port, however, that accessory may be a {@link #createBridge(HomekitAuthInfo, String,
+ * String, String, String) bridge accessory} containing child accessories.
+ *
+ *
The {@link HomekitAuthInfo HomekitAuthInfo} argument when creating accessories should be an
+ * implementation supplied by your application. Several of the values needed for your implementation
+ * are provided by this class, specifically {@link #generateKey() generateKey}, {@link
+ * #generateMac() generateMac}, and {@link #generateSalt()}. It is important that you provide these
+ * same values on each start of your application or Homekit will fail to recognize your device as
+ * being the same.
+ *
* @author Andy Lintner
*/
public class HomekitServer {
- private final HomekitHttpServer http;
- private final InetAddress localAddress;
-
- /**
- * Constructor. Contains an argument indicating the number of threads to use in the http server. The other constructors
- * default this to the number of available processors, however you may increase this in an environment with many users
- * and/or blocking accessory implementations.
- *
- * @param localAddress local address to bind to.
- * @param port local port to bind to.
- * @param nThreads number of threads to use in the http server
- * @throws IOException when the server cannot bind to the supplied port
- */
- public HomekitServer(InetAddress localAddress, int port, int nThreads) throws IOException {
- this.localAddress = localAddress;
- http = new HomekitHttpServer(port, nThreads);
- }
-
- /**
- * Constructor
- *
- * @param localAddress local address to bind to
- * @param port local port to bind to
- * @throws IOException when the server cannot bind to the supplied port
- */
- public HomekitServer(InetAddress localAddress, int port) throws IOException {
- this(localAddress, port, Runtime.getRuntime().availableProcessors());
- }
-
- /**
- * Constructor
- *
- * @param port local port to bind to.
- * @throws IOException when the server cannot bind to the supplied port
- */
- public HomekitServer(int port) throws IOException {
- this(InetAddress.getLocalHost(), port);
- }
-
- /**
- * Stops the service, closing down existing connections and preventing new ones.
- */
- public void stop() {
- http.stop();
- }
-
- /**
- * Creates a single (non-bridge) accessory
- *
- * @param authInfo authentication information for this accessory. These values should be persisted and re-supplied on re-start
- * of your application.
- * @param accessory accessory implementation. This will usually be an implementation of an interface in
- * {#link com.beowulfe.hap.accessories com.beowulfe.hap.accessories}.
- * @return the newly created server. Call {@link HomekitStandaloneAccessoryServer#start start} on this to begin.
- * @throws IOException when mDNS cannot connect to the network
- */
- public HomekitStandaloneAccessoryServer createStandaloneAccessory(HomekitAuthInfo authInfo,
- HomekitAccessory accessory) throws IOException {
- return new HomekitStandaloneAccessoryServer(accessory, http,
- localAddress, authInfo);
- }
-
- /**
- * Creates a bridge accessory, capable of holding multiple child accessories. This has the advantage over multiple standalone
- * accessories of only requiring a single pairing from iOS for the bridge.
- *
- * @param authInfo authentication information for this accessory. These values should be persisted and re-supplied on re-start
- * of your application.
- * @param label label for the bridge. This will show in iOS during pairing.
- * @param manufacturer manufacturer of the bridge. This information is exposed to iOS for unknown purposes.
- * @param model model of the bridge. This is also exposed to iOS for unknown purposes.
- * @param serialNumber serial number of the bridge. Also exposed. Purposes also unknown.
- * @return the bridge, from which you can {@link HomekitRoot#addAccessory add accessories} and then {@link HomekitRoot#start start} handling requests.
- * @throws IOException when mDNS cannot connect to the network
- */
- public HomekitRoot createBridge(HomekitAuthInfo authInfo, String label, String manufacturer,
- String model, String serialNumber) throws IOException {
- HomekitRoot root = new HomekitRoot(label, http, localAddress, authInfo);
- root.addAccessory(new HomekitBridge(label, serialNumber, model, manufacturer));
- return root;
- }
-
- /**
- * Generates a value to supply in {@link HomekitAuthInfo#getSalt() HomekitAuthInfo.getSalt()}. This is used to salt
- * the pin-code. You don't need to worry about that though - the salting is done on the plaintext pin. (Yes, plaintext
- * passwords are bad. Please don't secure your nuclear storage facility with this implementation)
- *
- * @return the generated salt
- */
- static public BigInteger generateSalt() {
- return HomekitUtils.generateSalt();
- }
-
- /**
- * Generates a value to supply in {@link HomekitAuthInfo#getPrivateKey() HomekitAuthInfo.getPrivKey()}. This is used as the
- * private key during pairing and connection setup.
- *
- * @return the generated key
- * @throws InvalidAlgorithmParameterException if the JVM does not contain the necessary encryption algorithms.
- */
- static public byte[] generateKey() throws InvalidAlgorithmParameterException {
- return HomekitUtils.generateKey();
- }
-
- /**
- * Generates a value to supply in {@link HomekitAuthInfo#getMac() HomekitAuthInfo.getMac()}. This is used as the unique
- * identifier of the accessory during mDNS advertising. It is a valid MAC address generated in the locally administered
- * range so as not to conflict with any commercial devices.
- *
- * @return the generated MAC
- */
- static public String generateMac() {
- return HomekitUtils.generateMac();
- }
+ private final HomekitHttpServer http;
+ private final InetAddress localAddress;
+
+ /**
+ * Constructor. Contains an argument indicating the number of threads to use in the http server.
+ * The other constructors default this to the number of available processors, however you may
+ * increase this in an environment with many users and/or blocking accessory implementations.
+ *
+ * @param localAddress local address to bind to.
+ * @param port local port to bind to.
+ * @param nThreads number of threads to use in the http server
+ * @throws IOException when the server cannot bind to the supplied port
+ */
+ public HomekitServer(InetAddress localAddress, int port, int nThreads) throws IOException {
+ this.localAddress = localAddress;
+ http = new HomekitHttpServer(port, nThreads);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param localAddress local address to bind to
+ * @param port local port to bind to
+ * @throws IOException when the server cannot bind to the supplied port
+ */
+ public HomekitServer(InetAddress localAddress, int port) throws IOException {
+ this(localAddress, port, Runtime.getRuntime().availableProcessors());
+ }
+
+ /**
+ * Constructor
+ *
+ * @param port local port to bind to.
+ * @throws IOException when the server cannot bind to the supplied port
+ */
+ public HomekitServer(int port) throws IOException {
+ this(InetAddress.getLocalHost(), port);
+ }
+
+ /** Stops the service, closing down existing connections and preventing new ones. */
+ public void stop() {
+ http.stop();
+ }
+
+ /**
+ * Creates a single (non-bridge) accessory
+ *
+ * @param authInfo authentication information for this accessory. These values should be persisted
+ * and re-supplied on re-start of your application.
+ * @param accessory accessory implementation. This will usually be an implementation of an
+ * interface in {#link com.beowulfe.hap.accessories com.beowulfe.hap.accessories}.
+ * @return the newly created server. Call {@link HomekitStandaloneAccessoryServer#start start} on
+ * this to begin.
+ * @throws IOException when mDNS cannot connect to the network
+ */
+ public HomekitStandaloneAccessoryServer createStandaloneAccessory(
+ HomekitAuthInfo authInfo, HomekitAccessory accessory) throws IOException {
+ return new HomekitStandaloneAccessoryServer(accessory, http, localAddress, authInfo);
+ }
+
+ /**
+ * Creates a bridge accessory, capable of holding multiple child accessories. This has the
+ * advantage over multiple standalone accessories of only requiring a single pairing from iOS for
+ * the bridge.
+ *
+ * @param authInfo authentication information for this accessory. These values should be persisted
+ * and re-supplied on re-start of your application.
+ * @param label label for the bridge. This will show in iOS during pairing.
+ * @param manufacturer manufacturer of the bridge. This information is exposed to iOS for unknown
+ * purposes.
+ * @param model model of the bridge. This is also exposed to iOS for unknown purposes.
+ * @param serialNumber serial number of the bridge. Also exposed. Purposes also unknown.
+ * @return the bridge, from which you can {@link HomekitRoot#addAccessory add accessories} and
+ * then {@link HomekitRoot#start start} handling requests.
+ * @throws IOException when mDNS cannot connect to the network
+ */
+ public HomekitRoot createBridge(
+ HomekitAuthInfo authInfo,
+ String label,
+ String manufacturer,
+ String model,
+ String serialNumber)
+ throws IOException {
+ HomekitRoot root = new HomekitRoot(label, http, localAddress, authInfo);
+ root.addAccessory(new HomekitBridge(label, serialNumber, model, manufacturer));
+ return root;
+ }
+
+ /**
+ * Generates a value to supply in {@link HomekitAuthInfo#getSalt() HomekitAuthInfo.getSalt()}.
+ * This is used to salt the pin-code. You don't need to worry about that though - the salting is
+ * done on the plaintext pin. (Yes, plaintext passwords are bad. Please don't secure your nuclear
+ * storage facility with this implementation)
+ *
+ * @return the generated salt
+ */
+ public static BigInteger generateSalt() {
+ return HomekitUtils.generateSalt();
+ }
+
+ /**
+ * Generates a value to supply in {@link HomekitAuthInfo#getPrivateKey()
+ * HomekitAuthInfo.getPrivKey()}. This is used as the private key during pairing and connection
+ * setup.
+ *
+ * @return the generated key
+ * @throws InvalidAlgorithmParameterException if the JVM does not contain the necessary encryption
+ * algorithms.
+ */
+ public static byte[] generateKey() throws InvalidAlgorithmParameterException {
+ return HomekitUtils.generateKey();
+ }
+ /**
+ * Generates a value to supply in {@link HomekitAuthInfo#getMac() HomekitAuthInfo.getMac()}. This
+ * is used as the unique identifier of the accessory during mDNS advertising. It is a valid MAC
+ * address generated in the locally administered range so as not to conflict with any commercial
+ * devices.
+ *
+ * @return the generated MAC
+ */
+ public static String generateMac() {
+ return HomekitUtils.generateMac();
+ }
}
diff --git a/src/main/java/com/beowulfe/hap/HomekitStandaloneAccessoryServer.java b/src/main/java/com/beowulfe/hap/HomekitStandaloneAccessoryServer.java
index 9fee827f0..3b631f276 100644
--- a/src/main/java/com/beowulfe/hap/HomekitStandaloneAccessoryServer.java
+++ b/src/main/java/com/beowulfe/hap/HomekitStandaloneAccessoryServer.java
@@ -1,36 +1,34 @@
package com.beowulfe.hap;
+import com.beowulfe.hap.impl.HomekitWebHandler;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
-import com.beowulfe.hap.impl.HomekitWebHandler;
-
/**
- * A server for exposing standalone Homekit accessory (as opposed to a Bridge accessory which contains multiple accessories).
- * Each standalone accessory will have its own pairing information, port, and pin. Instantiate this class via
- * {@link HomekitServer#createStandaloneAccessory(HomekitAuthInfo, HomekitAccessory)}.
+ * A server for exposing standalone Homekit accessory (as opposed to a Bridge accessory which
+ * contains multiple accessories). Each standalone accessory will have its own pairing information,
+ * port, and pin. Instantiate this class via {@link
+ * HomekitServer#createStandaloneAccessory(HomekitAuthInfo, HomekitAccessory)}.
*
* @author Andy Lintner
*/
public class HomekitStandaloneAccessoryServer {
-
- private final HomekitRoot root;
- HomekitStandaloneAccessoryServer(HomekitAccessory accessory,
- HomekitWebHandler webHandler, InetAddress localhost,
- HomekitAuthInfo authInfo) throws UnknownHostException, IOException {
- root = new HomekitRoot(accessory.getLabel(), webHandler, localhost, authInfo);
- root.addAccessory(accessory);
- }
-
- /**
- * Begins advertising and handling requests for this accessory.
- */
- public void start() {
- root.start();
- }
+ private final HomekitRoot root;
-
+ HomekitStandaloneAccessoryServer(
+ HomekitAccessory accessory,
+ HomekitWebHandler webHandler,
+ InetAddress localhost,
+ HomekitAuthInfo authInfo)
+ throws UnknownHostException, IOException {
+ root = new HomekitRoot(accessory.getLabel(), webHandler, localhost, authInfo);
+ root.addAccessory(accessory);
+ }
+ /** Begins advertising and handling requests for this accessory. */
+ public void start() {
+ root.start();
+ }
}
diff --git a/src/main/java/com/beowulfe/hap/Service.java b/src/main/java/com/beowulfe/hap/Service.java
index d9c74dae2..5bebea7be 100644
--- a/src/main/java/com/beowulfe/hap/Service.java
+++ b/src/main/java/com/beowulfe/hap/Service.java
@@ -1,8 +1,7 @@
package com.beowulfe.hap;
-import java.util.List;
-
import com.beowulfe.hap.characteristics.Characteristic;
+import java.util.List;
/**
* Interface for a Service offered by an accessory.
@@ -11,22 +10,23 @@
*/
public interface Service {
- /**
- * Characteristics are the variables offered for reading, updating, and eventing by the Service over the Homekit protocol.
- *
- * It is important to maintain the order of this list and not change its contents between invocations, or a pairing error
- * will result.
- *
- * @return the list of Characteristics.
- */
- List getCharacteristics();
-
- /**
- * The type is a UUID that uniquely identifies the type of Service offered. Apple defines several types for standard
- * Services, however UUIDs outside this range are allowed for custom Services.
- *
- * @return A string representation of the UUID, with hexadecimal digits in the format ########-####-####-####-############.
- */
- String getType();
+ /**
+ * Characteristics are the variables offered for reading, updating, and eventing by the Service
+ * over the Homekit protocol.
+ *
+ * It is important to maintain the order of this list and not change its contents between
+ * invocations, or a pairing error will result.
+ *
+ * @return the list of Characteristics.
+ */
+ List getCharacteristics();
-}
\ No newline at end of file
+ /**
+ * The type is a UUID that uniquely identifies the type of Service offered. Apple defines several
+ * types for standard Services, however UUIDs outside this range are allowed for custom Services.
+ *
+ * @return A string representation of the UUID, with hexadecimal digits in the format
+ * ########-####-####-####-############.
+ */
+ String getType();
+}
diff --git a/src/main/java/com/beowulfe/hap/accessories/BatteryAccessory.java b/src/main/java/com/beowulfe/hap/accessories/BatteryAccessory.java
index b69bdf7e3..849454a97 100644
--- a/src/main/java/com/beowulfe/hap/accessories/BatteryAccessory.java
+++ b/src/main/java/com/beowulfe/hap/accessories/BatteryAccessory.java
@@ -1,8 +1,7 @@
package com.beowulfe.hap.accessories;
-import java.util.concurrent.CompletableFuture;
-
import com.beowulfe.hap.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
/**
* Do not use. Devices that have battery levels should implement LowBatteryStatusAccessory.
@@ -12,22 +11,20 @@
@Deprecated
public interface BatteryAccessory {
- /**
- * Retrieves the battery level of the accessory.
- *
- * @return a future that will contain the accessory's battery state
- */
- CompletableFuture getBatteryLevelState();
+ /**
+ * Retrieves the battery level of the accessory.
+ *
+ * @return a future that will contain the accessory's battery state
+ */
+ CompletableFuture getBatteryLevelState();
- /**
- * Subscribes to changes in the battery level.
- *
- * @param callback the function to call when battery level changes.
- */
- void subscribeBatteryLevelState(HomekitCharacteristicChangeCallback callback);
+ /**
+ * Subscribes to changes in the battery level.
+ *
+ * @param callback the function to call when battery level changes.
+ */
+ void subscribeBatteryLevelState(HomekitCharacteristicChangeCallback callback);
- /**
- * Unsubscribes from changes in the battery level.
- */
- void unsubscribeBatteryLevelState();
+ /** Unsubscribes from changes in the battery level. */
+ void unsubscribeBatteryLevelState();
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/BatteryStatusAccessory.java b/src/main/java/com/beowulfe/hap/accessories/BatteryStatusAccessory.java
index 2e817a603..21f8f0356 100644
--- a/src/main/java/com/beowulfe/hap/accessories/BatteryStatusAccessory.java
+++ b/src/main/java/com/beowulfe/hap/accessories/BatteryStatusAccessory.java
@@ -1,34 +1,31 @@
package com.beowulfe.hap.accessories;
-import java.util.concurrent.CompletableFuture;
-
import com.beowulfe.hap.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
/**
- * An accessory that runs on batteries. Accessories that run on batteries are able to report
- * battery level.
+ * An accessory that runs on batteries. Accessories that run on batteries are able to report battery
+ * level.
*
* @author Tim Harper
*/
public interface BatteryStatusAccessory {
- /**
- * Queries if the device battery level is low; returning a value of true
- * will cause a low-battery status to appear in Home for the device.
- *
- * @return a future that will contain the accessory's low battery state
- */
- CompletableFuture getLowBatteryState();
+ /**
+ * Queries if the device battery level is low; returning a value of true will cause a low-battery
+ * status to appear in Home for the device.
+ *
+ * @return a future that will contain the accessory's low battery state
+ */
+ CompletableFuture getLowBatteryState();
- /**
- * Subscribes to changes in the battery level.
- *
- * @param callback the function to call when low battery state changes.
- */
- void subscribeLowBatteryState(HomekitCharacteristicChangeCallback callback);
+ /**
+ * Subscribes to changes in the battery level.
+ *
+ * @param callback the function to call when low battery state changes.
+ */
+ void subscribeLowBatteryState(HomekitCharacteristicChangeCallback callback);
- /**
- * Unsubscribes from changes in the low battery state.
- */
- void unsubscribeLowBatteryState();
+ /** Unsubscribes from changes in the low battery state. */
+ void unsubscribeLowBatteryState();
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/CarbonMonoxideSensor.java b/src/main/java/com/beowulfe/hap/accessories/CarbonMonoxideSensor.java
index 545a6b22a..85bf73ac4 100644
--- a/src/main/java/com/beowulfe/hap/accessories/CarbonMonoxideSensor.java
+++ b/src/main/java/com/beowulfe/hap/accessories/CarbonMonoxideSensor.java
@@ -5,42 +5,39 @@
import com.beowulfe.hap.Service;
import com.beowulfe.hap.accessories.properties.CarbonMonoxideDetectedState;
import com.beowulfe.hap.impl.services.CarbonMonoxideSensorService;
-
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
/**
- * A carbon monoxide sensor reports whether carbon monoxide has been detected or not.
+ * A carbon monoxide sensor reports whether carbon monoxide has been detected or not.
*
- * Carbon monoxide sensors that run on batteries will need to implement this interface
- * and also implement {@link BatteryStatusAccessory}.
+ * Carbon monoxide sensors that run on batteries will need to implement this interface and also
+ * implement {@link BatteryStatusAccessory}.
*
* @author Gaston Dombiak
*/
public interface CarbonMonoxideSensor extends HomekitAccessory {
- /**
- * Retrieves the state of the sensor that indicates if carbon monoxide has been detected.
- *
- * @return a future that will contain the carbon monoxide sensor's state
- */
- CompletableFuture getCarbonMonoxideDetectedState();
+ /**
+ * Retrieves the state of the sensor that indicates if carbon monoxide has been detected.
+ *
+ * @return a future that will contain the carbon monoxide sensor's state
+ */
+ CompletableFuture getCarbonMonoxideDetectedState();
- @Override
- default Collection getServices() {
- return Collections.singleton(new CarbonMonoxideSensorService(this));
- }
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new CarbonMonoxideSensorService(this));
+ }
- /**
- * Subscribes to changes in the carbon monoxide's state.
- *
- * @param callback the function to call when the state changes.
- */
- void subscribeCarbonMonoxideDetectedState(HomekitCharacteristicChangeCallback callback);
+ /**
+ * Subscribes to changes in the carbon monoxide's state.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCarbonMonoxideDetectedState(HomekitCharacteristicChangeCallback callback);
- /**
- * Unsubscribes from changes in the carbon monoxide's state.
- */
- void unsubscribeCarbonMonoxideDetectedState();
+ /** Unsubscribes from changes in the carbon monoxide's state. */
+ void unsubscribeCarbonMonoxideDetectedState();
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/ColorfulLightbulb.java b/src/main/java/com/beowulfe/hap/accessories/ColorfulLightbulb.java
index 6d971502a..d218bece4 100644
--- a/src/main/java/com/beowulfe/hap/accessories/ColorfulLightbulb.java
+++ b/src/main/java/com/beowulfe/hap/accessories/ColorfulLightbulb.java
@@ -1,67 +1,65 @@
package com.beowulfe.hap.accessories;
-import java.util.concurrent.CompletableFuture;
-
import com.beowulfe.hap.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
/**
- * Extends {@link Lightbulb} with color settings. This will usually be implemented along with
- * {@link DimmableLightbulb}, but not necessarily so.
+ * Extends {@link Lightbulb} with color settings. This will usually be implemented along with {@link
+ * DimmableLightbulb}, but not necessarily so.
*
* @author Andy Lintner
*/
public interface ColorfulLightbulb extends Lightbulb {
- /**
- * Retrieves the current hue of the light.
- *
- * @return a future that will contain the hue, expressed in arc degrees from 0 to 360.
- */
- CompletableFuture getHue();
-
- /**
- * Sets the current hue of the light
- * @param value the hue to set, expressed in arc degrees from 0 to 360.
- * @return a future that completes when the hue is changed
- * @throws Exception when the hue cannot be changed.
- */
- CompletableFuture setHue(Double value) throws Exception;
-
- /**
- * Subscribes to changes in the hue of the light.
- * @param callback the function to call when the state changes.
- */
- void subscribeHue(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Unsubscribes from changes in the hue of the light.
- */
- void unsubscribeHue();
-
- /**
- * Retrieves the saturation of the light.
- *
- * @return a future that will contain the saturation, expressed as a value between 0 and 100.
- */
- CompletableFuture getSaturation();
-
- /**
- * Sets the saturation of the light.
- * @param value the saturation to set, expressed as a value between 0 and 100.
- * @return a future that completes when the saturation is changed.
- * @throws Exception when the saturation cannot be set.
- */
- CompletableFuture setSaturation(Double value) throws Exception;
-
- /**
- * Subscribes to changes in the saturation of the light.
- * @param callback the function to call when the state changes.
- */
- void subscribeSaturation(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Unsubscribes from changes in the saturation of the light.
- */
- void unsubscribeSaturation();
-
+ /**
+ * Retrieves the current hue of the light.
+ *
+ * @return a future that will contain the hue, expressed in arc degrees from 0 to 360.
+ */
+ CompletableFuture getHue();
+
+ /**
+ * Sets the current hue of the light
+ *
+ * @param value the hue to set, expressed in arc degrees from 0 to 360.
+ * @return a future that completes when the hue is changed
+ * @throws Exception when the hue cannot be changed.
+ */
+ CompletableFuture setHue(Double value) throws Exception;
+
+ /**
+ * Subscribes to changes in the hue of the light.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeHue(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the hue of the light. */
+ void unsubscribeHue();
+
+ /**
+ * Retrieves the saturation of the light.
+ *
+ * @return a future that will contain the saturation, expressed as a value between 0 and 100.
+ */
+ CompletableFuture getSaturation();
+
+ /**
+ * Sets the saturation of the light.
+ *
+ * @param value the saturation to set, expressed as a value between 0 and 100.
+ * @return a future that completes when the saturation is changed.
+ * @throws Exception when the saturation cannot be set.
+ */
+ CompletableFuture setSaturation(Double value) throws Exception;
+
+ /**
+ * Subscribes to changes in the saturation of the light.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeSaturation(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the saturation of the light. */
+ void unsubscribeSaturation();
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/ContactSensor.java b/src/main/java/com/beowulfe/hap/accessories/ContactSensor.java
index 4f3b6bceb..4078278df 100644
--- a/src/main/java/com/beowulfe/hap/accessories/ContactSensor.java
+++ b/src/main/java/com/beowulfe/hap/accessories/ContactSensor.java
@@ -5,45 +5,41 @@
import com.beowulfe.hap.Service;
import com.beowulfe.hap.accessories.properties.ContactState;
import com.beowulfe.hap.impl.services.ContactSensorService;
-
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
/**
- * A contact sensor that reports whether contact is detected or not. Typical
- * contact sensors are window/door sensors. When contact is detected it means
- * that the door/window is closed.
+ * A contact sensor that reports whether contact is detected or not. Typical contact sensors are
+ * window/door sensors. When contact is detected it means that the door/window is closed.
*
- * Contact sensors that run on batteries will need to implement this interface
- * and also implement {@link BatteryStatusAccessory}.
+ * Contact sensors that run on batteries will need to implement this interface and also implement
+ * {@link BatteryStatusAccessory}.
*
* @author Gaston Dombiak
*/
public interface ContactSensor extends HomekitAccessory {
- /**
- * Retrieves the state of the contact. This is whether the contact is detected or not.
- * Detected contact means door/window is closed.
- *
- * @return a future that will contain the contact's state
- */
- CompletableFuture getCurrentState();
+ /**
+ * Retrieves the state of the contact. This is whether the contact is detected or not. Detected
+ * contact means door/window is closed.
+ *
+ * @return a future that will contain the contact's state
+ */
+ CompletableFuture getCurrentState();
- @Override
- default Collection getServices() {
- return Collections.singleton(new ContactSensorService(this));
- }
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new ContactSensorService(this));
+ }
- /**
- * Subscribes to changes in the contact state.
- *
- * @param callback the function to call when the state changes.
- */
- void subscribeContactState(HomekitCharacteristicChangeCallback callback);
+ /**
+ * Subscribes to changes in the contact state.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeContactState(HomekitCharacteristicChangeCallback callback);
- /**
- * Unsubscribes from changes in the contact state.
- */
- void unsubscribeContactState();
+ /** Unsubscribes from changes in the contact state. */
+ void unsubscribeContactState();
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/DimmableLightbulb.java b/src/main/java/com/beowulfe/hap/accessories/DimmableLightbulb.java
index 77ae675bf..e83b592e5 100644
--- a/src/main/java/com/beowulfe/hap/accessories/DimmableLightbulb.java
+++ b/src/main/java/com/beowulfe/hap/accessories/DimmableLightbulb.java
@@ -1,8 +1,7 @@
package com.beowulfe.hap.accessories;
-import java.util.concurrent.CompletableFuture;
-
import com.beowulfe.hap.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
/**
* Extends {@link Lightbulb} with brightness values.
@@ -11,29 +10,29 @@
*/
public interface DimmableLightbulb extends Lightbulb {
- /**
- * Retrieves the current brightness of the light
- * @return a future that will contain the brightness, expressed as an integer between 0 and 100.
- */
- CompletableFuture getBrightness();
-
- /**
- * Sets the current brightness of the light
- * @param value the brightness, on a scale of 0 to 100, to set
- * @return a future that completes when the brightness is changed
- * @throws Exception when the brightness cannot be set
- */
- CompletableFuture setBrightness(Integer value) throws Exception;
-
- /**
- * Subscribes to changes in the brightness of the light.
- * @param callback the function to call when the state changes.
- */
- void subscribeBrightness(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Unsubscribes from changes in the brightness of the light.
- */
- void unsubscribeBrightness();
-
+ /**
+ * Retrieves the current brightness of the light
+ *
+ * @return a future that will contain the brightness, expressed as an integer between 0 and 100.
+ */
+ CompletableFuture getBrightness();
+
+ /**
+ * Sets the current brightness of the light
+ *
+ * @param value the brightness, on a scale of 0 to 100, to set
+ * @return a future that completes when the brightness is changed
+ * @throws Exception when the brightness cannot be set
+ */
+ CompletableFuture setBrightness(Integer value) throws Exception;
+
+ /**
+ * Subscribes to changes in the brightness of the light.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeBrightness(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the brightness of the light. */
+ void unsubscribeBrightness();
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/Fan.java b/src/main/java/com/beowulfe/hap/accessories/Fan.java
index 37a2871d7..fe1acbaae 100644
--- a/src/main/java/com/beowulfe/hap/accessories/Fan.java
+++ b/src/main/java/com/beowulfe/hap/accessories/Fan.java
@@ -1,12 +1,11 @@
package com.beowulfe.hap.accessories;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.concurrent.CompletableFuture;
-
import com.beowulfe.hap.*;
import com.beowulfe.hap.accessories.properties.RotationDirection;
import com.beowulfe.hap.impl.services.FanService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
/**
* A fan, with power and rotational characteristics.
@@ -15,84 +14,86 @@
*/
public interface Fan extends HomekitAccessory {
- /**
- * Retrieves the current binary state of the fan's power.
- * @return a future that will contain the binary state
- */
- CompletableFuture getFanPower();
-
- /**
- * Retrieves the current rotation direction of the fan.
- * @return a future that will contain the direction
- */
- CompletableFuture getRotationDirection();
-
- /**
- * Retrieves the current speed of the fan's rotation
- * @return a future that will contain the speed, expressed as an integer between 0 and 100.
- */
- CompletableFuture getRotationSpeed();
-
- /**
- * Sets the binary state of the fan's power
- * @param state the binary state to set
- * @return a future that completes when the change is made
- * @throws Exception when the change cannot be made
- */
- CompletableFuture setFanPower(boolean state) throws Exception;
-
- /**
- * Sets the rotation direction of the fan
- * @param direction the direction to set
- * @return a future that completes when the change is made
- * @throws Exception when the change cannot be made
- */
- CompletableFuture setRotationDirection(RotationDirection direction) throws Exception;
-
-
- /**
- * Sets the speed of the fan's rotation
- * @param speed the speed to set, expressed as an integer between 0 and 100.
- * @return a future that completes when the change is made
- * @throws Exception when the change cannot be made
- */
- CompletableFuture setRotationSpeed(Integer speed) throws Exception;
-
- @Override
- default Collection getServices() {
- return Collections.singleton(new FanService(this));
- }
-
- /**
- * Subscribes to changes in the binary state of the fan's power.
- * @param callback the function to call when the state changes.
- */
- void subscribeFanPower(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Subscribes to changes in the rotation direction of the fan.
- * @param callback the function to call when the direction changes.
- */
- void subscribeRotationDirection(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Subscribes to changes in the rotation speed of the fan.
- * @param callback the function to call when the speed changes.
- */
- void subscribeRotationSpeed(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Unsubscribes from changes in the binary state of the fan's power.
- */
- void unsubscribeFanPower();
-
- /**
- * Unsubscribes from changes in the rotation direction of the fan.
- */
- void unsubscribeRotationDirection();
-
- /**
- * Unsubscribes from changes in the fan's rotation speed.
- */
- void unsubscribeRotationSpeed();
+ /**
+ * Retrieves the current binary state of the fan's power.
+ *
+ * @return a future that will contain the binary state
+ */
+ CompletableFuture getFanPower();
+
+ /**
+ * Retrieves the current rotation direction of the fan.
+ *
+ * @return a future that will contain the direction
+ */
+ CompletableFuture getRotationDirection();
+
+ /**
+ * Retrieves the current speed of the fan's rotation
+ *
+ * @return a future that will contain the speed, expressed as an integer between 0 and 100.
+ */
+ CompletableFuture getRotationSpeed();
+
+ /**
+ * Sets the binary state of the fan's power
+ *
+ * @param state the binary state to set
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setFanPower(boolean state) throws Exception;
+
+ /**
+ * Sets the rotation direction of the fan
+ *
+ * @param direction the direction to set
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setRotationDirection(RotationDirection direction) throws Exception;
+
+ /**
+ * Sets the speed of the fan's rotation
+ *
+ * @param speed the speed to set, expressed as an integer between 0 and 100.
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setRotationSpeed(Integer speed) throws Exception;
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new FanService(this));
+ }
+
+ /**
+ * Subscribes to changes in the binary state of the fan's power.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeFanPower(HomekitCharacteristicChangeCallback callback);
+
+ /**
+ * Subscribes to changes in the rotation direction of the fan.
+ *
+ * @param callback the function to call when the direction changes.
+ */
+ void subscribeRotationDirection(HomekitCharacteristicChangeCallback callback);
+
+ /**
+ * Subscribes to changes in the rotation speed of the fan.
+ *
+ * @param callback the function to call when the speed changes.
+ */
+ void subscribeRotationSpeed(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the binary state of the fan's power. */
+ void unsubscribeFanPower();
+
+ /** Unsubscribes from changes in the rotation direction of the fan. */
+ void unsubscribeRotationDirection();
+
+ /** Unsubscribes from changes in the fan's rotation speed. */
+ void unsubscribeRotationSpeed();
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/GarageDoor.java b/src/main/java/com/beowulfe/hap/accessories/GarageDoor.java
index 43dbb8b46..9197516cd 100644
--- a/src/main/java/com/beowulfe/hap/accessories/GarageDoor.java
+++ b/src/main/java/com/beowulfe/hap/accessories/GarageDoor.java
@@ -1,12 +1,11 @@
package com.beowulfe.hap.accessories;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.concurrent.CompletableFuture;
-
import com.beowulfe.hap.*;
import com.beowulfe.hap.accessories.properties.DoorState;
import com.beowulfe.hap.impl.services.GarageDoorService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
/**
* A garage door opener, with control and status of a garage door
@@ -15,68 +14,68 @@
*/
public interface GarageDoor extends HomekitAccessory {
- /**
- * Retrieves the current state of the door
- * @return a future which will contain the door's state
- */
- CompletableFuture getCurrentDoorState();
-
- /**
- * Retrieves the targeted state of the door
- * @return a future which will contain the door's targeted state
- */
- CompletableFuture getTargetDoorState();
-
- /**
- * Retrieves an indicator of an obstruction detected by the door
- * @return a future which will contain the indicator
- */
- CompletableFuture getObstructionDetected();
-
- /**
- * Sets the targeted state of the door.
- * @param state the targeted state
- * @return a future that completes when the change is made
- * @throws Exception when the change cannot be made
- */
- CompletableFuture setTargetDoorState(DoorState state) throws Exception;
+ /**
+ * Retrieves the current state of the door
+ *
+ * @return a future which will contain the door's state
+ */
+ CompletableFuture getCurrentDoorState();
+
+ /**
+ * Retrieves the targeted state of the door
+ *
+ * @return a future which will contain the door's targeted state
+ */
+ CompletableFuture getTargetDoorState();
+
+ /**
+ * Retrieves an indicator of an obstruction detected by the door
+ *
+ * @return a future which will contain the indicator
+ */
+ CompletableFuture getObstructionDetected();
+
+ /**
+ * Sets the targeted state of the door.
+ *
+ * @param state the targeted state
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setTargetDoorState(DoorState state) throws Exception;
+
+ /**
+ * Subscribes to changes in the door's state
+ *
+ * @param callback the function to call when the state changes
+ */
+ void subscribeCurrentDoorState(HomekitCharacteristicChangeCallback callback);
+
+ /**
+ * Subscribes to changes in the door's targeted state
+ *
+ * @param callback the function to call when the targeted state changes
+ */
+ void subscribeTargetDoorState(HomekitCharacteristicChangeCallback callback);
+
+ /**
+ * Subscribes to changes in the obstruction detected indicator
+ *
+ * @param callback the function to call when the indicator chnages
+ */
+ void subscribeObstructionDetected(HomekitCharacteristicChangeCallback callback);
- /**
- * Subscribes to changes in the door's state
- * @param callback the function to call when the state changes
- */
- void subscribeCurrentDoorState(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Subscribes to changes in the door's targeted state
- * @param callback the function to call when the targeted state changes
- */
- void subscribeTargetDoorState(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Subscribes to changes in the obstruction detected indicator
- * @param callback the function to call when the indicator chnages
- */
- void subscribeObstructionDetected(HomekitCharacteristicChangeCallback callback);
+ /** Unsubscribes from changes in the door's state */
+ void unsubscribeCurrentDoorState();
- /**
- * Unsubscribes from changes in the door's state
- */
- void unsubscribeCurrentDoorState();
-
- /**
- * Unsubscribes from changes in the door's targeted state
- */
- void unsubscribeTargetDoorState();
-
- /**
- * Unsubscribes from changes in the door's obstruction detected indicator
- */
- void unsubscribeObstructionDetected();
+ /** Unsubscribes from changes in the door's targeted state */
+ void unsubscribeTargetDoorState();
+ /** Unsubscribes from changes in the door's obstruction detected indicator */
+ void unsubscribeObstructionDetected();
- @Override
- default Collection getServices() {
- return Collections.singleton(new GarageDoorService(this));
- }
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new GarageDoorService(this));
+ }
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/HorizontalTiltingWindowCovering.java b/src/main/java/com/beowulfe/hap/accessories/HorizontalTiltingWindowCovering.java
index abfaf4547..5835a7bd8 100644
--- a/src/main/java/com/beowulfe/hap/accessories/HorizontalTiltingWindowCovering.java
+++ b/src/main/java/com/beowulfe/hap/accessories/HorizontalTiltingWindowCovering.java
@@ -1,8 +1,7 @@
package com.beowulfe.hap.accessories;
-import java.util.concurrent.CompletableFuture;
-
import com.beowulfe.hap.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
/**
* Extends WindowCovering with the ability to control horizontal tilt angles
@@ -11,45 +10,46 @@
*/
public interface HorizontalTiltingWindowCovering extends WindowCovering {
- /**
- * Retrieves the current horizontal tilt angle
- * @return a future that will contain the position as a value between -90 and 90
- */
- CompletableFuture getCurrentHorizontalTiltAngle();
-
- /**
- * Retrieves the target horizontal tilt angle
- * @return a future that will contain the target position as a value between -90 and 90
- */
- CompletableFuture getTargetHorizontalTiltAngle();
-
- /**
- * Sets the target position
- * @param angle the target angle to set, as a value between -90 and 90
- * @return a future that completes when the change is made
- * @throws Exception when the change cannot be made
- */
- CompletableFuture setTargetHorizontalTiltAngle(int angle) throws Exception;
-
- /**
- * Subscribes to changes in the current horizontal tilt angle.
- * @param callback the function to call when the state changes.
- */
- void subscribeCurrentHorizontalTiltAngle(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Subscribes to changes in the target horizontal tilt angle.
- * @param callback the function to call when the state changes.
- */
- void subscribeTargetHorizontalTiltAngle(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Unsubscribes from changes in the current horizontal tilt angle
- */
- void unsubscribeCurrentHorizontalTiltAngle();
-
- /**
- * Unsubscribes from changes in the target horizontal tilt angle
- */
- void unsubscribeTargetHorizontalTiltAngle();
+ /**
+ * Retrieves the current horizontal tilt angle
+ *
+ * @return a future that will contain the position as a value between -90 and 90
+ */
+ CompletableFuture getCurrentHorizontalTiltAngle();
+
+ /**
+ * Retrieves the target horizontal tilt angle
+ *
+ * @return a future that will contain the target position as a value between -90 and 90
+ */
+ CompletableFuture getTargetHorizontalTiltAngle();
+
+ /**
+ * Sets the target position
+ *
+ * @param angle the target angle to set, as a value between -90 and 90
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setTargetHorizontalTiltAngle(int angle) throws Exception;
+
+ /**
+ * Subscribes to changes in the current horizontal tilt angle.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCurrentHorizontalTiltAngle(HomekitCharacteristicChangeCallback callback);
+
+ /**
+ * Subscribes to changes in the target horizontal tilt angle.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeTargetHorizontalTiltAngle(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the current horizontal tilt angle */
+ void unsubscribeCurrentHorizontalTiltAngle();
+
+ /** Unsubscribes from changes in the target horizontal tilt angle */
+ void unsubscribeTargetHorizontalTiltAngle();
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/HumiditySensor.java b/src/main/java/com/beowulfe/hap/accessories/HumiditySensor.java
index b05bf209a..0401ee582 100644
--- a/src/main/java/com/beowulfe/hap/accessories/HumiditySensor.java
+++ b/src/main/java/com/beowulfe/hap/accessories/HumiditySensor.java
@@ -1,12 +1,11 @@
package com.beowulfe.hap.accessories;
+import com.beowulfe.hap.*;
+import com.beowulfe.hap.impl.services.HumiditySensorService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
-import com.beowulfe.hap.*;
-import com.beowulfe.hap.impl.services.HumiditySensorService;
-
/**
* A humidity sensor that reports the current relative humidity.
*
@@ -14,26 +13,25 @@
*/
public interface HumiditySensor extends HomekitAccessory {
- /**
- * Retrieves the current relative humidity.
- * @return a future that will contain the humidity as a value between 0 and 100
- */
- CompletableFuture getCurrentRelativeHumidity();
-
- @Override
- default Collection getServices() {
- return Collections.singleton(new HumiditySensorService(this));
- }
-
- /**
- * Subscribes to changes in the current relative humidity.
- * @param callback the function to call when the state changes.
- */
- void subscribeCurrentRelativeHumidity(HomekitCharacteristicChangeCallback callback);
+ /**
+ * Retrieves the current relative humidity.
+ *
+ * @return a future that will contain the humidity as a value between 0 and 100
+ */
+ CompletableFuture getCurrentRelativeHumidity();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new HumiditySensorService(this));
+ }
+
+ /**
+ * Subscribes to changes in the current relative humidity.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCurrentRelativeHumidity(HomekitCharacteristicChangeCallback callback);
- /**
- * Unsubscribes from changes in the current relative humidity.
- */
- void unsubscribeCurrentRelativeHumidity();
-
+ /** Unsubscribes from changes in the current relative humidity. */
+ void unsubscribeCurrentRelativeHumidity();
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/LeakSensor.java b/src/main/java/com/beowulfe/hap/accessories/LeakSensor.java
index 11443f155..9de42a52c 100644
--- a/src/main/java/com/beowulfe/hap/accessories/LeakSensor.java
+++ b/src/main/java/com/beowulfe/hap/accessories/LeakSensor.java
@@ -1,49 +1,42 @@
package com.beowulfe.hap.accessories;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.concurrent.CompletableFuture;
-
import com.beowulfe.hap.HomekitAccessory;
import com.beowulfe.hap.HomekitCharacteristicChangeCallback;
import com.beowulfe.hap.Service;
import com.beowulfe.hap.impl.services.LeakSensorService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
/**
- *
* A leak sensor that reports whether a leak has been detected.
- *
*
- *
- * Leak sensors that run on batteries will need to implement this interface
- * and also implement {@link BatteryStatusAccessory}.
- *
+ * Leak sensors that run on batteries will need to implement this interface and also implement
+ * {@link BatteryStatusAccessory}.
*
* @author Tim Harper
*/
public interface LeakSensor extends HomekitAccessory {
- /**
- * Retrieves the state of the leak sensor. If true then leak has been detected.
- *
- * @return a future that will contain the leak sensor's state
- */
- CompletableFuture getLeakDetected();
+ /**
+ * Retrieves the state of the leak sensor. If true then leak has been detected.
+ *
+ * @return a future that will contain the leak sensor's state
+ */
+ CompletableFuture getLeakDetected();
- @Override
- default Collection getServices() {
- return Collections.singleton(new LeakSensorService(this));
- }
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new LeakSensorService(this));
+ }
- /**
- * Subscribes to changes in the leak sensor.
- *
- * @param callback the function to call when the state changes.
- */
- void subscribeLeakDetected(HomekitCharacteristicChangeCallback callback);
+ /**
+ * Subscribes to changes in the leak sensor.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeLeakDetected(HomekitCharacteristicChangeCallback callback);
- /**
- * Unsubscribes from changes in the leak sensor.
- */
- void unsubscribeLeakDetected();
+ /** Unsubscribes from changes in the leak sensor. */
+ void unsubscribeLeakDetected();
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/LightSensor.java b/src/main/java/com/beowulfe/hap/accessories/LightSensor.java
index d9f7f5c65..7d16f406e 100644
--- a/src/main/java/com/beowulfe/hap/accessories/LightSensor.java
+++ b/src/main/java/com/beowulfe/hap/accessories/LightSensor.java
@@ -4,7 +4,6 @@
import com.beowulfe.hap.HomekitCharacteristicChangeCallback;
import com.beowulfe.hap.Service;
import com.beowulfe.hap.impl.services.LightSensorService;
-
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
@@ -16,27 +15,25 @@
*/
public interface LightSensor extends HomekitAccessory {
- /**
- * Retrieves the current ambient light level.
- *
- * @return a future that will contain the luminance level expressed in LUX.
- */
- CompletableFuture getCurrentAmbientLightLevel();
+ /**
+ * Retrieves the current ambient light level.
+ *
+ * @return a future that will contain the luminance level expressed in LUX.
+ */
+ CompletableFuture getCurrentAmbientLightLevel();
- @Override
- default Collection getServices() {
- return Collections.singleton(new LightSensorService(this));
- }
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new LightSensorService(this));
+ }
- /**
- * Subscribes to changes in the current ambient light level.
- *
- * @param callback the function to call when the state changes.
- */
- void subscribeCurrentAmbientLightLevel(HomekitCharacteristicChangeCallback callback);
+ /**
+ * Subscribes to changes in the current ambient light level.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCurrentAmbientLightLevel(HomekitCharacteristicChangeCallback callback);
- /**
- * Unsubscribes from changes in the current ambient light level.
- */
- void unsubscribeCurrentAmbientLightLevel();
+ /** Unsubscribes from changes in the current ambient light level. */
+ void unsubscribeCurrentAmbientLightLevel();
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/Lightbulb.java b/src/main/java/com/beowulfe/hap/accessories/Lightbulb.java
index e60fe3a4e..58f350618 100644
--- a/src/main/java/com/beowulfe/hap/accessories/Lightbulb.java
+++ b/src/main/java/com/beowulfe/hap/accessories/Lightbulb.java
@@ -1,12 +1,11 @@
package com.beowulfe.hap.accessories;
+import com.beowulfe.hap.*;
+import com.beowulfe.hap.impl.services.LightbulbService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
-import com.beowulfe.hap.*;
-import com.beowulfe.hap.impl.services.LightbulbService;
-
/**
* A simple light with a binary state.
*
@@ -14,33 +13,34 @@
*/
public interface Lightbulb extends HomekitAccessory {
- /**
- * Retrieves the current binary state of the light.
- * @return a future that will contain the binary state
- */
- CompletableFuture getLightbulbPowerState();
-
- /**
- * Sets the binary state of the light
- * @param powerState the binary state to set
- * @return a future that completes when the change is made
- * @throws Exception when the change cannot be made
- */
- CompletableFuture setLightbulbPowerState(boolean powerState) throws Exception;
-
- @Override
- default Collection getServices() {
- return Collections.singleton(new LightbulbService(this));
- }
-
- /**
- * Subscribes to changes in the binary state of the light.
- * @param callback the function to call when the state changes.
- */
- void subscribeLightbulbPowerState(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Unsubscribes from changes in the binary state of the light.
- */
- void unsubscribeLightbulbPowerState();
+ /**
+ * Retrieves the current binary state of the light.
+ *
+ * @return a future that will contain the binary state
+ */
+ CompletableFuture getLightbulbPowerState();
+
+ /**
+ * Sets the binary state of the light
+ *
+ * @param powerState the binary state to set
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setLightbulbPowerState(boolean powerState) throws Exception;
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new LightbulbService(this));
+ }
+
+ /**
+ * Subscribes to changes in the binary state of the light.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeLightbulbPowerState(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the binary state of the light. */
+ void unsubscribeLightbulbPowerState();
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/LockMechanism.java b/src/main/java/com/beowulfe/hap/accessories/LockMechanism.java
index 320d5dc0b..5f0fca812 100644
--- a/src/main/java/com/beowulfe/hap/accessories/LockMechanism.java
+++ b/src/main/java/com/beowulfe/hap/accessories/LockMechanism.java
@@ -5,41 +5,40 @@
import com.beowulfe.hap.Service;
import com.beowulfe.hap.accessories.properties.LockMechanismState;
import com.beowulfe.hap.impl.services.LockMechanismService;
-
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
/**
- * A lock capable of exposing its binary locked state. For a lock that can be locked/unlocked, use
- * {@link LockableLockMechanism}.
+ * A lock capable of exposing its binary locked state. For a lock that can be locked/unlocked, use
+ * {@link LockableLockMechanism}.
*
- * Locks that run on batteries will need to implement this interface and also
- * implement {@link BatteryStatusAccessory}.
+ * Locks that run on batteries will need to implement this interface and also implement {@link
+ * BatteryStatusAccessory}.
*
* @author Andy Lintner
*/
public interface LockMechanism extends HomekitAccessory {
- /**
- * Retrieves the current binary state of the lock.
- * @return a future that will contain the binary state.
- */
- CompletableFuture getCurrentMechanismState();
+ /**
+ * Retrieves the current binary state of the lock.
+ *
+ * @return a future that will contain the binary state.
+ */
+ CompletableFuture getCurrentMechanismState();
- /**
- * Subscribes to changes in the binary state of the lock.
- * @param callback the function to call when the state changes.
- */
- void subscribeCurrentMechanismState(HomekitCharacteristicChangeCallback callback);
+ /**
+ * Subscribes to changes in the binary state of the lock.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCurrentMechanismState(HomekitCharacteristicChangeCallback callback);
- /**
- * Unsubscribes from changes in the binary state of the lock.
- */
- void unsubscribeCurrentMechanismState();
+ /** Unsubscribes from changes in the binary state of the lock. */
+ void unsubscribeCurrentMechanismState();
- @Override
- default Collection getServices() {
- return Collections.singleton(new LockMechanismService(this));
- }
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new LockMechanismService(this));
+ }
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/LockableLockMechanism.java b/src/main/java/com/beowulfe/hap/accessories/LockableLockMechanism.java
index 50affacad..ef55e4d00 100644
--- a/src/main/java/com/beowulfe/hap/accessories/LockableLockMechanism.java
+++ b/src/main/java/com/beowulfe/hap/accessories/LockableLockMechanism.java
@@ -1,9 +1,8 @@
package com.beowulfe.hap.accessories;
-import java.util.concurrent.CompletableFuture;
-
import com.beowulfe.hap.HomekitCharacteristicChangeCallback;
import com.beowulfe.hap.accessories.properties.LockMechanismState;
+import java.util.concurrent.CompletableFuture;
/**
* Extends {@link LockMechanism} with the ability to lock and unlock the mechanism.
@@ -12,28 +11,28 @@
*/
public interface LockableLockMechanism extends LockMechanism {
- /**
- * Sets the binary state of the lock mechanism.
- *
- * @param state true for a locked mechanism, false for unlocked.
- * @throws Exception when the change cannot be made.
- */
- void setTargetMechanismState(LockMechanismState state) throws Exception;
+ /**
+ * Sets the binary state of the lock mechanism.
+ *
+ * @param state true for a locked mechanism, false for unlocked.
+ * @throws Exception when the change cannot be made.
+ */
+ void setTargetMechanismState(LockMechanismState state) throws Exception;
- /**
- * Retrieves the pending, but not yet completed, state of the lock mechanism.
- * @return the binary state
- */
- CompletableFuture getTargetMechanismState();
+ /**
+ * Retrieves the pending, but not yet completed, state of the lock mechanism.
+ *
+ * @return the binary state
+ */
+ CompletableFuture getTargetMechanismState();
- /**
- * Subscribes to changes in the pending, but not yet completed, binary state.
- * @param callback the function to call when the state changes.
- */
- void subscribeTargetMechanismState(HomekitCharacteristicChangeCallback callback);
+ /**
+ * Subscribes to changes in the pending, but not yet completed, binary state.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeTargetMechanismState(HomekitCharacteristicChangeCallback callback);
- /**
- * Unsubscribes from changes in the pending, but not yet completed, binary state.
- */
- void unsubscribeTargetMechanismState();
+ /** Unsubscribes from changes in the pending, but not yet completed, binary state. */
+ void unsubscribeTargetMechanismState();
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/MotionSensor.java b/src/main/java/com/beowulfe/hap/accessories/MotionSensor.java
index ee13e839c..41bd4ccbe 100644
--- a/src/main/java/com/beowulfe/hap/accessories/MotionSensor.java
+++ b/src/main/java/com/beowulfe/hap/accessories/MotionSensor.java
@@ -4,42 +4,39 @@
import com.beowulfe.hap.HomekitCharacteristicChangeCallback;
import com.beowulfe.hap.Service;
import com.beowulfe.hap.impl.services.MotionSensorService;
-
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
/**
- * A motion sensor that reports whether motion has been detected.
+ * A motion sensor that reports whether motion has been detected.
*
- * Motion sensors that run on batteries will need to implement this interface
- * and also implement {@link BatteryStatusAccessory}.
+ * Motion sensors that run on batteries will need to implement this interface and also implement
+ * {@link BatteryStatusAccessory}.
*
* @author Gaston Dombiak
*/
public interface MotionSensor extends HomekitAccessory {
- /**
- * Retrieves the state of the motion sensor. If true then motion has been detected.
- *
- * @return a future that will contain the motion sensor's state
- */
- CompletableFuture getMotionDetected();
+ /**
+ * Retrieves the state of the motion sensor. If true then motion has been detected.
+ *
+ * @return a future that will contain the motion sensor's state
+ */
+ CompletableFuture getMotionDetected();
- @Override
- default Collection getServices() {
- return Collections.singleton(new MotionSensorService(this));
- }
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new MotionSensorService(this));
+ }
- /**
- * Subscribes to changes in the motion sensor.
- *
- * @param callback the function to call when the state changes.
- */
- void subscribeMotionDetected(HomekitCharacteristicChangeCallback callback);
+ /**
+ * Subscribes to changes in the motion sensor.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeMotionDetected(HomekitCharacteristicChangeCallback callback);
- /**
- * Unsubscribes from changes in the motion sensor.
- */
- void unsubscribeMotionDetected();
+ /** Unsubscribes from changes in the motion sensor. */
+ void unsubscribeMotionDetected();
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/Outlet.java b/src/main/java/com/beowulfe/hap/accessories/Outlet.java
index 443acabe2..296c21a49 100644
--- a/src/main/java/com/beowulfe/hap/accessories/Outlet.java
+++ b/src/main/java/com/beowulfe/hap/accessories/Outlet.java
@@ -1,12 +1,11 @@
package com.beowulfe.hap.accessories;
+import com.beowulfe.hap.*;
+import com.beowulfe.hap.impl.services.OutletService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
-import com.beowulfe.hap.*;
-import com.beowulfe.hap.impl.services.OutletService;
-
/**
* A power outlet with boolean power and usage states.
*
@@ -14,51 +13,51 @@
*/
public interface Outlet extends HomekitAccessory {
- @Override
- default Collection getServices() {
- return Collections.singleton(new OutletService(this));
- }
-
- /**
- * Retrieves the current binary state of the outlet's power.
- * @return a future that will contain the binary state
- */
- CompletableFuture getPowerState();
-
- /**
- * Retrieves the current binary state indicating whether the outlet is in use.
- * @return a future that will contain the binary state
- */
- CompletableFuture getOutletInUse();
-
- /**
- * Sets the binary state of the outlet's power.
- * @param state the binary state to set
- * @return a future that completes when the change is made
- * @throws Exception when the change cannot be made
- */
- CompletableFuture setPowerState(boolean state) throws Exception;
-
- /**
- * Subscribes to changes in the binary state of the outlet's power.
- * @param callback the function to call when the state changes.
- */
- void subscribePowerState(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Subscribes to changes in the binary state indicating whether the outlet is in use.
- * @param callback the function to call when the state changes.
- */
- void subscribeOutletInUse(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Unsubscribes from changes in the binary state of the outlet's power.
- */
- void unsubscribePowerState();
-
- /**
- * Unsubscribes from changes in the binary state indicating whether hte outlet is in use.
- */
- void unsubscribeOutletInUse();
-
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new OutletService(this));
+ }
+
+ /**
+ * Retrieves the current binary state of the outlet's power.
+ *
+ * @return a future that will contain the binary state
+ */
+ CompletableFuture getPowerState();
+
+ /**
+ * Retrieves the current binary state indicating whether the outlet is in use.
+ *
+ * @return a future that will contain the binary state
+ */
+ CompletableFuture getOutletInUse();
+
+ /**
+ * Sets the binary state of the outlet's power.
+ *
+ * @param state the binary state to set
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setPowerState(boolean state) throws Exception;
+
+ /**
+ * Subscribes to changes in the binary state of the outlet's power.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribePowerState(HomekitCharacteristicChangeCallback callback);
+
+ /**
+ * Subscribes to changes in the binary state indicating whether the outlet is in use.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeOutletInUse(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the binary state of the outlet's power. */
+ void unsubscribePowerState();
+
+ /** Unsubscribes from changes in the binary state indicating whether hte outlet is in use. */
+ void unsubscribeOutletInUse();
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/SecuritySystem.java b/src/main/java/com/beowulfe/hap/accessories/SecuritySystem.java
index 096937b25..86c274599 100644
--- a/src/main/java/com/beowulfe/hap/accessories/SecuritySystem.java
+++ b/src/main/java/com/beowulfe/hap/accessories/SecuritySystem.java
@@ -7,90 +7,84 @@
import com.beowulfe.hap.accessories.properties.SecuritySystemAlarmType;
import com.beowulfe.hap.accessories.properties.TargetSecuritySystemState;
import com.beowulfe.hap.impl.services.SecuritySystemService;
-
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
/**
- * A security system that can be armed so that when a contact sensor is opened or a motion
- * sensor detects movement, then a siren could be fired off. There are different modes for arming
- * the system. See {@link TargetSecuritySystemState} for more information.
+ * A security system that can be armed so that when a contact sensor is opened or a motion sensor
+ * detects movement, then a siren could be fired off. There are different modes for arming the
+ * system. See {@link TargetSecuritySystemState} for more information.
*
* @author Gaston Dombiak
*/
public interface SecuritySystem extends HomekitAccessory {
- /**
- * Retrieves the current state of the security system. The state describes if the system
- * is armed in any of its variations; or if the alarm has been triggered; or if the system
- * is disarmed.
- *
- * @return current state of the security system.
- */
- CompletableFuture getCurrentSecuritySystemState();
+ /**
+ * Retrieves the current state of the security system. The state describes if the system is armed
+ * in any of its variations; or if the alarm has been triggered; or if the system is disarmed.
+ *
+ * @return current state of the security system.
+ */
+ CompletableFuture getCurrentSecuritySystemState();
- /**
- * Subscribes to changes to the state of the security system.
- *
- * @param callback the function to call when the state changes.
- */
- void subscribeCurrentSecuritySystemState(HomekitCharacteristicChangeCallback callback);
+ /**
+ * Subscribes to changes to the state of the security system.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCurrentSecuritySystemState(HomekitCharacteristicChangeCallback callback);
- /**
- * Unsubscribes from changes in the state of the security system.
- */
- void unsubscribeCurrentSecuritySystemState();
+ /** Unsubscribes from changes in the state of the security system. */
+ void unsubscribeCurrentSecuritySystemState();
- /**
- * Sets the state of the security system. The security system could be armed in any
- * of its variations or disarmed.
- *
- * @param state target state of the security system.
- * @throws Exception when the change cannot be made.
- */
- void setTargetSecuritySystemState(TargetSecuritySystemState state) throws Exception;
+ /**
+ * Sets the state of the security system. The security system could be armed in any of its
+ * variations or disarmed.
+ *
+ * @param state target state of the security system.
+ * @throws Exception when the change cannot be made.
+ */
+ void setTargetSecuritySystemState(TargetSecuritySystemState state) throws Exception;
- /**
- * Retrieves the pending, but not yet completed, state of the security system.
- *
- * @return target state of the security system.
- */
- CompletableFuture getTargetSecuritySystemState();
+ /**
+ * Retrieves the pending, but not yet completed, state of the security system.
+ *
+ * @return target state of the security system.
+ */
+ CompletableFuture getTargetSecuritySystemState();
- /**
- * Subscribes to changes in the pending, but not yet completed, state of the security system.
- *
- * @param callback the function to call when the state changes.
- */
- void subscribeTargetSecuritySystemState(HomekitCharacteristicChangeCallback callback);
+ /**
+ * Subscribes to changes in the pending, but not yet completed, state of the security system.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeTargetSecuritySystemState(HomekitCharacteristicChangeCallback callback);
- /**
- * Unsubscribes from changes in the pending, but not yet completed, state of the security system.
- */
- void unsubscribeTargetSecuritySystemState();
+ /**
+ * Unsubscribes from changes in the pending, but not yet completed, state of the security system.
+ */
+ void unsubscribeTargetSecuritySystemState();
- /**
- * Retrieves the alarm type of the security system.
- *
- * @return alarm type of the security system.
- */
- CompletableFuture getAlarmTypeState();
+ /**
+ * Retrieves the alarm type of the security system.
+ *
+ * @return alarm type of the security system.
+ */
+ CompletableFuture getAlarmTypeState();
- /**
- * Subscribes to changes to the alarm type of the security system.
- *
- * @param callback the function to call when the alarm type changes.
- */
- void subscribeAlarmTypeState(HomekitCharacteristicChangeCallback callback);
+ /**
+ * Subscribes to changes to the alarm type of the security system.
+ *
+ * @param callback the function to call when the alarm type changes.
+ */
+ void subscribeAlarmTypeState(HomekitCharacteristicChangeCallback callback);
- /**
- * Unsubscribes from changes in the alarm type of the security system.
- */
- void unsubscribeAlarmTypeState();
+ /** Unsubscribes from changes in the alarm type of the security system. */
+ void unsubscribeAlarmTypeState();
- @Override
- default Collection getServices() {
- return Collections.singleton(new SecuritySystemService(this));
- }
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new SecuritySystemService(this));
+ }
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/SmokeSensor.java b/src/main/java/com/beowulfe/hap/accessories/SmokeSensor.java
index 431e8ec7a..1fa4c6412 100644
--- a/src/main/java/com/beowulfe/hap/accessories/SmokeSensor.java
+++ b/src/main/java/com/beowulfe/hap/accessories/SmokeSensor.java
@@ -5,42 +5,39 @@
import com.beowulfe.hap.Service;
import com.beowulfe.hap.accessories.properties.SmokeDetectedState;
import com.beowulfe.hap.impl.services.SmokeSensorService;
-
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
/**
- * A smoke sensor reports whether smoke has been detected or not.
+ * A smoke sensor reports whether smoke has been detected or not.
*
- * Smoke sensors that run on batteries will need to implement this interface
- * and also implement {@link BatteryStatusAccessory}.
+ * Smoke sensors that run on batteries will need to implement this interface and also implement
+ * {@link BatteryStatusAccessory}.
*
* @author Gaston Dombiak
*/
public interface SmokeSensor extends HomekitAccessory {
- /**
- * Retrieves the state of the smoke sensor. This is whether smoke has been detected or not.
- *
- * @return a future that will contain the smoke sensor's state
- */
- CompletableFuture getSmokeDetectedState();
+ /**
+ * Retrieves the state of the smoke sensor. This is whether smoke has been detected or not.
+ *
+ * @return a future that will contain the smoke sensor's state
+ */
+ CompletableFuture getSmokeDetectedState();
- @Override
- default Collection getServices() {
- return Collections.singleton(new SmokeSensorService(this));
- }
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new SmokeSensorService(this));
+ }
- /**
- * Subscribes to changes in the smoke sensor's state.
- *
- * @param callback the function to call when the state changes.
- */
- void subscribeSmokeDetectedState(HomekitCharacteristicChangeCallback callback);
+ /**
+ * Subscribes to changes in the smoke sensor's state.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeSmokeDetectedState(HomekitCharacteristicChangeCallback callback);
- /**
- * Unsubscribes from changes in the smoke sensor's state.
- */
- void unsubscribeSmokeDetectedState();
+ /** Unsubscribes from changes in the smoke sensor's state. */
+ void unsubscribeSmokeDetectedState();
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/Switch.java b/src/main/java/com/beowulfe/hap/accessories/Switch.java
index 8885a5caf..e34f4be16 100644
--- a/src/main/java/com/beowulfe/hap/accessories/Switch.java
+++ b/src/main/java/com/beowulfe/hap/accessories/Switch.java
@@ -1,12 +1,11 @@
package com.beowulfe.hap.accessories;
+import com.beowulfe.hap.*;
+import com.beowulfe.hap.impl.services.SwitchService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
-import com.beowulfe.hap.*;
-import com.beowulfe.hap.impl.services.SwitchService;
-
/**
* A simple switch with a binary state.
*
@@ -14,33 +13,34 @@
*/
public interface Switch extends HomekitAccessory {
- /**
- * Retrieves the current binary state of the switch.
- * @return a future that will contain the binary state
- */
- CompletableFuture getSwitchState();
-
- /**
- * Sets the binary state of the switch
- * @param state the binary state to set
- * @return a future that completes when the change is made
- * @throws Exception when the change cannot be made
- */
- CompletableFuture setSwitchState(boolean state) throws Exception;
-
- @Override
- default Collection getServices() {
- return Collections.singleton(new SwitchService(this));
- }
-
- /**
- * Subscribes to changes in the binary state of the switch.
- * @param callback the function to call when the state changes.
- */
- void subscribeSwitchState(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Unsubscribes from changes in the binary state of the switch.
- */
- void unsubscribeSwitchState();
+ /**
+ * Retrieves the current binary state of the switch.
+ *
+ * @return a future that will contain the binary state
+ */
+ CompletableFuture getSwitchState();
+
+ /**
+ * Sets the binary state of the switch
+ *
+ * @param state the binary state to set
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setSwitchState(boolean state) throws Exception;
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new SwitchService(this));
+ }
+
+ /**
+ * Subscribes to changes in the binary state of the switch.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeSwitchState(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the binary state of the switch. */
+ void unsubscribeSwitchState();
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/TemperatureSensor.java b/src/main/java/com/beowulfe/hap/accessories/TemperatureSensor.java
index ac3dd639d..1ec14d6f2 100644
--- a/src/main/java/com/beowulfe/hap/accessories/TemperatureSensor.java
+++ b/src/main/java/com/beowulfe/hap/accessories/TemperatureSensor.java
@@ -1,12 +1,11 @@
package com.beowulfe.hap.accessories;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.concurrent.CompletableFuture;
-
import com.beowulfe.hap.*;
import com.beowulfe.hap.accessories.properties.TemperatureUnit;
import com.beowulfe.hap.impl.services.TemperatureSensorService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
/**
* A temperature sensor that reports the current temperature
@@ -15,45 +14,50 @@
*/
public interface TemperatureSensor extends HomekitAccessory {
- /**
- * Retrieves the current temperature, in celsius degrees.
- * @return a future that will contain the temperature.
- */
- CompletableFuture getCurrentTemperature();
-
- @Override
- default Collection getServices() {
- return Collections.singleton(new TemperatureSensorService(this));
- }
-
- /**
- * Subscribes to changes in the current temperature.
- * @param callback the function to call when the state changes.
- */
- void subscribeCurrentTemperature(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Unsubscribes from changes in the current temperature.
- */
- void unsubscribeCurrentTemperature();
-
- /**
- * Retrieves the minimum temperature, in celsius degrees, the thermostat can be set to.
- * @return the minimum temperature.
- */
- double getMinimumTemperature();
-
- /**
- * Retrieves the maximum temperature, in celsius degrees, the thermostat can be set to.
- * @return the maximum temperature.
- */
- double getMaximumTemperature();
-
- /**
- * Retrieves the temperature unit of the thermostat. The impact of this is unclear, as the actual temperature
- * is always communicated in celsius degrees, and the iOS device uses the user's locale to determine
- * the unit to convert to.
- * @return the temperature unit of the thermostat.
- */
- default TemperatureUnit getTemperatureUnit() { return TemperatureUnit.CELSIUS; }
+ /**
+ * Retrieves the current temperature, in celsius degrees.
+ *
+ * @return a future that will contain the temperature.
+ */
+ CompletableFuture getCurrentTemperature();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new TemperatureSensorService(this));
+ }
+
+ /**
+ * Subscribes to changes in the current temperature.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCurrentTemperature(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the current temperature. */
+ void unsubscribeCurrentTemperature();
+
+ /**
+ * Retrieves the minimum temperature, in celsius degrees, the thermostat can be set to.
+ *
+ * @return the minimum temperature.
+ */
+ double getMinimumTemperature();
+
+ /**
+ * Retrieves the maximum temperature, in celsius degrees, the thermostat can be set to.
+ *
+ * @return the maximum temperature.
+ */
+ double getMaximumTemperature();
+
+ /**
+ * Retrieves the temperature unit of the thermostat. The impact of this is unclear, as the actual
+ * temperature is always communicated in celsius degrees, and the iOS device uses the user's
+ * locale to determine the unit to convert to.
+ *
+ * @return the temperature unit of the thermostat.
+ */
+ default TemperatureUnit getTemperatureUnit() {
+ return TemperatureUnit.CELSIUS;
+ }
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/Thermostat.java b/src/main/java/com/beowulfe/hap/accessories/Thermostat.java
index 40f916e44..380f365ca 100644
--- a/src/main/java/com/beowulfe/hap/accessories/Thermostat.java
+++ b/src/main/java/com/beowulfe/hap/accessories/Thermostat.java
@@ -6,11 +6,8 @@
* A thermostat with heating and cooling controls.
*
* @author Andy Lintner
- * @deprecated Use {@link BasicThermostat}, {@link HeatingThermostat}, and {@link CoolingThermostat} instead
+ * @deprecated Use {@link BasicThermostat}, {@link HeatingThermostat}, and {@link CoolingThermostat}
+ * instead
*/
@Deprecated
-public interface Thermostat extends BasicThermostat, HeatingThermostat, CoolingThermostat {
-
-
-
-}
+public interface Thermostat extends BasicThermostat, HeatingThermostat, CoolingThermostat {}
diff --git a/src/main/java/com/beowulfe/hap/accessories/Valve.java b/src/main/java/com/beowulfe/hap/accessories/Valve.java
index 13606e09d..aef689123 100644
--- a/src/main/java/com/beowulfe/hap/accessories/Valve.java
+++ b/src/main/java/com/beowulfe/hap/accessories/Valve.java
@@ -1,14 +1,13 @@
package com.beowulfe.hap.accessories;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.concurrent.CompletableFuture;
-
import com.beowulfe.hap.HomekitAccessory;
import com.beowulfe.hap.HomekitCharacteristicChangeCallback;
import com.beowulfe.hap.Service;
import com.beowulfe.hap.accessories.properties.ValveType;
import com.beowulfe.hap.impl.services.ValveService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
/**
* A Valve (sprinkler head, faucet, etc.)
@@ -17,83 +16,77 @@
*/
public interface Valve extends HomekitAccessory {
- @Override
- default Collection getServices() {
- return Collections.singleton(new ValveService(this));
- }
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new ValveService(this));
+ }
- /**
- * Retrieves the current active state of the valve; Active could mean the valve is open (but not necessarily
- * running),
- * or that the valve is associated with an active watering program (like a watering program) but is not currently
- * running.
- *
- * To communicate water is flowing through a valve, inUse should be used.
- *
- * @return a future that will contain the binary state
- */
- CompletableFuture getValveActive();
+ /**
+ * Retrieves the current active state of the valve; Active could mean the valve is open (but not
+ * necessarily running), or that the valve is associated with an active watering program (like a
+ * watering program) but is not currently running.
+ *
+ * To communicate water is flowing through a valve, inUse should be used.
+ *
+ * @return a future that will contain the binary state
+ */
+ CompletableFuture getValveActive();
- /**
- * Sets the valve active state
- *
- * @param active the binary state to set
- * @return a future that completes when the change is made
- * @throws Exception when the change cannot be made
- */
- CompletableFuture setValveActive(boolean active) throws Exception;
+ /**
+ * Sets the valve active state
+ *
+ * @param active the binary state to set
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setValveActive(boolean active) throws Exception;
- /**
- * Subscribes to changes in the active state of the valve.
- *
- * @param callback the function to call when the state changes.
- */
- void subscribeValveActive(HomekitCharacteristicChangeCallback callback);
+ /**
+ * Subscribes to changes in the active state of the valve.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeValveActive(HomekitCharacteristicChangeCallback callback);
- /**
- * Unsubscribes from changes in the valve active state.
- */
- void unsubscribeValveActive();
+ /** Unsubscribes from changes in the valve active state. */
+ void unsubscribeValveActive();
- /**
- * Retrieves the current inUse state of the valve; InUse usually means water is flowing through the valve.
- *
- * To communicate water is flowing through a valve, inUse should be used.
- *
- * @return a future that will contain the binary state
- */
- CompletableFuture getValveInUse();
+ /**
+ * Retrieves the current inUse state of the valve; InUse usually means water is flowing through
+ * the valve.
+ *
+ * To communicate water is flowing through a valve, inUse should be used.
+ *
+ * @return a future that will contain the binary state
+ */
+ CompletableFuture getValveInUse();
- /**
- * Subscribes to changes in the inUse state of the valve.
- *
- * @param callback the function to call when the state changes.
- */
- void subscribeValveInUse(HomekitCharacteristicChangeCallback callback);
+ /**
+ * Subscribes to changes in the inUse state of the valve.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeValveInUse(HomekitCharacteristicChangeCallback callback);
- /**
- * Unsubscribes from changes in the valve inUse state.
- */
- void unsubscribeValveInUse();
+ /** Unsubscribes from changes in the valve inUse state. */
+ void unsubscribeValveInUse();
- /**
- * Retrieves the valve type.
- *
- * To communicate water is flowing through a valve, inUse should be used.
- *
- * @return a future that will contain the binary state
- */
- CompletableFuture getValveType();
+ /**
+ * Retrieves the valve type.
+ *
+ * To communicate water is flowing through a valve, inUse should be used.
+ *
+ * @return a future that will contain the binary state
+ */
+ CompletableFuture getValveType();
- /**
- * Subscribes to changes in the valveType state of the valve.
- *
- * @param callback the function to call when the state changes.
- */
- void subscribeValveType(HomekitCharacteristicChangeCallback callback);
+ /**
+ * Subscribes to changes in the valveType state of the valve.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeValveType(HomekitCharacteristicChangeCallback callback);
- /**
- * Unsubscribes from changes in the valveType state light.
- */
- void unsubscribeValveType();
+ /** Unsubscribes from changes in the valveType state light. */
+ void unsubscribeValveType();
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/ValveWithTimer.java b/src/main/java/com/beowulfe/hap/accessories/ValveWithTimer.java
index 4d3a7d25b..fdd296120 100644
--- a/src/main/java/com/beowulfe/hap/accessories/ValveWithTimer.java
+++ b/src/main/java/com/beowulfe/hap/accessories/ValveWithTimer.java
@@ -1,8 +1,7 @@
package com.beowulfe.hap.accessories;
-import java.util.concurrent.CompletableFuture;
-
import com.beowulfe.hap.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
/**
* Extends {@link Valve} with timer values.
@@ -11,56 +10,50 @@
*/
public interface ValveWithTimer extends Valve {
- /**
- * Retrieves the current duration for which the valve will run
- *
- * @return a future with the value
- */
- CompletableFuture getRemainingDuration();
-
- /**
- * Subscribes to changes in the duration; note it is not necessary to emit a
- * change every second, homekit infers the countdown progress clientside.
- *
- * @param callback the function when the existing duration has been replaced with a new one.
- */
- void subscribeRemainingDuration(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Unsubscribes from changes
- */
- void unsubscribeRemainingDuration();
-
- /**
- * Retrieves the current set duration for which the valve will be scheduled
- * to run; this is usually used as the duration to use when the valve is set
- * to active.
- *
- * @return a future with the value
- */
- CompletableFuture getSetDuration();
-
- /**
- * Sets the duration for which the valve will be scheduled to run; this is
- * usually used as the duration to use when the valve is set to active.
- *
- * If the valve is currently running, then Homekit assumes that changing
- * this value affects the current remaining duration.
- *
- * @return a future with the value
- */
- CompletableFuture setSetDuration(int value);
-
- /**
- * Subscribes to changes in the set duration
- *
- * @param callback the function when the value has changed
- */
- void subscribeSetDuration(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Unsubscribes from changes
- */
- void unsubscribeSetDuration();
-
+ /**
+ * Retrieves the current duration for which the valve will run
+ *
+ * @return a future with the value
+ */
+ CompletableFuture getRemainingDuration();
+
+ /**
+ * Subscribes to changes in the duration; note it is not necessary to emit a change every second,
+ * homekit infers the countdown progress clientside.
+ *
+ * @param callback the function when the existing duration has been replaced with a new one.
+ */
+ void subscribeRemainingDuration(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes */
+ void unsubscribeRemainingDuration();
+
+ /**
+ * Retrieves the current set duration for which the valve will be scheduled to run; this is
+ * usually used as the duration to use when the valve is set to active.
+ *
+ * @return a future with the value
+ */
+ CompletableFuture getSetDuration();
+
+ /**
+ * Sets the duration for which the valve will be scheduled to run; this is usually used as the
+ * duration to use when the valve is set to active.
+ *
+ * If the valve is currently running, then Homekit assumes that changing this value affects the
+ * current remaining duration.
+ *
+ * @return a future with the value
+ */
+ CompletableFuture setSetDuration(int value);
+
+ /**
+ * Subscribes to changes in the set duration
+ *
+ * @param callback the function when the value has changed
+ */
+ void subscribeSetDuration(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes */
+ void unsubscribeSetDuration();
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/VerticalTiltingWindowCovering.java b/src/main/java/com/beowulfe/hap/accessories/VerticalTiltingWindowCovering.java
index 263a09369..fae1c4c1b 100644
--- a/src/main/java/com/beowulfe/hap/accessories/VerticalTiltingWindowCovering.java
+++ b/src/main/java/com/beowulfe/hap/accessories/VerticalTiltingWindowCovering.java
@@ -1,8 +1,7 @@
package com.beowulfe.hap.accessories;
-import java.util.concurrent.CompletableFuture;
-
import com.beowulfe.hap.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
/**
* Extends WindowCovering with the ability to control vertical tilt angles
@@ -11,45 +10,46 @@
*/
public interface VerticalTiltingWindowCovering extends WindowCovering {
- /**
- * Retrieves the current vertical tilt angle
- * @return a future that will contain the position as a value between -90 and 90
- */
- CompletableFuture getCurrentVerticalTiltAngle();
-
- /**
- * Retrieves the target vertical tilt angle
- * @return a future that will contain the target position as a value between -90 and 90
- */
- CompletableFuture getTargetVerticalTiltAngle();
-
- /**
- * Sets the target position
- * @param angle the target angle to set, as a value between -90 and 90
- * @return a future that completes when the change is made
- * @throws Exception when the change cannot be made
- */
- CompletableFuture setTargetVerticalTiltAngle(int angle) throws Exception;
-
- /**
- * Subscribes to changes in the current vertical tilt angle.
- * @param callback the function to call when the state changes.
- */
- void subscribeCurrentVerticalTiltAngle(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Subscribes to changes in the target vertical tilt angle.
- * @param callback the function to call when the state changes.
- */
- void subscribeTargetVerticalTiltAngle(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Unsubscribes from changes in the current vertical tilt angle
- */
- void unsubscribeCurrentVerticalTiltAngle();
-
- /**
- * Unsubscribes from changes in the target vertical tilt angle
- */
- void unsubscribeTargetVerticalTiltAngle();
+ /**
+ * Retrieves the current vertical tilt angle
+ *
+ * @return a future that will contain the position as a value between -90 and 90
+ */
+ CompletableFuture getCurrentVerticalTiltAngle();
+
+ /**
+ * Retrieves the target vertical tilt angle
+ *
+ * @return a future that will contain the target position as a value between -90 and 90
+ */
+ CompletableFuture getTargetVerticalTiltAngle();
+
+ /**
+ * Sets the target position
+ *
+ * @param angle the target angle to set, as a value between -90 and 90
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setTargetVerticalTiltAngle(int angle) throws Exception;
+
+ /**
+ * Subscribes to changes in the current vertical tilt angle.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCurrentVerticalTiltAngle(HomekitCharacteristicChangeCallback callback);
+
+ /**
+ * Subscribes to changes in the target vertical tilt angle.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeTargetVerticalTiltAngle(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the current vertical tilt angle */
+ void unsubscribeCurrentVerticalTiltAngle();
+
+ /** Unsubscribes from changes in the target vertical tilt angle */
+ void unsubscribeTargetVerticalTiltAngle();
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/WindowCovering.java b/src/main/java/com/beowulfe/hap/accessories/WindowCovering.java
index 230678f8c..340013ca7 100644
--- a/src/main/java/com/beowulfe/hap/accessories/WindowCovering.java
+++ b/src/main/java/com/beowulfe/hap/accessories/WindowCovering.java
@@ -1,12 +1,11 @@
package com.beowulfe.hap.accessories;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.concurrent.CompletableFuture;
-
import com.beowulfe.hap.*;
import com.beowulfe.hap.accessories.properties.WindowCoveringPositionState;
import com.beowulfe.hap.impl.services.WindowCoveringService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
/**
* A window covering, like blinds, which can be remotely controlled.
@@ -15,92 +14,94 @@
*/
public interface WindowCovering extends HomekitAccessory {
- /**
- * Retrieves the current position
- * @return a future that will contain the position as a value between 0 and 100
- */
- CompletableFuture getCurrentPosition();
-
- /**
- * Retrieves the target position
- * @return a future that will contain the target position as a value between 0 and 100
- */
- CompletableFuture getTargetPosition();
-
- /**
- * Retrieves the state of the position: increasing, decreasing, or stopped
- * @return a future that will contain the current state
- */
- CompletableFuture getPositionState();
-
- /**
- * Retrieves an indication that the window covering is obstructed from moving
- * @return a future that will contain a boolean indicating whether an obstruction is present
- */
- CompletableFuture getObstructionDetected();
-
- @Override
- default Collection getServices() {
- return Collections.singleton(new WindowCoveringService(this));
- }
-
- /**
- * Sets the target position
- * @param position the target position to set, as a value between 1 and 100
- * @return a future that completes when the change is made
- * @throws Exception when the change cannot be made
- */
- CompletableFuture setTargetPosition(int position) throws Exception;
-
- /**
- * Sets the hold position state
- * @param hold whether or not to hold the current position state
- * @return a future that completes when the change is made
- * @throws Exception when the change cannot be made
- */
- CompletableFuture setHoldPosition(boolean hold) throws Exception;
-
- /**
- * Subscribes to changes in the current position.
- * @param callback the function to call when the state changes.
- */
- void subscribeCurrentPosition(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Subscribes to changes in the target position.
- * @param callback the function to call when the state changes.
- */
- void subscribeTargetPosition(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Subscribes to changes in the position state: increasing, decreasing, or stopped
- * @param callback the function to call when the state changes.
- */
- void subscribePositionState(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Subscribes to changes in the obstruction detected state
- * @param callback the function to call when the state changes.
- */
- void subscribeObstructionDetected(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Unsubscribes from changes in the current position.
- */
- void unsubscribeCurrentPosition();
-
- /**
- * Unsubscribes from changes in the target position.
- */
- void unsubscribeTargetPosition();
-
- /**
- * Unsubscribes from changes in the position state
- */
- void unsubscribePositionState();
-
- /**
- * Unsubscribes from changes in the obstruction detected state
- */
- void unsubscribeObstructionDetected();
+ /**
+ * Retrieves the current position
+ *
+ * @return a future that will contain the position as a value between 0 and 100
+ */
+ CompletableFuture getCurrentPosition();
+
+ /**
+ * Retrieves the target position
+ *
+ * @return a future that will contain the target position as a value between 0 and 100
+ */
+ CompletableFuture getTargetPosition();
+
+ /**
+ * Retrieves the state of the position: increasing, decreasing, or stopped
+ *
+ * @return a future that will contain the current state
+ */
+ CompletableFuture getPositionState();
+
+ /**
+ * Retrieves an indication that the window covering is obstructed from moving
+ *
+ * @return a future that will contain a boolean indicating whether an obstruction is present
+ */
+ CompletableFuture getObstructionDetected();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new WindowCoveringService(this));
+ }
+
+ /**
+ * Sets the target position
+ *
+ * @param position the target position to set, as a value between 1 and 100
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setTargetPosition(int position) throws Exception;
+
+ /**
+ * Sets the hold position state
+ *
+ * @param hold whether or not to hold the current position state
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setHoldPosition(boolean hold) throws Exception;
+
+ /**
+ * Subscribes to changes in the current position.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCurrentPosition(HomekitCharacteristicChangeCallback callback);
+
+ /**
+ * Subscribes to changes in the target position.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeTargetPosition(HomekitCharacteristicChangeCallback callback);
+
+ /**
+ * Subscribes to changes in the position state: increasing, decreasing, or stopped
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribePositionState(HomekitCharacteristicChangeCallback callback);
+
+ /**
+ * Subscribes to changes in the obstruction detected state
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeObstructionDetected(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the current position. */
+ void unsubscribeCurrentPosition();
+
+ /** Unsubscribes from changes in the target position. */
+ void unsubscribeTargetPosition();
+
+ /** Unsubscribes from changes in the position state */
+ void unsubscribePositionState();
+
+ /** Unsubscribes from changes in the obstruction detected state */
+ void unsubscribeObstructionDetected();
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/package-info.java b/src/main/java/com/beowulfe/hap/accessories/package-info.java
index 7c54d98bc..22f91c5ac 100644
--- a/src/main/java/com/beowulfe/hap/accessories/package-info.java
+++ b/src/main/java/com/beowulfe/hap/accessories/package-info.java
@@ -1,4 +1,2 @@
-/**
- * Contains interfaces that can be implemented to represent an exposed accessory.
- */
-package com.beowulfe.hap.accessories;
\ No newline at end of file
+/** Contains interfaces that can be implemented to represent an exposed accessory. */
+package com.beowulfe.hap.accessories;
diff --git a/src/main/java/com/beowulfe/hap/accessories/properties/CarbonMonoxideDetectedState.java b/src/main/java/com/beowulfe/hap/accessories/properties/CarbonMonoxideDetectedState.java
index 95bcf53b1..556eb2892 100644
--- a/src/main/java/com/beowulfe/hap/accessories/properties/CarbonMonoxideDetectedState.java
+++ b/src/main/java/com/beowulfe/hap/accessories/properties/CarbonMonoxideDetectedState.java
@@ -5,26 +5,28 @@
import java.util.stream.Collectors;
public enum CarbonMonoxideDetectedState {
+ NORMAL(0),
+ ABNORMAL(1);
- NORMAL(0),
- ABNORMAL(1);
+ private static final Map reverse;
- private final static Map reverse;
- static {
- reverse = Arrays.stream(CarbonMonoxideDetectedState.values()).collect(Collectors.toMap(CarbonMonoxideDetectedState::getCode, t -> t));
- }
+ static {
+ reverse =
+ Arrays.stream(CarbonMonoxideDetectedState.values())
+ .collect(Collectors.toMap(CarbonMonoxideDetectedState::getCode, t -> t));
+ }
- public static CarbonMonoxideDetectedState fromCode(Integer code) {
- return reverse.get(code);
- }
+ public static CarbonMonoxideDetectedState fromCode(Integer code) {
+ return reverse.get(code);
+ }
- private final int code;
+ private final int code;
- CarbonMonoxideDetectedState(int code) {
- this.code = code;
- }
+ CarbonMonoxideDetectedState(int code) {
+ this.code = code;
+ }
- public int getCode() {
- return code;
- }
+ public int getCode() {
+ return code;
+ }
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/properties/ContactState.java b/src/main/java/com/beowulfe/hap/accessories/properties/ContactState.java
index ca4a352ae..b8a466ceb 100644
--- a/src/main/java/com/beowulfe/hap/accessories/properties/ContactState.java
+++ b/src/main/java/com/beowulfe/hap/accessories/properties/ContactState.java
@@ -5,26 +5,28 @@
import java.util.stream.Collectors;
public enum ContactState {
+ DETECTED(0),
+ NOT_DETECTED(1);
- DETECTED(0),
- NOT_DETECTED(1);
+ private static final Map reverse;
- private final static Map reverse;
- static {
- reverse = Arrays.stream(ContactState.values()).collect(Collectors.toMap(ContactState::getCode, t -> t));
- }
+ static {
+ reverse =
+ Arrays.stream(ContactState.values())
+ .collect(Collectors.toMap(ContactState::getCode, t -> t));
+ }
- public static ContactState fromCode(Integer code) {
- return reverse.get(code);
- }
+ public static ContactState fromCode(Integer code) {
+ return reverse.get(code);
+ }
- private final int code;
+ private final int code;
- ContactState(int code) {
- this.code = code;
- }
+ ContactState(int code) {
+ this.code = code;
+ }
- public int getCode() {
- return code;
- }
+ public int getCode() {
+ return code;
+ }
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/properties/CurrentSecuritySystemState.java b/src/main/java/com/beowulfe/hap/accessories/properties/CurrentSecuritySystemState.java
index a9666c946..3c8291415 100644
--- a/src/main/java/com/beowulfe/hap/accessories/properties/CurrentSecuritySystemState.java
+++ b/src/main/java/com/beowulfe/hap/accessories/properties/CurrentSecuritySystemState.java
@@ -1,57 +1,48 @@
package com.beowulfe.hap.accessories.properties;
import com.beowulfe.hap.accessories.SecuritySystem;
-
import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;
/**
- * The current state of a {@link SecuritySystem}. Unlike {@link TargetSecuritySystemState}, this enum
- * includes a triggered state.
+ * The current state of a {@link SecuritySystem}. Unlike {@link TargetSecuritySystemState}, this
+ * enum includes a triggered state.
*
* @author Gaston Dombiak
*/
public enum CurrentSecuritySystemState {
- /**
- * The home is occupied and residents are active.
- */
- STAY_ARM(0),
- /**
- * The home is unoccupied.
- */
- AWAY_ARM(1),
- /**
- * The home is occupied and residents are sleeping.
- */
- NIGHT_ARM(2),
- /**
- * The security system is disarmed.
- */
- DISARMED(3),
- /**
- * The security system is triggered.
- */
- TRIGGERED(4);
-
- private final static Map reverse;
- static {
- reverse = Arrays.stream(CurrentSecuritySystemState.values()).collect(Collectors
- .toMap(CurrentSecuritySystemState::getCode, t -> t));
- }
-
- public static CurrentSecuritySystemState fromCode(Integer code) {
- return reverse.get(code);
- }
-
- private final int code;
-
- CurrentSecuritySystemState(int code) {
- this.code = code;
- }
-
- public int getCode() {
- return code;
- }
+ /** The home is occupied and residents are active. */
+ STAY_ARM(0),
+ /** The home is unoccupied. */
+ AWAY_ARM(1),
+ /** The home is occupied and residents are sleeping. */
+ NIGHT_ARM(2),
+ /** The security system is disarmed. */
+ DISARMED(3),
+ /** The security system is triggered. */
+ TRIGGERED(4);
+
+ private static final Map reverse;
+
+ static {
+ reverse =
+ Arrays.stream(CurrentSecuritySystemState.values())
+ .collect(Collectors.toMap(CurrentSecuritySystemState::getCode, t -> t));
+ }
+
+ public static CurrentSecuritySystemState fromCode(Integer code) {
+ return reverse.get(code);
+ }
+
+ private final int code;
+
+ CurrentSecuritySystemState(int code) {
+ this.code = code;
+ }
+
+ public int getCode() {
+ return code;
+ }
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/properties/DoorState.java b/src/main/java/com/beowulfe/hap/accessories/properties/DoorState.java
index d85745986..bcb329768 100644
--- a/src/main/java/com/beowulfe/hap/accessories/properties/DoorState.java
+++ b/src/main/java/com/beowulfe/hap/accessories/properties/DoorState.java
@@ -5,30 +5,29 @@
import java.util.stream.Collectors;
public enum DoorState {
+ OPEN(0),
+ CLOSED(1),
+ OPENING(2),
+ CLOSING(3),
+ STOPPED(4);
- OPEN(0),
- CLOSED(1),
- OPENING(2),
- CLOSING(3),
- STOPPED(4);
-
-
- private final static Map reverse;
- static {
- reverse = Arrays.stream(DoorState.values()).collect(Collectors.toMap(t -> t.getCode(), t -> t));
- }
-
- public static DoorState fromCode(Integer code) {
- return reverse.get(code);
- }
-
- private final int code;
-
- private DoorState(int code) {
- this.code = code;
- }
-
- public int getCode() {
- return code;
- }
+ private static final Map reverse;
+
+ static {
+ reverse = Arrays.stream(DoorState.values()).collect(Collectors.toMap(t -> t.getCode(), t -> t));
+ }
+
+ public static DoorState fromCode(Integer code) {
+ return reverse.get(code);
+ }
+
+ private final int code;
+
+ private DoorState(int code) {
+ this.code = code;
+ }
+
+ public int getCode() {
+ return code;
+ }
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/properties/LockMechanismState.java b/src/main/java/com/beowulfe/hap/accessories/properties/LockMechanismState.java
index 8250c8e28..0b2afb5cc 100644
--- a/src/main/java/com/beowulfe/hap/accessories/properties/LockMechanismState.java
+++ b/src/main/java/com/beowulfe/hap/accessories/properties/LockMechanismState.java
@@ -1,40 +1,40 @@
package com.beowulfe.hap.accessories.properties;
+import com.beowulfe.hap.accessories.LockMechanism;
import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;
-import com.beowulfe.hap.accessories.LockMechanism;
-
/**
* The state of a {@link LockMechanism}.
*
* @author Andy Lintner
*/
public enum LockMechanismState {
-
- UNSECURED(0),
- SECURED(1),
- JAMMED(2),
- UNKNOWN(3)
- ;
-
- private final static Map reverse;
- static {
- reverse = Arrays.stream(LockMechanismState.values()).collect(Collectors.toMap(t -> t.getCode(), t -> t));
- }
-
- public static LockMechanismState fromCode(Integer code) {
- return reverse.get(code);
- }
-
- private final int code;
-
- private LockMechanismState(int code) {
- this.code = code;
- }
-
- public int getCode() {
- return code;
- }
+ UNSECURED(0),
+ SECURED(1),
+ JAMMED(2),
+ UNKNOWN(3);
+
+ private static final Map reverse;
+
+ static {
+ reverse =
+ Arrays.stream(LockMechanismState.values())
+ .collect(Collectors.toMap(t -> t.getCode(), t -> t));
+ }
+
+ public static LockMechanismState fromCode(Integer code) {
+ return reverse.get(code);
+ }
+
+ private final int code;
+
+ private LockMechanismState(int code) {
+ this.code = code;
+ }
+
+ public int getCode() {
+ return code;
+ }
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/properties/RotationDirection.java b/src/main/java/com/beowulfe/hap/accessories/properties/RotationDirection.java
index 9a7d4693f..4c504d28a 100644
--- a/src/main/java/com/beowulfe/hap/accessories/properties/RotationDirection.java
+++ b/src/main/java/com/beowulfe/hap/accessories/properties/RotationDirection.java
@@ -5,26 +5,28 @@
import java.util.stream.Collectors;
public enum RotationDirection {
- CLOCKWISE(0),
- COUNTER_CLOCKWISE(1)
- ;
-
- private final static Map reverse;
- static {
- reverse = Arrays.stream(RotationDirection.values()).collect(Collectors.toMap(t -> t.getCode(), t -> t));
- }
-
- public static RotationDirection fromCode(Integer code) {
- return reverse.get(code);
- }
-
- private final int code;
-
- private RotationDirection(int code) {
- this.code = code;
- }
-
- public int getCode() {
- return code;
- }
+ CLOCKWISE(0),
+ COUNTER_CLOCKWISE(1);
+
+ private static final Map reverse;
+
+ static {
+ reverse =
+ Arrays.stream(RotationDirection.values())
+ .collect(Collectors.toMap(t -> t.getCode(), t -> t));
+ }
+
+ public static RotationDirection fromCode(Integer code) {
+ return reverse.get(code);
+ }
+
+ private final int code;
+
+ private RotationDirection(int code) {
+ this.code = code;
+ }
+
+ public int getCode() {
+ return code;
+ }
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/properties/SecuritySystemAlarmType.java b/src/main/java/com/beowulfe/hap/accessories/properties/SecuritySystemAlarmType.java
index 161cd91f9..aa8b0806c 100644
--- a/src/main/java/com/beowulfe/hap/accessories/properties/SecuritySystemAlarmType.java
+++ b/src/main/java/com/beowulfe/hap/accessories/properties/SecuritySystemAlarmType.java
@@ -1,7 +1,6 @@
package com.beowulfe.hap.accessories.properties;
import com.beowulfe.hap.accessories.SecuritySystem;
-
import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;
@@ -13,32 +12,30 @@
*/
public enum SecuritySystemAlarmType {
- /**
- * Alarm conditions are cleared
- */
- NO_ALARM(0),
- /**
- * Alarm type is not known
- */
- UNKNOWN(1);
-
- private final static Map reverse;
- static {
- reverse = Arrays.stream(SecuritySystemAlarmType.values()).collect(Collectors
- .toMap(SecuritySystemAlarmType::getCode, t -> t));
- }
-
- public static SecuritySystemAlarmType fromCode(Integer code) {
- return reverse.get(code);
- }
-
- private final int code;
-
- SecuritySystemAlarmType(int code) {
- this.code = code;
- }
-
- public int getCode() {
- return code;
- }
+ /** Alarm conditions are cleared */
+ NO_ALARM(0),
+ /** Alarm type is not known */
+ UNKNOWN(1);
+
+ private static final Map reverse;
+
+ static {
+ reverse =
+ Arrays.stream(SecuritySystemAlarmType.values())
+ .collect(Collectors.toMap(SecuritySystemAlarmType::getCode, t -> t));
+ }
+
+ public static SecuritySystemAlarmType fromCode(Integer code) {
+ return reverse.get(code);
+ }
+
+ private final int code;
+
+ SecuritySystemAlarmType(int code) {
+ this.code = code;
+ }
+
+ public int getCode() {
+ return code;
+ }
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/properties/SmokeDetectedState.java b/src/main/java/com/beowulfe/hap/accessories/properties/SmokeDetectedState.java
index 159a767ee..7c929c6b2 100644
--- a/src/main/java/com/beowulfe/hap/accessories/properties/SmokeDetectedState.java
+++ b/src/main/java/com/beowulfe/hap/accessories/properties/SmokeDetectedState.java
@@ -5,26 +5,28 @@
import java.util.stream.Collectors;
public enum SmokeDetectedState {
+ NOT_DETECTED(0),
+ DETECTED(1);
- NOT_DETECTED(0),
- DETECTED(1);
+ private static final Map reverse;
- private final static Map reverse;
- static {
- reverse = Arrays.stream(SmokeDetectedState.values()).collect(Collectors.toMap(SmokeDetectedState::getCode, t -> t));
- }
+ static {
+ reverse =
+ Arrays.stream(SmokeDetectedState.values())
+ .collect(Collectors.toMap(SmokeDetectedState::getCode, t -> t));
+ }
- public static SmokeDetectedState fromCode(Integer code) {
- return reverse.get(code);
- }
+ public static SmokeDetectedState fromCode(Integer code) {
+ return reverse.get(code);
+ }
- private final int code;
+ private final int code;
- SmokeDetectedState(int code) {
- this.code = code;
- }
+ SmokeDetectedState(int code) {
+ this.code = code;
+ }
- public int getCode() {
- return code;
- }
+ public int getCode() {
+ return code;
+ }
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/properties/TargetSecuritySystemState.java b/src/main/java/com/beowulfe/hap/accessories/properties/TargetSecuritySystemState.java
index 35bd087a2..bb924fcc8 100644
--- a/src/main/java/com/beowulfe/hap/accessories/properties/TargetSecuritySystemState.java
+++ b/src/main/java/com/beowulfe/hap/accessories/properties/TargetSecuritySystemState.java
@@ -1,7 +1,6 @@
package com.beowulfe.hap.accessories.properties;
import com.beowulfe.hap.accessories.SecuritySystem;
-
import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;
@@ -13,40 +12,34 @@
*/
public enum TargetSecuritySystemState {
- /**
- * Arm the system when the home is occupied and residents are active.
- */
- STAY_ARM(0),
- /**
- * Arm the system when the home is unoccupied.
- */
- AWAY_ARM(1),
- /**
- * Arm the system when the home is occupied and residents are sleeping.
- */
- NIGHT_ARM(2),
- /**
- * Disarm the system.
- */
- DISARM(3);
-
- private final static Map reverse;
- static {
- reverse = Arrays.stream(TargetSecuritySystemState.values()).collect(Collectors
- .toMap(TargetSecuritySystemState::getCode, t -> t));
- }
-
- public static TargetSecuritySystemState fromCode(Integer code) {
- return reverse.get(code);
- }
-
- private final int code;
-
- TargetSecuritySystemState(int code) {
- this.code = code;
- }
-
- public int getCode() {
- return code;
- }
+ /** Arm the system when the home is occupied and residents are active. */
+ STAY_ARM(0),
+ /** Arm the system when the home is unoccupied. */
+ AWAY_ARM(1),
+ /** Arm the system when the home is occupied and residents are sleeping. */
+ NIGHT_ARM(2),
+ /** Disarm the system. */
+ DISARM(3);
+
+ private static final Map reverse;
+
+ static {
+ reverse =
+ Arrays.stream(TargetSecuritySystemState.values())
+ .collect(Collectors.toMap(TargetSecuritySystemState::getCode, t -> t));
+ }
+
+ public static TargetSecuritySystemState fromCode(Integer code) {
+ return reverse.get(code);
+ }
+
+ private final int code;
+
+ TargetSecuritySystemState(int code) {
+ this.code = code;
+ }
+
+ public int getCode() {
+ return code;
+ }
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/properties/TemperatureUnit.java b/src/main/java/com/beowulfe/hap/accessories/properties/TemperatureUnit.java
index 7cf1a476e..27bf004b4 100644
--- a/src/main/java/com/beowulfe/hap/accessories/properties/TemperatureUnit.java
+++ b/src/main/java/com/beowulfe/hap/accessories/properties/TemperatureUnit.java
@@ -1,38 +1,37 @@
package com.beowulfe.hap.accessories.properties;
+import com.beowulfe.hap.accessories.TemperatureSensor;
import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;
-import com.beowulfe.hap.accessories.TemperatureSensor;
-
/**
* The temperature unit used by a {@link TemperatureSensor}.
*
* @author Andy Lintner
*/
public enum TemperatureUnit {
+ CELSIUS(0),
+ FAHRENHEIT(1);
+
+ private static final Map reverse;
+
+ static {
+ reverse =
+ Arrays.stream(TemperatureUnit.values()).collect(Collectors.toMap(t -> t.getCode(), t -> t));
+ }
+
+ static TemperatureUnit fromCode(Integer code) {
+ return reverse.get(code);
+ }
+
+ private final int code;
+
+ private TemperatureUnit(int code) {
+ this.code = code;
+ }
- CELSIUS(0),
- FAHRENHEIT(1)
- ;
-
- private final static Map reverse;
- static {
- reverse = Arrays.stream(TemperatureUnit.values()).collect(Collectors.toMap(t -> t.getCode(), t -> t));
- }
-
- static TemperatureUnit fromCode(Integer code) {
- return reverse.get(code);
- }
-
- private final int code;
-
- private TemperatureUnit(int code) {
- this.code = code;
- }
-
- public int getCode() {
- return code;
- }
+ public int getCode() {
+ return code;
+ }
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/properties/ThermostatMode.java b/src/main/java/com/beowulfe/hap/accessories/properties/ThermostatMode.java
index 081e11793..4d6f2f893 100644
--- a/src/main/java/com/beowulfe/hap/accessories/properties/ThermostatMode.java
+++ b/src/main/java/com/beowulfe/hap/accessories/properties/ThermostatMode.java
@@ -1,40 +1,39 @@
package com.beowulfe.hap.accessories.properties;
+import com.beowulfe.hap.accessories.thermostat.BasicThermostat;
import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;
-import com.beowulfe.hap.accessories.thermostat.BasicThermostat;
-
/**
* The mode used by a {@link BasicThermostat}
*
* @author Andy Lintner
*/
public enum ThermostatMode {
+ OFF(0),
+ HEAT(1),
+ COOL(2),
+ AUTO(3);
+
+ private static final Map reverse;
+
+ static {
+ reverse =
+ Arrays.stream(ThermostatMode.values()).collect(Collectors.toMap(t -> t.getCode(), t -> t));
+ }
+
+ public static ThermostatMode fromCode(Integer code) {
+ return reverse.get(code);
+ }
+
+ private final int code;
+
+ private ThermostatMode(int code) {
+ this.code = code;
+ }
- OFF(0),
- HEAT(1),
- COOL(2),
- AUTO(3)
- ;
-
- private final static Map reverse;
- static {
- reverse = Arrays.stream(ThermostatMode.values()).collect(Collectors.toMap(t -> t.getCode(), t -> t));
- }
-
- public static ThermostatMode fromCode(Integer code) {
- return reverse.get(code);
- }
-
- private final int code;
-
- private ThermostatMode(int code) {
- this.code = code;
- }
-
- public int getCode() {
- return code;
- }
+ public int getCode() {
+ return code;
+ }
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/properties/ValveType.java b/src/main/java/com/beowulfe/hap/accessories/properties/ValveType.java
index 0991e8fd4..a16105155 100644
--- a/src/main/java/com/beowulfe/hap/accessories/properties/ValveType.java
+++ b/src/main/java/com/beowulfe/hap/accessories/properties/ValveType.java
@@ -1,39 +1,38 @@
package com.beowulfe.hap.accessories.properties;
+import com.beowulfe.hap.accessories.Valve;
import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;
-import com.beowulfe.hap.accessories.Valve;
-
/**
* The mode used by a {@link Valve}
*
* @author Tim Harper
*/
public enum ValveType {
+ GENERIC(0),
+ IRRIGATION(1),
+ SHOWER(2),
+ WATER_FAUCET(3);
- GENERIC(0),
- IRRIGATION(1),
- SHOWER(2),
- WATER_FAUCET(3);
+ private static final Map reverse;
- private final static Map reverse;
- static {
- reverse = Arrays.stream(ValveType.values()).collect(Collectors.toMap(t -> t.getCode(), t -> t));
- }
+ static {
+ reverse = Arrays.stream(ValveType.values()).collect(Collectors.toMap(t -> t.getCode(), t -> t));
+ }
- public static ValveType fromCode(Integer code) {
- return reverse.get(code);
- }
+ public static ValveType fromCode(Integer code) {
+ return reverse.get(code);
+ }
- private final int code;
+ private final int code;
- private ValveType(int code) {
- this.code = code;
- }
+ private ValveType(int code) {
+ this.code = code;
+ }
- public int getCode() {
- return code;
- }
+ public int getCode() {
+ return code;
+ }
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/properties/WindowCoveringPositionState.java b/src/main/java/com/beowulfe/hap/accessories/properties/WindowCoveringPositionState.java
index 29624ad81..b57bc4b6f 100644
--- a/src/main/java/com/beowulfe/hap/accessories/properties/WindowCoveringPositionState.java
+++ b/src/main/java/com/beowulfe/hap/accessories/properties/WindowCoveringPositionState.java
@@ -1,38 +1,39 @@
package com.beowulfe.hap.accessories.properties;
+import com.beowulfe.hap.accessories.WindowCovering;
import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;
-import com.beowulfe.hap.accessories.WindowCovering;
-
/**
* The position state used by a {@link WindowCovering}
*
* @author Andy Lintner
*/
public enum WindowCoveringPositionState {
- DECREASING(0),
- INCREASING(1),
- STOPPED(2)
- ;
-
- private final static Map reverse;
- static {
- reverse = Arrays.stream(WindowCoveringPositionState.values()).collect(Collectors.toMap(t -> t.getCode(), t -> t));
- }
-
- public static WindowCoveringPositionState fromCode(Integer code) {
- return reverse.get(code);
- }
-
- private final int code;
-
- private WindowCoveringPositionState(int code) {
- this.code = code;
- }
-
- public int getCode() {
- return code;
- }
+ DECREASING(0),
+ INCREASING(1),
+ STOPPED(2);
+
+ private static final Map reverse;
+
+ static {
+ reverse =
+ Arrays.stream(WindowCoveringPositionState.values())
+ .collect(Collectors.toMap(t -> t.getCode(), t -> t));
+ }
+
+ public static WindowCoveringPositionState fromCode(Integer code) {
+ return reverse.get(code);
+ }
+
+ private final int code;
+
+ private WindowCoveringPositionState(int code) {
+ this.code = code;
+ }
+
+ public int getCode() {
+ return code;
+ }
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/properties/package-info.java b/src/main/java/com/beowulfe/hap/accessories/properties/package-info.java
index ee3991bbf..e234adb4c 100644
--- a/src/main/java/com/beowulfe/hap/accessories/properties/package-info.java
+++ b/src/main/java/com/beowulfe/hap/accessories/properties/package-info.java
@@ -1,4 +1,2 @@
-/**
- * Contains properties used by {@link com.beowulfe.hap.accessories}.
- */
-package com.beowulfe.hap.accessories.properties;
\ No newline at end of file
+/** Contains properties used by {@link com.beowulfe.hap.accessories}. */
+package com.beowulfe.hap.accessories.properties;
diff --git a/src/main/java/com/beowulfe/hap/accessories/thermostat/BasicThermostat.java b/src/main/java/com/beowulfe/hap/accessories/thermostat/BasicThermostat.java
index 803738ca8..f6fc9ec36 100644
--- a/src/main/java/com/beowulfe/hap/accessories/thermostat/BasicThermostat.java
+++ b/src/main/java/com/beowulfe/hap/accessories/thermostat/BasicThermostat.java
@@ -1,83 +1,88 @@
package com.beowulfe.hap.accessories.thermostat;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.concurrent.CompletableFuture;
-
import com.beowulfe.hap.*;
import com.beowulfe.hap.accessories.TemperatureSensor;
import com.beowulfe.hap.accessories.properties.ThermostatMode;
import com.beowulfe.hap.impl.services.ThermostatService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
public interface BasicThermostat extends HomekitAccessory, TemperatureSensor {
- /**
- * Retrieves the current {@link ThermostatMode} of the thermostat.
- * @return a future that will contain the mode.
- */
- CompletableFuture getCurrentMode();
+ /**
+ * Retrieves the current {@link ThermostatMode} of the thermostat.
+ *
+ * @return a future that will contain the mode.
+ */
+ CompletableFuture getCurrentMode();
+
+ /**
+ * Subscribes to changes in the {@link ThermostatMode} of the thermostat.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCurrentMode(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the mode of the thermostat. */
+ void unsubscribeCurrentMode();
- /**
- * Subscribes to changes in the {@link ThermostatMode} of the thermostat.
- * @param callback the function to call when the state changes.
- */
- void subscribeCurrentMode(HomekitCharacteristicChangeCallback callback);
+ /**
+ * Sets the {@link ThermostatMode} of the thermostat.
+ *
+ * @param mode The {@link ThermostatMode} to set.
+ * @throws Exception when the change cannot be made.
+ */
+ void setTargetMode(ThermostatMode mode) throws Exception;
- /**
- * Unsubscribes from changes in the mode of the thermostat.
- */
- void unsubscribeCurrentMode();
+ /**
+ * Retrieves the pending, but not yet complete, {@link ThermostatMode} of the thermostat.
+ *
+ * @return a future that will contain the target mode.
+ */
+ CompletableFuture getTargetMode();
- /**
- * Sets the {@link ThermostatMode} of the thermostat.
- * @param mode The {@link ThermostatMode} to set.
- * @throws Exception when the change cannot be made.
- */
- void setTargetMode(ThermostatMode mode) throws Exception;
+ /**
+ * Subscribes to changes in the pending, but not yet complete, {@link ThermostatMode} of the
+ * thermostat.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeTargetMode(HomekitCharacteristicChangeCallback callback);
- /**
- * Retrieves the pending, but not yet complete, {@link ThermostatMode} of the thermostat.
- * @return a future that will contain the target mode.
- */
- CompletableFuture getTargetMode();
+ /**
+ * Unsubscribes from changes in the pending, but not yet complete, {@link ThermostatMode} of the
+ * thermostat.
+ */
+ void unsubscribeTargetMode();
- /**
- * Subscribes to changes in the pending, but not yet complete, {@link ThermostatMode} of the thermostat.
- * @param callback the function to call when the state changes.
- */
- void subscribeTargetMode(HomekitCharacteristicChangeCallback callback);
+ /**
+ * Retrieves the target temperature, in celsius degrees.
+ *
+ * @return a future that will contain the target temperature.
+ */
+ CompletableFuture getTargetTemperature();
- /**
- * Unsubscribes from changes in the pending, but not yet complete, {@link ThermostatMode} of the thermostat.
- */
- void unsubscribeTargetMode();
+ /**
+ * Sets the target temperature.
+ *
+ * @param value the target temperature, in celsius degrees.
+ * @throws Exception when the temperature cannot be changed.
+ */
+ void setTargetTemperature(Double value) throws Exception;
- /**
- * Retrieves the target temperature, in celsius degrees.
- * @return a future that will contain the target temperature.
- */
- CompletableFuture getTargetTemperature();
+ /**
+ * Subscribes to changes in the target temperature.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeTargetTemperature(HomekitCharacteristicChangeCallback callback);
- /**
- * Sets the target temperature.
- * @param value the target temperature, in celsius degrees.
- * @throws Exception when the temperature cannot be changed.
- */
- void setTargetTemperature(Double value) throws Exception;
-
- /**
- * Subscribes to changes in the target temperature.
- * @param callback the function to call when the state changes.
- */
- void subscribeTargetTemperature(HomekitCharacteristicChangeCallback callback);
+ /** Unsubscribes from changes in the target temperature. */
+ void unsubscribeTargetTemperature();
- /**
- * Unsubscribes from changes in the target temperature.
- */
- void unsubscribeTargetTemperature();
-
- @Override
- default Collection getServices() {
- return Collections.singleton(new ThermostatService(this));
- }
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new ThermostatService(this));
+ }
}
diff --git a/src/main/java/com/beowulfe/hap/accessories/thermostat/CoolingThermostat.java b/src/main/java/com/beowulfe/hap/accessories/thermostat/CoolingThermostat.java
index 60b0fe175..cb60ed88b 100644
--- a/src/main/java/com/beowulfe/hap/accessories/thermostat/CoolingThermostat.java
+++ b/src/main/java/com/beowulfe/hap/accessories/thermostat/CoolingThermostat.java
@@ -1,32 +1,32 @@
package com.beowulfe.hap.accessories.thermostat;
-import java.util.concurrent.CompletableFuture;
-
import com.beowulfe.hap.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
public interface CoolingThermostat extends BasicThermostat {
- /**
- * Retrieves the temperature above which the thermostat should begin cooling.
- * @return a future that will contain the threshold temperature, in celsius degrees.
- */
- CompletableFuture