2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.velux.internal.things;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
18 * <B>Velux</B> product characteristics: Product State.
20 * Combined set of information which describes a current state of a single Velux product.
22 * Methods in handle this type of information:
24 * <LI>{@link #VeluxProductState(VeluxProductReference, int, int)} to create a new product state.</LI>
25 * <LI>{@link #getActuator()} to retrieve the number representing this actuator/product.</LI>
26 * <LI>{@link #getProductReference()} to retrieve reference to a product.</LI>
27 * <LI>{@link #getState()} to retrieve the current {@link VeluxProductState.ProductState product state}.</LI>
28 * <LI>{@link #getStateAsInt()} to retrieve the current product state.</LI>
29 * <LI>{@link #toString} to retrieve a human-readable description of the product state.</LI>
33 * @author Guenther Schreiner - initial contribution.
36 public class VeluxProductState {
40 private class ProductState {
44 public int getState() {
48 private ProductState(int state) {
55 private VeluxProductReference productReference;
57 private ProductState state;
61 public VeluxProductState(VeluxProductReference productReference, int actuator, int state) {
62 this.productReference = productReference;
63 this.actuator = actuator;
64 this.state = new ProductState(state);
67 // Class access methods
69 public VeluxProductReference getProductReference() {
70 return this.productReference;
73 public int getActuator() {
77 public ProductState getState() {
81 public int getStateAsInt() {
82 return this.state.getState();
86 public String toString() {
87 return String.format("State (%s, actuator %d, value %d)", this.productReference, this.actuator, this.state);